def pipeSakl(strain): reads1 = "/Volumes/BioSan/Users/friedrich/GB-3G/Reads/Run3/CleanPE/s_1_%s-trim.fq" % (strain) reads2 = "/Volumes/BioSan/Users/friedrich/GB-3G/Reads/Run3/CleanPE/s_2_%s-trim.fq" % (strain) repOut = "/Volumes/BioSan/Users/friedrich/GB-3G/BWA/Nuclear/CleanPE/%s" % strain ref = "/Volumes/BioSan/Users/friedrich/GB-3G/SequenceReference/Sakl/Index/BWA/saklRef.fasta" if not os.path.isdir(repOut): os.mkdir(repOut) cmdA = "chmod 777 %s" % repOut os.system(cmdA) outBWA = "aln_%s_1Bis" % strain opt = "" if not "Run3" in reads1: opt += "-I" ficSam = traitementBWA.lanceBWA(outBWA, reads1, reads2, repOut, ref, opt) #ficSam = "%s/%sPE.sam" % (repOut,outBWA) # conversion du ficSam traditionnel en ficSam avec Flags textuels ficSamX = traitementSamtools.convertFlag(ficSam) #ficSamX = "%s-X" % ficSam # extraction des ali de reads paires de ficSam a partir des infos de ficSamX ficSamCorrect = traitementBWA.extraitCorrectlyPairedFromSam(ficSamX, ficSam) #ficSamCorrect = "%s/aln_%s_1BisPE.sam-correct" % (repOut,strain) lUnmappedReads = traitementBWA.extraitUnmappedReadsPair(ficSamCorrect, reads1, reads2) opt += " -n 8 -o 2" outBWA2 = "aln_%s_unmapped" % strain ficSamUnmapped = traitementBWA.lanceBWA(outBWA2, lUnmappedReads[0], lUnmappedReads[1], repOut, ref, opt) #ficSamUnmapped = "%s/aln_%s_unmappedPE.sam" % (repOut,strain) ficSamUnmappedInRef = traitementSamtools.deconvolueSam(ficSamUnmapped) # concatenation des 2 fichiers sam : d abord les unmapped pour avoir le header, puis ficSamCorrected ficSamAll = "%s/aln_%s_PE.sam" % (repOut, strain) cmdB = "cat %s %s > %s" % (ficSamUnmappedInRef, ficSamCorrect, ficSamAll) # a partir de celui-ci extraction des ali des paires OK os.system(cmdB) # je peux creer les fic de reads unmapped pour mito a partir de la aussi # ils s appelleront xxx_unmapped_unmapped.fq lReadsUnmappedPourMito = traitementBWA.extraitUnmappedReadsPair(ficSamUnmappedInRef, lUnmappedReads[0], lUnmappedReads[1]) #traitementSamtools.lancePipeSamtools(ficSamAll,ref) # 1ere etape est de retirer les ali avec flag ? a 0 dans les bam ficVarFilter = traitementSamtools.lancePipeSamtools(ficSamAll, ref) traitementSamtools.fromVarfilter2tsvLike(ficVarFilter)
def pipeSakl(strain,run): if run == "run2": reads1 = "/Volumes/BioSan/Users/friedrich/GB-3G/Reads/Run2/s_3_1_%s_unmapped_unmapped.fq" % (strain) reads2 = "/Volumes/BioSan/Users/friedrich/GB-3G/Reads/Run2/s_3_2_%s_unmapped_unmapped.fq" % (strain) else: reads1 = "/Volumes/BioSan/Users/friedrich/GB-3G/Reads/s_8_1_%s_unmapped_unmapped.fq" % (strain) reads2 = "/Volumes/BioSan/Users/friedrich/GB-3G/Reads/s_8_2_%s_unmapped_unmapped.fq" % (strain) repOut = "/Volumes/BioSan/Users/friedrich/GB-3G/BWA/Mito/%s" % strain ref = "/Volumes/BioSan/Users/friedrich/GB-3G/SequenceReference/Sakl/Mito/test_sc.tfa" if not os.path.isdir(repOut): os.mkdir(repOut) cmdA = "chmod 777 %s" % repOut os.system(cmdA) outBWA = "alnMitotest_sc_%s_1" % strain opt = "-n 3" ficSam = traitementBWA.lanceBWA(outBWA,reads1,reads2,repOut,ref,opt) ficSamInRef = deconvolueSam(ficSam) lancePipeSamtools(ficSamInRef,ref) ficVarFilter = lanceSamtools(ficSam,ref) traitementSamtools.fromVarfilter2tsvLike(ficVarFilter)
def mappingSaklCleanSE(strain): reads1 = "/Volumes/BioSan/Users/friedrich/GB-3G/Reads/CleanPE/s_1_%s-trim.fq" % (strain) reads2 = "/Volumes/BioSan/Users/friedrich/GB-3G/Reads/CleanPE/s_2_%s-trim.fq" % (strain) if not os.path.isfile(reads1): reads1 = "/Volumes/BioSan/Users/friedrich/GB-3G/Reads/Run3/CleanPE/s_1_%s-trim.fq" % (strain) reads2 = "/Volumes/BioSan/Users/friedrich/GB-3G/Reads/Run3/CleanPE/s_2_%s-trim.fq" % (strain) repOut = "/Volumes/BioSan/Users/friedrich/GB-3G/BWA/NuclearMito/%s" % (strain) ref = "/Volumes/BioSan/Users/friedrich/GB-3G/SequenceReference/Sakl/Index/BWA/saklRefNuclMito.fasta" if not os.path.isdir(repOut): os.mkdir(repOut) cmdA = "chmod 777 %s" % repOut os.system(cmdA) outBWA = "aln_%s" % strain opt = "-n 8 -o 2 " if not "Run3" in reads1: opt += "-I " # print reads ficSam = traitementBWA.lanceBWA(outBWA, reads1, reads2, repOut, ref, opt) # conversion du ficSam traditionnel en ficSam avec Flags textuels ficSamInRef = traitementSamtools.deconvolueSam(ficSam) ficSamNotInRef = ficSamInRef.replace("inRef", "notInRef") ficSamX = traitementSamtools.convertFlag(ficSamNotInRef) traitementBWA.extraitPEUnmappedReads(ficSamX, reads1, reads2)
def pipeSaklCleanReadsMito(strain, refSt): reads1 = "/Volumes/BioSan/Users/friedrich/GB-3G/Reads/CleanPE/s_1_%s-trim_unmapped_unmapped.fq" % (strain) reads2 = "/Volumes/BioSan/Users/friedrich/GB-3G/Reads/CleanPE/s_2_%s-trim_unmapped_unmapped.fq" % (strain) repOut = "/Volumes/BioSan/Users/friedrich/GB-3G/BWA/Mito/%s" % strain ref = "/Volumes/BioSan/Users/friedrich/GB-3G/SequenceReference/Sakl/Mito/mito%s.fasta" % (refSt) #ref = "/Volumes/BioSan/Users/friedrich/GB-3G/SequenceReference/Sakl/Mito/mitoCBS5828.fasta" if not os.path.isdir(repOut): os.mkdir(repOut) cmdA = "chmod 777 %s" % repOut os.system(cmdA) outBWA = "aln_%s_unmapped" % strain opt = "-n 8 -o 2" if not "Run3" in reads1: opt += " -I" #opt = "-n 10 -o 4" #ficSam = traitementBWA.lanceBWA(outBWA2,lUnmappedReads[0],lUnmappedReads[1],repOut,ref,opt) ficSam = traitementBWA.lanceBWA(outBWA, reads1, reads2, repOut, ref, opt) #ficSam = traitementBWA.lanceBWA(outBWA,reads1,reads2,repOut,ref) ficSamInRef = traitementSamtools.deconvolueSam(ficSam) # renomme le fichier de mapping ficSamAll = "%s/aln_%s_unmapped_PE.sam" % (repOut, strain) cmdB = "mv %s %s" % (ficSamInRef, ficSamAll) os.system(cmdB) #traitementSamtools.lancePipeSamtools(ficSamAll,ref) # 1ere etape est de retirer les ali avec flag ? a 0 dans les bam # puis qq stats et estimation du nombre de SNP etc ficVarFilter = traitementSamtools.lancePipeSamtoolsSansRel(ficSamAll, ref) #ficVarFilter = traitementSamtools.lancePipeSamtools(ficSamAll,ref) traitementSamtools.fromVarfilter2tsvLike(ficVarFilter)
def pipeIncompPE(strain): reads1 = "/Volumes/BioSan/Users/friedrich/Reads/BGI/Run1Feb2013/%s/%s_1.fq" % (strain,strain) reads2 = "/Volumes/BioSan/Users/friedrich/Reads/BGI/Run1Feb2013/%s/%s_2.fq" % (strain,strain) repOut = "/Volumes/BioSan/Users/jhou/Documents/Incompatibility/BWA/%s" % strain ref = "/Volumes/BioSan/Users/friedrich/ReferenceSequence/LaKl/CBS3082/saklRef.fasta" if not os.path.isdir(repOut): os.mkdir(repOut) cmdA = "chmod 777 %s" % repOut os.system(cmdA) opt = "-n 5 -o 1" opt = "" out = "aln-ref%s" % strain ficSam = traitementBWA.lanceBWA(out,reads1,reads2,repOut,ref,opt) ficSamInRef = traitementSamtools.deconvolueSam(ficSam) # 1ere etape est de retirer les ali avec flag ? a 0 dans les bam ficVarFilter = lancePipeSamtoolsJing(ficSamInRef,ref) traitementSamtools.fromVarfilter2tsvLike(ficVarFilter)
def pipeIncompPE(strain): reads1 = "/Volumes/BioSan/Users/jhou/Documents/Reads/Pool-gly-R/%s_Cleandata_1.fq" % strain reads2 = "/Volumes/BioSan/Users/jhou/Documents/Reads/Pool-gly-R/%s_Cleandata_2.fq" % strain repOut = "/Volumes/BioSan/Users/jhou/Documents/Incompatibility/BWA/test/%s" % strain ref = "/Volumes/BioSan/Users/friedrich/Incompatibilite/ReferenceSequence/FY/Index/BWA/FYref.tfa" if not os.path.isdir(repOut): os.mkdir(repOut) cmdA = "chmod 777 %s" % repOut os.system(cmdA) opt = "-n 5 -o 1" opt = "" out = "aln-%s" % strain ficSam = traitementBWA.lanceBWA(out,reads1,reads2,repOut,ref,opt) ficSamInRef = traitementSamtools.deconvolueSam(ficSam) # 1ere etape est de retirer les ali avec flag ? a 0 dans les bam ficVarFilter = lancePipeSamtoolsJing(ficSamInRef,ref) traitementSamtools.fromVarfilter2tsvLike(ficVarFilter)
def pipeIncompPE(strain): reads1 = "/Volumes/BioSan/Users/friedrich/Reads/Genoscope/1002YeastGenomes/201307/BCM_%sOSW_6_1_C2420ACXX.%s_clean.fastq" % ( strain.split("-")[0], strain.split("-")[1]) reads2 = "/Volumes/BioSan/Users/friedrich/Reads/Genoscope/1002YeastGenomes/201307/BCM_%sOSW_6_2_C2420ACXX.%s_clean.fastq" % ( strain.split("-")[0], strain.split("-")[1]) repOut = "/Volumes/BioSan/Users/friedrich/1002YeastGenomes/BWA/%s" % strain ref = "/Volumes/BioSan/Users/friedrich/Incompatibilite/ReferenceSequence/FY/test_ref/FYref.tfa" if not os.path.isdir(repOut): os.mkdir(repOut) cmdA = "chmod 777 %s" % repOut os.system(cmdA) opt = "-n 5 -o 1" opt = "" out = "aln-%s" % strain ficSam = traitementBWA.lanceBWA(out, reads1, reads2, repOut, ref, opt) ficSamInRef = traitementSamtools.deconvolueSam(ficSam) # 1ere etape est de retirer les ali avec flag ? a 0 dans les bam ficVarFilter = lancePipeSamtoolsJing(ficSamInRef, ref) traitementSamtools.fromVarfilter2tsvLike(ficVarFilter)
def pipeSace(strain): reads1 = "/Volumes/BioSan/Users/ssiguenza/Projets/MiSeqDunham/RunOct2012/%s/CleanPE/s_1_%s-trim-clean.fq" % (strain,strain) reads2 = "/Volumes/BioSan/Users/ssiguenza/Projets/MiSeqDunham/RunOct2012/%s/CleanPE/s_2_%s-trim-clean.fq" % (strain,strain) repOut = "/Volumes/BioSan/Users/friedrich/NIH/RunOct2012/%s/n9o2" % strain ref = "/Volumes/BioSan/Users/friedrich/Incompatibilite/ReferenceSequence/FY/Index/BWA/FYref.tfa" if not os.path.isdir(repOut): os.mkdir(repOut) cmdA = "chmod 777 %s" % repOut os.system(cmdA) outBWA = "aln_%s" % strain opt = "-n 9 -o 2" #opt += " -I" ficSamAll = traitementBWA.lanceBWA(outBWA,reads1,reads2,repOut,ref,opt) ficSamAll = "%s/aln_%sPE.sam" % (repOut,strain) ficVarFilter = traitementSamtools.lancePipeSamtools(ficSamAll,ref) traitementSamtools.fromVarfilter2tsvLike(ficVarFilter)
def pipeSaklPE(strain, p1, p2): reads1 = "/Volumes/BioSan/Users/friedrich/GB-3G/Reads/Run6/CleanPE/s_1_%s-trim.fq" % (strain) reads2 = "/Volumes/BioSan/Users/friedrich/GB-3G/Reads/Run6/CleanPE/s_2_%s-trim.fq" % (strain) repOut = "/Volumes/BioSan/Users/pjung/Documents/GB-3G/BWA/Nuclear/Recombinaison/%s" % strain ref = "/Volumes/BioSan/Users/friedrich/GB-3G/SequenceReference/Sakl/Index/BWA/saklRef.fasta" if not os.path.isdir(repOut): os.mkdir(repOut) cmdA = "chmod 777 %s" % repOut os.system(cmdA) outBWA = "aln_%s_1" % strain opt = "" if not "Run3" in reads1 and not "Run4" in reads1: opt += "-I" opt += " -n 8 -o 2" ficSam = traitementBWA.lanceBWA(outBWA, reads1, reads2, repOut, ref, opt) ficVarFilter = traitementSamtools.lancePipeSamtoolsRecomb(ficSam, ref) ficOri = definiProvenanceSeg(strain, p1, p2) ficOriNew = postTraiteProvenanceSeg(ficOri, strain)
def pipeIncompMito(strain): #reads = "/Volumes/BioSan/Users/friedrich/Incompatibilite/Reads/Run5/s_%s-trim.fq" % (strain) #repOut = "/Volumes/BioSan/Users/friedrich/Incompatibilite/BWA/%s" % strain ref = "/Volumes/BioSan/Users/friedrich/Incompatibilite/ReferenceSequence/FY/Index/BWA/mitoRefnew.fasta" reads1 = "/Volumes/BioSan/Users/friedrich/Incompatibilite/Reads/Run2BGI/%s.L500_1.fq" % (strain) reads2 = "/Volumes/BioSan/Users/friedrich/Incompatibilite/Reads/Run2BGI/%s.L500_2.fq" % (strain) repOut = "/Volumes/BioSan/Users/jhou/Documents/Incompatibility/BWA/%s_mitoBIS" % strain #ref = "/Volumes/BioSan/Users/friedrich/Incompatibilite/ReferenceSequence/FY/test_ref/mitoRef.fasta" if not os.path.isdir(repOut): os.mkdir(repOut) cmdA = "chmod 777 %s" % repOut os.system(cmdA) opt = "-n 5 -o 2" opt = "" out = "aln-Mito%s" % strain ficSam = traitementBWA.lanceBWA(out,reads1,reads2,repOut,ref,opt) #ficSam = "%s/%sSE.sam" % (repOut,out) ficSamInRef = traitementSamtools.deconvolueSam(ficSam) # 1ere etape est de retirer les ali avec flag ? a 0 dans les bam ficVarFilter = lancePipeSamtoolsJing(ficSamInRef,ref) traitementSamtools.fromVarfilter2tsvLike(ficVarFilter)