Changeset 58


Ignore:
Timestamp:
Aug 11, 2010, 4:14:03 PM (10 years ago)
Author:
j@…
bzr:base-revision:
j@dannynavarro.net-20100811085231-whn2ggfjixkylyo9
bzr:committer:
Danny Navarro <j@dannynavarro.net>
bzr:file-ids:

mzcms/parsers.py parsers.py-20100806092910-g1sxvv1o5b9umkof-1
bzr:mapping-version:
v4
bzr:repository-uuid:
724254b2-fbe6-419d-9466-c04ef4c9d29d
bzr:revision-id:
j@dannynavarro.net-20100811094810-08o9ti8sq8zm2bfs
bzr:revno:
58
bzr:revprop:branch-nick:
trunk
bzr:root:
trunk
bzr:timestamp:
2010-08-11 11:48:10.141000032 +0200
bzr:user-agent:
bzr2.1.2+bzr-svn1.0.3
svn:original-date:
2010-08-11T09:48:10.141000Z
Message:

Fixed the filtering for target proteins

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mzcms/parsers.py

    r56 r58  
    5454                 scan_str=r'FinneganScanNumber%3a%20(\d+)%20',
    5555                 rawfn_str=r'RawFile%3a%20(.+raw)',
    56                  decoy_str=r'^REV_IPI',
    57                  contaminant_str=r'^CON_IPI',
     56                 decoy_str=r'^REV_.*',
     57                 contaminant_str=r'^CON_.*',
    5858                 # XXX: Fix default factories
    5959                 ):
     
    130130                accs = match.group(8)
    131131                prot_ids = get_prot_ids(accs)
    132                 is_target = check_target(prot_ids,
     132                target_prots = filter_target_prots(prot_ids,
    133133                        self.non_target_regexes)
    134                 if is_target and (rank == 1 or rank == 2):
     134                if target_prots and (rank == 1 or rank == 2):
    135135                    mascot_psm = MascotPsm(
    136136                            rank=rank,
     
    139139                            pep_seq=pep_seq,
    140140                            score=score,
    141                             prot_ids=prot_ids
     141                            prot_ids=target_prots
    142142                            )
    143143                    nativeid_psms[nativeid].append(mascot_psm)
     
    225225                 )
    226226
    227 def check_target(prot_ids, regexes):
    228     """Returns True if there is at least one target protein in Mascot
    229        protein accession string.
    230     """
     227def filter_target_prots(prot_ids, regexes):
     228    """Filters a list of protein ids for target protein ids
     229    """
     230    target_prots = list()
    231231    for prot_id in prot_ids:
     232        non_target_flag = True
    232233        for regex in regexes:
    233234            if re.match(regex, prot_id):
    234                 return False
    235         return True
     235                non_target_flag = False
     236        if non_target_flag:
     237            target_prots.append(prot_id)
     238    return target_prots
     239
    236240
    237241def apply_mods(peptide_str, mod_str):
Note: See TracChangeset for help on using the changeset viewer.