PEATDB/DNAtool/Restriction_Digest_driver.py
def tidy_restriction_labels(self,direction='up',temporary=None,underline_unique=None):
		"""This function is for tidying up the restr. site placement after initial drawing
                   It also draws the boxes and lines for the sites"""
		c = self.seqframe
		if direction=='up':
		   l=-15
		   base_shift=0
		else:
			l=15
			base_shift=30

		#clear the temporary rects and lines from previous time
		self.seqframe.delete('templabelrect')
		self.seqframe.delete('templine')
		currentsites=[]
		#use seperate lists depending on whether temp sites are being drawn
		if temporary:
			for obj in self.temp_objs.keys():
				currentsites.append(obj)
		else:
			for obj in self.new_seq_win_objs.keys():
				currentsites.append(obj)
		#for each obj, see if it overlaps nearest, and if so - move it up/down
		for obj in currentsites:
			box = c.bbox(obj)
			x1=box[0]
			y1=box[1]
			x2=box[2]
			y2=box[3]
			overlap=[]
			overlap=c.find_overlapping(x1,y1,x2,y2)
			if overlap:
				for overobj in overlap:
					if overobj != obj:
					#if overlap is a text label, move it upwards until
					#it no longer overlaps another label
						if 'textlabel' in c.gettags(overobj):
							c.move(overobj, 0, l)

		#Now plot rectangle, lift text and then remove sites from list for next time
		#first determine if unique site from tag
		for obj in currentsites:
			#first draw the lines..
			coords = c.coords(obj)
			enzyme = c.gettags(obj)[3]
			sitetag = c.gettags(obj)[4]
			x=coords[0]
			y1=coords[1]
			y2=self.seq_row+base_shift
			yorg_here=y2
			# If we have a protein sequence then lift the line a bit
			if self.data.has_key('ORF_selected'):
				if direction=='up':
					yorg_here=(y2-15)/self.y_scale
				else:
					yorg_here=(y2-15)*self.y_scale
                        # If a comparison sequence is loaded raise line more
			if self.show_comp_sequence.get()==1:
				if direction=='up':
					if self.maxseqlevel==0:
						yorg_here=(yorg_here-15)/self.y_scale
					else:
						yorg_here=yorg_here-(self.maxseqlevel*15)/self.y_scale
  					if self.primer_displayed==1 and self.maxseqlevel>0:
						yorg_here=(yorg_here-15)/self.y_scale
				else:
				    yorg_here=(yorg_here-15)*self.y_scale

			if temporary:
				line=self.seqframe.create_line(x,yorg_here-5,x,y1,fill=self.linecol,
						 width=2,stipple='gray25',tag=('templine',enzyme,sitetag,direction))
			else:
				line=self.seqframe.create_line(x,yorg_here-5,x,y1,fill=self.linecol,
						width=2,stipple='gray25',tag=('line',enzyme,sitetag,direction))
			#lower the lines behind other objects
			c.tag_lower(line)
			if 'u' in c.gettags(obj):
				fillcolour='pink'
			else:
				fillcolour='lightyellow'
			box = c.bbox(obj)			
			if temporary:
				rect = c.create_rectangle(box,tag=('templabelrect',enzyme,sitetag),fill=fillcolour)
			else:
				rect = c.create_rectangle(box,tag=('labelrect',enzyme,sitetag),fill=fillcolour)				
			c.tag_raise(obj)
This function is for tidying up the restr. site placement after initial drawing
                   It also draws the boxes and lines for the sites
This function is for tidying up the restr. site placement after initial drawing
It also draws the boxes and lines for the sites
This function is for tidying up the restr . site placement after initial drawing It also draws the boxes and lines for the sites
def tidy_restriction_labels(self,direction='up',temporary=None,underline_unique=None):
		c = self.seqframe
		if direction=='up':
		   l=-15
		   base_shift=0
		else:
			l=15
			base_shift=30
		self.seqframe.delete('templabelrect')
		self.seqframe.delete('templine')
		currentsites=[]
		if temporary:
			for obj in self.temp_objs.keys():
				currentsites.append(obj)
		else:
			for obj in self.new_seq_win_objs.keys():
				currentsites.append(obj)
		for obj in currentsites:
			box = c.bbox(obj)
			x1=box[0]
			y1=box[1]
			x2=box[2]
			y2=box[3]
			overlap=[]
			overlap=c.find_overlapping(x1,y1,x2,y2)
			if overlap:
				for overobj in overlap:
					if overobj != obj:
						if 'textlabel' in c.gettags(overobj):
							c.move(overobj, 0, l)
		for obj in currentsites:
			coords = c.coords(obj)
			enzyme = c.gettags(obj)[3]
			sitetag = c.gettags(obj)[4]
			x=coords[0]
			y1=coords[1]
			y2=self.seq_row+base_shift
			yorg_here=y2
			if self.data.has_key('ORF_selected'):
				if direction=='up':
					yorg_here=(y2-15)/self.y_scale
				else:
					yorg_here=(y2-15)*self.y_scale
			if self.show_comp_sequence.get()==1:
				if direction=='up':
					if self.maxseqlevel==0:
						yorg_here=(yorg_here-15)/self.y_scale
					else:
						yorg_here=yorg_here-(self.maxseqlevel*15)/self.y_scale
  					if self.primer_displayed==1 and self.maxseqlevel>0:
						yorg_here=(yorg_here-15)/self.y_scale
				else:
				    yorg_here=(yorg_here-15)*self.y_scale
			if temporary:
				line=self.seqframe.create_line(x,yorg_here-5,x,y1,fill=self.linecol,
						 width=2,stipple='gray25',tag=('templine',enzyme,sitetag,direction))
			else:
				line=self.seqframe.create_line(x,yorg_here-5,x,y1,fill=self.linecol,
						width=2,stipple='gray25',tag=('line',enzyme,sitetag,direction))
			c.tag_lower(line)
			if 'u' in c.gettags(obj):
				fillcolour='pink'
			else:
				fillcolour='lightyellow'
			box = c.bbox(obj)			
			if temporary:
				rect = c.create_rectangle(box,tag=('templabelrect',enzyme,sitetag),fill=fillcolour)
			else:
				rect = c.create_rectangle(box,tag=('labelrect',enzyme,sitetag),fill=fillcolour)				
			c.tag_raise(obj)
def tidy_restriction_labels ( self , direction = 'up' , temporary = None , underline_unique = None ) : c = self . seqframe if direction == 'up' : l = - 15 base_shift = 0 else : l = 15 base_shift = 30 self . seqframe . delete ( 'templabelrect' ) self . seqframe . delete ( 'templine' ) currentsites = [ ] if temporary : for obj in self . temp_objs . keys ( ) : currentsites . append ( obj ) else : for obj in self . new_seq_win_objs . keys ( ) : currentsites . append ( obj ) for obj in currentsites : box = c . bbox ( obj ) x1 = box [ 0 ] y1 = box [ 1 ] x2 = box [ 2 ] y2 = box [ 3 ] overlap = [ ] overlap = c . find_overlapping ( x1 , y1 , x2 , y2 ) if overlap : for overobj in overlap : if overobj != obj : if 'textlabel' in c . gettags ( overobj ) : c . move ( overobj , 0 , l ) for obj in currentsites : coords = c . coords ( obj ) enzyme = c . gettags ( obj ) [ 3 ] sitetag = c . gettags ( obj ) [ 4 ] x = coords [ 0 ] y1 = coords [ 1 ] y2 = self . seq_row + base_shift yorg_here = y2 if self . data . has_key ( 'ORF_selected' ) : if direction == 'up' : yorg_here = ( y2 - 15 ) / self . y_scale else : yorg_here = ( y2 - 15 ) * self . y_scale if self . show_comp_sequence . get ( ) == 1 : if direction == 'up' : if self . maxseqlevel == 0 : yorg_here = ( yorg_here - 15 ) / self . y_scale else : yorg_here = yorg_here - ( self . maxseqlevel * 15 ) / self . y_scale if self . primer_displayed == 1 and self . maxseqlevel > 0 : yorg_here = ( yorg_here - 15 ) / self . y_scale else : yorg_here = ( yorg_here - 15 ) * self . y_scale if temporary : line = self . seqframe . create_line ( x , yorg_here - 5 , x , y1 , fill = self . linecol , width = 2 , stipple = 'gray25' , tag = ( 'templine' , enzyme , sitetag , direction ) ) else : line = self . seqframe . create_line ( x , yorg_here - 5 , x , y1 , fill = self . linecol , width = 2 , stipple = 'gray25' , tag = ( 'line' , enzyme , sitetag , direction ) ) c . tag_lower ( line ) if 'u' in c . gettags ( obj ) : fillcolour = 'pink' else : fillcolour = 'lightyellow' box = c . bbox ( obj ) if temporary : rect = c . create_rectangle ( box , tag = ( 'templabelrect' , enzyme , sitetag ) , fill = fillcolour ) else : rect = c . create_rectangle ( box , tag = ( 'labelrect' , enzyme , sitetag ) , fill = fillcolour ) c . tag_raise ( obj )
This function is for tidying up the restr.
This function is for tidying up the restr .
"""This function is for tidying up the restr. site placement after initial drawing
                   It also draws the boxes and lines for the sites""" #clear the temporary rects and lines from previous time #use seperate lists depending on whether temp sites are being drawn #for each obj, see if it overlaps nearest, and if so - move it up/down #if overlap is a text label, move it upwards until #it no longer overlaps another label #Now plot rectangle, lift text and then remove sites from list for next time #first determine if unique site from tag #first draw the lines.. # If we have a protein sequence then lift the line a bit # If a comparison sequence is loaded raise line more #lower the lines behind other objects
self
direction
temporary
underline_unique