-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
subtract documentation #83
Comments
You don't see them but the metadata columns are here:
As explained in the man page (
Does this help? |
Makes sense. But then why is the output of subtract of two Geanges a GRangesList instead of GRanges? |
Because each range in the 1st GRanges object can produce several fragments after the subtraction so we use a GRangesList representation to group the fragments that are coming from the same original range together. Like here where the subtraction breaks the first range in
By doing this, the operation preserves positionality i.e. the i-th element in the output corresponds to the i-th element in the input (i.e. in the first GRanges object). Another way to describe this is to say that the output is parallel to the input, which is a nice property. If you don't like or don't need the grouping then you can
But then you loose positionality and the top-level metadata (if the GRangesList object had any). |
Understood. Thanks very much for explaining. The only issue is what if someone wanted a GRanges output while also preserving the metadata columns. In a prior github issue you had proposed the below code, which does the above, but I was wondering whether the subtract function has a way to do this? Based on what you are saying, it seems not?
|
In that case you need to manually propagate the top-level metadata columns of the GRangesList object to its unlisted form. This can be done with:
This specialized version of
Using this, you'll get what you are after by doing just I should probably bake this functionality into |
Yes, I think it would be helpful to have a parameter for subtract that allows to either unlist or not. |
Hi,
subtract says that metadata columns of x are propagated, but that doesn't seem to be happening:
"The names and metadata columns on x are propagated to the result."
I think either the documentation is wrong, or subtract code is wrong.
Thanks
The text was updated successfully, but these errors were encountered: