[docs]defprofile_genome_plot(bar_width,l_genome,allinsertionsites_list,allcounts_binnedlist,summed_chr_length_dict,middle_chr_position,chrom_list,variable,genes_currentchrom_pos_list,gene_pos_dict):"""Plot function to show the whole insertion map throughout the genome Parameters ---------- bar_width : int The width for the histogram of the plot, by default None , which means internally the length of the genome over 1000 l_genome : int The length of the genome in bp allinsertionsites_list : list List of insertions sites allcounts_binnedlist : list List of binned counts summed_chr_length_dict : dict The cumulative sum of the length of every chromosome middle_chr_position : dict Middle chromosome position per chromosome chrom_list : list A list of all the chromosomes variable : str It could be "transposons" or "reads" genes_currentchrom_pos_list : list List of genes per chromosome gene_pos_dict : dict Postion along the genome of every gene """_,essential_file,_=load_default_files()genes_essential_list=list_known_essentials(essential_file)plt.figure(figsize=(19.0,9.0))grid=plt.GridSpec(20,1,wspace=0.0,hspace=0.0)textsize=12textcolor="#000000"barcolor="#333333"chrom_color=(0.9,0.9,0.9,1.0)essential_face_color="#00F28E"non_essential_face_color="#F20064"alpha=0.8binsize=bar_widthax=plt.subplot(grid[0:19,0])ax.grid(False)ax.tick_params(axis='x',which='major',pad=30)axc=plt.subplot(grid[19,0])axc.set_xlim(0,l_genome)axc.tick_params(axis='x',# changes apply to the x-axiswhich='both',# both major and minor ticks are affectedbottom=False,# ticks along the bottom edge are offtop=False,# ticks along the top edge are offlabelbottom=False)# labels along the bottom edge are offaxc.tick_params(axis='y',# changes apply to the y-axiswhich='both',# both major and minor ticks are affectedleft=False,# ticks along the bottom edge are offright=False,# ticks along the top edge are offlabelleft=False)# labels along the bottom edge are offax.set_xlim(0,l_genome)# bar linesax.bar(allinsertionsites_list,allcounts_binnedlist,width=binsize,color=barcolor)# chromosome linesforchrominsummed_chr_length_dict:ax.axvline(x=summed_chr_length_dict.get(chrom),linestyle='-',color=chrom_color)ax.set_xticks(middle_chr_position)ax.set_xticklabels(chrom_list,fontsize=textsize)# Axis labelsifvariable=="transposons":ax.set_ylabel('Transposon Count',fontsize=textsize,color=textcolor)elifvariable=="reads":ax.set_ylabel('Read Count',fontsize=textsize,color=textcolor)# colored bars in the bottom forgeneingenes_currentchrom_pos_list:ifnotgene_pos_dict.get(gene)[0]=='Mito':gene_start_pos=summed_chr_length_dict.get(gene_pos_dict.get(gene)[0])+int(gene_pos_dict.get(gene)[1])gene_end_pos=summed_chr_length_dict.get(gene_pos_dict.get(gene)[0])+int(gene_pos_dict.get(gene)[2])ifgeneingenes_essential_list:axc.axvspan(gene_start_pos,gene_end_pos,facecolor=essential_face_color,alpha=alpha)else:axc.axvspan(gene_start_pos,gene_end_pos,facecolor=non_essential_face_color,alpha=alpha)