Skip to content
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

setdiff not behaving as expected #67

Open
gevro opened this issue Jul 15, 2022 · 0 comments
Open

setdiff not behaving as expected #67

gevro opened this issue Jul 15, 2022 · 0 comments

Comments

@gevro
Copy link

gevro commented Jul 15, 2022

Hi,
For some reason the below setdiff is not filtering out the element in x, even though it is encompassed by y.

x:

> mutations.gr[[1]][2]
GRanges object with 1 range and 0 metadata columns:
      seqnames    ranges strand
         <Rle> <IRanges>  <Rle>
  [1]     chr1  15003249      +
  -------
  seqinfo: 23 sequences from an unspecified genome; no seqlengths

y:

> genes[266]
GRanges object with 1 range and 0 metadata columns:
      seqnames            ranges strand
         <Rle>         <IRanges>  <Rle>
  [1]     chr1 14971680-15048506      *
  -------
  seqinfo: 24 sequences from an unspecified genome; no seqlengths
> setdiff(mutations.gr[[1]][2],genes[266])
GRanges object with 1 range and 0 metadata columns:
      seqnames    ranges strand
         <Rle> <IRanges>  <Rle>
  [1]     chr1  15003249      +
  -------
  seqinfo: 24 sequences from an unspecified genome; no seqlengths

=> The result should be an empty GRanges.

But adding ignore.strand=TRUE works:

> setdiff(mutations.gr[[1]][2],genes[266],ignore.strand=TRUE)
GRanges object with 0 ranges and 0 metadata columns:
   seqnames    ranges strand
      <Rle> <IRanges>  <Rle>
  -------
  seqinfo: 24 sequences from an unspecified genome; no seqlengths

Shouldn't setdiff of a range with strand = + that is encompassed by a range with strand = * be considered an overlap and removed by setdiff?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant