def do_aln(self, in_file, out_file): """Test for generating sai files given the reference and read file""" cmdline = BwaAlignCommandline(bwa_exe) cmdline.set_parameter("reference", self.reference_file) cmdline.read_file = in_file self.assertTrue(os.path.isfile(in_file)) stdout, stderr = cmdline(stdout=out_file) self.assertTrue("fail to locate the index" not in str(stderr) + str(stdout), "Error aligning sequence to reference:\n%s\nStdout:%s\nStderr:%s\n" % (cmdline, stdout, stderr))
def PerformBWA(reference_genome,IN_READS): from subprocess import call Refgenome_file=reference_genome print(reference_genome) Input_reads= IN_READS #OUTPUT_file = 'Alignedreads.sam' #f=open(OUTPUT_file,"w") output_sai_file = 'read_1.sai' from Bio.Sequencing.Applications import BwaSamseCommandline from Bio.Sequencing.Applications import BwaAlignCommandline from Bio.Sequencing.Applications import BwaIndexCommandline align_cmd= BwaAlignCommandline(reference=Refgenome_file, read_file=Input_reads) cmd = "bwa index reference_genome"