Esempio n. 1
0
def generate_protein_fdr(target, decoy, theader, dheader, headerfields):
    tproteins = [x for x in reader.generate_tsv_proteins(target, theader)]
    dproteins = [x for x in reader.generate_tsv_proteins(decoy, dheader)]
    [x.update({'target_decoy': 'target'}) for x in tproteins]
    [x.update({'target_decoy': 'decoy'}) for x in dproteins]
    proteins = sorted(tproteins + dproteins, key=lambda x: get_score(x),
                      reverse=True)
    fdrheader = headerfields['proteinfdr'][prottabledata.HEADER_QVAL][None]
    for protein in qvalue_generator(fdrheader, proteins):
        yield protein
Esempio n. 2
0
def generate_accessionmaps(targetprot, decoyprot, theader, dheader):
    t_scores, d_scores = {}, {}
    for protein in reader.generate_tsv_proteins(targetprot, theader):
        acc = protein[prottabledata.HEADER_PROTEIN]
        t_scores[acc] = protein
        t_scores[acc]['target_decoy'] = 'target'
    for protein in reader.generate_tsv_proteins(decoyprot, dheader):
        acc = protein[prottabledata.HEADER_PROTEIN]
        d_scores[acc] = protein
        d_scores[acc]['target_decoy'] = 'decoy'
    return t_scores, d_scores
Esempio n. 3
0
def create_td_assoc_map(tproteins, dproteins, theader, dheader):
    tdmap = {}
    for dprot in reader.generate_tsv_proteins(dproteins, dheader):
        dprot = dprot[prottabledata.HEADER_PROTEIN]
        faketprot = dprot.replace(mzidtsvdata.DECOY_PREFIX, '')
        tdmap[faketprot] = dprot
    for tprot in reader.generate_tsv_proteins(tproteins, theader):
        tprot = tprot[prottabledata.HEADER_PROTEIN]
        if not tdmap.get(tprot, False):
            tdmap[tprot] = None
    return tdmap
Esempio n. 4
0
def generate_accessionmaps(targetprot, decoyprot, theader, dheader):
    t_scores, d_scores = {}, {}
    for protein in reader.generate_tsv_proteins(targetprot, theader):
        acc = protein[prottabledata.HEADER_PROTEIN]
        t_scores[acc] = protein
        t_scores[acc]['target_decoy'] = 'target'
    for protein in reader.generate_tsv_proteins(decoyprot, dheader):
        acc = protein[prottabledata.HEADER_PROTEIN]
        d_scores[acc] = protein
        d_scores[acc]['target_decoy'] = 'decoy'
    return t_scores, d_scores
Esempio n. 5
0
def create_td_assoc_map(tproteins, dproteins, theader, dheader):
    tdmap = {}
    for dprot in reader.generate_tsv_proteins(dproteins, dheader):
        dprot = dprot[prottabledata.HEADER_PROTEIN]
        faketprot = dprot.replace(mzidtsvdata.DECOY_PREFIX, '')
        tdmap[faketprot] = dprot
    for tprot in reader.generate_tsv_proteins(tproteins, theader):
        tprot = tprot[prottabledata.HEADER_PROTEIN]
        if not tdmap.get(tprot, False):
            tdmap[tprot] = None
    return tdmap
Esempio n. 6
0
 def initialize_input(self):
     super().initialize_input()
     quantheader = reader.get_tsv_header(self.quantfile)
     self.quantfields = reader.get_cols_in_file(self.quantcolpattern,
                                                quantheader)
     self.quantacc = reader.get_cols_in_file(self.quantacccolpattern,
                                             quantheader, single_col=True)
     self.quantpeptides = reader.generate_tsv_proteins(self.quantfile,
                                                       quantheader)
Esempio n. 7
0
 def initialize_input(self):
     super().initialize_input()
     quantheader = reader.get_tsv_header(self.quantfile)
     self.quantfields = reader.get_cols_in_file(self.quantcolpattern,
                                                quantheader)
     self.quantacc = reader.get_cols_in_file(self.quantacccolpattern,
                                             quantheader,
                                             single_col=True)
     self.quantfeatures = reader.generate_tsv_proteins(
         self.quantfile, quantheader)
Esempio n. 8
0
def output_to_target_accession_table(targetfn, featratios, channels):
    #loop prottable, add ratios from dict, acc = key
    theader = reader.get_tsv_header(targetfn)
    acc_field = theader[0]
    for feat in reader.generate_tsv_proteins(targetfn, theader):
        try:
            quants = featratios[feat[acc_field]]
        except KeyError:
            quants = {ch: 'NA' for ch in channels}
            quants.update({get_no_psms_field(ch): 'NA' for ch in channels})
        else:
            quants.pop(ISOQUANTRATIO_FEAT_ACC)
        feat.update(quants)
        yield feat
Esempio n. 9
0
def output_to_target_accession_table(targetfn, featratios, channels):
    #loop prottable, add ratios from dict, acc = key
    theader = reader.get_tsv_header(targetfn)
    acc_field = theader[0]
    for feat in reader.generate_tsv_proteins(targetfn, theader):
        try:
            quants = featratios[feat[acc_field]]
        except KeyError:
            quants = {ch: 'NA' for ch in channels}
            quants.update({get_no_psms_field(ch): 'NA' for ch in channels})
        else:
            quants.pop(ISOQUANTRATIO_FEAT_ACC)
        feat.update(quants)
        yield feat
Esempio n. 10
0
 def initialize_input(self):
     self.oldheader = reader.get_tsv_header(self.fn)
     self.in_proteins = reader.generate_tsv_proteins(self.fn,
                                                     self.oldheader)
Esempio n. 11
0
 def initialize_input(self):
     self.oldheader = reader.get_tsv_header(self.fn)
     self.in_proteins = reader.generate_tsv_proteins(
         self.fn, self.oldheader)