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

cleanGaps: support colinear GBreaks objects and zero-width ranges. #12

Open
charles-plessy opened this issue Feb 8, 2022 · 0 comments

Comments

@charles-plessy
Copy link
Collaborator

Some GBreak objects contain adjacent ranges, that return nothing when passed through cleanGaps.

> gr <- GRanges(c("a:1-10:+", "a:11-20:+"))
> gr
GRanges object with 2 ranges and 0 metadata columns:
      seqnames    ranges strand
         <Rle> <IRanges>  <Rle>
  [1]        a      1-10      +
  [2]        a     11-20      +
  -------
  seqinfo: 1 sequence from an unspecified genome; no seqlengths
> cleanGaps(gr)
GRanges object with 0 ranges and 0 metadata columns:
   seqnames    ranges strand
      <Rle> <IRanges>  <Rle>
  -------
  seqinfo: 1 sequence from an unspecified genome; no seqlengths

The function needs to be modified so that it returns a zero-width range. Here is an idea:

> cleanGaps(gr - 1)
GRanges object with 1 range and 0 metadata columns:
      seqnames    ranges strand
         <Rle> <IRanges>  <Rle>
  [1]        a     10-11      *
  -------
  seqinfo: 1 sequence from an unspecified genome; no seqlengths
> cleanGaps(gr - 1) -1
GRanges object with 1 range and 0 metadata columns:
      seqnames    ranges strand
         <Rle> <IRanges>  <Rle>
  [1]        a     11-10      *
  -------
  seqinfo: 1 sequence from an unspecified genome; no seqlengths
> width(cleanGaps(gr - 1) -1)
[1] 0

Once this is done, it should be possible to pass a GBreaks object containing only colinear ranges, and to turn it into colinear double-gap regions.

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