本文整理汇总了Python中TAMO.seq.Fasta.keys方法的典型用法代码示例。如果您正苦于以下问题:Python Fasta.keys方法的具体用法?Python Fasta.keys怎么用?Python Fasta.keys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TAMO.seq.Fasta
的用法示例。
在下文中一共展示了Fasta.keys方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: swp2swp
# 需要导入模块: from TAMO.seq import Fasta [as 别名]
# 或者: from TAMO.seq.Fasta import keys [as 别名]
def swp2swp(swp):
'Converts, when possible, from P014543 to ADR1_YEAST'
'Only works for yeast right now'
global _swp2swp
if not _swp2swp:
lines = Fasta.keys(_SWPFASTA,key_func=lambda x:x)
for line in lines:
toks = line.split()
text_name = toks[1]
numeric_name = toks[2]
if text_name[0:2] == 'SW' and numeric_name[0] == 'P':
_swp2swp[text_name[3:]] = numeric_name
_swp2swp[numeric_name] = text_name[3:]
if _swp2swp.has_key(swp):
return _swp2swp[swp]
示例2: main
# 需要导入模块: from TAMO.seq import Fasta [as 别名]
# 或者: from TAMO.seq.Fasta import keys [as 别名]
def main():
short_opts = 'f:'
long_opts = ['genome=', 'range=', 'top=', 'pcnt=', 'bgfile=']
try: opts, args = getopt.getopt(sys.argv[1:], short_opts, long_opts)
except getopt.GetoptError:
print getopt.GetoptError.__dict__
usage()
if not opts: usage()
fastafile = ''
top_count = 10
top_pcnt = None
genome = 'YEAST'
w_start = 8
w_stop = 15
bgfile = MDSCAN_DIR + 'yeast_int.bg'
for opt,value in opts:
if opt == '-f': fastafile = value
if opt == '--genome': genome = value
if opt == '--top': top_count = int(value)
if opt == '--pcnt': top_pcnt = float(value)
if opt == '--range': w_start,w_stop= [int(x) for x in value.split(',')]
print "#" + ' '.join(sys.argv)
probeids = Fasta.keys(fastafile)
Genome = MotifMetrics.ProbeSet(genome)
probeids = Genome.filter(probeids)
if top_pcnt: top_count = max(top_count,int(top_pcnt/100.0 * len(probeids)))
theMeta = metaMDscan(fastafile,w_start,w_stop,top_count)
for m in theMeta.motifs:
m.pvalue = Genome.p_value(m,probeids,'v')
m.church = Genome.church(m,probeids,'v')
sys.stdout.flush()
theMeta.motifs.sort(lambda x,y: cmp(x.pvalue,y.pvalue))
print_motifs(theMeta.motifs)