Changeset 39


Ignore:
Timestamp:
Aug 11, 2010, 4:08:35 PM (10 years ago)
Author:
j@…
bzr:base-revision:
j@dannynavarro.net-20100809120631-tojiityird7y8f68
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-20100809121616-774ops20e8y2s6l7
bzr:revno:
39
bzr:revprop:branch-nick:
trunk
bzr:root:
trunk
bzr:timestamp:
2010-08-09 14:16:16.243000031 +0200
bzr:user-agent:
bzr2.1.2+bzr-svn1.0.3
svn:original-date:
2010-08-09T12:16:16.243000Z
Message:

Implented function to check for target Psm

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mzcms/parsers.py

    r38 r39  
    101101                accs = match.group(8)
    102102                prot_ids = get_prot_ids(accs)
    103                 is_target = check_target(accs, self.decoy_regex)
     103                is_target = check_target(prot_ids, self.decoy_regex)
    104104                if is_target and rank == 1 or rank == 2:
    105105                    mascot_psm = MascotPsm(
     
    168168def get_prot_ids(accs):
    169169    return (x[1].split('"')
    170             for x in (x.split(':')
    171             for x in accs.split(',"')
     170            for x in (y.split(':')
     171            for y in accs.split(',"')
    172172                      )
    173173            )
     174
     175def check_target(prot_ids, regexes):
     176    """Returns True if there is at least one target protein in Mascot
     177       protein accession string.
     178    """
     179    for prot_id in prot_ids:
     180        for regex in regexes:
     181            if re.match(regex, prot_id):
     182                return False
     183    return True
    174184
    175185def apply_mods(peptide_str, mod_str):
Note: See TracChangeset for help on using the changeset viewer.