Changeset 25
- Timestamp:
- Aug 11, 2010, 4:04:36 PM (10 years ago)
- bzr:base-revision:
- j@dannynavarro.net-20100806093012-l67phkga1smqy5lj
- bzr:committer:
- Danny Navarro <j@dannynavarro.net>
- bzr:file-ids:
.bzrignore bzrignore-20100730084509-1oxl7srf8gii89tg-1
mzcms/models.py models.py-20100730084238-fjjwldiefr0w07zv-4
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-20100806113756-c05d2haeot4rmaiy
- bzr:revno:
- 25
- bzr:revprop:branch-nick:
- trunk
- bzr:root:
- trunk
- bzr:timestamp:
- 2010-08-06 13:37:56.970999956 +0200
- bzr:user-agent:
- bzr2.1.2+bzr-svn1.0.3
- svn:original-date:
- 2010-08-06T11:37:56.971000Z
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.bzrignore
r5 r25 2 2 *.egg-info 3 3 tags 4 .coverage -
trunk/mzcms/models.py
r24 r25 9 9 class Experiment(Folder): 10 10 __parent__ = __name__ = None 11 def __init__(self, proteins, peptides, spectra, psms):11 def __init__(self, subfolders): 12 12 super(Experiment, self).__init__() 13 self['proteins'] = Proteins(proteins) 14 self['peptides'] = Peptides(peptides) 15 self['spectra'] = Spectra(spectra) 16 self['psms'] = Psms(psms) 13 for subfolder in subfolders: 14 self[subfolder.name] = subfolder 17 15 18 16 class Proteins(Folder): … … 74 72 def appmaker(zodb_root): 75 73 if not 'app_root' in zodb_root: 76 data = parse_dats('./dats') 77 app_root = Experiment(data) 74 folders = parse_dats('./dats', proteins_factory=Proteins, 75 peptides_factory=Peptides, 76 spectra_factory=Spectra, 77 psms_factory=Psms, 78 ) 79 app_root = Experiment(folders) 78 80 zodb_root['app_root'] = app_root 79 81 import transaction -
trunk/mzcms/parsers.py
r24 r25 31 31 RAWFN_REGEX = re.compile(r'raw%3a%20(.+raw)') 32 32 33 class MascotParser(object): 34 """Mascot Parser 35 """ 36 33 class DatParser(object): 34 """Mascot Dat Parser 35 """ 37 36 def __init__(self, decoy_str, scans_in_title=False): 38 37 self.decoy_regex = re.compile(decoy_str) … … 47 46 if line.startswith("FILE="): 48 47 #XXX: There must be something in the standard library 49 # to normalize paths48 # to normalize this properly 50 49 full_path = line.strip().split('=')[1] 51 50 norm_path = full_path.replace("\\", "/") … … 187 186 writer.writerow(psm) 188 187 188 def parse_dats(dats_dir, proteins_factory=dict, peptides_factory=dict, 189 spectra_factory=dict, psms_factory=dict): 190 """Parses all the dat files in dats_dir 191 """ 192 dats = get_dat_files(dats_dir) 193 proteins = proteins_factory() 194 peptides = peptides_factory() 195 spectra = spectra_factory() 196 psms = psms_factory() 197 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) 204 return proteins, peptides, spectra, psms 205 189 206 def main(): 190 207 usage = "usage: %prog [options] mascotresult1.dat [mascotresult2.dat ...]" … … 227 244 for arg in args: 228 245 with open(arg) as in_file: 229 dat_parser = MascotParser(options.decoy_str,246 dat_parser = DatParser(options.decoy_str, 230 247 scans_in_title = options.scans_in_title) 231 248 psms = dat_parser.parse(in_file)
Note: See TracChangeset
for help on using the changeset viewer.