Changeset 26


Ignore:
Timestamp:
Aug 11, 2010, 4:04:52 PM (10 years ago)
Author:
j@…
bzr:base-revision:
j@dannynavarro.net-20100806113756-c05d2haeot4rmaiy
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-20100806120031-x0349ul02lytyb8h
bzr:revno:
26
bzr:revprop:branch-nick:
trunk
bzr:root:
trunk
bzr:timestamp:
2010-08-06 14:00:31.428999901 +0200
bzr:user-agent:
bzr2.1.2+bzr-svn1.0.3
svn:original-date:
2010-08-06T12:00:31.429000Z
Message:

implemented dat path walker

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mzcms/parsers.py

    r25 r26  
    33"""
    44import sys
     5import os
    56import re
    67import csv
     
    190191    """Parses all the dat files in dats_dir
    191192    """
    192     dats = get_dat_files(dats_dir)
     193    dat_paths = (f for f in os.walk(dats_dir))
    193194    proteins = proteins_factory()
    194195    peptides = peptides_factory()
     
    196197    psms = psms_factory()
    197198    dat_parser = DatParser(decoy_str, scans_in_title)
    198     for dat in dats:
    199         dat_proteins, dat_peptides, dat_spectra, dat_psms = dat_parser.parse(file)
    200         proteins.update(dat_proteins)
    201         peptides.update(dat_peptides)
    202         spectra.update(dat_spectra)
    203         psms.update(dat_psms)
     199    for dat_path in dat_paths:
     200        with open(dat_path) as dat_file:
     201            dat_proteins, dat_peptides, \
     202            dat_spectra, dat_psms = dat_parser.parse(dat_file)
     203            proteins.update(dat_proteins)
     204            peptides.update(dat_peptides)
     205            spectra.update(dat_spectra)
     206            psms.update(dat_psms)
    204207    return proteins, peptides, spectra, psms
    205208
Note: See TracChangeset for help on using the changeset viewer.