Esempio n. 1
0
def cdr3_translation(info):
    naive_cdr3_seq = naive_cdr3(info)
    naive_cdr3_seq = naive_cdr3_seq[3:len(naive_cdr3_seq) - 3]
    if len(naive_cdr3_seq) % 3 != 0:
        # print '  out of frame: adding %s' % ((3 - len(naive_cdr3_seq) % 3) * 'N')
        naive_cdr3_seq += (3 - len(naive_cdr3_seq) % 3) * 'N'
    return utils.ltranslate(naive_cdr3_seq)
Esempio n. 2
0
 def get_cdr3_title(self, annotation):
     naive_cdr3_seq, _ = utils.subset_iseq(annotation, 0, restrict_to_region='cdr3')
     title = ''
     if len(naive_cdr3_seq) % 3 != 0:
         # print '  out of frame: adding %s' % ((3 - len(naive_cdr3_seq) % 3) * 'N')
         naive_cdr3_seq += (3 - len(naive_cdr3_seq) % 3) * 'N'
         title += ' (out of frame)'
     title = utils.ltranslate(naive_cdr3_seq) + title
     return title
Esempio n. 3
0
    def increment_per_sequence_params(self, info, iseq):
        """ increment parameters that differ for each sequence within the clonal family """
        self.mute_total += 1
        self.mfreqer.increment(info, iseq)
        for nuke in utils.nukes:
            self.counts['seq_content'][nuke] += info['seqs'][iseq].count(nuke)

        # aa seq content stuff
        nseq = info['seqs'][iseq]
        if info['v_5p_del'] > 0:
            nseq = info['v_5p_del'] * utils.ambig_base + nseq
        if len(info['fv_insertion']) > 0:
            nseq = nseq[len(info['fv_insertion']):]
        if len(nseq) % 3 != 0:
            nseq += utils.ambig_base * (
                3 - (len(nseq) % 3)
            )  # I think I could replace this with the new utils.pad_nuc_seq()
        aaseq = utils.ltranslate(nseq)
        for aa in self.all_aa:
            self.counts['seq_aa_content'][aa] += aaseq.count(aa)
Esempio n. 4
0
 def init_aa_stuff(self):
     codons = itertools.product(
         utils.nukes + ['N'], repeat=3
     )  # I cannot for the life of me find anything in Bio that will give me the list of amino acids, wtf, but I'm tired of googling, this will be fine
     self.all_aa = set([utils.ltranslate(''.join(c)) for c in codons])