當前位置: 首頁>>代碼示例>>Python>>正文


Python screed.ScreedDB類代碼示例

本文整理匯總了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
開發者ID:anotherthomas,項目名稱:screed,代碼行數:25,代碼來源:pygr_api.py

示例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"
開發者ID:ahnt,項目名稱:kMerBrowserInterface,代碼行數:16,代碼來源:kmerBrowser.py

示例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
開發者ID:lgautier,項目名稱:screed,代碼行數:19,代碼來源:pygr_api.py

示例4: setup

 def setup(self):
     self.db = ScreedDB(tri + '_screed')
開發者ID:ahaerpfer,項目名稱:screed,代碼行數:2,代碼來源:__init__.py

示例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())
開發者ID:ahnt,項目名稱:kMerBrowserInterface,代碼行數:71,代碼來源:kmerBrowser.py

示例6: __init__

 def __init__(self, filepath):
     self.sdb = ScreedDB(filepath)
開發者ID:anotherthomas,項目名稱:screed,代碼行數:2,代碼來源:pygr_api.py

示例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
開發者ID:NacroKill,項目名稱:dmel-ercc-diff,代碼行數:31,代碼來源:Tophat_Birnavirus_Confirmer_2.0.py


注:本文中的screed.ScreedDB類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。