grape.ensmallen.datasets.kghub

This sub-module offers methods to automatically retrieve the graphs from KGHub repository.

View Source
"""This sub-module offers methods to automatically retrieve the graphs from KGHub repository."""

from .kgmicrobe import KGMicrobe
from .kgcovid19 import KGCOVID19

__all__ = [
	"KGMicrobe", "KGCOVID19",
]
#   def KGMicrobe( directed: bool = False, preprocess: bool = True, load_nodes: bool = True, verbose: int = 2, cache: bool = True, cache_path: str = 'graphs/kghub', version: str = 'current', **additional_graph_kwargs: Dict ) -> grape.ensmallen.ensmallen.Graph:
View Source
def KGMicrobe(
    directed: bool = False,
    preprocess: bool = True,
    load_nodes: bool = True,
    verbose: int = 2,
    cache: bool = True,
    cache_path: str = "graphs/kghub",
    version: str = "current",
    **additional_graph_kwargs: Dict
) -> Graph:
    """Return new instance of the kg-microbe graph.

    The graph is automatically retrieved from the KGHub repository.	

    Parameters
    -------------------
    directed: bool = False
        Wether to load the graph as directed or undirected.
        By default false.
    preprocess: bool = True
        Whether to preprocess the graph to be loaded in 
        optimal time and memory.
    load_nodes: bool = True,
        Whether to load the nodes vocabulary or treat the nodes
        simply as a numeric range.
    verbose: int = 2,
        Wether to show loading bars during the retrieval and building
        of the graph.
    cache: bool = True
        Whether to use cache, i.e. download files only once
        and preprocess them only once.
    cache_path: str = "graphs"
        Where to store the downloaded graphs.
    version: str = "current"
        The version of the graph to retrieve.		
	The available versions are:
			- 20210422
			- 20210517
			- 20210608
			- 20210615
			- 20210617
			- 20210622
			- 20210715
			- current
    additional_graph_kwargs: Dict
        Additional graph kwargs.

    Returns
    -----------------------
    Instace of kg-microbe graph.

	
    """
    return AutomaticallyRetrievedGraph(
        graph_name="KGMicrobe",
        repository="kghub",
        version=version,
        directed=directed,
        preprocess=preprocess,
        load_nodes=load_nodes,
        verbose=verbose,
        cache=cache,
        cache_path=cache_path,
        additional_graph_kwargs=additional_graph_kwargs
    )()

Return new instance of the kg-microbe graph.

The graph is automatically retrieved from the KGHub repository.

Parameters
  • directed (bool = False): Wether to load the graph as directed or undirected. By default false.
  • preprocess (bool = True): Whether to preprocess the graph to be loaded in optimal time and memory.
  • load_nodes (bool = True,): Whether to load the nodes vocabulary or treat the nodes simply as a numeric range.
  • verbose (int = 2,): Wether to show loading bars during the retrieval and building of the graph.
  • cache (bool = True): Whether to use cache, i.e. download files only once and preprocess them only once.
  • cache_path (str = "graphs"): Where to store the downloaded graphs.
  • version (str = "current"): The version of the graph to retrieve.
    The available versions are: - 20210422 - 20210517 - 20210608 - 20210615 - 20210617 - 20210622 - 20210715 - current
  • additional_graph_kwargs (Dict): Additional graph kwargs.
Returns
  • Instace of kg-microbe graph.
#   def KGCOVID19( directed: bool = False, preprocess: bool = True, load_nodes: bool = True, verbose: int = 2, cache: bool = True, cache_path: str = 'graphs/kghub', version: str = 'current', **additional_graph_kwargs: Dict ) -> grape.ensmallen.ensmallen.Graph:
View Source
def KGCOVID19(
    directed: bool = False,
    preprocess: bool = True,
    load_nodes: bool = True,
    verbose: int = 2,
    cache: bool = True,
    cache_path: str = "graphs/kghub",
    version: str = "current",
    **additional_graph_kwargs: Dict
) -> Graph:
    """Return new instance of the kg-covid-19 graph.

    The graph is automatically retrieved from the KGHub repository.	

    Parameters
    -------------------
    directed: bool = False
        Wether to load the graph as directed or undirected.
        By default false.
    preprocess: bool = True
        Whether to preprocess the graph to be loaded in 
        optimal time and memory.
    load_nodes: bool = True,
        Whether to load the nodes vocabulary or treat the nodes
        simply as a numeric range.
    verbose: int = 2,
        Wether to show loading bars during the retrieval and building
        of the graph.
    cache: bool = True
        Whether to use cache, i.e. download files only once
        and preprocess them only once.
    cache_path: str = "graphs"
        Where to store the downloaded graphs.
    version: str = "current"
        The version of the graph to retrieve.		
	The available versions are:
			- 20200925
			- 20200927
			- 20200929
			- 20201001
			- 20201012
			- 20201101
			- 20201202
			- 20210101
			- 20210128
			- 20210201
			- 20210218
			- 20210301
			- 20210412
			- 20210725
			- 20210726
			- 20210727
			- 20210823
			- 20210902
			- 20211002
			- current
    additional_graph_kwargs: Dict
        Additional graph kwargs.

    Returns
    -----------------------
    Instace of kg-covid-19 graph.

	References
	---------------------
	Please cite the following if you use the data:
	
	```bib
	@article{reese2021kg,
	  title={KG-COVID-19: a framework to produce customized knowledge graphs for COVID-19 response},
	  author={Reese, Justin T and Unni, Deepak and Callahan, Tiffany J and Cappelletti, Luca and Ravanmehr, Vida and Carbon, Seth and Shefchek, Kent A and Good, Benjamin M and Balhoff, James P and Fontana, Tommaso and others},
	  journal={Patterns},
	  volume={2},
	  number={1},
	  pages={100155},
	  year={2021},
	  publisher={Elsevier}
	}
	```
    """
    return AutomaticallyRetrievedGraph(
        graph_name="KGCOVID19",
        repository="kghub",
        version=version,
        directed=directed,
        preprocess=preprocess,
        load_nodes=load_nodes,
        verbose=verbose,
        cache=cache,
        cache_path=cache_path,
        additional_graph_kwargs=additional_graph_kwargs
    )()

Return new instance of the kg-covid-19 graph.

The graph is automatically retrieved from the KGHub repository.

Parameters
  • directed (bool = False): Wether to load the graph as directed or undirected. By default false.
  • preprocess (bool = True): Whether to preprocess the graph to be loaded in optimal time and memory.
  • load_nodes (bool = True,): Whether to load the nodes vocabulary or treat the nodes simply as a numeric range.
  • verbose (int = 2,): Wether to show loading bars during the retrieval and building of the graph.
  • cache (bool = True): Whether to use cache, i.e. download files only once and preprocess them only once.
  • cache_path (str = "graphs"): Where to store the downloaded graphs.
  • version (str = "current"): The version of the graph to retrieve.
    The available versions are: - 20200925 - 20200927 - 20200929 - 20201001 - 20201012 - 20201101 - 20201202 - 20210101 - 20210128 - 20210201 - 20210218 - 20210301 - 20210412 - 20210725 - 20210726 - 20210727 - 20210823 - 20210902 - 20211002 - current
  • additional_graph_kwargs (Dict): Additional graph kwargs.
Returns

- Instace of kg-covid-19 graph.: References

Please cite the following if you use the data:

@article{reese2021kg,
  title={KG-COVID-19: a framework to produce customized knowledge graphs for COVID-19 response},
  author={Reese, Justin T and Unni, Deepak and Callahan, Tiffany J and Cappelletti, Luca and Ravanmehr, Vida and Carbon, Seth and Shefchek, Kent A and Good, Benjamin M and Balhoff, James P and Fontana, Tommaso and others},
  journal={Patterns},
  volume={2},
  number={1},
  pages={100155},
  year={2021},
  publisher={Elsevier}
}