id_map = parse_results[2] # convert to SAM if conversion_mode != 'proBED': file = open_sam_file(directory, name) create_SAM_header(file, version, database, sorting_order, database_v, species, command_line, psm_file, comments) PSM2SAM(psm_hash, transcript_hash, exon_hash, decoy_annotation, allowed_mismatches, file, rm_duplicates, three_frame_translation, psm_file, id_map, None) compute_NH_XL(directory, name, include_unmapped, conversion_mode) sam_2_bam(directory, name) # convert to BED else: file = proBAM_proBED.open_bed_file(directory, name) proBAM_proBED.create_BED_header(file, database, database_v, command_line, psm_file, comments) proBAM_proBED.PSM2BED(psm_hash, transcript_hash, exon_hash, decoy_annotation, allowed_mismatches, file, rm_duplicates, three_frame_translation, id_map, None, database_v, species) print("proBAM conversion succesful") print("%f seconds" % (time.time() - start_time)) # output script run time else: # start GUI import proBAM_GUI proBAM_GUI._get_global_arguments_() proBAM_GUI.GUI()
def execute_proBAM(root): """ :param root: window root :return: """ root.config(cursor="watch") root.update() start_time = time.time() # start timing function Label(text="console:", pady=5, width=70, background="#f2f2f2").grid(row=12, columnspan=2) std_text = ScrolledText.ScrolledText(root, height=20) std_text.grid(row=15, columnspan=2) sys.stdout = Std_redirector(std_text) sys.stderr = Std_redirector(std_text) sys.stdin = Std_redirector(std_text) root.update() # get and print arguments try: _print_arguments_() command_line = ( "python proBAM.py --name " + str(name) + " --mismatches " + str(allowed_mismatches.get()) + " --version " + str(database_v.get()) + " --database " + str(database.get().upper()) + " --species " + str(species.get()) + " --file " + str(psm_file) + " --directory " + str(directory) + " --rm_duplicates " + str(rm_duplicates.get()) + " --allow_decoys " + str(allow_decoys.get()) + " --tri_frame_translation " + str(three_frame_translation.get() + " --pre_picked_annotation " + pre_picked_annotation) ) print "\n" # hash PSM_DATA and define variables psm_hash = proBAM_input.get_PSM_hash(psm_file, decoy_annotation) parse_results = proBAM_IDparser.parseID( psm_hash, species.get().replace(" ", "_"), database.get().upper(), decoy_annotation, int(database_v.get()), three_frame_translation.get(), pre_picked_annotation, ) annotation = parse_results[1] psm_hash = parse_results[0] transcript_hash = annotation[0] exon_hash = annotation[1] id_map = parse_results[2] # convert to SAM if probed == "N": file = proBAM.open_sam_file(directory, name.get()) proBAM.create_SAM_header( file, version, database.get().upper(), sorting_order, database_v.get(), species.get(), command_line, psm_file, comments, ) proBAM.PSM2SAM( psm_hash, transcript_hash, exon_hash, decoy_annotation, int(allowed_mismatches.get()), file, allow_decoys.get(), rm_duplicates.get(), three_frame_translation.get(), psm_file, id_map, root, ) proBAM.compute_NH_XL(directory, name.get()) proBAM.sam_2_bam(directory, name.get()) else: file = proBAM_proBED.open_bed_file(directory, name.get()) proBAM_proBED.create_BED_header( file, version, database.get().upper(), sorting_order.get(), database_v.get(), species.get(), command_line, psm_file, comments, ) proBAM_proBED.PSM2BED( psm_hash, transcript_hash, exon_hash, decoy_annotation, allowed_mismatches.get(), file, allow_decoys.get(), rm_duplicates.get(), three_frame_translation.get(), psm_file, id_map, ) root.config(cursor="") print ("proBAM conversion succesful") print ("%f seconds" % (time.time() - start_time)) # output script run time except Exception, e: print "ERROR:" + str( e ) + "\n" "Please check if all parameters were supplied correctly, if the error keeps occuring contact " 'the developers at "https://github.com/Biobix/proBAMconvert/issues" ' "and provide the file to be processed along with the following error message:" print e root.config(cursor="")
def execute_proBAM(root): ''' :param root: window root :return: ''' root.config(cursor="watch") root.update() start_time = time.time() # start timing function Label(text='console:', pady=5, width=70, background="#f2f2f2").grid(row=12, columnspan=2) std_text = ScrolledText.ScrolledText(root, height=20) std_text.grid(row=15, columnspan=2) sys.stdout = Std_redirector(std_text) sys.stderr = Std_redirector(std_text) sys.stdin = Std_redirector(std_text) root.update() # get and print arguments try: _print_arguments_() command_line = "python proBAM.py --name " + str(name.get()) + " --mismatches " + str( allowed_mismatches.get()) + " --version " + str(database_v.get()) \ + " --database " + str(database.get().upper()) + " --species " + str(species.get().replace(' ','_')) + " --file " + str(psm_file) + \ " --directory " + str(directory) + " --rm_duplicates " + str(rm_duplicates.get()) + \ " --tri_frame_translation " + \ str(three_frame_translation+" --pre_picked_annotation "+pre_picked_annotation) +\ " --include_unmapped "+str(include_unmapped) print '\n' # hash PSM_DATA and define variables psm_hash = proBAM_input.get_PSM_hash(psm_file, decoy_annotation) parse_results = proBAM_IDparser.parseID( psm_hash, species.get().replace(' ', '_'), database.get().upper(), decoy_annotation, int(database_v.get()), three_frame_translation, pre_picked_annotation) annotation = parse_results[1] psm_hash = parse_results[0] transcript_hash = annotation[0] exon_hash = annotation[1] id_map = parse_results[2] # convert to SAM if conversion_mode.get() != 'proBED': file = proBAM.open_sam_file(directory, name.get()) proBAM.create_SAM_header(file, version, database.get().upper(), sorting_order, database_v.get(), species.get().replace(' ', '_'), command_line, psm_file, comments) proBAM.PSM2SAM(psm_hash, transcript_hash, exon_hash, decoy_annotation, int(allowed_mismatches.get()), file, rm_duplicates.get(), three_frame_translation, psm_file, id_map, root) proBAM.compute_NH_XL(directory, name.get(), include_unmapped, conversion_mode) proBAM.sam_2_bam(directory, name.get()) else: file = proBAM_proBED.open_bed_file(directory, name.get()) proBAM_proBED.create_BED_header(file, database.get().upper(), database_v.get(), command_line, psm_file, comments) proBAM_proBED.PSM2BED(psm_hash, transcript_hash, exon_hash, decoy_annotation, int(allowed_mismatches.get()), file, rm_duplicates.get(), three_frame_translation, id_map, root, database_v.get(), species.get().replace(' ', '_')) root.config(cursor="") print("proBAM conversion succesful") print("%f seconds" % (time.time() - start_time) ) # output script run time except Exception, e: print "ERROR:"+str(e)+"\n" \ "Please check if all parameters were supplied correctly, if the error keeps occuring contact " \ "the developers at \"https://github.com/Biobix/proBAMconvert/issues\" " \ "and provide the file to be processed along with the following error message:" print e root.config(cursor="")
# hash PSM_DATA and define variables psm_hash=proBAM_input.get_PSM_hash(psm_file,decoy_annotation) parse_results=proBAM_IDparser.parseID(psm_hash,species,database,decoy_annotation,database_v,three_frame_translation ,pre_picked_annotation) annotation=parse_results[1] psm_hash=parse_results[0] transcript_hash=annotation[0] exon_hash=annotation[1] id_map=parse_results[2] # convert to SAM if probed=='N': file = open_sam_file(directory, name) create_SAM_header(file, version, database, sorting_order, database_v, species, command_line, psm_file, comments) PSM2SAM(psm_hash,transcript_hash,exon_hash,decoy_annotation,allowed_mismatches,file,allow_decoys,rm_duplicates, three_frame_translation,psm_file,id_map,None) compute_NH_XL(directory, name) sam_2_bam(directory, name) # convert to BED else: file = proBAM_proBED.open_bed_file(directory, name) proBAM_proBED.create_BED_header(file, database, database_v, command_line, psm_file, comments) proBAM_proBED.PSM2BED(psm_hash,transcript_hash,exon_hash,decoy_annotation,allowed_mismatches,file,allow_decoys, rm_duplicates,three_frame_translation,psm_file) print("proBAM conversion succesful") print("%f seconds" % (time.time() - start_time)) # output script run time