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


Python Helper.error方法代码示例

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


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

示例1: topGenes

# 需要导入模块: from Helper import Helper [as 别名]
# 或者: from Helper.Helper import error [as 别名]
    def topGenes(self,sumDict, fileName,number=20,value=4):
        if number > len(sumDict):
            if len(sumDict)<1:
                Helper.warning("no edited genes found", self.logFile, self.textField)
                return
            Helper.warning("The number of top genes you wanted is bigger than the number of edited genes", self.logFile, self.textField)
            number=len(sumDict)
        if value > 4:
            Helper.error("sumDict only hold four values", self.logFile, self.textField)
        
        
        counts=collections.OrderedDict(sorted(sumDict.items(), key=lambda t: t[1][value],reverse=True)[:number])
        barNameTuple=()
        valueMatrix=[[]]
        for array in counts.values():
            valueMatrix[0].append(array[value])
        for gene in counts.keys():
            barNameTuple+=(gene.names[0],)

        if value==0:
            barName="3'-UTR"
        elif value==1:
            barName="5'-UTR"
        elif value==2:
            barName="Exonic"
        elif value==3:
            barName="Intronic"
        elif value==4:
            barName="Total"
        
        yLim=max(max(i) for i in valueMatrix)+1
        Helper.createBarplot(valueMatrix, fileName, barNameTuple, [barName], width=0.35, title="Highly Edited Genes",yLim=yLim,barText=False,yText="Editing Counts")
开发者ID:djhn75,项目名称:RNAEditor,代码行数:34,代码来源:VariantSet.py

示例2: startAnalysis

# 需要导入模块: from Helper import Helper [as 别名]
# 或者: from Helper.Helper import error [as 别名]
    def startAnalysis(self):
        """
        START MAPPING
        """
        if self.fastqFiles[0].endswith("bam"):
            if self.fastqFiles[0].endswith("noDup.realigned.recalibrated.bam"):
                Helper.info("Bam File given. Skip mapping", self.logFile, self.textField)
                self.mapFastQ=None
                mapResultFile=self.fastqFiles[0]
            else: 
                Helper.error("Bam File was not mapped with RnaEditor, this is not supported. Please provide the fastq Files to RnaEditor", self.logFile, self.textField, "red")
        else:
            self.mapFastQ=MapFastq(self)
            mapResultFile=self.mapFastQ.startAnalysis()

        """
        START CALLING EDITING SITES
        """
        self.callEditSites=CallEditingSites(mapResultFile,self)
        result = self.callEditSites.startAnalysis()
        
        
        
        #finished
        self.isTerminated=True
        
        
        
        Helper.status("rnaEditor Finished with %s" % self.params.output, self.logFile, self.textField,"green",True)
        Helper.status("Open %s to see the results" % self.params.output+".html", self.logFile, self.textField,"green",True)
        self.cleanUp()
开发者ID:djhn75,项目名称:RNAEditor,代码行数:33,代码来源:RNAEditor.py

示例3: newAssay

# 需要导入模块: from Helper import Helper [as 别名]
# 或者: from Helper.Helper import error [as 别名]
    def newAssay(self):
        '''
        Function wich starts a new analysis
        '''
        
        inputTab = self.view.tabMainWindow.widget(0)
        
        #get Parameters 
        parameters=Parameters(inputTab)
        if parameters.paired==True:
            #fastqs=inputTab.dropList.dropFirstTwoItems()
            fastqs = inputTab.dropList.dropFirstItem()
            if fastqs[0]!=None:
                if not str(fastqs[0].text()).endswith(".bam"):
                    fastqs+=inputTab.dropList.dropFirstItem()
        else:
            fastqs = inputTab.dropList.dropFirstItem()        
        
        """
        check if droplist returned a value
        """
        if parameters.paired==True:
            if fastqs[-1] == None:
                QtGui.QMessageBox.information(self.view,"Warning","Warning:\nNot enough Sequencing Files for paired-end sequencing!!!\n\nDrop FASTQ-Files to the drop area!")
                return
        if fastqs[0] == None:
            QtGui.QMessageBox.information(self.view,"Warning","Warning:\nNo Sequencing Files found!!!\n\nDrop FASTQ-Files to the drop area!")
            return
        sampleName = Helper.getSampleName(str(fastqs[0].text()))
        if sampleName == None:
            QtGui.QMessageBox.information(self.view,"Warning","Warning:\nNo valid Sequencing File!!!\n\nDrop FASTQ-Files to the drop area!")
            return
        
        fastqFiles=[]
        for fastq in fastqs:
            fastqFiles.append(str(fastq.text()))

        
        
        runTab = RunTab(self)

        
        
        #initialize new Thread with new assay
        try:
            assay = RnaEdit(fastqFiles, parameters,runTab.commandBox)
        except Exception as err:
            QtGui.QMessageBox.information(self.view,"Error", str(err)+"Cannot start Analysis!")
            Helper.error(str(err) + "\n creating rnaEditor Object Failed!", textField=runTab.commandBox)
        currentIndex = self.view.tabMainWindow.count()

        # self.view.tabMainWindow.addTab(self.runTab, "Analysis"+ str(Helper.assayCount))
        self.view.tabMainWindow.addTab(runTab, sampleName + " " + str(currentIndex))
        Helper.runningThreads.append(assay)
        
        assay.start()
        
        self.view.connect(assay, QtCore.SIGNAL("taskDone"), self.openAnalysis)
开发者ID:djhn75,项目名称:RNAEditor,代码行数:60,代码来源:GuiControll.py

示例4: run

# 需要导入模块: from Helper import Helper [as 别名]
# 或者: from Helper.Helper import error [as 别名]
 def run(self):
     try:
         self.startAnalysis()
     except Exception:
         Helper.error("RnaEditor Failed",self.logFile,self.textField)
     
     """ At this point the RnaEditor has succesfully finished """
     fileDir = os.path.dirname(os.path.realpath(__file__))
     cmd=["python",fileDir+"/createDiagrams.py","-o", self.params.output]
     a=subprocess.call(cmd)
     self.emit(QtCore.SIGNAL("taskDone"), self.params.output+".html")
开发者ID:djhn75,项目名称:RNAEditor,代码行数:13,代码来源:RNAEditor.py

示例5: stopImmediately

# 需要导入模块: from Helper import Helper [as 别名]
# 或者: from Helper.Helper import error [as 别名]
 def stopImmediately(self):
     if hasattr(self, 'callEditSites'):
         self.callEditSites.cleanUp()
     self.isTerminated=True
     
     if self.runningCommand != False:
         self.runningCommand.kill()
     else:
         self.terminate()
         self.wait()
     Helper.error("Analysis was terminated by User", self.logFile, self.textField)
开发者ID:djhn75,项目名称:RNAEditor,代码行数:13,代码来源:RNAEditor.py

示例6: __init__

# 需要导入模块: from Helper import Helper [as 别名]
# 或者: from Helper.Helper import error [as 别名]
    def __init__(self, fastqFiles, params, textField):
        QtCore.QThread.__init__(self)
        if isinstance(params, Parameters):
            self.params = params
        else:
            Helper.error("Params has to be Instance of Parameters")
        if isinstance(textField, QtGui.QTextEdit) or textField==0:
            self.textField=textField
        else:
            Helper.error("textField has to be Instance of QtGui.QTextEdit or 0")
        

        self.fastqFiles=fastqFiles
        
        #hold the running Popen object
        self.runningCommand=False
        self.isTerminated = False
        #check if the input Files are there
        
        #hold basic statistic values of the run
        basicStatDict={}
            
        
        #set directory where the outputFiles should be written to
        if self.params.output=="default":
            if self.fastqFiles[0].endswith("noDup.realigned.recalibrated.bam"):
                self.sampleName=fastqFiles[0][fastqFiles[0].rfind("/")+1:fastqFiles[0].rfind(".noDup.realigned.recalibrated.bam")]
                self.outdir=fastqFiles[0][0:fastqFiles[0].rfind("/")+1]
            else:
                self.sampleName=fastqFiles[0][fastqFiles[0].rfind("/")+1:fastqFiles[0].rfind(".")]
                # outdir = /path/to/output/rnaEditor/samplename/
                self.outdir=fastqFiles[0][0:fastqFiles[0].rfind("/")+1]+"rnaEditor/"+self.sampleName+"/"
            
            #output=/path/to/output/rnaEditor/samplename/samplename
            self.params.output=self.outdir+self.sampleName
            if not os.path.exists(self.outdir):
                os.makedirs(self.outdir, mode=0755)
                os.chmod(self.outdir, 0755)

            #create folder for html output
            if not os.path.exists(self.outdir+"/html"):
                os.makedirs(self.outdir+"/html", mode=0755)
                os.chmod(self.outdir, 0755)
        
        
        self.checkDependencies()
        
        #check if the input Files are there
        self.printParameters()
开发者ID:djhn75,项目名称:RNAEditor,代码行数:51,代码来源:RNAEditor.py

示例7: cleanUp

# 需要导入模块: from Helper import Helper [as 别名]
# 或者: from Helper.Helper import error [as 别名]
    def cleanUp(self):
        #print "deleteAssay " + str(self)
        if self.runningCommand != False:
            self.runningCommand.kill()
 
        try:
            if self.mapFastQ!=None:
                self.mapFastQ.cleanUp()
            del self.mapFastQ
        except AttributeError:
            Helper.error("could not delete MapFastQ instance", self.logFile, self.textField)
        try:
            self.callEditSites.cleanUp()
            del self.callEditSites
        except AttributeError:
            Helper.error("could not delete RnaEdit instance", self.logFile, self.textField)
开发者ID:djhn75,项目名称:RNAEditor,代码行数:18,代码来源:RNAEditor.py

示例8: topGenes

# 需要导入模块: from Helper import Helper [as 别名]
# 或者: from Helper.Helper import error [as 别名]
def topGenes(sumDict, fileName,number=20,value=5, logFile=None,textField=0):
        if number > len(sumDict):
            if len(sumDict)<1:
                Helper.warning("no edited genes found", logFile, textField)
                return
            Helper.warning("The given gene number is bigger than the number of total edited genes", logFile, textField)
            number=len(sumDict)
        if value not in (1,2,3,4,5):
            Helper.error("sumDict hast to be between 1 an 5", logFile, textField)
        
        
        counts=OrderedDict(sorted(sumDict.items(), key=lambda t: t[1][value],reverse=True)[:number])
        barNameTuple=()
        valueMatrix=[[]]
        for array in counts.values():
            valueMatrix[0].append(array[value])
        for gene in counts.keys():
            barNameTuple+=(counts[gene][0],)

        if value==1:
            barName="3'-UTR"
        elif value  ==2:
            barName="5'-UTR"
        elif value==3:
            barName="Exonic"
        elif value==4:
            barName="Intronic"
        elif value==5:
            barName="Total"
        
        yLim=max(max(i) for i in valueMatrix)+1
        Helper.createBarplot(valueMatrix, fileName, barNameTuple, [barName], width=0.35, title="Highly Edited Genes",yLim=yLim,barText=False,yText="Editing Counts")
        
        
        file= open(fileName.replace("png","txt"),"w")
        file.write("\t".join(["Gene_Symbol","Number_of_editing_sites"])+"\n")
        htmlStr="<table class='geneTable'><tr><th>GeneName</th><th>Number of editing sites</th></tr>"
        for gene in counts:
            htmlStr+="<tr><td>%s</td><td>%s</td></tr>"%(counts[gene][0],counts[gene][value])
            geneName=counts[gene][0]
            numbers=str(counts[gene][value])
            file.write("\t".join([geneName,numbers]) +"\n")
        htmlStr+="</table>"
        return htmlStr
开发者ID:djhn75,项目名称:RNAEditor,代码行数:46,代码来源:createDiagrams.py

示例9: checkDependencies

# 需要导入模块: from Helper import Helper [as 别名]
# 或者: from Helper.Helper import error [as 别名]
def checkDependencies(args):
    '''
    Checks the existence of the necessary packages and tools
    :param sourceDir: folder which contains all the software
    '''
    Helper.newline(1)
    Helper.info("CHECK DEPENDENCIES")
    
    #check if all tools are there
    if not os.path.isfile(args.sourceDir+"bwa"):
        Helper.error("BWA not found in %s" % args.sourceDir)
    if not os.path.isfile(args.sourceDir+"picard-tools/SortSam.jar"):
        Helper.error("SortSam.jar not found in %s" % args.sourceDir+"picard-tools")
    if not os.path.isfile(args.sourceDir+"picard-tools/MarkDuplicates.jar"):
        Helper.error("MarkDuplicates.jar not found in %s" % args.sourceDir+"picard-tools")
    if not os.path.isfile(args.sourceDir+"GATK/GenomeAnalysisTK.jar"):
        Helper.error("GenomeAnalysisTK.jar not found in %s" % args.sourceDir+"GATK/")
    if not os.path.isfile(args.sourceDir+"samtools"):
        Helper.error("samtools not found in %s" % args.sourceDir)
    if not os.system("java -version")==0:
        Helper.error("Java could not be found, Please install java")
    
    #check if all files are there
    if not os.path.isfile(args.RefGenome):
        Helper.error("Could not find Reference Genome in %s: " % args.RefGenome)
    # Files for BWA
    if not os.path.isfile(args.RefGenome+".amb"):
        Helper.error("Could not find %s.amb" % args.RefGenome)
        Helper.error("run: 'bwa index %s' to create it" % args.RefGenome)
    if not os.path.isfile(args.RefGenome+".ann"):
        Helper.error("Could not find %s.ann" % args.RefGenome)
        Helper.error("run: 'bwa index %s' to create it" % args.RefGenome)
    if not os.path.isfile(args.RefGenome+".bwt"):
        Helper.error("Could not find %s.bwt" % args.RefGenome)
        Helper.error("run: 'bwa index %s' to create it" % args.RefGenome)
    if not os.path.isfile(args.RefGenome+".pac"):
        Helper.error("Could not find %s.pac" % args.RefGenome)
        Helper.error("run: 'bwa index %s' to create it" % args.RefGenome)
    if not os.path.isfile(args.RefGenome+".sa"):
        Helper.error("Could not find %s.sa" % args.RefGenome)
        Helper.error("run: 'bwa index %s' to create it" % args.RefGenome)
    
    #Files for GATK
    if not os.path.isfile(args.RefGenome.replace(".fastq",".dict")):
        Helper.error("Could not find %s" % args.RefGenome.replace(".fastq",".dict"))
        Helper.error("run: 'java -jar %s/picard-tools/CreateSequenceDictionary.jar R=%s  O= %s.dict' to create it" % (args.sourceDir,args.RefGenome,args.RefGenome.replace(".fastq",".dict")))
    if not os.path.isfile(args.RefGenome+".fai"):
        Helper.error("Could not find %s.fai" % args.RefGenome)
        Helper.error("run: 'samtools faidx %s' to create it" % args.RefGenome)

    #SNP databases
    if not os.path.isfile(args.dbsnp):
        Helper.error("Could not find %s: " % args.dbsnp)
开发者ID:djhn75,项目名称:RNAEditor,代码行数:55,代码来源:MapFastq.py

示例10: checkDependencies

# 需要导入模块: from Helper import Helper [as 别名]
# 或者: from Helper.Helper import error [as 别名]
    def checkDependencies(self):
        """checks if all files are there
        if all programs are installed properly and if the output directory is writable"""
        try:
            self.logFile=open(self.params.output + ".log","w+")
        except IOError:
            Helper.error("Cannot open Log File", textField=self.textField)

        if type(self.fastqFiles) == list:
            self.fastqFiles=self.fastqFiles
        elif type(self.fastqFile) == str:
            self.fastqFiles=[self.fastqFiles]
        else:
            Helper.error("FastQ File has wrong variable type",self.logFile,self.textField)
        
        for file in self.fastqFiles:
            if not os.path.isfile(file):
                Helper.error("Could not find: %s" %file,self.logFile,self.textField)
            
        '''
        Checks the existence of the necessary packages and tools
        :param sourceDir: folder which contains all the software
        '''
        Helper.newline(1)
        Helper.info("CHECK DEPENDENCIES",self.logFile,self.textField)
        
        #check if all tools are there
        if not os.path.isfile(self.params.sourceDir+"bwa"):
            Helper.error("BWA not found in %s" % self.params.sourceDir,self.logFile,self.textField)
        if not os.path.isfile(self.params.sourceDir+"picard-tools/SortSam.jar"):
            Helper.error("SortSam.jar not found in %s" % self.params.sourceDir+"picard-tools",self.logFile,self.textField)
        if not os.path.isfile(self.params.sourceDir+"picard-tools/MarkDuplicates.jar"):
            Helper.error("MarkDuplicates.jar not found in %s" % self.params.sourceDir+"picard-tools",self.logFile,self.textField)
        if not os.path.isfile(self.params.sourceDir+"GATK/GenomeAnalysisTK.jar"):
            Helper.error("GenomeAnalysisTK.jar not found in %s" % self.params.sourceDir+"GATK/",self.logFile,self.textField)
        if not os.path.isfile(self.params.sourceDir+"blat"):
            Helper.error("blat not found in %s" % self.params.sourceDir,self.logFile,self.textField)
        if not os.path.isfile(self.params.sourceDir+"samtools"):
            Helper.error("samtools not found in %s" % self.params.sourceDir,self.logFile,self.textField)
        if not os.system("java -version")==0:
            Helper.error("Java could not be found, Please install java",self.logFile,self.textField)
        
        
        
        #check if all files are there
        if not os.path.isfile(self.params.refGenome):
            Helper.error("Could not find Reference Genome in %s: " % self.params.refGenome,self.logFile,self.textField)
        
        # Files for BWA
        if not os.path.isfile(self.params.refGenome+".amb"):
            Helper.warning("Could not find %s.amb" % self.params.refGenome,self.logFile,self.textField)
            Helper.error("run: 'bwa index %s' to create it" % self.params.refGenome,self.logFile,self.textField)
        if not os.path.isfile(self.params.refGenome+".ann"):
            Helper.warning("Could not find %s.ann" % self.params.refGenome,self.logFile,self.textField)
            Helper.error("run: 'bwa index %s' to create it" % self.params.refGenome,self.logFile,self.textField)
        if not os.path.isfile(self.params.refGenome+".bwt"):
            Helper.warning("Could not find %s.bwt" % self.params.refGenome,self.logFile,self.textField)
            Helper.error("run: 'bwa index %s' to create it" % self.params.refGenome,self.logFile,self.textField)
        if not os.path.isfile(self.params.refGenome+".pac"):
            Helper.warning("Could not find %s.pac" % self.params.refGenome,self.logFile,self.textField)
            Helper.error("run: 'bwa index %s' to create it" % self.params.refGenome,self.logFile,self.textField)
        if not os.path.isfile(self.params.refGenome+".sa"):
            Helper.warning("Could not find %s.sa" % self.params.refGenome,self.logFile,self.textField)
            Helper.error("run: 'bwa index %s' to create it" % self.params.refGenome,self.logFile,self.textField)

        
        #Files for GATK
        
        
        if self.params.refGenome.endswith("fasta"):
            if not os.path.isfile(self.params.refGenome.replace(".fasta",".dict")):
                Helper.warning("Could not find %s" % self.params.refGenome.replace(".fasta",".dict"),self.logFile,self.textField)
                Helper.error("run: 'java -jar %spicard-tools/CreateSequenceDictionary.jar R=%s  O= %s' to create it" % (self.params.sourceDir,self.params.refGenome,self.params.refGenome.replace(".fastq",".dict")),self.logFile,self.textField)
        elif self.params.refGenome.endswith("fa"):
            if not os.path.isfile(self.params.refGenome.replace(".fa",".dict")):
                Helper.warning("Could not find %s" % self.params.refGenome.replace(".fa",".dict"),self.logFile,self.textField)
                Helper.error("run: 'java -jar %spicard-tools/CreateSequenceDictionary.jar R=%s  O= %s' to create it" % (self.params.sourceDir,self.params.refGenome,self.params.refGenome.replace(".fa",".dict")),self.logFile,self.textField)
        else:
            Helper.error("RefGenome has wrong suffix. Either '.fa' or '.fasta'")
        if not os.path.isfile(self.params.refGenome+".fai"):
            Helper.warning("Could not find %s.sai" % self.params.refGenome,self.logFile,self.textField)
            Helper.error("run: 'samtools faidx %s' to create it" % self.params.refGenome,self.logFile,self.textField)
    
        #SNP databases
        if not os.path.isfile(self.params.dbsnp):
            Helper.error("Could not find dbSNP database %s: " % self.params.dbsnp,self.logFile,self.textField)
        if not os.path.isfile(self.params.hapmap) and self.params.hapmap != "None":
            Helper.error("Could not find Hapmap database %s: " % self.params.hapmap,self.logFile,self.textField)
        if not os.path.isfile(self.params.omni) and self.params.omni != "None":
            Helper.error("Could not find Omni database %s: " % self.params.omni,self.logFile,self.textField)
        if not os.path.isfile(self.params.esp) and self.params.esp != "None":
            Helper.error("Could not find 1000G database %s: " % self.params.esp,self.logFile,self.textField)
            
        #region Files
        if not os.path.isfile(self.params.aluRegions):
            Helper.error("Could not find %s: " % self.params.aluRegions,self.logFile,self.textField)
            
        if not os.path.isfile(self.params.gtfFile):
            Helper.error("Could not find %s: " % self.params.gtfFile,self.logFile,self.textField)

#.........这里部分代码省略.........
开发者ID:djhn75,项目名称:RNAEditor,代码行数:103,代码来源:RNAEditor.py


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