예제 #1
0
from kdbom2 import kdbom
from sequence import fasta as F
from sequence import blastNoSQL as B
from sequence import aos as A
import numpy as N

SQLservers = (('kf-db1',3306),)
prrsvDB = kdbom.tryDBconnect('PRRSV',SQLservers)

class Sequence(kdbom.KSqlObject):
    _table = prrsvDB.Sequence
    
    def generateFasta(self):
        '''generates a fasta file using Sequence_ID as
        the title and Sequence as the sequence
        '''
        rec=F.Record(title=self.Sequence_ID, sequence=self.Sequence)
        return rec

    def taxa(self):
        """return generator of taxa that I belong to
        """
        return Taxon.generator(Sequence.Sequence_ID==self)

    fasta=generateFasta
        

class Candidate(kdbom.KSqlObject):
    _table = prrsvDB.Candidate

    energyStats=dict(
예제 #2
0
import os
import os.path
import datetime
from types import *

import utils

from __init__ import *
from fasta import *
from blastNoSQL import *

from kdbom2 import kdbom


blastDB = kdbom.tryDBconnect(db='Blast_Results',
                             serversPorts='kf-db1',
                             getTables=False,
                             fatal=True)


SQL = {'createHspTable':
       """
       CREATE TABLE IF NOT EXISTS %s (
       `Hsp_ID` bigint unsigned NOT NULL AUTO_INCREMENT,
       `Q_Gi` varchar(255) NOT NULL,
       `T_Gi` varchar(255) NOT NULL,
       `Ident` float unsigned NOT NULL,
       `Length` int unsigned NOT NULL,
       `Gaps` int unsigned NOT NULL,
       `Mismatch` int unsigned NOT NULL,
       `Q_Start` int unsigned NOT NULL,
       `Q_End` int unsigned NOT NULL,