bokeh.models.VeeHead

Here are the examples of the python api bokeh.models.VeeHead taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

0 Source : genome_protein_plots.py
with GNU General Public License v3.0
from michellejlin

def protein_annotation(first):
	protein_locs = []
	protein_names = []
	protein_lengths = []

	# Shades in every other protein region. Provides warning if proteins overlap.
	for i in range(0, proteins.shape[0]):
		if(i==0):
			x1 = 0
		elif(proteins.iloc[i,1]   <   proteins.iloc[i-1,2]) and first:
			print('WARNING: Protein-' + str(proteins.iloc[i,0]) + ' is overlapping with Protein-' + str(proteins.iloc[i-1,0]))
			print('Analysis will continue but the visualization for these two proteins will look a little funny. Often the fix for this is simply deleting the small ancilary proteins that overlapping from the gff file and using the -f and -g flags. For more help see the readme.')
			x1 = proteins.iloc[i,1]
		else:
			x1 = proteins.iloc[i,1]
		if(i==proteins.shape[0]-1):
			x2 = proteins.iloc[i,2]
		else:
			x2 = proteins.iloc[(i+1),1]
		if(i%2==0):
			genome_plot.add_layout(BoxAnnotation(left=x1, right=x2, fill_alpha=0.1, fill_color='green'))
		protein_locs.append((x1+x2)/2)
		protein_lengths.append(x2-x1)
		protein_names.append(proteins.iloc[i,0])

	if(os.stat("mat_peptides_additions.txt").st_size!=0):
		# Makes arrows for mature peptides.
		for i in range(0, mat_peptides_list.shape[0]):
			x1 = mat_peptides_list.iloc[i,1]
			x2 = mat_peptides_list.iloc[i,2]
			genome_plot.add_layout(Arrow(end = VeeHead(size=20, fill_color = "cadetblue", fill_alpha = 0.3, line_alpha = 0), 
				line_color = "cadetblue", line_width = 20, x_start = x1, x_end = x2,
				y_start = 5, y_end = 5, line_alpha = 0.3))

	# Adds protein labels as tick marks.
	genome_plot.xaxis.ticker = protein_locs
	protein_locs2 = []
	for protein_loc in protein_locs:
		str_protein_loc = str(protein_loc)
		## print("old str_protein_loc" + str_protein_loc)
		if ".0" in str_protein_loc:
			str_protein_loc = str_protein_loc.split('.')[0]
			## print("split" + str_protein_loc)
			protein_locs2.append(int(str_protein_loc))
		else:
			protein_locs2.append(float(str_protein_loc))	
	genome_plot.xaxis.major_label_overrides = dict(zip(protein_locs2, protein_names))
	return protein_names,protein_lengths

	
# Creates the legend and configures some of the toolbar stuff.
def configurePlot(g):