def gene_count(directory, summary_folder, chromosomes_folder, input_folder, chromosomes_list, sam_file_list): num_cores = Parallel.cpu_count() print ">>> Using %d Processor Cores" % (num_cores - 1) Parallel.Parallel(n_jobs=num_cores - 1)(Parallel.delayed( lets_count)(directory, summary_folder, chromosomes_folder, input_folder, chromosomes_list, f) for f in sam_file_list)
def gene_count(directory, summary_folder, chromosomes_folder, input_folder, chromosomes_list, sam_file_list): num_cores = Parallel.cpu_count() print ">>> Using %d Processor Cores" % (num_cores - 1) _spin = spinbar.SpinCursor(msg="Processing mapped .sam files ...", speed=2) _spin.start() Parallel.Parallel(n_jobs=num_cores-1)(Parallel.delayed(letsCount)(directory, summary_folder, chromosomes_folder, input_folder, chromosomes_list, f) for f in sam_file_list) _spin.stop()
def blast_search(self, directory, db_name, blast_results_folder, blast_results_query): platform_specific_path = 'osx' suffix = '' if _platform == "linux" or _platform == "linux2": platform_specific_path = 'linux' elif _platform == "darwin": platform_specific_path = 'osx' elif _platform.startswith('win'): platform_specific_path = 'windows' suffix = '.exe' bit_size = 'x' + str(struct.calcsize("P") * 8) blast_path = os.path.join(os.curdir, 'ncbi_blast', 'bin', platform_specific_path, bit_size) # self.fileio.check_path(os.curdir, blast_path, 'Cannot find relevant Blast programs in Resources folder') blast_db = os.path.join(os.curdir, 'ncbi_blast', 'db') # database_list = self.fileio.get_file_list(blast_db, ".fa") # selection = select.Selection_Dialog() # selection.windowTitle('Blast Database Selection') # selection.populate_list(database_list) # selection.exec_() # selection.activateWindow() # db_selection = selection.selection db_path = os.path.join(blast_db, db_name) print ">>> Selected Blast DB: %s" % db_name sys.stdout.flush() file_list = self.fileio.get_file_list(directory, blast_results_folder, ".fa") for file_name in file_list: output_file = os.path.join( directory, blast_results_folder, file_name.replace(".junctions.fa", '.blast.txt')) print ">>> Running BLAST search for file: " + file_name blast_command_list = [ os.path.join(blast_path, 'blastn' + suffix), '-query', os.path.join(directory, 'blast_results', file_name), '-db', db_path, '-task', 'blastn', '-dust', 'no', '-num_threads', str(Parallel.cpu_count()), '-outfmt', '7', '-out', output_file, '-evalue', '0.2', '-max_target_seqs', '10' ] # blast_command = " ".join(blast_command_list) sys.stdout.flush() # os.system(blast_command) self.blast_pipe = subprocess.Popen(blast_command_list, shell=False) self.blast_pipe.wait()
def blast_search(self, directory, db_name, blast_results_folder): platform_specific_path = 'osx' suffix = '' if _platform == "linux" or _platform == "linux2": platform_specific_path = 'linux' elif _platform == "darwin": platform_specific_path = 'osx' elif _platform.startswith('win'): platform_specific_path = 'windows' suffix = '.exe' bit_size = 'x' + str(struct.calcsize("P") * 8) blast_path = os.path.join(os.curdir, 'ncbi_blast', 'bin', platform_specific_path, bit_size) # self.fileio.check_path(os.curdir, blast_path, 'Cannot find relevant Blast programs in Resources folder') blast_db = os.path.join(os.curdir, 'ncbi_blast', 'db') # database_list = self.fileio.get_file_list(blast_db, ".fa") # selection = select.Selection_Dialog() # selection.windowTitle('Blast Database Selection') # selection.populate_list(database_list) # selection.exec_() # selection.activateWindow() # db_selection = selection.selection db_path = os.path.join(blast_db, db_name) print ">>> Selected Blast DB: %s" % db_name sys.stdout.flush() for file_name in self.fileio.get_file_list(directory, blast_results_folder, ".fa"): output_file = os.path.join(directory, blast_results_folder, file_name + '.blast.txt') blast_command_list = [os.path.join(blast_path, 'blastn' + suffix), '-query', os.path.join(directory, 'blast_results', file_name), '-db', db_path, '-task', 'blastn', '-dust', 'no', '-num_threads', str(Parallel.cpu_count()), '-outfmt', '7', '-out', output_file, '-evalue', '0.2', '-max_target_seqs', '10'] # blast_command = " ".join(blast_command_list) print ">>> Running BLAST search for file: " + file_name sys.stdout.flush() self._spin = spinbar.SpinCursor(msg="Please wait for BLAST to finish...", speed=2) self._spin.start() # os.system(blast_command) self.blast_pipe = subprocess.Popen(blast_command_list, shell=False) self.blast_pipe.wait() self._spin.stop()