File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616 Dataset ,
1717 ontology_entity_mapper ,
1818)
19- from pypath .inputs_v2 .parsers import brenda as _parsers
19+ from pypath .inputs_v2 .parsers . base import iter_tsv , _first_handle
2020from pypath .internals .tabular_builder import (
2121 AssociationBuilder ,
2222 AssociationsBuilder ,
4646 license = LicenseCV .UNSPECIFIED ,
4747 update_category = UpdateCategoryCV .IRREGULAR ,
4848 pubmed = '33554247' ,
49- primary_category = 'intercell ' ,
49+ primary_category = 'interactions ' ,
5050 description = (
5151 'PMIDB provides both interactions and non-interactions between protein '
5252 'and metabolite, which not only reduces the experimental cost for '
6767 for f in files
6868}
6969
70- #def parser(opener, skiprows):
70+ def parser (opener , header = None , sep = '\t ' ):
71+
72+ if header is not None and iter (header ):
73+
74+ entries = [line .strip ().split (sep ) for line in _first_handle (opener )]
75+
76+ if x := len (entries [0 ]) - len (header ):
77+
78+ raise KeyError (
79+ 'Length of header is %s than the number of entries'
80+ % ('smaller' if x > 0 else 'larger' )
81+ )
82+
83+ yield from [
84+ {k : v for k , v in zip (header , line )}
85+ for line in entries
86+ ]
87+
88+ else :
89+
90+ return iter_tsv (opener )
7191
7292# =================================== SCHEMA ===================================
7393
You can’t perform that action at this time.
0 commit comments