Commit 83af8008 authored by cmaffeo2's avatar cmaffeo2
Browse files

Shift segment occupancies when extending segmentmodel

parent 9dc9ecec
......@@ -1716,14 +1716,30 @@ class SegmentModel(ArbdModel):
def extend(self, other, copy=True, include_strands=False):
assert( isinstance(other, SegmentModel) )
try:
max_occupancy = max([s.occupancy for s in self.segments if 'occupancy' in s.__dict__])
occupancy0 = 10**np.ceil(np.log10(max_occupancy+1))
except:
pass
if copy:
for s in other.segments:
self.segments.append(deepcopy(s))
newseg = deepcopy(s)
try:
newseg.occupancy = occupancy0+s.occupancy
except:
pass
self.segments.append(newseg)
if include_strands:
for s in other.strands:
self.strands.append(deepcopy(s))
else:
for s in other.segments:
try:
s.occupancy = occupancy0+s.occupancy
except:
pass
self.segments.append(s)
if include_strands:
for s in other.strands:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment