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 pipeCramORI(): reads1 = "/Volumes/BioSan/Users/friedrich/Dikaryome/Reads/Cram/CleanPE/AQF_AFOSU_4_all_707WBAAXX-trim.fq" #reads2 = "/Volumes/BioSan/Users/friedrich/Dikaryome/Reads/Cram/CleanPE/AQF_AFOSU_4_2_707WBAAXX-trim.fq" repOut = "/Volumes/BioSan/Users/friedrich/Dikaryome/BWA/CramVsDeha" ref = "/Volumes/BioSan/Users/friedrich/Dikaryome/ReferenceSequences/Deha/Index/BWA/genomeDeha.tfa" if not os.path.isdir(repOut): os.mkdir(repOut) cmdA = "chmod 777 %s" % repOut os.system(cmdA) outBWA = "aln_CramVsDeha" opt = "-n 8 -o 2" ficSam = traitementBWA.lanceBWAsamse(outBWA,reads1,repOut,ref,opt) #ficSam = "aln_CramVsDeha_1SE.sam" # determination des unmapped reads #lUnmappedReads = traitementBWA.extraitUnmappedReadsPair(ficSamCorrect,reads1,reads2) # mapping de ces "unmapped" avec des parametres moins stringents #outBWA2 = "aln_CramVsDeha_unmapped" #ficSamUnmapped = traitementBWA.lanceBWA(outBWA2,lUnmappedReads[0],lUnmappedReads[1],repOut,ref,opt) #ficSamUnmappedInRef = traitementSamtools.deconvolueSam(ficSamUnmapped) # concatenation des 2 fichiers sam : d abord les unmapped pour avoir le header, puis ficSamCorrected #ficSamAll = "%s/aln_CramVsDeha_PE.sam" % (repOut) #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]) ficVarFilter = traitementSamtools.lancePipeSamtoolsSansRel(ficSam,ref) # 1ere etape est de retirer les ali avec flag ? a 0 dans les bam traitementSamtools.fromVarfilter2tsvLike(ficVarFilter)