本文整理汇总了Python中CGAT.FastaIterator.count方法的典型用法代码示例。如果您正苦于以下问题:Python FastaIterator.count方法的具体用法?Python FastaIterator.count怎么用?Python FastaIterator.count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGAT.FastaIterator
的用法示例。
在下文中一共展示了FastaIterator.count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: runMEMEOnSequences
# 需要导入模块: from CGAT import FastaIterator [as 别名]
# 或者: from CGAT.FastaIterator import count [as 别名]
def runMEMEOnSequences(infile, outfile):
'''run MEME to find motifs.
In order to increase the signal/noise ratio,
MEME is not run on all intervals but only the
top 10% of intervals (peakval) are used.
Also, only the segment of 200 bp around the peak
is used and not the complete interval.
* Softmasked sequence is converted to hardmasked
sequence to avoid the detection of spurious motifs.
* Sequence is run through dustmasker
'''
to_cluster = True
# job_options = "-l mem_free=8000M"
nseqs = int(FastaIterator.count(infile))
if nseqs == 0:
E.warn("%s: no sequences - meme skipped" % outfile)
P.touch(outfile)
return
target_path = os.path.join(
os.path.abspath(PARAMS["exportdir"]), "meme", outfile)
tmpdir = P.getTempDir(".")
statement = '''
meme %(infile)s -dna -revcomp
-mod %(meme_model)s
-nmotifs %(meme_nmotifs)s
-oc %(tmpdir)s
-maxsize %(motifs_max_size)s
%(meme_options)s
> %(outfile)s.log
'''
P.run()
collectMEMEResults(tmpdir, target_path, outfile)
示例2: subsampleNReadsFromFasta
# 需要导入模块: from CGAT import FastaIterator [as 别名]
# 或者: from CGAT.FastaIterator import count [as 别名]
def subsampleNReadsFromFasta(infile, outfile, nreads, logfile=""):
checkParams()
nseqs = FastaIterator.count(infile)
if nreads > nseqs:
prop = 1
else:
prop = float(nreads)/float(nseqs)
if logfile:
logfile = "-L %s" % logfile
statement = ''' python %(scriptsdir)s/fasta2fasta.py
-I %(infile)s
%(logfile)s
-m sample
--sample-proportion=%(prop)s
-S %(outfile)s '''
P.run()