本文整理汇总了Python中screed.ScreedDB类的典型用法代码示例。如果您正苦于以下问题:Python ScreedDB类的具体用法?Python ScreedDB怎么用?Python ScreedDB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ScreedDB类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _ScreedSeqInfoDict_ByName
class _ScreedSeqInfoDict_ByName(object, UserDict.DictMixin):
"""seqInfoDict implementation that uses names to retrieve records."""
def __init__(self, filepath):
self.sdb = ScreedDB(filepath)
def __getitem__(self, k):
v = self.sdb[k]
return _ScreedSequenceInfo(k, v)
def keys(self):
return self.sdb.keys()
def itervalues(self):
i = 0
max_index = len(self.sdb)
while i < max_index:
v = self.sdb.loadRecordByIndex(i)
yield _ScreedSequenceInfo(v.name, v)
i += 1
def iteritems(self):
for v in self.itervalues():
yield v.record.name, v
示例2: __init__
def __init__(self):
# the 12 is the size of K which can be set here:
#self.ktable=khmer.new_ktable(12)
self.ktable=khmer.new_hashbits(self.theK,1e9,4)
#specify the files you want to load, they have to be screed files
names=('chr01.fsa','chr02.fsa','chr03.fsa','chr04.fsa','chr05.fsa','chr06.fsa','chr07.fsa',
'chr08.fsa','chr09.fsa','chr10.fsa','chr11.fsa','chr12.fsa','chr13.fsa','chr14.fsa','chr15.fsa','chr16.fsa')
for name in names:
self.fadb=ScreedDB(name)
print name
keys=self.fadb.keys()
for key in keys:
s=self.fadb[key]['sequence']
self.ktable.consume(str(s))
print "done consuming"
示例3: _ScreedSeqInfoDict_ByIndex
class _ScreedSeqInfoDict_ByIndex(object, UserDict.DictMixin):
"""seqInfoDict implementation that uses indices to retrieve records."""
def __init__(self, filepath):
self.sdb = ScreedDB(filepath)
def __getitem__(self, k):
n = int(k)
v = self.sdb.loadRecordByIndex(n)
return _ScreedSequenceInfo(k, v)
def keys(self):
return xrange(0, len(self.sdb))
def iterkeys(self):
i = 0
max_index = len(self.sdb)
while i < max_index:
yield i
i += 1
示例4: setup
def setup(self):
self.db = ScreedDB(tri + '_screed')
示例5: myFirstUI
class myFirstUI(Directory):
_q_exports = ['','firstkMer','kmerNeighborhood']
theK=17
def __init__(self):
# the 12 is the size of K which can be set here:
#self.ktable=khmer.new_ktable(12)
self.ktable=khmer.new_hashbits(self.theK,1e9,4)
#specify the files you want to load, they have to be screed files
names=('chr01.fsa','chr02.fsa','chr03.fsa','chr04.fsa','chr05.fsa','chr06.fsa','chr07.fsa',
'chr08.fsa','chr09.fsa','chr10.fsa','chr11.fsa','chr12.fsa','chr13.fsa','chr14.fsa','chr15.fsa','chr16.fsa')
for name in names:
self.fadb=ScreedDB(name)
print name
keys=self.fadb.keys()
for key in keys:
s=self.fadb[key]['sequence']
self.ktable.consume(str(s))
print "done consuming"
def _q_index(self):
return "kmer browser database"
def firstkMer(self):
i=0
while self.ktable.get(i)==0:
i+=1
return self.ktable.reverse_hash(i)
def addAllKmers(self,currentKmer,depth,maxDepth):
if depth<maxDepth:
L=['A','C','G','T']
rawStringLead=currentKmer[0:(self.theK-1)]
rawStringTrail=currentKmer[1:self.theK]
for l in L:
s=rawStringTrail+l
if self.ktable.get(s)!=0:
self.lines[currentKmer+' '+s]=1
if not s in self.liste:
self.liste[s]=depth+1
self.addAllKmers(s,depth+1,maxDepth)
s=l+rawStringLead
if self.ktable.get(s)!=0:
self.lines[currentKmer+' '+s]=1
if not s in self.liste:
self.liste[s]=depth+1
self.addAllKmers(s,depth+1,maxDepth)
def kmerNeighborhood(self):
request=quixote.get_request()
form=request.form
n=int(form['n'])
print n
self.liste=dict()
self.lines=dict()
self.liste.clear()
self.lines.clear()
self.liste[str(form['kmer'])]=0
self.addAllKmers(str(form['kmer']),0,n)
S=str(len(self.liste))+'\n'
for l in self.liste.keys():
S=S+l+' '+str(self.liste[l])+'\n'
for l in self.lines.keys():
S=S+l+'\n'
return S
def interface(self):
myVariable=templatesdir
template = env.get_template('kMerBrowserInterface.html')
return template.render(locals())
示例6: __init__
def __init__(self, filepath):
self.sdb = ScreedDB(filepath)
示例7: ScreedDB
import time as t
import os, os.path
import glob
import platform
global array
import screed
import sys
from screed import ScreedDB
import string
#corriendo = "N"
bioinfo_path = "/Users/ivanjimenez/Desktop/CLASES/INTERNSHIPS/BIOINFO INTERNSHIP FILES/RESULTS/newresults/"
viralgenome_path = bioinfo_path + "copy_birna_x_virus.fa"
screed.read_fasta_sequences("/Users/ivanjimenez/Desktop/CLASES/INTERNSHIPS/BIOINFO INTERNSHIP FILES/RESULTS/newresults/copy_birna_x_virus.fa")
birna_x_virusdb = ScreedDB(viralgenome_path + "_screed")
#Setting the number of mismatches that are allowed...
k = 6
def getpath():
wd = os.path.dirname(os.path.abspath(__file__))
if platform.system() == 'Windows':
array = wd.split('\\')
destination = "\\\\".join(array)
destination += '\\\\'
else:
array = wd.split('//')
destination = "////".join(array)
destination += '////'
return destination