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 extraitUnmappedCleanSE(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) ficSamInRef = "%s/aln_%sPE.sam.inRef" % (repOut, strain) ficSamNotInRef = ficSamInRef.replace("inRef", "notInRef") ficSamX = traitementSamtools.convertFlag(ficSamNotInRef) traitementBWA.extraitPEUnmappedReads(ficSamX, reads1, reads2)
def pipeIncompForAssembly(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/%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 0 -o 0" ficSam = traitementBWA.lanceBWAsamse(strain,out,reads,repOut,ref,opt) ficSamX = traitementSamtools.convertFlag(ficSam) lUnmappedReads = traitementBWA.extraitUnmappedReads(ficSam,reads)
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 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)