3d-dart/server/system/NAfunctionLib.py
def _ToBaseOne(self,sequence):
		
		"""Convert everything to two strands of one-letter code bases"""
		
		template = []
		complement = []
		
		if self.type == 'base':			#Convert three to one, make complementary strand
			for resid in sequence[0]:
				if resid in BASELIST3_T:
					template.append(BASELIST1_T[BASELIST3_T.index(resid)])
				elif resid in BASELIST1_T:
					template.append(resid)
			if sequence[1]:
				for resid in sequence[1]:
					if resid in BASELIST3_T:
						complement.append(BASELIST1_T[BASELIST3_T.index(resid)])
					elif resid in BASELIST1_T:
						complement.append(resid)
			else:
				for resid in template:
					complement.append(BASELIST1_C[BASELIST1_T.index(resid)])		
						
		elif self.type == 'pair':		#Convert base-pair three to one. Conserve template and complement
			splitter = re.compile('-')
			single_t = []
			single_c = []
			for resid in sequence[0]:
				single_t.append(splitter.split(resid)[0])
				single_c.append(splitter.split(resid)[1])
			if len(single_t[0]) == 1:
				template = single_t
				complement = single_c
			elif len(single_t[0]) == 3:
				for resid in single_t:
					if resid in BASELIST3_T:
						template.append(BASELIST1_T[BASELIST3_T.index(resid)])
				for resid in single_c:
					if resid in BASELIST3_T:
						complement.append(BASELIST1_T[BASELIST3_T.index(resid)])			
		
		elif self.type == 'step':
			splitter = re.compile('/')
			single_t = []
			single_c = []
			for resid in sequence[0]:
				single_t.append(splitter.split(resid)[0])
				single_c.append(splitter.split(resid)[1])
			
			if len(single_t[0]) == 2:
				count = len(single_t)
				step = 0
				while step < count:
					if step == count-1:
						template.append(single_t[step][0])
						template.append(single_t[step][1])
						complement.append(single_c[step][1])
						complement.append(single_c[step][0])
					else:	
						template.append(single_t[step][0])
						complement.append(single_c[step][1])
					step = step+1
		else:
			template = None
			complement = None		
			
		self.input.append(template)
		self.input.append(complement)
Convert everything to two strands of one-letter code bases
Convert everything to two strands of one-letter code bases
Convert everything to two strands of one - letter code bases
def _ToBaseOne(self,sequence):
		template = []
		complement = []
		if self.type == 'base':			
			for resid in sequence[0]:
				if resid in BASELIST3_T:
					template.append(BASELIST1_T[BASELIST3_T.index(resid)])
				elif resid in BASELIST1_T:
					template.append(resid)
			if sequence[1]:
				for resid in sequence[1]:
					if resid in BASELIST3_T:
						complement.append(BASELIST1_T[BASELIST3_T.index(resid)])
					elif resid in BASELIST1_T:
						complement.append(resid)
			else:
				for resid in template:
					complement.append(BASELIST1_C[BASELIST1_T.index(resid)])		
		elif self.type == 'pair':		
			splitter = re.compile('-')
			single_t = []
			single_c = []
			for resid in sequence[0]:
				single_t.append(splitter.split(resid)[0])
				single_c.append(splitter.split(resid)[1])
			if len(single_t[0]) == 1:
				template = single_t
				complement = single_c
			elif len(single_t[0]) == 3:
				for resid in single_t:
					if resid in BASELIST3_T:
						template.append(BASELIST1_T[BASELIST3_T.index(resid)])
				for resid in single_c:
					if resid in BASELIST3_T:
						complement.append(BASELIST1_T[BASELIST3_T.index(resid)])			
		elif self.type == 'step':
			splitter = re.compile('/')
			single_t = []
			single_c = []
			for resid in sequence[0]:
				single_t.append(splitter.split(resid)[0])
				single_c.append(splitter.split(resid)[1])
			if len(single_t[0]) == 2:
				count = len(single_t)
				step = 0
				while step < count:
					if step == count-1:
						template.append(single_t[step][0])
						template.append(single_t[step][1])
						complement.append(single_c[step][1])
						complement.append(single_c[step][0])
					else:	
						template.append(single_t[step][0])
						complement.append(single_c[step][1])
					step = step+1
		else:
			template = None
			complement = None		
		self.input.append(template)
		self.input.append(complement)
def _ToBaseOne ( self , sequence ) : template = [ ] complement = [ ] if self . type == 'base' : for resid in sequence [ 0 ] : if resid in BASELIST3_T : template . append ( BASELIST1_T [ BASELIST3_T . index ( resid ) ] ) elif resid in BASELIST1_T : template . append ( resid ) if sequence [ 1 ] : for resid in sequence [ 1 ] : if resid in BASELIST3_T : complement . append ( BASELIST1_T [ BASELIST3_T . index ( resid ) ] ) elif resid in BASELIST1_T : complement . append ( resid ) else : for resid in template : complement . append ( BASELIST1_C [ BASELIST1_T . index ( resid ) ] ) elif self . type == 'pair' : splitter = re . compile ( '-' ) single_t = [ ] single_c = [ ] for resid in sequence [ 0 ] : single_t . append ( splitter . split ( resid ) [ 0 ] ) single_c . append ( splitter . split ( resid ) [ 1 ] ) if len ( single_t [ 0 ] ) == 1 : template = single_t complement = single_c elif len ( single_t [ 0 ] ) == 3 : for resid in single_t : if resid in BASELIST3_T : template . append ( BASELIST1_T [ BASELIST3_T . index ( resid ) ] ) for resid in single_c : if resid in BASELIST3_T : complement . append ( BASELIST1_T [ BASELIST3_T . index ( resid ) ] ) elif self . type == 'step' : splitter = re . compile ( '/' ) single_t = [ ] single_c = [ ] for resid in sequence [ 0 ] : single_t . append ( splitter . split ( resid ) [ 0 ] ) single_c . append ( splitter . split ( resid ) [ 1 ] ) if len ( single_t [ 0 ] ) == 2 : count = len ( single_t ) step = 0 while step < count : if step == count - 1 : template . append ( single_t [ step ] [ 0 ] ) template . append ( single_t [ step ] [ 1 ] ) complement . append ( single_c [ step ] [ 1 ] ) complement . append ( single_c [ step ] [ 0 ] ) else : template . append ( single_t [ step ] [ 0 ] ) complement . append ( single_c [ step ] [ 1 ] ) step = step + 1 else : template = None complement = None self . input . append ( template ) self . input . append ( complement )
Convert everything to two strands of one-letter code bases
Convert everything to two strands of one - letter code bases
"""Convert everything to two strands of one-letter code bases""" #Convert three to one, make complementary strand #Convert base-pair three to one. Conserve template and complement
self
sequence