Bio2BEL DrugBank¶
Installation¶
bio2bel_drugbank
can be installed easily from PyPI with
the following code in your favorite terminal:
$ python3 -m pip install bio2bel_drugbank
or from the latest code on GitHub with:
$ python3 -m pip install git+https://github.com/bio2bel/drugbank.git@master
Setup¶
Warning
DrugBank requires a bit of downloading and file organization. Will be documented soon.
Python REPL¶
>>> import bio2bel_drugbank
>>> drugbank_manager = bio2bel_drugbank.Manager()
>>> drugbank_manager.populate()
Command Line Utility¶
bio2bel_drugbank populate
Manager¶
Defines the Bio2BEL DrugBank manager.
-
class
bio2bel_drugbank.manager.
Manager
(*args, **kwargs)[source]¶ Manager for Bio2BEL DrugBank.
-
namespace_model
¶ alias of
bio2bel_drugbank.models.Drug
-
get_group_by_name
(name: str) → Optional[bio2bel_drugbank.models.Group][source]¶ Get a Group by name.
-
get_or_create_group
(name: str) → bio2bel_drugbank.models.Group[source]¶ Get or create a Group by name.
-
get_species_by_name
(name: str) → Optional[bio2bel_drugbank.models.Species][source]¶ Get a Species by name.
-
get_or_create_species
(name: str) → bio2bel_drugbank.models.Species[source]¶ Get or create a Species by name.
-
get_category_by_name
(name: str) → Optional[bio2bel_drugbank.models.Category][source]¶ Get a Category by name.
-
get_or_create_category
(name: str, **kwargs) → bio2bel_drugbank.models.Category[source]¶ Get or create a Category by name.
-
get_or_create_patent
(country: str, patent_id: str, **kwargs) → bio2bel_drugbank.models.Patent[source]¶ Get or creates a Patent.
-
populate
(url: Optional[str] = None) → None[source]¶ Populate DrugBank.
Parameters: url – Path to the DrugBank XML
-
count_drugs_categories
() → int[source]¶ Count the number of drug-category relations in the database.
-
list_drug_protein_interactions
() → List[bio2bel_drugbank.models.DrugProteinInteraction][source]¶ List drug-protein interactions.
-
enrich_targets
(graph: pybel.struct.graph.BELGraph) → None[source]¶ Enrich the protein targets in the graph with Drug-Protein interactions from DrugBank.
-
lookup_drug
(node: pybel.dsl.node_classes.BaseEntity) → Optional[bio2bel_drugbank.models.Drug][source]¶ Try and look up a drug.
-
enrich_drug_inchi
(graph: pybel.struct.graph.BELGraph) → None[source]¶ Enrich drugs in the graph with their InChI equivalent nodes.
-
enrich_drug_equivalences
(graph: pybel.struct.graph.BELGraph) → None[source]¶ Enrich drugs in the graph with their equivalent nodes.
-
enrich_drugs
(graph: pybel.struct.graph.BELGraph) → None[source]¶ Enrich drugs in the graph with their targets.
-
get_hgnc_id_to_drugs
() → Dict[str, List[str]][source]¶ Get a dictionary of HGNC identifiers (not prepended with HGNC:) to list of drug names.
-
get_drug_to_hgnc_ids
(cache=True, recalculate=False) → Dict[str, List[str]][source]¶ Get a dictionary of drug names to lists HGNC identifiers (not prepended with HGNC:).
-
Models¶
Database models for bio2bel_drugbank.
-
class
bio2bel_drugbank.models.
Base
(**kwargs)¶ The most base type
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-
class
bio2bel_drugbank.models.
Type
(**kwargs)[source]¶ Represents the type of a drug - either small molecule or biologic.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-
class
bio2bel_drugbank.models.
Drug
(**kwargs)[source]¶ Represents a drug.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-
as_bel
() → pybel.dsl.node_classes.Abundance[source]¶ Get this drug as a PyBEL abundance identified by its DrugBank identifier.
-
as_inchi_bel
() → pybel.dsl.node_classes.Abundance[source]¶ Get this drug as a PyBEL abundance identified by InChI.
-
-
class
bio2bel_drugbank.models.
DrugXref
(**kwargs)[source]¶ Represents a drug’s cross-reference to another database.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-
class
bio2bel_drugbank.models.
Patent
(**kwargs)[source]¶ Represents a patent.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-
google_url
¶ Return the Google Patents URL of this patent.
-
-
class
bio2bel_drugbank.models.
Alias
(**kwargs)[source]¶ Represents an alias of a drug.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-
class
bio2bel_drugbank.models.
AtcCode
(**kwargs)[source]¶ Represents an ATC code of a drug.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-
class
bio2bel_drugbank.models.
Group
(**kwargs)[source]¶ Represents a drug group.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-
class
bio2bel_drugbank.models.
Category
(**kwargs)[source]¶ Represents a drug category.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-
class
bio2bel_drugbank.models.
Species
(**kwargs)[source]¶ Represents a species.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-
class
bio2bel_drugbank.models.
Protein
(**kwargs)[source]¶ Represents a protein.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-
class
bio2bel_drugbank.models.
Action
(**kwargs)[source]¶ Represents the action a drug takes in a drug-protein interaction.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-
class
bio2bel_drugbank.models.
Article
(**kwargs)[source]¶ Represents an article in PubMed.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-
class
bio2bel_drugbank.models.
DrugProteinInteraction
(**kwargs)[source]¶ Represents an interaction between a drug and a protein.
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.