Example #1
0
    def __init__(self):

        # Read orientations
        # type 0 <--- --->
        # type 1 ---> --->
        # type 2 ---> <---
        self.OT = enum('OUT', 'SAME', 'IN', 'ERROR')

        # Links are stored as triples (contig1, contig2, linktype)
        # There are 4 linktypes:
        # SS  <--1--- ---2-->
        # SE  <--1--- <--2---
        # ES  ---1--> ---2-->
        # EE  ---1--> <--2---
        self.LT = enum('SS', 'SE', 'ES', 'EE', 'ERROR')

        self.LTInverter = {
            self.LT.SS: self.LT.SS,
            self.LT.SE: self.LT.ES,
            self.LT.ES: self.LT.SE,
            self.LT.EE: self.LT.EE,
            self.LT.ERROR: self.LT.ERROR
        }

        self.compl = s_maketrans('ACGT', 'TGCA')
Example #2
0
 def getKmerSigWeights(self):
     """Return a hash of index into kmer sig -> GC %"""
     kmer_names = self.makeKmerColNames()
     weights = []
     compl = s_maketrans('ACGTacgt', '01100110')
     for kmer in kmer_names:
         weights.append(sum([float(x) for x in list(kmer.translate(compl))])/float(self.kLen))
     return weights
Example #3
0
    def __init__(self):

        # Read orientations
        # type 0 <--- --->
        # type 1 ---> --->
        # type 2 ---> <---
        self.OT = enum('OUT', 'SAME', 'IN', 'ERROR')
        
        # Links are stored as triples (contig1, contig2, linktype)
        # There are 4 linktypes:
        # SS  <--1--- ---2--> 
        # SE  <--1--- <--2---
        # ES  ---1--> ---2-->
        # EE  ---1--> <--2---
        self.LT = enum('SS','SE','ES','EE','ERROR')
        
        self.LTInverter = {self.LT.SS:self.LT.SS, 
                           self.LT.SE:self.LT.ES, 
                           self.LT.ES:self.LT.SE, 
                           self.LT.EE:self.LT.EE,
                           self.LT.ERROR:self.LT.ERROR}
        
        self.compl = s_maketrans('ACGT', 'TGCA')
Example #4
0
 def __init__(self):
     self.compl = s_maketrans('ACGTacgtnN', '0110011000')
Example #5
0
 def getGC(self, seq):
     """Get the GC of a sequence"""
     Ns = seq.count('N') + seq.count('n')
     compl = s_maketrans('ACGTacgtnN', '0110011000')
     return sum([float(x) for x in list(seq.translate(compl))])/float(len(seq) - Ns)
Example #6
0
 def __init__(self, kLen=4):
     self.kLen = kLen
     self.compl = s_maketrans('ACGT', 'TGCA')
     (self.kmerCols, self.llDict) = self.makeKmerColNames(makeLL=True)
     self.numMers = len(self.kmerCols)