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


Python Fasta.seqs方法代码示例

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


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

示例1: info2seeds

# 需要导入模块: from TAMO.seq import Fasta [as 别名]
# 或者: from TAMO.seq.Fasta import seqs [as 别名]
def info2seeds(N,infofile,probefile,species='YEAST'):
    G    = ProbeSet(species)
    IDs  = G.ids_from_file(probefile)
    Q    = EM.theMarkovBackground.zeroth()
 
    seqs = Fasta.seqs(infofile)
    
    if not N:
        nmers = seqs
    else:
        nmers= MotifTools.top_nmers(N,seqs)
        if len(nmers) > 1000: nmers = nmers[0:1000]
        
    print "Scoring enrichment of %d nmers from %s"%len(nmers,infofile)
    sys.stdout.flush()
    
    nmers_scoresT = []
    for nmer in nmers:
        if nmer.isalpha():
            p = G.p_value(nmer,IDs,'') #'verbose'
            nmers_scoresT.append((nmer,p))
    nmers_scoresT.sort(lambda x,y: cmp(x[1],y[1]))
    last = min(20,len(nmers_scoresT))
    models = []
    for i in range(last):
        seq = nmers_scoresT[i][0]
        m = MotifTools.Motif('',Q)
        m.compute_from_text(seq,0.1)
        models.append(m)
    for tup in nmers_scoresT[0:40]:
        print tup
    return(models)
开发者ID:adamlabadorf,项目名称:TAMO,代码行数:34,代码来源:TAMO_EM.py

示例2: __init__

# 需要导入模块: from TAMO.seq import Fasta [as 别名]
# 或者: from TAMO.seq.Fasta import seqs [as 别名]
 def __init__(self,species='YEAST',seqs=''):
     if  seqs:
         self.sourcefile = 'Runtime (%d sequences)'%len(seqs)
     elif  species.find('.6MBG') >= 0:
         self.sourcefile = species
     elif species[0:5] == 'YEAST':
         self.sourcefile = TAMO.paths.Whiteheaddir+'Yeast6kArray/yeast.intergenic.6.freq'
         TAMO.paths.CHECK(self.sourcefile,'Whitehead')
     elif species[0:5] == 'HUMAN':
         self.sourcefile = TAMO.paths.Whiteheaddir+'Human13kArray/human_elongated_probbesQC250.6MBG'
         TAMO.paths.CHECK(self.sourcefile,'Whitehead')
     elif os.path.exists(re.sub('.fsa|.fasta','.6MBG',species)):
         self.sourcefile = re.sub('.fsa|.fasta','.6MBG',species)
     elif os.path.exists(species) and (species.find('.fsa') >=0):
         self.sourcefile = species
         print "EM.MarkovBackground: Computing background from %s"%species
         sys.stdout.flush()
         self.freqs_from_seqs(Fasta.seqs(species))
     #elif os.path.exists(species):
     #    self.sourcefile = species
     else:
         print 'EM.MarkovBackground: Unknown species %s, using Yeast'
         self.sourcefile = TAMO.paths.Whiteheaddir+'Yeast6kArray/yeast.intergenic.6.freq'
         TAMO.paths.CHECK(self.sourcefile,'Whitehead')
     self.species = species
     self.D  = {}
     self.F  = {}         #Frequencies
     self.CP = {}         #log2(Conditional Probabilities)  CP['ACTG'] = p( G | ACT ) 
     self.nmers_by_size = map(lambda x:[],range(0,10))
     self.highestorder = 0
     if seqs:
         print "EM.MarkovBackground: Computing background from %d sequences"%len(seqs)
         self.freq_from_seqs(seqs)
     else:
         self.freq_from_file()
     self.compute_conditional()
     self.totD = {}
开发者ID:adamlabadorf,项目名称:TAMO,代码行数:39,代码来源:EM.py

示例3: range

# 需要导入模块: from TAMO.seq import Fasta [as 别名]
# 或者: from TAMO.seq.Fasta import seqs [as 别名]
from TAMO import MotifTools 
from TAMO.seq import Fasta 
from TAMO import MotifMetrics
from TAMO.MD.AlignAce import AlignAce 
from TAMO.MD.MDscan import MDscan 
from TAMO.MD.Meme import Meme 
from TAMO import Clustering
#from TAMO.DataSources import GO
from time import time

TC8_path = '/Users/biggus/Documents/James/Data/ClusterDefs/TC-Fastas/TC-8.fas'
TC8_ids  = Fasta.ids(TC8_path)
TC8_seqs = Fasta.seqs(TC8_path)
allSeqs  = MotifMetrics.ProbeSet('/Users/biggus/Documents/James/Data/2KB/2kb_Sequence/2kb_Anopheles/2KBupTSS_goodAffyAGAPsFastasOUT.masked.nr.fas')

outFile  = '/Users/biggus/Documents/James/Data/ClusterDefs/TC-8_MotifMetrics.5-12.txt'

roughBestKmers = []

for i in range(6,10):
    imers = MotifMetrics.top_nmers_seqs(i,TC8_seqs)
    roughBestKmers.extend(imers)
    print '%s %smers found.' % (len(imers), i)
    
kmerMetrics = ['Kmer\thGeoPval\tBinomOverRep\n']
    
for kmer in roughBestKmers:
    hGeoPval = allSeqs.Enrichment(kmer, TC8_ids)
    binom   = allSeqs.overrep(kmer,TC8_ids)
    kmerMetrics.append('%s\t%s\t%s\n' % (kmer,hGeoPval,binom))
    
开发者ID:xguse,项目名称:gusPyProj,代码行数:32,代码来源:runningMotifMetrics.py


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