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


Python Helper.status方法代码示例

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


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

示例1: startAnalysis

# 需要导入模块: from Helper import Helper [as 别名]
# 或者: from Helper.Helper import status [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

示例2: fillDicts

# 需要导入模块: from Helper import Helper [as 别名]
# 或者: from Helper.Helper import status [as 别名]
def fillDicts(files,columns,keys):
    '''
        creates the table and fills the set of keys
    '''
    fileNumber=len(files)
    fileCounter=0
    keySet=()
    fileCounter=0
    for file in files: #loop through all files
        i=0
        Helper.info("Get information from %s" % file)
        file = open(file)
        
        for line in file: #loop through current file
            line = line.split()
            keyTuple=()
            for k in keys:
                keyTuple=keyTuple+(line[k-1],)
            
            value=[]
            for column in columns: #get the needed values
                try:
                    value.append(line[column-1])
                except IndexError:
                    raise ValueError("Not enough rows in line: %s in file %s" % (" ".join(line),file.name))
            
            if keyTuple in keySet:
                #currentDefaultList=idDict[keyTuple]
                #currentDefaultList[fileCounter]=value
                #idDict[keyTuple]=currentDefaultList
                idDict[keyTuple][fileCounter]=value #replace filecounter List with values from current File
            else:
                currentDefaultList=[["--"]*len(columns)]*len(files) #create default list, with all values empty
                currentDefaultList[fileCounter]=value
                idDict[keyTuple]=currentDefaultList
                keySet=keySet+(keyTuple,)
            
            i+=1
            if i % 1000 == 0:
                Helper.status("%s lines parsed" % i)
        fileCounter+=1
    return idDict,keySet
开发者ID:djhn75,项目名称:RNAEditor,代码行数:44,代码来源:recountReads.py

示例3: removeEdgeMismatches

# 需要导入模块: from Helper import Helper [as 别名]
# 或者: from Helper.Helper import status [as 别名]
 def removeEdgeMismatches(self,bamFile,minDistance, minBaseQual):
     startTime=Helper.getTime()
     minDistance=int(minDistance)
     counter=0;j=0  
     num_lines = len(self.variantDict)
     Helper.info(" [%s] remove Missmatches from the first %s bp from read edges" % (startTime.strftime("%c"),str(minDistance)),self.logFile,self.textField)
     
     bamFile = Samfile(bamFile, "rb")
     
     for varKey in self.variantDict.keys():
         variant = self.variantDict[varKey]
         
         counter+=1
         if counter%10000==0:
             Helper.status('%s mm parsed ' % counter ,self.logFile, self.textField,"grey")
         
         keepSNP=False
         varPos=variant.position-1
         iter = bamFile.pileup(variant.chromosome, variant.position-1, variant.position)
         #walks up the region wich overlap this position
         for x in iter:
             if x.pos == varPos:
                 for pileupread in x.pileups: #walk through the single reads
                     if not pileupread.is_del and not pileupread.is_refskip:
                         distance=abs(pileupread.alignment.alen-pileupread.query_position) if pileupread.alignment.is_reverse else pileupread.query_position
                         if distance >= minDistance:
                             #check readBase and Base Quality
                             if pileupread.alignment.query_sequence[pileupread.query_position] == variant.alt and pileupread.alignment.query_qualities[pileupread.query_position]>=minBaseQual:
                             #if pileupread.alignment.query_sequence[pileupread.query_position] == variant.alt:
                                 keepSNP=True
                                 
         if keepSNP==False:
             j+=1
             del self.variantDict[varKey]
     
     Helper.status('%s of %svariants were deleted' % (j,num_lines), self.logFile, self.textField,"black") 
     Helper.printTimeDiff(startTime, self.logFile, self.textField)
     bamFile.close()
开发者ID:djhn75,项目名称:RNAEditor,代码行数:40,代码来源:VariantSet.py

示例4: getBaseCount

# 需要导入模块: from Helper import Helper [as 别名]
# 或者: from Helper.Helper import status [as 别名]
fileCounter=0
defaultList= ["--"]*len(args.columns)
for bamFile in args.bams:
    i=0
    #Helper.status("recounting Reads for %s" % bamFile)    
    Helper.info("recounting Reads from %s" % bamFile)
    samfile = pysam.AlignmentFile(bamFile, "rb")
    for keyTuple in keySet[1:]:
        i+=1
        '''check if basecount is unset for current condition''' 
        if idDict[keyTuple][fileCounter] == defaultList: 
            chr,startAnalysis = keyTuple[3],int(keyTuple[7])-1 #pysam is zero based        
            reads=samfile.fetch(chr, startAnalysis, startAnalysis+1)
            baseCount = getBaseCount(reads,startAnalysis)
            idDict[keyTuple][fileCounter] = baseCount
    if counter % 1000 == 0:
        Helper.status("%s out of %s editing sites finished" % (i,len(keySet)))
    
    fileCounter+=1
    
        
'''write the results to the output file'''
outFile = open(args.outFile,"w")     
deli="\t"*len(args.columns)
outFile.write("\t"*len(args.keys)+deli.join(header)+"\n")
for keyTuple in keySet:
    output=list(keyTuple)
    for v in idDict[keyTuple]:
        output=output+v
    outFile.write("\t".join(output)+"\n")
开发者ID:djhn75,项目名称:RNAEditor,代码行数:32,代码来源:recountReads.py

示例5: splitByBed

# 需要导入模块: from Helper import Helper [as 别名]
# 或者: from Helper.Helper import status [as 别名]
 def splitByBed(self,bedFile):
     '''
     returns overlaps and nonOverlaps from bed file features
     :param bedFile: as string or file
     :param getNonOverlaps: boolean
     '''
     
     if type(bedFile) == str:
         bedFile = open(bedFile)
     elif type(bedFile) != file:
         raise TypeError("bedFile has wrong type, need str or file, %s found" % type(bedFile))
     
     startTime=Helper.getTime()
     Helper.info("[%s] Split Variants by Bed File %s" %  (startTime.strftime("%c"),bedFile.name) ,self.logFile,self.textField)
     
     variantsByChromosome = self.getVariantListByChromosome() 
     overlapSet = set()
     i=0
     for line in bedFile:
         
         try:
             sl = line.split("\t") 
             #if "\t" in line else line.split(" ")
             chromosome,start,stop = sl[:3]
             start,stop=(int(start),int(stop))
         except ValueError:
             raise ValueError("Error in line '%s'" % line)
         
         for v in variantsByChromosome[chromosome]:
             if start < v.position < stop:
                 overlapSet.add((v.chromosome,v.position,v.ref,v.alt))
         i+=1
         if i %100000==0:
             Helper.status("%s Bed Feautes parsed" % i, self.logFile,self.textField,"grey")
     
     
     Helper.info("finished parsing Bed file", self.logFile,self.textField)
     Helper.printTimeDiff(startTime, self.logFile,self.textField)
            
     #nonOverlapSet = set(self.variantDict.keys()) - overlapSet #delete all accept the ones which are overlapping
     
     
     overlaps = {key: self.variantDict[key] for key in self.variantDict if key in overlapSet}
     
     Helper.info("finished creating overlaps", self.logFile,self.textField)
     Helper.printTimeDiff(startTime, self.logFile,self.textField)
     
     nonOverlaps = {key: self.variantDict[key] for key in self.variantDict if key not in overlapSet}
     
     """
     overlaps={}
     for variantTuple in overlapSet:
         #del self.variantDict[variantTuple]
         overlaps[variantTuple]=self.variantDict[variantTuple]
     
     nonOverlaps={}
     for variantTuple in nonOverlapSet:
         nonOverlaps[variantTuple]=self.variantDict
     """
     
     Helper.printTimeDiff(startTime, self.logFile,self.textField)
     return overlaps, nonOverlaps
开发者ID:djhn75,项目名称:RNAEditor,代码行数:64,代码来源:VariantSet.py


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