Пример #1
0
 def __init__(self, part, row, col, idnum=0):
     self._doc = part.document()
     super(VirtualHelix, self).__init__(part)
     self._coord = (row, col)  # col, row
     self._part = part
     self._scaf_strandset = StrandSet(StrandType.SCAFFOLD, self)
     self._stap_strandset = StrandSet(StrandType.STAPLE, self)
     # If self._part exists, it owns self._number
     # in that only it may modify it through the
     # private interface. The public interface for
     # setNumber just routes the call to the parent
     # dnapart if one is present. If self._part == None
     # the virtualhelix owns self._number and may modify it.
     self._number = None
     self.setNumber(idnum)
	#Determine position for oligo strands (first oligo: from 1 --> length/2 second oligo: next (length/2)+1 --> length )
	oligo_pos.append([1,int(int(i[2])/2),int(int(i[2])/2)+1,int(i[2])])
	
# Max length of the Strand Set
MAX_LENGTH = 64
offset_idx = 0

# Make the container for the StrandSets 
ss_fwd = [None]*vhCounter
ss_rev = [None]*vhCounter

# Create the StrandsSets and fill them with Strands 
# The assumption here is that Scaffold is forward strand and that the reverse strands is Staple Strands
try: 
	for i in range(vhCounter):	
		ss_fwd[i] = StrandSet(is_fwd=True, id_num=i, part=part, initial_size=MAX_LENGTH)
		ss_rev[i] = StrandSet(is_fwd=False, id_num=i, part=part, initial_size=MAX_LENGTH)   
		ss_fwd[i].createStrand(base_idx_low=offset_idx, base_idx_high=offset_idx+oligo_pos[i][3], color='#0066cc')
		ss_rev[i].createStrand(base_idx_low=offset_idx, base_idx_high=offset_idx+oligo_pos[i][1], color='#f44242')
		ss_rev[i].createStrand(base_idx_low=offset_idx+oligo_pos[i][2], base_idx_high=offset_idx+oligo_pos[i][3], color='#007200')
		part.fwd_strandsets[i] = ss_fwd[i]
		part.rev_strandsets[i] = ss_rev[i] 
except Exception: 
	print('Failed to create StrandSet/Strands')

"""
print('\t', fwd_ss, '\t', [s.idxs() for s in fwd_ss.strands()], '\n\t\t\t\t',
          [s.getColor() for s in fwd_ss.strands()])
print('\t', rev_ss, '\t', [s.idxs() for s in rev_ss.strands()], '\n\t\t\t\t',
          [s.getColor() for s in rev_ss.strands()])