本文整理汇总了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()
示例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
示例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()
示例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")
示例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