当前位置: 首页>>代码示例>>Python>>正文


Python Helper.proceedCommand方法代码示例

本文整理汇总了Python中Helper.Helper.proceedCommand方法的典型用法代码示例。如果您正苦于以下问题:Python Helper.proceedCommand方法的具体用法?Python Helper.proceedCommand怎么用?Python Helper.proceedCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Helper.Helper的用法示例。


在下文中一共展示了Helper.proceedCommand方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: startAnalysis

# 需要导入模块: from Helper import Helper [as 别名]
# 或者: from Helper.Helper import proceedCommand [as 别名]
    def startAnalysis(self):   
        recaledBamFile=self.rnaEdit.params.output+".noDup.realigned.recalibrated.bam"
        if os.path.isfile(recaledBamFile):
            Helper.info("* * * [Skipping] Mapping result File already exists * * *",self.rnaEdit.logFile,self.rnaEdit.textField)
            self.rnaEdit.logFile.flush()
            return recaledBamFile
        
        
        if self.rnaEdit.params.paired == True:  #For paired end sequencing
            #Align first Fastq Reads to the Genome
            saiFile1=self.rnaEdit.params.output+"_1.sai"
            cmd = [self.rnaEdit.params.sourceDir+"bwa", "aln" , "-t",self.rnaEdit.params.threads, "-n", self.rnaEdit.params.maxDiff , "-k", self.rnaEdit.params.seedDiff, self.rnaEdit.params.refGenome, self.fastqFile1]
            Helper.proceedCommand("Align first Reads with BWA", cmd, self.fastqFile1, saiFile1, self.rnaEdit)
            
            #Align second Fastq Reads to the Genome
            saiFile2=self.rnaEdit.params.output+"_2.sai"
            cmd = [self.rnaEdit.params.sourceDir+"bwa", "aln" , "-t",self.rnaEdit.params.threads, "-n", self.rnaEdit.params.maxDiff , "-k", self.rnaEdit.params.seedDiff, self.rnaEdit.params.refGenome, self.fastqFile2]
            Helper.proceedCommand("Align second Reads with BWA", cmd, self.fastqFile2, saiFile2, self.rnaEdit)
        
            #convert sai to sam
            samFile=self.rnaEdit.params.output+".sam"
            cmd = [self.rnaEdit.params.sourceDir + "bwa", "sampe", "-r", "@RG\tID:bwa\tSM:A\tPL:ILLUMINA\tPU:HiSEQ2000", self.rnaEdit.params.refGenome, saiFile1, saiFile2, self.fastqFile1, self.fastqFile2]
            Helper.proceedCommand("convert sai to sam", cmd, saiFile1, samFile, self.rnaEdit)
        elif self.rnaEdit.params.paired == False:  #For single end sequencing
            #Align Fastq Reads to the Genome
            saiFile=self.rnaEdit.params.output+".sai"
            cmd = [self.rnaEdit.params.sourceDir+"bwa", "aln" , "-t",self.rnaEdit.params.threads, "-n", self.rnaEdit.params.maxDiff , "-k", self.rnaEdit.params.seedDiff, self.rnaEdit.params.refGenome, self.fastqFile]
            Helper.proceedCommand("Align Reads with BWA", cmd, self.fastqFile, saiFile, self.rnaEdit)
            
            #convert sai to sam
            samFile=self.rnaEdit.params.output+".sam"

            cmd = [self.rnaEdit.params.sourceDir + "bwa", "samse", "-r", "@RG\tID:bwa\tSM:A\tPL:ILLUMINA\tPU:HiSEQ2000", self.rnaEdit.params.refGenome, saiFile, self.fastqFile]
            #cmd = [self.rnaEdit.params.sourceDir + "bwa", "samse", self.rnaEdit.params.refGenome, saiFile, self.fastqFile]
            Helper.proceedCommand("convert sai to sam", cmd, saiFile, samFile, self.rnaEdit)
        
        #convert sam to bam
        unsortedBamFile=self.rnaEdit.params.output+".unsorted.bam"
        bamFile=self.rnaEdit.params.output+".bam"
        """
        cmd=["java", "-Xmx8


        G", "-jar", self.rnaEdit.params.sourceDir + "picard-tools/SortSam.jar", "INPUT=" + samFile, "OUTPUT=" + bamFile, "SO=coordinate", "VALIDATION_STRINGENCY=LENIENT", "CREATE_INDEX=true"]
        Helper.proceedCommand("convert sam to bam", cmd, samFile, bamFile, self.rnaEdit)
        """

        #Sort and Index Bam File
        #Helper.status("Sort Bam", self.rnaEdit.logFile,self.rnaEdit.textField)
        
        '''pysamSamFile = pysam.Samfile(samFile,'r')
        pysamBamFile = pysam.Samfile(unsortedBamFile,'wb', template=pysamSamFile)
        
        for read in pysamSamFile.fetch():
             pysamBamFile.write(read)'''
        
        #pysam.sort(samFile,"-o", bamFile)
        cmd = [self.rnaEdit.params.sourceDir + "samtools", "sort", samFile,"-o", bamFile]
        Helper.proceedCommand("Sort Bam File", cmd, samFile, bamFile, self.rnaEdit)
        
        #Helper.status("index Bam", self.rnaEdit.logFile,self.rnaEdit.textField)
        #pysam.index(bamFile)
        cmd = [self.rnaEdit.params.sourceDir + "samtools", "index", bamFile]
        Helper.proceedCommand("Index Bam File", cmd, samFile, bamFile+".bai", self.rnaEdit)
        
        #mark PCR duplicates
        #Helper.status("Remove Duplicates", self.rnaEdit.logFile,self.rnaEdit.textField)
        markedFile=self.rnaEdit.params.output+".noDup.bam"
        cmd=["java","-Xmx16G","-jar",self.rnaEdit.params.sourceDir + "picard-tools/MarkDuplicates.jar","INPUT=" + bamFile, "OUTPUT=" + markedFile, "METRICS_FILE="+self.rnaEdit.params.output+".pcr.metrics", "VALIDATION_STRINGENCY=LENIENT", "CREATE_INDEX=true"]
        Helper.proceedCommand("Remove PCR duplicates", cmd, bamFile, markedFile, self.rnaEdit)
        
        
        """if self.rnaEdit.params.paired == False:
            pysam.rmdup("-s",bamFile,markedFile)
        else:
            pysam.rmdup(bamFile,markedFile)

        #pysam.rmdup(bamFile,markedFile)
        if self.rnaEdit.params.paired == False:
            cmd = [self.rnaEdit.params.sourceDir + "samtools", "rmdup", "-s", bamFile, markedFile]
        else:
            cmd = [self.rnaEdit.params.sourceDir + "samtools", "rmdup", bamFile, markedFile]
        Helper.proceedCommand("Index Bam File", cmd, bamFile, markedFile, self.rnaEdit)
        
        
        Helper.status("index Bam", self.rnaEdit.logFile,self.rnaEdit.textField)
        pysam.index(markedFile)
        
        cmd = [self.rnaEdit.params.sourceDir + "samtools", "index", bamFile]
        Helper.proceedCommand("Index Bam File", cmd, bamFile, markedFile+".bai", self.rnaEdit)
        #return bamFile"""
        
        
        #run Alignement with tophat
        """
        bamFile=self.rnaEdit.params.output+"/accepted_hits.bam"
        cmd=[self.rnaEdit.params.sourceDir + "tophat/tophat2", "--no-coverage-search","--keep-fasta-order", "-p", "12", "--rg-id", "A","--rg-sample","A","--rg-library","illumina","--rg-platform-unit","HiSeq", "-o", self.rnaEdit.params.output, self.rnaEdit.params.refGenome, self.fastqFile ]
        print cmd
        Helper.proceedCommand("Map reads with tophat", cmd, self.rnaEdit.params.fastqFile, bamFile, self.rnaEdit.)
        """
#.........这里部分代码省略.........
开发者ID:djhn75,项目名称:RNAEditor,代码行数:103,代码来源:MapFastq.py


注:本文中的Helper.Helper.proceedCommand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。