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 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 lanceExtraitUnmapped(): liStrains = ['DH-01', 'DH-02', 'DH-04'] for strain in liStrains: ficSam = "/Volumes/BioSan/Users/friedrich/Gonorrhoeae/BWA/%s/aln_%sPE.sam" % (strain, strain) ficInRef = traitementSamtools.deconvolueSam(ficSam) #print ficInRef ficNotInRef = ficInRef.replace("inRef", "notInRef") #ficNotInRef = "%s.notInRef" % ficSam reads1 = "/Volumes/BioSan/Users/friedrich/Reads/BGI/Run2Jan2013/%s/CleanPE/%s_Cleandata_1-trim.fq" % ( strain, strain) reads2 = "/Volumes/BioSan/Users/friedrich/Reads/BGI/Run2Jan2013/%s/CleanPE/%s_Cleandata_2-trim.fq" % ( strain, strain) extraitPEUnmappedReads(ficNotInRef, reads1, reads2, strain)
def pipeIncomp16(strain,out): reads = "/Volumes/BioSan/Users/friedrich/Incompatibilite/Reads/%s/NG-5435_%s_sequence.fastq" % (strain,strain[:-2]) repOut = "/Volumes/BioSan/Users/friedrich/Incompatibilite/BWA/Chrom16/%s" % strain ref = "/Volumes/BioSan/Users/friedrich/Incompatibilite/ReferenceSequence/FY/Index/BWA/chrom16_350000-420000.fasta" if not os.path.isdir(repOut): os.mkdir(repOut) cmdA = "chmod 777 %s" % repOut os.system(cmdA) ficSam = traitementBWA.lanceBWAsamse(strain,out,reads,repOut,ref) 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 = traitementSamtools.lancePipeSamtools(ficSamInRef,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 pipeIncompSE(strain): reads = "/Volumes/BioSan/Users/friedrich/Incompatibilite/Reads/Run5/s_%s_all-trim.fq" % (strain) repOut = "/Volumes/BioSan/Users/friedrich/Incompatibilite/BWA/%s" % strain ref = "/Volumes/BioSan/Users/friedrich/Incompatibilite/ReferenceSequence/FY/test_ref/FYref.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-%s" % strain ficSam = traitementBWA.lanceBWAsamse(out,reads,repOut,ref,opt) #ficSam = "%s/%sSE.sam" % (repOut,out) ficSamInRef = traitementSamtools.deconvolueSam(ficSam) #ficSamInRef = "%s/%sSE.sam.inRef" % (repOut,out) # 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 pipeMDR(strain): #reads = "/Volumes/BioSan/Users/friedrich/MDR/Reads/Run5/s_%s-trim.fq" % (strain) #reads = "/Volumes/BioSan/Users/friedrich/MDR/Reads/Run5c/CleanSE/s_%s-trim.fq" % (strain) reads = "/Volumes/BioSan/Users/friedrich/Incompatibilite/Reads/YJM326_1/NG-5435_YJM326_sequence.fastq-trim.fastq" #repOut = "/Volumes/BioSan/Users/friedrich/MDR/BWA/%s" % strain repOut = "/Volumes/BioSan/Users/friedrich/Incompatibilite/Reads/YJM326_1" 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 = "-n 0 -o 0" out = "alnFin-%s" % strain ficSam = traitementBWA.lanceBWAsamse(out, reads, repOut, ref, opt) ficSamInRef = traitementSamtools.deconvolueSam(ficSam) # 1ere etape est de retirer les ali avec flag ? a 0 dans les bam ficVarFilter = traitementSamtools.lancePipeSamtools(ficSamInRef, ref) fromVarfilter2tsvLikeCyrielle(ficVarFilter)
def mappingSaklCleanSEOld(strain): reads = "/Volumes/BioSan/Users/friedrich/GB-3G/Reads/CleanSE30strains/s_%s-trim.fq" % (strain) if not os.path.isfile(reads): reads = "/Volumes/BioSan/Users/friedrich/GB-3G/Reads/CleanSE30strains/Run3/s_%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 reads: opt += "-I " print reads ficSam = traitementBWA.lanceBWAsamse(outBWA, reads, repOut, ref, opt) # ficSam = "/Volumes/BioSan/Users/friedrich/GB-3G/BWA/NuclearMito/55-86_1/aln_55-86_1SE.sam" ficSamInRef = traitementSamtools.deconvolueSam(ficSam) ficSamX = traitementSamtools.convertFlag(ficSamInRef) unmappedReads = traitementBWA.extraitUnmappedReads(ficSamX, reads)
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)