API¶
Entry points¶
These functions are available after you import apyhgnc
and should be
used as the main entry points for apyhgnc. If you want more control, you
can use the internal classes described below.
-
async
apyhgnc.apyhgnc.
afetch
(field: str, term: Union[str, int]) → pandas.core.frame.DataFrame[source]¶ Launch an asynchronous fetch from HGNC.
- Parameters
field (str) – HGNC field to query
term (Union[str,int]) – query term
- Returns
pd.DataFrame
Example
>>> import asyncio >>> loop = asyncio.get_event_loop() >>> loop.run_until_complete(apyhgnc.afetch("symbol", "ZNF3"))
-
async
apyhgnc.apyhgnc.
asearch
(*args, **kwargs) → pandas.core.frame.DataFrame[source]¶ Launch an asynchronous search on HGNC.
- Parameters
*args – either a single term to search all available fields, or a specific field and term to restrich the search
**kwargs – one or more keywork arguments with a field and a string or list of strings representing the search term(s)
- Returns
pd.DataFrame
Example
>>> import asyncio >>> loop = asyncio.get_event_loop() >>> loop.run_until_complete(apyhgnc.asearch("symbol", "BRAF"))
-
apyhgnc.apyhgnc.
fetch
(field: str, term: Union[str, int]) → pandas.core.frame.DataFrame[source]¶ Launch a synchronous fetch from HGNC.
- Parameters
field (str) – HGNC field to query
term (Union[str,int]) – query term
- Returns
pd.DataFrame
Example
>>> apyhgnc.fetch("symbol", "ZNF3")
-
apyhgnc.apyhgnc.
info
() → apyhgnc.classes.Info[source]¶ Retrieve basic information from HGNC.
- Returns
Info
Examples
>>> i = apyhgnc.info() >>> i.searchableFields # list of searchable fields >>> i.storedFields # list of stored fields >>> i.lastModified # date of last HGNC database modification >>> i.numDoc # number of entries in HGNC database
-
apyhgnc.apyhgnc.
search
(*args, **kwargs) → pandas.core.frame.DataFrame[source]¶ Launch a synchronous search on HGNC.
- Parameters
*args – either a single term to search all available fields, or a specific field and term to restrich the search
**kwargs – one or more keywork arguments with a field and a string or list of strings representing the search term(s)
- Returns
pd.DataFrame
Examples
>>> apyhgnc.search("BRAF") # search all searchable fields >>> apyhgnc.search("symbol", "BRAF") # restrict search to symbol field >>> apyhgnc.search(symbol="BRAF") # search with a keyword argument >>> apyhgnc.search(symbol=["BRAF", "ZNF"]) # search with OR >>> apyhgnc.search(symbol="BRAF", status="Approved") # search multiple keywords
Internal classes¶
These are the internal classes used by apyhgnc. Use them if you want more control over the application.
-
class
apyhgnc.classes.
Fetch
(field: str, term: Union[str, int])[source]¶ Class used to look for specific entries on HGNC.
- Parameters
field (str) – HGNC field to query
term (Union[str,int]) – query term
Example
>>> Fetch("symbol", "ZNF3")
-
class
apyhgnc.classes.
Info
[source]¶ Class used to retrieve information from HGNC.
-
url
¶ return the URL used to retrieve results
- Type
str
-
response
¶ return the raw response produced by the info call
- Type
Dict[str, Any]
-
searchableFields
¶ return the list of available searchable fields from HGNC
- Type
List[str]
-
storedFields
¶ return the list of available stored fields from HGNC
- Type
List[str]
-
lastModified
¶ return the date and time when the HGNC server was last modified
- Type
str
-
numDoc
¶ return the number of entries currently present in the HGNC server
- Type
int
Examples
>>> i = Info() >>> i.searchableFields # list of searchable fields >>> i.storedFields # list of stored fields >>> i.lastModified # date of last HGNC database modification >>> i.numDoc # number of entries in HGNC database
-
property
lastModified
Return the date and time when the HGNC server was last modified.
- Returns
str
-
property
numDoc
Return the number of entries currently present in the HGNC server.
- Returns
int
-
property
response
Return the raw response produced by the info call.
- Returns
Dict[str,Any]
-
property
searchableFields
Return the list of available searchable fields from HGNC.
- Returns
List[str]
-
property
storedFields
Return the list of available stored fields from HGNC.
- Returns
List[str]
-
property
url
Return the URL used to retrieve results.
- Returns
str
-
-
class
apyhgnc.classes.
Search
(*args, **kwargs)[source]¶ Class used to look for entries of interest on HGNC.
- Parameters
*args – either a single term to search all available fields, or a specific field and term to restrich the search
**kwargs – one or more keywork arguments with a field and a string or list of strings representing the search term(s)
Examples
>>> Search("BRAF") # search all searchable fields >>> Search("symbol", "BRAF") # restrict search to symbol field >>> Search(symbol="BRAF") # search with a keyword argument >>> Search(symbol=["BRAF", "ZNF"]) # search with OR >>> Search(symbol="BRAF", status="Approved") # search multiple keywords