Skip to content

Commit

Permalink
new MappingInput - started a little draft
Browse files Browse the repository at this point in the history
  • Loading branch information
deeenes committed Feb 4, 2024
1 parent 0282fbf commit da57bf9
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions pypath/utils/_mapping/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -1079,9 +1079,7 @@ def _ncbi_taxid(organism: str | int | None) -> int | None:
return _taxonomy.ensure_ncbi_tax_id(organism)


class FileMapping(MappingResource):

resource = 'file'
class MappingInput:

def __init__(
self,
Expand All @@ -1095,6 +1093,38 @@ def __init__(
ncbi_tax_id = None,
entity_type = 'protein',
):
"""
Describe the capabilities of a generic URI of ID translation data.
Most often one URI provides single translation table, however,
sometimes the identifiers might have synonyms, or the organism and ID
types can be part of the URI. These cases are also supported here.
Args:
id_type_a:
A valid identifier type or synonym.
id_type_b:
A valid identifier type or synonym.
uri:
The URI of the data source.
col_a:
Index of the column with identifier A.
col_b:
Index of the column with identifier B.
separator:
Column separator.
header:
Number of rows to skip.
ncbi_tax_id:
NCBI Taxonomy ID of the organism.
id_synonyms:
Synonyms
"""


class FileMapping(MappingResource):

resource = 'file'

MappingResource.__init__(
self,
Expand Down

0 comments on commit da57bf9

Please sign in to comment.