Skip to content

Commit

Permalink
upping to minor version; also improved GRS.subtract unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
fabio-t committed Jul 17, 2020
1 parent 38feb63 commit 91ae102
Show file tree
Hide file tree
Showing 3 changed files with 229 additions and 105 deletions.
6 changes: 4 additions & 2 deletions rgt/GenomicRegionSet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1135,12 +1135,13 @@ def window(self, y, adding_length=1000):
return extended_self.intersect(y)

def subtract(self, y, whole_region=False, merge=True, exact=False):
"""Return a GenomicRegionSet excluded the overlapping regions with y.
"""Return a copy of this GenomicRegionSet minus all the regions overlapping with y.
*Keyword arguments:*
- y -- the GenomicRegionSet which to subtract by
- whole_region -- subtract the whole region, not partially
- merge -- before subtracting, it merges any overlapping sequence within self or y
- exact -- only regions which match exactly with a region within y are subtracted
if set, whole_region and merge are completely ignored
if set, the returned GRS is sorted and does not contain duplicates
Expand Down Expand Up @@ -1273,10 +1274,11 @@ def subtract(self, y, whole_region=False, merge=True, exact=False):
if len(self) == 0 or len(y) == 0:
return self

# If there is overlap within self or y, they should be merged first.
if not self.sorted:
self.sort()

# if there is overlap within self or y, and the `merge` option is set,
# we merge any overlapping sequence and create two different GenomicRegionSets
if merge:
a = self.merge(w_return=True)
b = y.merge(w_return=True)
Expand Down
2 changes: 1 addition & 1 deletion rgt/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.13.0"
__version__ = "0.13.1"
Loading

0 comments on commit 91ae102

Please sign in to comment.