repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
sorgerlab/indra
indra/assemblers/pysb/export.py
_prepare_kappa
def _prepare_kappa(model): """Return a Kappa STD with the model loaded.""" import kappy kappa = kappy.KappaStd() model_str = export(model, 'kappa') kappa.add_model_string(model_str) kappa.project_parse() return kappa
python
def _prepare_kappa(model): """Return a Kappa STD with the model loaded.""" import kappy kappa = kappy.KappaStd() model_str = export(model, 'kappa') kappa.add_model_string(model_str) kappa.project_parse() return kappa
[ "def", "_prepare_kappa", "(", "model", ")", ":", "import", "kappy", "kappa", "=", "kappy", ".", "KappaStd", "(", ")", "model_str", "=", "export", "(", "model", ",", "'kappa'", ")", "kappa", ".", "add_model_string", "(", "model_str", ")", "kappa", ".", "p...
Return a Kappa STD with the model loaded.
[ "Return", "a", "Kappa", "STD", "with", "the", "model", "loaded", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/export.py#L141-L148
train
sorgerlab/indra
indra/databases/cbio_client.py
send_request
def send_request(**kwargs): """Return a data frame from a web service request to cBio portal. Sends a web service requrest to the cBio portal with arguments given in the dictionary data and returns a Pandas data frame on success. More information about the service here: http://www.cbioportal.org/w...
python
def send_request(**kwargs): """Return a data frame from a web service request to cBio portal. Sends a web service requrest to the cBio portal with arguments given in the dictionary data and returns a Pandas data frame on success. More information about the service here: http://www.cbioportal.org/w...
[ "def", "send_request", "(", "**", "kwargs", ")", ":", "skiprows", "=", "kwargs", ".", "pop", "(", "'skiprows'", ",", "None", ")", "res", "=", "requests", ".", "get", "(", "cbio_url", ",", "params", "=", "kwargs", ")", "if", "res", ".", "status_code", ...
Return a data frame from a web service request to cBio portal. Sends a web service requrest to the cBio portal with arguments given in the dictionary data and returns a Pandas data frame on success. More information about the service here: http://www.cbioportal.org/web_api.jsp Parameters ----...
[ "Return", "a", "data", "frame", "from", "a", "web", "service", "request", "to", "cBio", "portal", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/cbio_client.py#L25-L63
train
sorgerlab/indra
indra/databases/cbio_client.py
get_mutations
def get_mutations(study_id, gene_list, mutation_type=None, case_id=None): """Return mutations as a list of genes and list of amino acid changes. Parameters ---------- study_id : str The ID of the cBio study. Example: 'cellline_ccle_broad' or 'paad_icgc' gene_list :...
python
def get_mutations(study_id, gene_list, mutation_type=None, case_id=None): """Return mutations as a list of genes and list of amino acid changes. Parameters ---------- study_id : str The ID of the cBio study. Example: 'cellline_ccle_broad' or 'paad_icgc' gene_list :...
[ "def", "get_mutations", "(", "study_id", ",", "gene_list", ",", "mutation_type", "=", "None", ",", "case_id", "=", "None", ")", ":", "genetic_profile", "=", "get_genetic_profiles", "(", "study_id", ",", "'mutation'", ")", "[", "0", "]", "gene_list_str", "=", ...
Return mutations as a list of genes and list of amino acid changes. Parameters ---------- study_id : str The ID of the cBio study. Example: 'cellline_ccle_broad' or 'paad_icgc' gene_list : list[str] A list of genes with their HGNC symbols. Example: ['BRAF', 'KRAS'] m...
[ "Return", "mutations", "as", "a", "list", "of", "genes", "and", "list", "of", "amino", "acid", "changes", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/cbio_client.py#L66-L106
train
sorgerlab/indra
indra/databases/cbio_client.py
get_case_lists
def get_case_lists(study_id): """Return a list of the case set ids for a particular study. TAKE NOTE the "case_list_id" are the same thing as "case_set_id" Within the data, this string is referred to as a "case_list_id". Within API calls it is referred to as a 'case_set_id'. The documentation does ...
python
def get_case_lists(study_id): """Return a list of the case set ids for a particular study. TAKE NOTE the "case_list_id" are the same thing as "case_set_id" Within the data, this string is referred to as a "case_list_id". Within API calls it is referred to as a 'case_set_id'. The documentation does ...
[ "def", "get_case_lists", "(", "study_id", ")", ":", "data", "=", "{", "'cmd'", ":", "'getCaseLists'", ",", "'cancer_study_id'", ":", "study_id", "}", "df", "=", "send_request", "(", "**", "data", ")", "case_set_ids", "=", "df", "[", "'case_list_id'", "]", ...
Return a list of the case set ids for a particular study. TAKE NOTE the "case_list_id" are the same thing as "case_set_id" Within the data, this string is referred to as a "case_list_id". Within API calls it is referred to as a 'case_set_id'. The documentation does not make this explicitly clear. ...
[ "Return", "a", "list", "of", "the", "case", "set", "ids", "for", "a", "particular", "study", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/cbio_client.py#L109-L133
train
sorgerlab/indra
indra/databases/cbio_client.py
get_profile_data
def get_profile_data(study_id, gene_list, profile_filter, case_set_filter=None): """Return dict of cases and genes and their respective values. Parameters ---------- study_id : str The ID of the cBio study. Example: 'cellline_ccle_broad' or 'paad_icgc' gene_list...
python
def get_profile_data(study_id, gene_list, profile_filter, case_set_filter=None): """Return dict of cases and genes and their respective values. Parameters ---------- study_id : str The ID of the cBio study. Example: 'cellline_ccle_broad' or 'paad_icgc' gene_list...
[ "def", "get_profile_data", "(", "study_id", ",", "gene_list", ",", "profile_filter", ",", "case_set_filter", "=", "None", ")", ":", "genetic_profiles", "=", "get_genetic_profiles", "(", "study_id", ",", "profile_filter", ")", "if", "genetic_profiles", ":", "genetic_...
Return dict of cases and genes and their respective values. Parameters ---------- study_id : str The ID of the cBio study. Example: 'cellline_ccle_broad' or 'paad_icgc' gene_list : list[str] A list of genes with their HGNC symbols. Example: ['BRAF', 'KRAS'] profile_f...
[ "Return", "dict", "of", "cases", "and", "genes", "and", "their", "respective", "values", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/cbio_client.py#L136-L193
train
sorgerlab/indra
indra/databases/cbio_client.py
get_num_sequenced
def get_num_sequenced(study_id): """Return number of sequenced tumors for given study. This is useful for calculating mutation statistics in terms of the prevalence of certain mutations within a type of cancer. Parameters ---------- study_id : str The ID of the cBio study. Exam...
python
def get_num_sequenced(study_id): """Return number of sequenced tumors for given study. This is useful for calculating mutation statistics in terms of the prevalence of certain mutations within a type of cancer. Parameters ---------- study_id : str The ID of the cBio study. Exam...
[ "def", "get_num_sequenced", "(", "study_id", ")", ":", "data", "=", "{", "'cmd'", ":", "'getCaseLists'", ",", "'cancer_study_id'", ":", "study_id", "}", "df", "=", "send_request", "(", "**", "data", ")", "if", "df", ".", "empty", ":", "return", "0", "row...
Return number of sequenced tumors for given study. This is useful for calculating mutation statistics in terms of the prevalence of certain mutations within a type of cancer. Parameters ---------- study_id : str The ID of the cBio study. Example: 'paad_icgc' Returns ------...
[ "Return", "number", "of", "sequenced", "tumors", "for", "given", "study", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/cbio_client.py#L196-L220
train
sorgerlab/indra
indra/databases/cbio_client.py
get_cancer_studies
def get_cancer_studies(study_filter=None): """Return a list of cancer study identifiers, optionally filtered. There are typically multiple studies for a given type of cancer and a filter can be used to constrain the returned list. Parameters ---------- study_filter : Optional[str] A st...
python
def get_cancer_studies(study_filter=None): """Return a list of cancer study identifiers, optionally filtered. There are typically multiple studies for a given type of cancer and a filter can be used to constrain the returned list. Parameters ---------- study_filter : Optional[str] A st...
[ "def", "get_cancer_studies", "(", "study_filter", "=", "None", ")", ":", "data", "=", "{", "'cmd'", ":", "'getCancerStudies'", "}", "df", "=", "send_request", "(", "**", "data", ")", "res", "=", "_filter_data_frame", "(", "df", ",", "[", "'cancer_study_id'",...
Return a list of cancer study identifiers, optionally filtered. There are typically multiple studies for a given type of cancer and a filter can be used to constrain the returned list. Parameters ---------- study_filter : Optional[str] A string used to filter the study IDs to return. Examp...
[ "Return", "a", "list", "of", "cancer", "study", "identifiers", "optionally", "filtered", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/cbio_client.py#L261-L285
train
sorgerlab/indra
indra/databases/cbio_client.py
get_cancer_types
def get_cancer_types(cancer_filter=None): """Return a list of cancer types, optionally filtered. Parameters ---------- cancer_filter : Optional[str] A string used to filter cancer types. Its value is the name or part of the name of a type of cancer. Example: "melanoma", "pancrea...
python
def get_cancer_types(cancer_filter=None): """Return a list of cancer types, optionally filtered. Parameters ---------- cancer_filter : Optional[str] A string used to filter cancer types. Its value is the name or part of the name of a type of cancer. Example: "melanoma", "pancrea...
[ "def", "get_cancer_types", "(", "cancer_filter", "=", "None", ")", ":", "data", "=", "{", "'cmd'", ":", "'getTypesOfCancer'", "}", "df", "=", "send_request", "(", "**", "data", ")", "res", "=", "_filter_data_frame", "(", "df", ",", "[", "'type_of_cancer_id'"...
Return a list of cancer types, optionally filtered. Parameters ---------- cancer_filter : Optional[str] A string used to filter cancer types. Its value is the name or part of the name of a type of cancer. Example: "melanoma", "pancreatic", "non-small cell lung" Returns ----...
[ "Return", "a", "list", "of", "cancer", "types", "optionally", "filtered", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/cbio_client.py#L288-L309
train
sorgerlab/indra
indra/databases/cbio_client.py
get_ccle_mutations
def get_ccle_mutations(gene_list, cell_lines, mutation_type=None): """Return a dict of mutations in given genes and cell lines from CCLE. This is a specialized call to get_mutations tailored to CCLE cell lines. Parameters ---------- gene_list : list[str] A list of HGNC gene symbols to get ...
python
def get_ccle_mutations(gene_list, cell_lines, mutation_type=None): """Return a dict of mutations in given genes and cell lines from CCLE. This is a specialized call to get_mutations tailored to CCLE cell lines. Parameters ---------- gene_list : list[str] A list of HGNC gene symbols to get ...
[ "def", "get_ccle_mutations", "(", "gene_list", ",", "cell_lines", ",", "mutation_type", "=", "None", ")", ":", "mutations", "=", "{", "cl", ":", "{", "g", ":", "[", "]", "for", "g", "in", "gene_list", "}", "for", "cl", "in", "cell_lines", "}", "for", ...
Return a dict of mutations in given genes and cell lines from CCLE. This is a specialized call to get_mutations tailored to CCLE cell lines. Parameters ---------- gene_list : list[str] A list of HGNC gene symbols to get mutations in cell_lines : list[str] A list of CCLE cell line n...
[ "Return", "a", "dict", "of", "mutations", "in", "given", "genes", "and", "cell", "lines", "from", "CCLE", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/cbio_client.py#L312-L347
train
sorgerlab/indra
indra/databases/cbio_client.py
get_ccle_lines_for_mutation
def get_ccle_lines_for_mutation(gene, amino_acid_change): """Return cell lines with a given point mutation in a given gene. Checks which cell lines in CCLE have a particular point mutation in a given gene and return their names in a list. Parameters ---------- gene : str The HGNC symbo...
python
def get_ccle_lines_for_mutation(gene, amino_acid_change): """Return cell lines with a given point mutation in a given gene. Checks which cell lines in CCLE have a particular point mutation in a given gene and return their names in a list. Parameters ---------- gene : str The HGNC symbo...
[ "def", "get_ccle_lines_for_mutation", "(", "gene", ",", "amino_acid_change", ")", ":", "data", "=", "{", "'cmd'", ":", "'getMutationData'", ",", "'case_set_id'", ":", "ccle_study", ",", "'genetic_profile_id'", ":", "ccle_study", "+", "'_mutations'", ",", "'gene_list...
Return cell lines with a given point mutation in a given gene. Checks which cell lines in CCLE have a particular point mutation in a given gene and return their names in a list. Parameters ---------- gene : str The HGNC symbol of the mutated gene in whose product the amino acid cha...
[ "Return", "cell", "lines", "with", "a", "given", "point", "mutation", "in", "a", "given", "gene", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/cbio_client.py#L350-L377
train
sorgerlab/indra
indra/databases/cbio_client.py
get_ccle_cna
def get_ccle_cna(gene_list, cell_lines): """Return a dict of CNAs in given genes and cell lines from CCLE. CNA values correspond to the following alterations -2 = homozygous deletion -1 = hemizygous deletion 0 = neutral / no change 1 = gain 2 = high level amplification Parameters ...
python
def get_ccle_cna(gene_list, cell_lines): """Return a dict of CNAs in given genes and cell lines from CCLE. CNA values correspond to the following alterations -2 = homozygous deletion -1 = hemizygous deletion 0 = neutral / no change 1 = gain 2 = high level amplification Parameters ...
[ "def", "get_ccle_cna", "(", "gene_list", ",", "cell_lines", ")", ":", "profile_data", "=", "get_profile_data", "(", "ccle_study", ",", "gene_list", ",", "'COPY_NUMBER_ALTERATION'", ",", "'all'", ")", "profile_data", "=", "dict", "(", "(", "key", ",", "value", ...
Return a dict of CNAs in given genes and cell lines from CCLE. CNA values correspond to the following alterations -2 = homozygous deletion -1 = hemizygous deletion 0 = neutral / no change 1 = gain 2 = high level amplification Parameters ---------- gene_list : list[str] ...
[ "Return", "a", "dict", "of", "CNAs", "in", "given", "genes", "and", "cell", "lines", "from", "CCLE", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/cbio_client.py#L380-L412
train
sorgerlab/indra
indra/databases/cbio_client.py
get_ccle_mrna
def get_ccle_mrna(gene_list, cell_lines): """Return a dict of mRNA amounts in given genes and cell lines from CCLE. Parameters ---------- gene_list : list[str] A list of HGNC gene symbols to get mRNA amounts for. cell_lines : list[str] A list of CCLE cell line names to get mRNA amou...
python
def get_ccle_mrna(gene_list, cell_lines): """Return a dict of mRNA amounts in given genes and cell lines from CCLE. Parameters ---------- gene_list : list[str] A list of HGNC gene symbols to get mRNA amounts for. cell_lines : list[str] A list of CCLE cell line names to get mRNA amou...
[ "def", "get_ccle_mrna", "(", "gene_list", ",", "cell_lines", ")", ":", "gene_list_str", "=", "','", ".", "join", "(", "gene_list", ")", "data", "=", "{", "'cmd'", ":", "'getProfileData'", ",", "'case_set_id'", ":", "ccle_study", "+", "'_mrna'", ",", "'geneti...
Return a dict of mRNA amounts in given genes and cell lines from CCLE. Parameters ---------- gene_list : list[str] A list of HGNC gene symbols to get mRNA amounts for. cell_lines : list[str] A list of CCLE cell line names to get mRNA amounts for. Returns ------- mrna_amount...
[ "Return", "a", "dict", "of", "mRNA", "amounts", "in", "given", "genes", "and", "cell", "lines", "from", "CCLE", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/cbio_client.py#L415-L452
train
sorgerlab/indra
indra/databases/cbio_client.py
_filter_data_frame
def _filter_data_frame(df, data_col, filter_col, filter_str=None): """Return a filtered data frame as a dictionary.""" if filter_str is not None: relevant_cols = data_col + [filter_col] df.dropna(inplace=True, subset=relevant_cols) row_filter = df[filter_col].str.contains(filter_str, cas...
python
def _filter_data_frame(df, data_col, filter_col, filter_str=None): """Return a filtered data frame as a dictionary.""" if filter_str is not None: relevant_cols = data_col + [filter_col] df.dropna(inplace=True, subset=relevant_cols) row_filter = df[filter_col].str.contains(filter_str, cas...
[ "def", "_filter_data_frame", "(", "df", ",", "data_col", ",", "filter_col", ",", "filter_str", "=", "None", ")", ":", "if", "filter_str", "is", "not", "None", ":", "relevant_cols", "=", "data_col", "+", "[", "filter_col", "]", "df", ".", "dropna", "(", "...
Return a filtered data frame as a dictionary.
[ "Return", "a", "filtered", "data", "frame", "as", "a", "dictionary", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/cbio_client.py#L455-L464
train
sorgerlab/indra
rest_api/api.py
allow_cors
def allow_cors(func): """This is a decorator which enable CORS for the specified endpoint.""" def wrapper(*args, **kwargs): response.headers['Access-Control-Allow-Origin'] = '*' response.headers['Access-Control-Allow-Methods'] = \ 'PUT, GET, POST, DELETE, OPTIONS' response.he...
python
def allow_cors(func): """This is a decorator which enable CORS for the specified endpoint.""" def wrapper(*args, **kwargs): response.headers['Access-Control-Allow-Origin'] = '*' response.headers['Access-Control-Allow-Methods'] = \ 'PUT, GET, POST, DELETE, OPTIONS' response.he...
[ "def", "allow_cors", "(", "func", ")", ":", "def", "wrapper", "(", "*", "args", ",", "**", "kwargs", ")", ":", "response", ".", "headers", "[", "'Access-Control-Allow-Origin'", "]", "=", "'*'", "response", ".", "headers", "[", "'Access-Control-Allow-Methods'",...
This is a decorator which enable CORS for the specified endpoint.
[ "This", "is", "a", "decorator", "which", "enable", "CORS", "for", "the", "specified", "endpoint", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L50-L59
train
sorgerlab/indra
rest_api/api.py
trips_process_text
def trips_process_text(): """Process text with TRIPS and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) text = body.get('text') tp = trips.process_text(text) return _stmts_from_proc(tp)
python
def trips_process_text(): """Process text with TRIPS and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) text = body.get('text') tp = trips.process_text(text) return _stmts_from_proc(tp)
[ "def", "trips_process_text", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "loa...
Process text with TRIPS and return INDRA Statements.
[ "Process", "text", "with", "TRIPS", "and", "return", "INDRA", "Statements", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L76-L84
train
sorgerlab/indra
rest_api/api.py
trips_process_xml
def trips_process_xml(): """Process TRIPS EKB XML and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) xml_str = body.get('xml_str') tp = trips.process_xml(xml_str) return _stmts_from_proc...
python
def trips_process_xml(): """Process TRIPS EKB XML and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) xml_str = body.get('xml_str') tp = trips.process_xml(xml_str) return _stmts_from_proc...
[ "def", "trips_process_xml", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "load...
Process TRIPS EKB XML and return INDRA Statements.
[ "Process", "TRIPS", "EKB", "XML", "and", "return", "INDRA", "Statements", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L89-L97
train
sorgerlab/indra
rest_api/api.py
reach_process_text
def reach_process_text(): """Process text with REACH and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) text = body.get('text') offline = True if body.get('offline') else False rp = reac...
python
def reach_process_text(): """Process text with REACH and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) text = body.get('text') offline = True if body.get('offline') else False rp = reac...
[ "def", "reach_process_text", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "loa...
Process text with REACH and return INDRA Statements.
[ "Process", "text", "with", "REACH", "and", "return", "INDRA", "Statements", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L104-L113
train
sorgerlab/indra
rest_api/api.py
reach_process_json
def reach_process_json(): """Process REACH json and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) json_str = body.get('json') rp = reach.process_json_str(json_str) return _stmts_from_pr...
python
def reach_process_json(): """Process REACH json and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) json_str = body.get('json') rp = reach.process_json_str(json_str) return _stmts_from_pr...
[ "def", "reach_process_json", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "loa...
Process REACH json and return INDRA Statements.
[ "Process", "REACH", "json", "and", "return", "INDRA", "Statements", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L118-L126
train
sorgerlab/indra
rest_api/api.py
reach_process_pmc
def reach_process_pmc(): """Process PubMedCentral article and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) pmcid = body.get('pmcid') rp = reach.process_pmc(pmcid) return _stmts_from_pr...
python
def reach_process_pmc(): """Process PubMedCentral article and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) pmcid = body.get('pmcid') rp = reach.process_pmc(pmcid) return _stmts_from_pr...
[ "def", "reach_process_pmc", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "load...
Process PubMedCentral article and return INDRA Statements.
[ "Process", "PubMedCentral", "article", "and", "return", "INDRA", "Statements", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L131-L139
train
sorgerlab/indra
rest_api/api.py
bel_process_pybel_neighborhood
def bel_process_pybel_neighborhood(): """Process BEL Large Corpus neighborhood and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) genes = body.get('genes') bp = bel.process_pybel_neighborhoo...
python
def bel_process_pybel_neighborhood(): """Process BEL Large Corpus neighborhood and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) genes = body.get('genes') bp = bel.process_pybel_neighborhoo...
[ "def", "bel_process_pybel_neighborhood", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ...
Process BEL Large Corpus neighborhood and return INDRA Statements.
[ "Process", "BEL", "Large", "Corpus", "neighborhood", "and", "return", "INDRA", "Statements", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L147-L155
train
sorgerlab/indra
rest_api/api.py
bel_process_belrdf
def bel_process_belrdf(): """Process BEL RDF and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) belrdf = body.get('belrdf') bp = bel.process_belrdf(belrdf) return _stmts_from_proc(bp)
python
def bel_process_belrdf(): """Process BEL RDF and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) belrdf = body.get('belrdf') bp = bel.process_belrdf(belrdf) return _stmts_from_proc(bp)
[ "def", "bel_process_belrdf", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "loa...
Process BEL RDF and return INDRA Statements.
[ "Process", "BEL", "RDF", "and", "return", "INDRA", "Statements", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L160-L168
train
sorgerlab/indra
rest_api/api.py
biopax_process_pc_pathsbetween
def biopax_process_pc_pathsbetween(): """Process PathwayCommons paths between genes, return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) genes = body.get('genes') bp = biopax.process_pc_pathsbetw...
python
def biopax_process_pc_pathsbetween(): """Process PathwayCommons paths between genes, return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) genes = body.get('genes') bp = biopax.process_pc_pathsbetw...
[ "def", "biopax_process_pc_pathsbetween", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ...
Process PathwayCommons paths between genes, return INDRA Statements.
[ "Process", "PathwayCommons", "paths", "between", "genes", "return", "INDRA", "Statements", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L174-L182
train
sorgerlab/indra
rest_api/api.py
biopax_process_pc_pathsfromto
def biopax_process_pc_pathsfromto(): """Process PathwayCommons paths from-to genes, return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) source = body.get('source') target = body.get('target') ...
python
def biopax_process_pc_pathsfromto(): """Process PathwayCommons paths from-to genes, return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) source = body.get('source') target = body.get('target') ...
[ "def", "biopax_process_pc_pathsfromto", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ...
Process PathwayCommons paths from-to genes, return INDRA Statements.
[ "Process", "PathwayCommons", "paths", "from", "-", "to", "genes", "return", "INDRA", "Statements", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L187-L196
train
sorgerlab/indra
rest_api/api.py
biopax_process_pc_neighborhood
def biopax_process_pc_neighborhood(): """Process PathwayCommons neighborhood, return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) genes = body.get('genes') bp = biopax.process_pc_neighborhood(gen...
python
def biopax_process_pc_neighborhood(): """Process PathwayCommons neighborhood, return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) genes = body.get('genes') bp = biopax.process_pc_neighborhood(gen...
[ "def", "biopax_process_pc_neighborhood", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ...
Process PathwayCommons neighborhood, return INDRA Statements.
[ "Process", "PathwayCommons", "neighborhood", "return", "INDRA", "Statements", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L201-L209
train
sorgerlab/indra
rest_api/api.py
eidos_process_text
def eidos_process_text(): """Process text with EIDOS and return INDRA Statements.""" if request.method == 'OPTIONS': return {} req = request.body.read().decode('utf-8') body = json.loads(req) text = body.get('text') webservice = body.get('webservice') if not webservice: respo...
python
def eidos_process_text(): """Process text with EIDOS and return INDRA Statements.""" if request.method == 'OPTIONS': return {} req = request.body.read().decode('utf-8') body = json.loads(req) text = body.get('text') webservice = body.get('webservice') if not webservice: respo...
[ "def", "eidos_process_text", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "req", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "loads", ...
Process text with EIDOS and return INDRA Statements.
[ "Process", "text", "with", "EIDOS", "and", "return", "INDRA", "Statements", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L215-L228
train
sorgerlab/indra
rest_api/api.py
eidos_process_jsonld
def eidos_process_jsonld(): """Process an EIDOS JSON-LD and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) eidos_json = body.get('jsonld') ep = eidos.process_json_str(eidos_json) return ...
python
def eidos_process_jsonld(): """Process an EIDOS JSON-LD and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) eidos_json = body.get('jsonld') ep = eidos.process_json_str(eidos_json) return ...
[ "def", "eidos_process_jsonld", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "l...
Process an EIDOS JSON-LD and return INDRA Statements.
[ "Process", "an", "EIDOS", "JSON", "-", "LD", "and", "return", "INDRA", "Statements", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L233-L241
train
sorgerlab/indra
rest_api/api.py
cwms_process_text
def cwms_process_text(): """Process text with CWMS and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) text = body.get('text') cp = cwms.process_text(text) return _stmts_from_proc(cp)
python
def cwms_process_text(): """Process text with CWMS and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) text = body.get('text') cp = cwms.process_text(text) return _stmts_from_proc(cp)
[ "def", "cwms_process_text", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "load...
Process text with CWMS and return INDRA Statements.
[ "Process", "text", "with", "CWMS", "and", "return", "INDRA", "Statements", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L246-L254
train
sorgerlab/indra
rest_api/api.py
hume_process_jsonld
def hume_process_jsonld(): """Process Hume JSON-LD and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) jsonld_str = body.get('jsonld') jsonld = json.loads(jsonld_str) hp = hume.process_js...
python
def hume_process_jsonld(): """Process Hume JSON-LD and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) jsonld_str = body.get('jsonld') jsonld = json.loads(jsonld_str) hp = hume.process_js...
[ "def", "hume_process_jsonld", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "lo...
Process Hume JSON-LD and return INDRA Statements.
[ "Process", "Hume", "JSON", "-", "LD", "and", "return", "INDRA", "Statements", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L259-L268
train
sorgerlab/indra
rest_api/api.py
sofia_process_text
def sofia_process_text(): """Process text with Sofia and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) text = body.get('text') auth = body.get('auth') sp = sofia.process_text(text, auth...
python
def sofia_process_text(): """Process text with Sofia and return INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) text = body.get('text') auth = body.get('auth') sp = sofia.process_text(text, auth...
[ "def", "sofia_process_text", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "loa...
Process text with Sofia and return INDRA Statements.
[ "Process", "text", "with", "Sofia", "and", "return", "INDRA", "Statements", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L288-L297
train
sorgerlab/indra
rest_api/api.py
assemble_pysb
def assemble_pysb(): """Assemble INDRA Statements and return PySB model string.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') export_format = body.get('export_format') stmts ...
python
def assemble_pysb(): """Assemble INDRA Statements and return PySB model string.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') export_format = body.get('export_format') stmts ...
[ "def", "assemble_pysb", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "loads", ...
Assemble INDRA Statements and return PySB model string.
[ "Assemble", "INDRA", "Statements", "and", "return", "PySB", "model", "string", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L307-L342
train
sorgerlab/indra
rest_api/api.py
assemble_cx
def assemble_cx(): """Assemble INDRA Statements and return CX network json.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') stmts = stmts_from_json(stmts_json) ca = CxAssembler...
python
def assemble_cx(): """Assemble INDRA Statements and return CX network json.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') stmts = stmts_from_json(stmts_json) ca = CxAssembler...
[ "def", "assemble_cx", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "loads", ...
Assemble INDRA Statements and return CX network json.
[ "Assemble", "INDRA", "Statements", "and", "return", "CX", "network", "json", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L348-L359
train
sorgerlab/indra
rest_api/api.py
share_model_ndex
def share_model_ndex(): """Upload the model to NDEX""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_str = body.get('stmts') stmts_json = json.loads(stmts_str) stmts = stmts_from_json(stmts_json["statements"...
python
def share_model_ndex(): """Upload the model to NDEX""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_str = body.get('stmts') stmts_json = json.loads(stmts_str) stmts = stmts_from_json(stmts_json["statements"...
[ "def", "share_model_ndex", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "loads...
Upload the model to NDEX
[ "Upload", "the", "model", "to", "NDEX" ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L365-L379
train
sorgerlab/indra
rest_api/api.py
fetch_model_ndex
def fetch_model_ndex(): """Download model and associated pieces from NDEX""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) network_id = body.get('network_id') cx = process_ndex_network(network_id) network_attr = [...
python
def fetch_model_ndex(): """Download model and associated pieces from NDEX""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) network_id = body.get('network_id') cx = process_ndex_network(network_id) network_attr = [...
[ "def", "fetch_model_ndex", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "loads...
Download model and associated pieces from NDEX
[ "Download", "model", "and", "associated", "pieces", "from", "NDEX" ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L384-L401
train
sorgerlab/indra
rest_api/api.py
assemble_graph
def assemble_graph(): """Assemble INDRA Statements and return Graphviz graph dot string.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') stmts = stmts_from_json(stmts_json) ga ...
python
def assemble_graph(): """Assemble INDRA Statements and return Graphviz graph dot string.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') stmts = stmts_from_json(stmts_json) ga ...
[ "def", "assemble_graph", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "loads",...
Assemble INDRA Statements and return Graphviz graph dot string.
[ "Assemble", "INDRA", "Statements", "and", "return", "Graphviz", "graph", "dot", "string", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L407-L418
train
sorgerlab/indra
rest_api/api.py
assemble_cyjs
def assemble_cyjs(): """Assemble INDRA Statements and return Cytoscape JS network.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') stmts = stmts_from_json(stmts_json) cja = CyJ...
python
def assemble_cyjs(): """Assemble INDRA Statements and return Cytoscape JS network.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') stmts = stmts_from_json(stmts_json) cja = CyJ...
[ "def", "assemble_cyjs", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "loads", ...
Assemble INDRA Statements and return Cytoscape JS network.
[ "Assemble", "INDRA", "Statements", "and", "return", "Cytoscape", "JS", "network", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L424-L436
train
sorgerlab/indra
rest_api/api.py
assemble_english
def assemble_english(): """Assemble each statement into """ if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') stmts = stmts_from_json(stmts_json) sentences = {} for st in stmts:...
python
def assemble_english(): """Assemble each statement into """ if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') stmts = stmts_from_json(stmts_json) sentences = {} for st in stmts:...
[ "def", "assemble_english", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "loads...
Assemble each statement into
[ "Assemble", "each", "statement", "into" ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L442-L457
train
sorgerlab/indra
rest_api/api.py
assemble_loopy
def assemble_loopy(): """Assemble INDRA Statements into a Loopy model using SIF Assembler.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') stmts = stmts_from_json(stmts_json) s...
python
def assemble_loopy(): """Assemble INDRA Statements into a Loopy model using SIF Assembler.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') stmts = stmts_from_json(stmts_json) s...
[ "def", "assemble_loopy", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "loads",...
Assemble INDRA Statements into a Loopy model using SIF Assembler.
[ "Assemble", "INDRA", "Statements", "into", "a", "Loopy", "model", "using", "SIF", "Assembler", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L462-L474
train
sorgerlab/indra
rest_api/api.py
get_ccle_mrna_levels
def get_ccle_mrna_levels(): """Get CCLE mRNA amounts using cBioClient""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) gene_list = body.get('gene_list') cell_lines = body.get('cell_lines') mrna_amounts = cbio_clie...
python
def get_ccle_mrna_levels(): """Get CCLE mRNA amounts using cBioClient""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) gene_list = body.get('gene_list') cell_lines = body.get('cell_lines') mrna_amounts = cbio_clie...
[ "def", "get_ccle_mrna_levels", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "l...
Get CCLE mRNA amounts using cBioClient
[ "Get", "CCLE", "mRNA", "amounts", "using", "cBioClient" ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L480-L490
train
sorgerlab/indra
rest_api/api.py
get_ccle_mutations
def get_ccle_mutations(): """Get CCLE mutations returns the amino acid changes for a given list of genes and cell lines """ if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) gene_list = body.get('gene_list') cell_...
python
def get_ccle_mutations(): """Get CCLE mutations returns the amino acid changes for a given list of genes and cell lines """ if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) gene_list = body.get('gene_list') cell_...
[ "def", "get_ccle_mutations", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "loa...
Get CCLE mutations returns the amino acid changes for a given list of genes and cell lines
[ "Get", "CCLE", "mutations", "returns", "the", "amino", "acid", "changes", "for", "a", "given", "list", "of", "genes", "and", "cell", "lines" ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L517-L529
train
sorgerlab/indra
rest_api/api.py
map_grounding
def map_grounding(): """Map grounding on a list of INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') stmts = stmts_from_json(stmts_json) stmts_out = ac.map_grou...
python
def map_grounding(): """Map grounding on a list of INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') stmts = stmts_from_json(stmts_json) stmts_out = ac.map_grou...
[ "def", "map_grounding", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "loads", ...
Map grounding on a list of INDRA Statements.
[ "Map", "grounding", "on", "a", "list", "of", "INDRA", "Statements", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L534-L543
train
sorgerlab/indra
rest_api/api.py
run_preassembly
def run_preassembly(): """Run preassembly on a list of INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') stmts = stmts_from_json(stmts_json) scorer = body.get('...
python
def run_preassembly(): """Run preassembly on a list of INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') stmts = stmts_from_json(stmts_json) scorer = body.get('...
[ "def", "run_preassembly", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "loads"...
Run preassembly on a list of INDRA Statements.
[ "Run", "preassembly", "on", "a", "list", "of", "INDRA", "Statements", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L562-L578
train
sorgerlab/indra
rest_api/api.py
map_ontologies
def map_ontologies(): """Run ontology mapping on a list of INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') stmts = stmts_from_json(stmts_json) om = OntologyMa...
python
def map_ontologies(): """Run ontology mapping on a list of INDRA Statements.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') stmts = stmts_from_json(stmts_json) om = OntologyMa...
[ "def", "map_ontologies", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "loads",...
Run ontology mapping on a list of INDRA Statements.
[ "Run", "ontology", "mapping", "on", "a", "list", "of", "INDRA", "Statements", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L583-L593
train
sorgerlab/indra
rest_api/api.py
filter_by_type
def filter_by_type(): """Filter to a given INDRA Statement type.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') stmt_type_str = body.get('type') stmt_type_str = stmt_type_str....
python
def filter_by_type(): """Filter to a given INDRA Statement type.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') stmt_type_str = body.get('type') stmt_type_str = stmt_type_str....
[ "def", "filter_by_type", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "loads",...
Filter to a given INDRA Statement type.
[ "Filter", "to", "a", "given", "INDRA", "Statement", "type", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L598-L610
train
sorgerlab/indra
rest_api/api.py
filter_grounded_only
def filter_grounded_only(): """Filter to grounded Statements only.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') score_threshold = body.get('score_threshold') if score_thresh...
python
def filter_grounded_only(): """Filter to grounded Statements only.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') score_threshold = body.get('score_threshold') if score_thresh...
[ "def", "filter_grounded_only", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "l...
Filter to grounded Statements only.
[ "Filter", "to", "grounded", "Statements", "only", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L615-L627
train
sorgerlab/indra
rest_api/api.py
filter_belief
def filter_belief(): """Filter to beliefs above a given threshold.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') belief_cutoff = body.get('belief_cutoff') if belief_cutoff is...
python
def filter_belief(): """Filter to beliefs above a given threshold.""" if request.method == 'OPTIONS': return {} response = request.body.read().decode('utf-8') body = json.loads(response) stmts_json = body.get('statements') belief_cutoff = body.get('belief_cutoff') if belief_cutoff is...
[ "def", "filter_belief", "(", ")", ":", "if", "request", ".", "method", "==", "'OPTIONS'", ":", "return", "{", "}", "response", "=", "request", ".", "body", ".", "read", "(", ")", ".", "decode", "(", "'utf-8'", ")", "body", "=", "json", ".", "loads", ...
Filter to beliefs above a given threshold.
[ "Filter", "to", "beliefs", "above", "a", "given", "threshold", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/rest_api/api.py#L632-L644
train
sorgerlab/indra
indra/util/get_version.py
get_git_info
def get_git_info(): """Get a dict with useful git info.""" start_dir = abspath(curdir) try: chdir(dirname(abspath(__file__))) re_patt_str = (r'commit\s+(?P<commit_hash>\w+).*?Author:\s+' r'(?P<author_name>.*?)\s+<(?P<author_email>.*?)>\s+Date:\s+' ...
python
def get_git_info(): """Get a dict with useful git info.""" start_dir = abspath(curdir) try: chdir(dirname(abspath(__file__))) re_patt_str = (r'commit\s+(?P<commit_hash>\w+).*?Author:\s+' r'(?P<author_name>.*?)\s+<(?P<author_email>.*?)>\s+Date:\s+' ...
[ "def", "get_git_info", "(", ")", ":", "start_dir", "=", "abspath", "(", "curdir", ")", "try", ":", "chdir", "(", "dirname", "(", "abspath", "(", "__file__", ")", ")", ")", "re_patt_str", "=", "(", "r'commit\\s+(?P<commit_hash>\\w+).*?Author:\\s+'", "r'(?P<author...
Get a dict with useful git info.
[ "Get", "a", "dict", "with", "useful", "git", "info", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/get_version.py#L18-L37
train
sorgerlab/indra
indra/util/get_version.py
get_version
def get_version(with_git_hash=True, refresh_hash=False): """Get an indra version string, including a git hash.""" version = __version__ if with_git_hash: global INDRA_GITHASH if INDRA_GITHASH is None or refresh_hash: with open(devnull, 'w') as nul: try: ...
python
def get_version(with_git_hash=True, refresh_hash=False): """Get an indra version string, including a git hash.""" version = __version__ if with_git_hash: global INDRA_GITHASH if INDRA_GITHASH is None or refresh_hash: with open(devnull, 'w') as nul: try: ...
[ "def", "get_version", "(", "with_git_hash", "=", "True", ",", "refresh_hash", "=", "False", ")", ":", "version", "=", "__version__", "if", "with_git_hash", ":", "global", "INDRA_GITHASH", "if", "INDRA_GITHASH", "is", "None", "or", "refresh_hash", ":", "with", ...
Get an indra version string, including a git hash.
[ "Get", "an", "indra", "version", "string", "including", "a", "git", "hash", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/util/get_version.py#L40-L54
train
sorgerlab/indra
indra/assemblers/cx/assembler.py
_fix_evidence_text
def _fix_evidence_text(txt): """Eliminate some symbols to have cleaner supporting text.""" txt = re.sub('[ ]?\( xref \)', '', txt) # This is to make [ xref ] become [] to match the two readers txt = re.sub('\[ xref \]', '[]', txt) txt = re.sub('[\(]?XREF_BIBR[\)]?[,]?', '', txt) txt = re.sub('[\...
python
def _fix_evidence_text(txt): """Eliminate some symbols to have cleaner supporting text.""" txt = re.sub('[ ]?\( xref \)', '', txt) # This is to make [ xref ] become [] to match the two readers txt = re.sub('\[ xref \]', '[]', txt) txt = re.sub('[\(]?XREF_BIBR[\)]?[,]?', '', txt) txt = re.sub('[\...
[ "def", "_fix_evidence_text", "(", "txt", ")", ":", "txt", "=", "re", ".", "sub", "(", "'[ ]?\\( xref \\)'", ",", "''", ",", "txt", ")", "txt", "=", "re", ".", "sub", "(", "'\\[ xref \\]'", ",", "'[]'", ",", "txt", ")", "txt", "=", "re", ".", "sub",...
Eliminate some symbols to have cleaner supporting text.
[ "Eliminate", "some", "symbols", "to", "have", "cleaner", "supporting", "text", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/cx/assembler.py#L562-L571
train
sorgerlab/indra
indra/assemblers/cx/assembler.py
CxAssembler.make_model
def make_model(self, add_indra_json=True): """Assemble the CX network from the collected INDRA Statements. This method assembles a CX network from the set of INDRA Statements. The assembled network is set as the assembler's cx argument. Parameters ---------- add_indra_j...
python
def make_model(self, add_indra_json=True): """Assemble the CX network from the collected INDRA Statements. This method assembles a CX network from the set of INDRA Statements. The assembled network is set as the assembler's cx argument. Parameters ---------- add_indra_j...
[ "def", "make_model", "(", "self", ",", "add_indra_json", "=", "True", ")", ":", "self", ".", "add_indra_json", "=", "add_indra_json", "for", "stmt", "in", "self", ".", "statements", ":", "if", "isinstance", "(", "stmt", ",", "Modification", ")", ":", "self...
Assemble the CX network from the collected INDRA Statements. This method assembles a CX network from the set of INDRA Statements. The assembled network is set as the assembler's cx argument. Parameters ---------- add_indra_json : Optional[bool] If True, the INDRA St...
[ "Assemble", "the", "CX", "network", "from", "the", "collected", "INDRA", "Statements", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/cx/assembler.py#L75-L115
train
sorgerlab/indra
indra/assemblers/cx/assembler.py
CxAssembler.print_cx
def print_cx(self, pretty=True): """Return the assembled CX network as a json string. Parameters ---------- pretty : bool If True, the CX string is formatted with indentation (for human viewing) otherwise no indentation is used. Returns ------- ...
python
def print_cx(self, pretty=True): """Return the assembled CX network as a json string. Parameters ---------- pretty : bool If True, the CX string is formatted with indentation (for human viewing) otherwise no indentation is used. Returns ------- ...
[ "def", "print_cx", "(", "self", ",", "pretty", "=", "True", ")", ":", "def", "_get_aspect_metadata", "(", "aspect", ")", ":", "count", "=", "len", "(", "self", ".", "cx", ".", "get", "(", "aspect", ")", ")", "if", "self", ".", "cx", ".", "get", "...
Return the assembled CX network as a json string. Parameters ---------- pretty : bool If True, the CX string is formatted with indentation (for human viewing) otherwise no indentation is used. Returns ------- json_str : str A json for...
[ "Return", "the", "assembled", "CX", "network", "as", "a", "json", "string", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/cx/assembler.py#L117-L158
train
sorgerlab/indra
indra/assemblers/cx/assembler.py
CxAssembler.save_model
def save_model(self, file_name='model.cx'): """Save the assembled CX network in a file. Parameters ---------- file_name : Optional[str] The name of the file to save the CX network to. Default: model.cx """ with open(file_name, 'wt') as fh: cx_str ...
python
def save_model(self, file_name='model.cx'): """Save the assembled CX network in a file. Parameters ---------- file_name : Optional[str] The name of the file to save the CX network to. Default: model.cx """ with open(file_name, 'wt') as fh: cx_str ...
[ "def", "save_model", "(", "self", ",", "file_name", "=", "'model.cx'", ")", ":", "with", "open", "(", "file_name", ",", "'wt'", ")", "as", "fh", ":", "cx_str", "=", "self", ".", "print_cx", "(", ")", "fh", ".", "write", "(", "cx_str", ")" ]
Save the assembled CX network in a file. Parameters ---------- file_name : Optional[str] The name of the file to save the CX network to. Default: model.cx
[ "Save", "the", "assembled", "CX", "network", "in", "a", "file", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/cx/assembler.py#L160-L170
train
sorgerlab/indra
indra/assemblers/cx/assembler.py
CxAssembler.set_context
def set_context(self, cell_type): """Set protein expression data and mutational status as node attribute This method uses :py:mod:`indra.databases.context_client` to get protein expression levels and mutational status for a given cell type and set a node attribute for proteins according...
python
def set_context(self, cell_type): """Set protein expression data and mutational status as node attribute This method uses :py:mod:`indra.databases.context_client` to get protein expression levels and mutational status for a given cell type and set a node attribute for proteins according...
[ "def", "set_context", "(", "self", ",", "cell_type", ")", ":", "node_names", "=", "[", "node", "[", "'n'", "]", "for", "node", "in", "self", ".", "cx", "[", "'nodes'", "]", "]", "res_expr", "=", "context_client", ".", "get_protein_expression", "(", "node...
Set protein expression data and mutational status as node attribute This method uses :py:mod:`indra.databases.context_client` to get protein expression levels and mutational status for a given cell type and set a node attribute for proteins accordingly. Parameters ---------- ...
[ "Set", "protein", "expression", "data", "and", "mutational", "status", "as", "node", "attribute" ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/cx/assembler.py#L212-L265
train
sorgerlab/indra
indra/databases/biogrid_client.py
get_publications
def get_publications(gene_names, save_json_name=None): """Return evidence publications for interaction between the given genes. Parameters ---------- gene_names : list[str] A list of gene names (HGNC symbols) to query interactions between. Currently supports exactly two genes only. ...
python
def get_publications(gene_names, save_json_name=None): """Return evidence publications for interaction between the given genes. Parameters ---------- gene_names : list[str] A list of gene names (HGNC symbols) to query interactions between. Currently supports exactly two genes only. ...
[ "def", "get_publications", "(", "gene_names", ",", "save_json_name", "=", "None", ")", ":", "if", "len", "(", "gene_names", ")", "!=", "2", ":", "logger", ".", "warning", "(", "'Other than 2 gene names given.'", ")", "return", "[", "]", "res_dict", "=", "_se...
Return evidence publications for interaction between the given genes. Parameters ---------- gene_names : list[str] A list of gene names (HGNC symbols) to query interactions between. Currently supports exactly two genes only. save_json_name : Optional[str] A file name to save the...
[ "Return", "evidence", "publications", "for", "interaction", "between", "the", "given", "genes", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/biogrid_client.py#L90-L120
train
sorgerlab/indra
indra/assemblers/pysb/common.py
_n
def _n(name): """Return valid PySB name.""" n = name.encode('ascii', errors='ignore').decode('ascii') n = re.sub('[^A-Za-z0-9_]', '_', n) n = re.sub(r'(^[0-9].*)', r'p\1', n) return n
python
def _n(name): """Return valid PySB name.""" n = name.encode('ascii', errors='ignore').decode('ascii') n = re.sub('[^A-Za-z0-9_]', '_', n) n = re.sub(r'(^[0-9].*)', r'p\1', n) return n
[ "def", "_n", "(", "name", ")", ":", "n", "=", "name", ".", "encode", "(", "'ascii'", ",", "errors", "=", "'ignore'", ")", ".", "decode", "(", "'ascii'", ")", "n", "=", "re", ".", "sub", "(", "'[^A-Za-z0-9_]'", ",", "'_'", ",", "n", ")", "n", "=...
Return valid PySB name.
[ "Return", "valid", "PySB", "name", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/assemblers/pysb/common.py#L5-L10
train
sorgerlab/indra
indra/sources/indra_db_rest/processor.py
IndraDBRestProcessor.get_hash_statements_dict
def get_hash_statements_dict(self): """Return a dict of Statements keyed by hashes.""" res = {stmt_hash: stmts_from_json([stmt])[0] for stmt_hash, stmt in self.__statement_jsons.items()} return res
python
def get_hash_statements_dict(self): """Return a dict of Statements keyed by hashes.""" res = {stmt_hash: stmts_from_json([stmt])[0] for stmt_hash, stmt in self.__statement_jsons.items()} return res
[ "def", "get_hash_statements_dict", "(", "self", ")", ":", "res", "=", "{", "stmt_hash", ":", "stmts_from_json", "(", "[", "stmt", "]", ")", "[", "0", "]", "for", "stmt_hash", ",", "stmt", "in", "self", ".", "__statement_jsons", ".", "items", "(", ")", ...
Return a dict of Statements keyed by hashes.
[ "Return", "a", "dict", "of", "Statements", "keyed", "by", "hashes", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/indra_db_rest/processor.py#L159-L163
train
sorgerlab/indra
indra/sources/indra_db_rest/processor.py
IndraDBRestProcessor.merge_results
def merge_results(self, other_processor): """Merge the results of this processor with those of another.""" if not isinstance(other_processor, self.__class__): raise ValueError("Can only extend with another %s instance." % self.__class__.__name__) self.sta...
python
def merge_results(self, other_processor): """Merge the results of this processor with those of another.""" if not isinstance(other_processor, self.__class__): raise ValueError("Can only extend with another %s instance." % self.__class__.__name__) self.sta...
[ "def", "merge_results", "(", "self", ",", "other_processor", ")", ":", "if", "not", "isinstance", "(", "other_processor", ",", "self", ".", "__class__", ")", ":", "raise", "ValueError", "(", "\"Can only extend with another %s instance.\"", "%", "self", ".", "__cla...
Merge the results of this processor with those of another.
[ "Merge", "the", "results", "of", "this", "processor", "with", "those", "of", "another", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/indra_db_rest/processor.py#L165-L179
train
sorgerlab/indra
indra/sources/indra_db_rest/processor.py
IndraDBRestProcessor.wait_until_done
def wait_until_done(self, timeout=None): """Wait for the background load to complete.""" start = datetime.now() if not self.__th: raise IndraDBRestResponseError("There is no thread waiting to " "complete.") self.__th.join(timeout) ...
python
def wait_until_done(self, timeout=None): """Wait for the background load to complete.""" start = datetime.now() if not self.__th: raise IndraDBRestResponseError("There is no thread waiting to " "complete.") self.__th.join(timeout) ...
[ "def", "wait_until_done", "(", "self", ",", "timeout", "=", "None", ")", ":", "start", "=", "datetime", ".", "now", "(", ")", "if", "not", "self", ".", "__th", ":", "raise", "IndraDBRestResponseError", "(", "\"There is no thread waiting to \"", "\"complete.\"", ...
Wait for the background load to complete.
[ "Wait", "for", "the", "background", "load", "to", "complete", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/indra_db_rest/processor.py#L181-L198
train
sorgerlab/indra
indra/sources/indra_db_rest/processor.py
IndraDBRestProcessor._merge_json
def _merge_json(self, stmt_json, ev_counts): """Merge these statement jsons with new jsons.""" # Where there is overlap, there _should_ be agreement. self.__evidence_counts.update(ev_counts) for k, sj in stmt_json.items(): if k not in self.__statement_jsons: ...
python
def _merge_json(self, stmt_json, ev_counts): """Merge these statement jsons with new jsons.""" # Where there is overlap, there _should_ be agreement. self.__evidence_counts.update(ev_counts) for k, sj in stmt_json.items(): if k not in self.__statement_jsons: ...
[ "def", "_merge_json", "(", "self", ",", "stmt_json", ",", "ev_counts", ")", ":", "self", ".", "__evidence_counts", ".", "update", "(", "ev_counts", ")", "for", "k", ",", "sj", "in", "stmt_json", ".", "items", "(", ")", ":", "if", "k", "not", "in", "s...
Merge these statement jsons with new jsons.
[ "Merge", "these", "statement", "jsons", "with", "new", "jsons", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/indra_db_rest/processor.py#L200-L217
train
sorgerlab/indra
indra/sources/indra_db_rest/processor.py
IndraDBRestProcessor._run_queries
def _run_queries(self, agent_strs, stmt_types, params, persist): """Use paging to get all statements requested.""" self._query_over_statement_types(agent_strs, stmt_types, params) assert len(self.__done_dict) == len(stmt_types) \ or None in self.__done_dict.keys(), \ "Do...
python
def _run_queries(self, agent_strs, stmt_types, params, persist): """Use paging to get all statements requested.""" self._query_over_statement_types(agent_strs, stmt_types, params) assert len(self.__done_dict) == len(stmt_types) \ or None in self.__done_dict.keys(), \ "Do...
[ "def", "_run_queries", "(", "self", ",", "agent_strs", ",", "stmt_types", ",", "params", ",", "persist", ")", ":", "self", ".", "_query_over_statement_types", "(", "agent_strs", ",", "stmt_types", ",", "params", ")", "assert", "len", "(", "self", ".", "__don...
Use paging to get all statements requested.
[ "Use", "paging", "to", "get", "all", "statements", "requested", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/indra_db_rest/processor.py#L274-L293
train
sorgerlab/indra
indra/literature/pubmed_client.py
get_ids
def get_ids(search_term, **kwargs): """Search Pubmed for paper IDs given a search term. Search options can be passed as keyword arguments, some of which are custom keywords identified by this function, while others are passed on as parameters for the request to the PubMed web service For details on...
python
def get_ids(search_term, **kwargs): """Search Pubmed for paper IDs given a search term. Search options can be passed as keyword arguments, some of which are custom keywords identified by this function, while others are passed on as parameters for the request to the PubMed web service For details on...
[ "def", "get_ids", "(", "search_term", ",", "**", "kwargs", ")", ":", "use_text_word", "=", "kwargs", ".", "pop", "(", "'use_text_word'", ",", "True", ")", "if", "use_text_word", ":", "search_term", "+=", "'[tw]'", "params", "=", "{", "'term'", ":", "search...
Search Pubmed for paper IDs given a search term. Search options can be passed as keyword arguments, some of which are custom keywords identified by this function, while others are passed on as parameters for the request to the PubMed web service For details on parameters that can be used in PubMed sear...
[ "Search", "Pubmed", "for", "paper", "IDs", "given", "a", "search", "term", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/pubmed_client.py#L41-L103
train
sorgerlab/indra
indra/literature/pubmed_client.py
get_id_count
def get_id_count(search_term): """Get the number of citations in Pubmed for a search query. Parameters ---------- search_term : str A term for which the PubMed search should be performed. Returns ------- int or None The number of citations for the query, or None if the quer...
python
def get_id_count(search_term): """Get the number of citations in Pubmed for a search query. Parameters ---------- search_term : str A term for which the PubMed search should be performed. Returns ------- int or None The number of citations for the query, or None if the quer...
[ "def", "get_id_count", "(", "search_term", ")", ":", "params", "=", "{", "'term'", ":", "search_term", ",", "'rettype'", ":", "'count'", ",", "'db'", ":", "'pubmed'", "}", "tree", "=", "send_request", "(", "pubmed_search", ",", "params", ")", "if", "tree",...
Get the number of citations in Pubmed for a search query. Parameters ---------- search_term : str A term for which the PubMed search should be performed. Returns ------- int or None The number of citations for the query, or None if the query fails.
[ "Get", "the", "number", "of", "citations", "in", "Pubmed", "for", "a", "search", "query", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/pubmed_client.py#L106-L127
train
sorgerlab/indra
indra/literature/pubmed_client.py
get_ids_for_gene
def get_ids_for_gene(hgnc_name, **kwargs): """Get the curated set of articles for a gene in the Entrez database. Search parameters for the Gene database query can be passed in as keyword arguments. Parameters ---------- hgnc_name : string The HGNC name of the gene. This is used to obt...
python
def get_ids_for_gene(hgnc_name, **kwargs): """Get the curated set of articles for a gene in the Entrez database. Search parameters for the Gene database query can be passed in as keyword arguments. Parameters ---------- hgnc_name : string The HGNC name of the gene. This is used to obt...
[ "def", "get_ids_for_gene", "(", "hgnc_name", ",", "**", "kwargs", ")", ":", "hgnc_id", "=", "hgnc_client", ".", "get_hgnc_id", "(", "hgnc_name", ")", "if", "hgnc_id", "is", "None", ":", "raise", "ValueError", "(", "'Invalid HGNC name.'", ")", "entrez_id", "=",...
Get the curated set of articles for a gene in the Entrez database. Search parameters for the Gene database query can be passed in as keyword arguments. Parameters ---------- hgnc_name : string The HGNC name of the gene. This is used to obtain the HGNC ID (using the hgnc_client mod...
[ "Get", "the", "curated", "set", "of", "articles", "for", "a", "gene", "in", "the", "Entrez", "database", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/pubmed_client.py#L131-L170
train
sorgerlab/indra
indra/literature/pubmed_client.py
get_article_xml
def get_article_xml(pubmed_id): """Get the XML metadata for a single article from the Pubmed database. """ if pubmed_id.upper().startswith('PMID'): pubmed_id = pubmed_id[4:] params = {'db': 'pubmed', 'retmode': 'xml', 'id': pubmed_id} tree = send_request(pubmed_fe...
python
def get_article_xml(pubmed_id): """Get the XML metadata for a single article from the Pubmed database. """ if pubmed_id.upper().startswith('PMID'): pubmed_id = pubmed_id[4:] params = {'db': 'pubmed', 'retmode': 'xml', 'id': pubmed_id} tree = send_request(pubmed_fe...
[ "def", "get_article_xml", "(", "pubmed_id", ")", ":", "if", "pubmed_id", ".", "upper", "(", ")", ".", "startswith", "(", "'PMID'", ")", ":", "pubmed_id", "=", "pubmed_id", "[", "4", ":", "]", "params", "=", "{", "'db'", ":", "'pubmed'", ",", "'retmode'...
Get the XML metadata for a single article from the Pubmed database.
[ "Get", "the", "XML", "metadata", "for", "a", "single", "article", "from", "the", "Pubmed", "database", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/pubmed_client.py#L174-L186
train
sorgerlab/indra
indra/literature/pubmed_client.py
get_abstract
def get_abstract(pubmed_id, prepend_title=True): """Get the abstract of an article in the Pubmed database.""" article = get_article_xml(pubmed_id) if article is None: return None return _abstract_from_article_element(article, prepend_title)
python
def get_abstract(pubmed_id, prepend_title=True): """Get the abstract of an article in the Pubmed database.""" article = get_article_xml(pubmed_id) if article is None: return None return _abstract_from_article_element(article, prepend_title)
[ "def", "get_abstract", "(", "pubmed_id", ",", "prepend_title", "=", "True", ")", ":", "article", "=", "get_article_xml", "(", "pubmed_id", ")", "if", "article", "is", "None", ":", "return", "None", "return", "_abstract_from_article_element", "(", "article", ",",...
Get the abstract of an article in the Pubmed database.
[ "Get", "the", "abstract", "of", "an", "article", "in", "the", "Pubmed", "database", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/pubmed_client.py#L224-L229
train
sorgerlab/indra
indra/literature/pubmed_client.py
get_metadata_from_xml_tree
def get_metadata_from_xml_tree(tree, get_issns_from_nlm=False, get_abstracts=False, prepend_title=False, mesh_annotations=False): """Get metadata for an XML tree containing PubmedArticle elements. Documentation on the XML structure can be found at: ...
python
def get_metadata_from_xml_tree(tree, get_issns_from_nlm=False, get_abstracts=False, prepend_title=False, mesh_annotations=False): """Get metadata for an XML tree containing PubmedArticle elements. Documentation on the XML structure can be found at: ...
[ "def", "get_metadata_from_xml_tree", "(", "tree", ",", "get_issns_from_nlm", "=", "False", ",", "get_abstracts", "=", "False", ",", "prepend_title", "=", "False", ",", "mesh_annotations", "=", "False", ")", ":", "results", "=", "{", "}", "pm_articles", "=", "t...
Get metadata for an XML tree containing PubmedArticle elements. Documentation on the XML structure can be found at: - https://www.nlm.nih.gov/bsd/licensee/elements_descriptions.html - https://www.nlm.nih.gov/bsd/licensee/elements_alphabetical.html Parameters ---------- tree : xml.etree...
[ "Get", "metadata", "for", "an", "XML", "tree", "containing", "PubmedArticle", "elements", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/pubmed_client.py#L303-L364
train
sorgerlab/indra
indra/literature/pubmed_client.py
get_metadata_for_ids
def get_metadata_for_ids(pmid_list, get_issns_from_nlm=False, get_abstracts=False, prepend_title=False): """Get article metadata for up to 200 PMIDs from the Pubmed database. Parameters ---------- pmid_list : list of PMIDs as strings Can contain 1-200 PMIDs. get_iss...
python
def get_metadata_for_ids(pmid_list, get_issns_from_nlm=False, get_abstracts=False, prepend_title=False): """Get article metadata for up to 200 PMIDs from the Pubmed database. Parameters ---------- pmid_list : list of PMIDs as strings Can contain 1-200 PMIDs. get_iss...
[ "def", "get_metadata_for_ids", "(", "pmid_list", ",", "get_issns_from_nlm", "=", "False", ",", "get_abstracts", "=", "False", ",", "prepend_title", "=", "False", ")", ":", "if", "len", "(", "pmid_list", ")", ">", "200", ":", "raise", "ValueError", "(", "\"Me...
Get article metadata for up to 200 PMIDs from the Pubmed database. Parameters ---------- pmid_list : list of PMIDs as strings Can contain 1-200 PMIDs. get_issns_from_nlm : boolean Look up the full list of ISSN number for the journal associated with the article, which helps to ma...
[ "Get", "article", "metadata", "for", "up", "to", "200", "PMIDs", "from", "the", "Pubmed", "database", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/pubmed_client.py#L391-L425
train
sorgerlab/indra
indra/literature/pubmed_client.py
get_issns_for_journal
def get_issns_for_journal(nlm_id): """Get a list of the ISSN numbers for a journal given its NLM ID. Information on NLM XML DTDs is available at https://www.nlm.nih.gov/databases/dtd/ """ params = {'db': 'nlmcatalog', 'retmode': 'xml', 'id': nlm_id} tree = send_reque...
python
def get_issns_for_journal(nlm_id): """Get a list of the ISSN numbers for a journal given its NLM ID. Information on NLM XML DTDs is available at https://www.nlm.nih.gov/databases/dtd/ """ params = {'db': 'nlmcatalog', 'retmode': 'xml', 'id': nlm_id} tree = send_reque...
[ "def", "get_issns_for_journal", "(", "nlm_id", ")", ":", "params", "=", "{", "'db'", ":", "'nlmcatalog'", ",", "'retmode'", ":", "'xml'", ",", "'id'", ":", "nlm_id", "}", "tree", "=", "send_request", "(", "pubmed_fetch", ",", "params", ")", "if", "tree", ...
Get a list of the ISSN numbers for a journal given its NLM ID. Information on NLM XML DTDs is available at https://www.nlm.nih.gov/databases/dtd/
[ "Get", "a", "list", "of", "the", "ISSN", "numbers", "for", "a", "journal", "given", "its", "NLM", "ID", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/pubmed_client.py#L429-L448
train
sorgerlab/indra
indra/explanation/model_checker.py
remove_im_params
def remove_im_params(model, im): """Remove parameter nodes from the influence map. Parameters ---------- model : pysb.core.Model PySB model. im : networkx.MultiDiGraph Influence map. Returns ------- networkx.MultiDiGraph Influence map with the parameter nodes re...
python
def remove_im_params(model, im): """Remove parameter nodes from the influence map. Parameters ---------- model : pysb.core.Model PySB model. im : networkx.MultiDiGraph Influence map. Returns ------- networkx.MultiDiGraph Influence map with the parameter nodes re...
[ "def", "remove_im_params", "(", "model", ",", "im", ")", ":", "for", "param", "in", "model", ".", "parameters", ":", "try", ":", "im", ".", "remove_node", "(", "param", ".", "name", ")", "except", ":", "pass" ]
Remove parameter nodes from the influence map. Parameters ---------- model : pysb.core.Model PySB model. im : networkx.MultiDiGraph Influence map. Returns ------- networkx.MultiDiGraph Influence map with the parameter nodes removed.
[ "Remove", "parameter", "nodes", "from", "the", "influence", "map", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/explanation/model_checker.py#L919-L940
train
sorgerlab/indra
indra/explanation/model_checker.py
_get_signed_predecessors
def _get_signed_predecessors(im, node, polarity): """Get upstream nodes in the influence map. Return the upstream nodes along with the overall polarity of the path to that node by account for the polarity of the path to the given node and the polarity of the edge between the given node and its immediat...
python
def _get_signed_predecessors(im, node, polarity): """Get upstream nodes in the influence map. Return the upstream nodes along with the overall polarity of the path to that node by account for the polarity of the path to the given node and the polarity of the edge between the given node and its immediat...
[ "def", "_get_signed_predecessors", "(", "im", ",", "node", ",", "polarity", ")", ":", "signed_pred_list", "=", "[", "]", "for", "pred", "in", "im", ".", "predecessors", "(", "node", ")", ":", "pred_edge", "=", "(", "pred", ",", "node", ")", "yield", "(...
Get upstream nodes in the influence map. Return the upstream nodes along with the overall polarity of the path to that node by account for the polarity of the path to the given node and the polarity of the edge between the given node and its immediate predecessors. Parameters ---------- im...
[ "Get", "upstream", "nodes", "in", "the", "influence", "map", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/explanation/model_checker.py#L1009-L1037
train
sorgerlab/indra
indra/explanation/model_checker.py
_get_edge_sign
def _get_edge_sign(im, edge): """Get the polarity of the influence by examining the edge sign.""" edge_data = im[edge[0]][edge[1]] # Handle possible multiple edges between nodes signs = list(set([v['sign'] for v in edge_data.values() if v.get('sign')])) if len(signs...
python
def _get_edge_sign(im, edge): """Get the polarity of the influence by examining the edge sign.""" edge_data = im[edge[0]][edge[1]] # Handle possible multiple edges between nodes signs = list(set([v['sign'] for v in edge_data.values() if v.get('sign')])) if len(signs...
[ "def", "_get_edge_sign", "(", "im", ",", "edge", ")", ":", "edge_data", "=", "im", "[", "edge", "[", "0", "]", "]", "[", "edge", "[", "1", "]", "]", "signs", "=", "list", "(", "set", "(", "[", "v", "[", "'sign'", "]", "for", "v", "in", "edge_...
Get the polarity of the influence by examining the edge sign.
[ "Get", "the", "polarity", "of", "the", "influence", "by", "examining", "the", "edge", "sign", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/explanation/model_checker.py#L1040-L1057
train
sorgerlab/indra
indra/explanation/model_checker.py
_add_modification_to_agent
def _add_modification_to_agent(agent, mod_type, residue, position): """Add a modification condition to an Agent.""" new_mod = ModCondition(mod_type, residue, position) # Check if this modification already exists for old_mod in agent.mods: if old_mod.equals(new_mod): return agent ...
python
def _add_modification_to_agent(agent, mod_type, residue, position): """Add a modification condition to an Agent.""" new_mod = ModCondition(mod_type, residue, position) # Check if this modification already exists for old_mod in agent.mods: if old_mod.equals(new_mod): return agent ...
[ "def", "_add_modification_to_agent", "(", "agent", ",", "mod_type", ",", "residue", ",", "position", ")", ":", "new_mod", "=", "ModCondition", "(", "mod_type", ",", "residue", ",", "position", ")", "for", "old_mod", "in", "agent", ".", "mods", ":", "if", "...
Add a modification condition to an Agent.
[ "Add", "a", "modification", "condition", "to", "an", "Agent", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/explanation/model_checker.py#L1060-L1069
train
sorgerlab/indra
indra/explanation/model_checker.py
_match_lhs
def _match_lhs(cp, rules): """Get rules with a left-hand side matching the given ComplexPattern.""" rule_matches = [] for rule in rules: reactant_pattern = rule.rule_expression.reactant_pattern for rule_cp in reactant_pattern.complex_patterns: if _cp_embeds_into(rule_cp, cp): ...
python
def _match_lhs(cp, rules): """Get rules with a left-hand side matching the given ComplexPattern.""" rule_matches = [] for rule in rules: reactant_pattern = rule.rule_expression.reactant_pattern for rule_cp in reactant_pattern.complex_patterns: if _cp_embeds_into(rule_cp, cp): ...
[ "def", "_match_lhs", "(", "cp", ",", "rules", ")", ":", "rule_matches", "=", "[", "]", "for", "rule", "in", "rules", ":", "reactant_pattern", "=", "rule", ".", "rule_expression", ".", "reactant_pattern", "for", "rule_cp", "in", "reactant_pattern", ".", "comp...
Get rules with a left-hand side matching the given ComplexPattern.
[ "Get", "rules", "with", "a", "left", "-", "hand", "side", "matching", "the", "given", "ComplexPattern", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/explanation/model_checker.py#L1084-L1093
train
sorgerlab/indra
indra/explanation/model_checker.py
_cp_embeds_into
def _cp_embeds_into(cp1, cp2): """Check that any state in ComplexPattern2 is matched in ComplexPattern1. """ # Check that any state in cp2 is matched in cp1 # If the thing we're matching to is just a monomer pattern, that makes # things easier--we just need to find the corresponding monomer pattern ...
python
def _cp_embeds_into(cp1, cp2): """Check that any state in ComplexPattern2 is matched in ComplexPattern1. """ # Check that any state in cp2 is matched in cp1 # If the thing we're matching to is just a monomer pattern, that makes # things easier--we just need to find the corresponding monomer pattern ...
[ "def", "_cp_embeds_into", "(", "cp1", ",", "cp2", ")", ":", "if", "cp1", "is", "None", "or", "cp2", "is", "None", ":", "return", "False", "cp1", "=", "as_complex_pattern", "(", "cp1", ")", "cp2", "=", "as_complex_pattern", "(", "cp2", ")", "if", "len",...
Check that any state in ComplexPattern2 is matched in ComplexPattern1.
[ "Check", "that", "any", "state", "in", "ComplexPattern2", "is", "matched", "in", "ComplexPattern1", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/explanation/model_checker.py#L1096-L1114
train
sorgerlab/indra
indra/explanation/model_checker.py
_mp_embeds_into
def _mp_embeds_into(mp1, mp2): """Check that conditions in MonomerPattern2 are met in MonomerPattern1.""" sc_matches = [] if mp1.monomer.name != mp2.monomer.name: return False # Check that all conditions in mp2 are met in mp1 for site_name, site_state in mp2.site_conditions.items(): ...
python
def _mp_embeds_into(mp1, mp2): """Check that conditions in MonomerPattern2 are met in MonomerPattern1.""" sc_matches = [] if mp1.monomer.name != mp2.monomer.name: return False # Check that all conditions in mp2 are met in mp1 for site_name, site_state in mp2.site_conditions.items(): ...
[ "def", "_mp_embeds_into", "(", "mp1", ",", "mp2", ")", ":", "sc_matches", "=", "[", "]", "if", "mp1", ".", "monomer", ".", "name", "!=", "mp2", ".", "monomer", ".", "name", ":", "return", "False", "for", "site_name", ",", "site_state", "in", "mp2", "...
Check that conditions in MonomerPattern2 are met in MonomerPattern1.
[ "Check", "that", "conditions", "in", "MonomerPattern2", "are", "met", "in", "MonomerPattern1", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/explanation/model_checker.py#L1117-L1127
train
sorgerlab/indra
indra/explanation/model_checker.py
_monomer_pattern_label
def _monomer_pattern_label(mp): """Return a string label for a MonomerPattern.""" site_strs = [] for site, cond in mp.site_conditions.items(): if isinstance(cond, tuple) or isinstance(cond, list): assert len(cond) == 2 if cond[1] == WILD: site_str = '%s_%s' % ...
python
def _monomer_pattern_label(mp): """Return a string label for a MonomerPattern.""" site_strs = [] for site, cond in mp.site_conditions.items(): if isinstance(cond, tuple) or isinstance(cond, list): assert len(cond) == 2 if cond[1] == WILD: site_str = '%s_%s' % ...
[ "def", "_monomer_pattern_label", "(", "mp", ")", ":", "site_strs", "=", "[", "]", "for", "site", ",", "cond", "in", "mp", ".", "site_conditions", ".", "items", "(", ")", ":", "if", "isinstance", "(", "cond", ",", "tuple", ")", "or", "isinstance", "(", ...
Return a string label for a MonomerPattern.
[ "Return", "a", "string", "label", "for", "a", "MonomerPattern", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/explanation/model_checker.py#L1224-L1239
train
sorgerlab/indra
indra/explanation/model_checker.py
_stmt_from_rule
def _stmt_from_rule(model, rule_name, stmts): """Return the INDRA Statement corresponding to a given rule by name.""" stmt_uuid = None for ann in model.annotations: if ann.predicate == 'from_indra_statement': if ann.subject == rule_name: stmt_uuid = ann.object ...
python
def _stmt_from_rule(model, rule_name, stmts): """Return the INDRA Statement corresponding to a given rule by name.""" stmt_uuid = None for ann in model.annotations: if ann.predicate == 'from_indra_statement': if ann.subject == rule_name: stmt_uuid = ann.object ...
[ "def", "_stmt_from_rule", "(", "model", ",", "rule_name", ",", "stmts", ")", ":", "stmt_uuid", "=", "None", "for", "ann", "in", "model", ".", "annotations", ":", "if", "ann", ".", "predicate", "==", "'from_indra_statement'", ":", "if", "ann", ".", "subject...
Return the INDRA Statement corresponding to a given rule by name.
[ "Return", "the", "INDRA", "Statement", "corresponding", "to", "a", "given", "rule", "by", "name", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/explanation/model_checker.py#L1263-L1274
train
sorgerlab/indra
indra/explanation/model_checker.py
ModelChecker.generate_im
def generate_im(self, model): """Return a graph representing the influence map generated by Kappa Parameters ---------- model : pysb.Model The PySB model whose influence map is to be generated Returns ------- graph : networkx.MultiDiGraph ...
python
def generate_im(self, model): """Return a graph representing the influence map generated by Kappa Parameters ---------- model : pysb.Model The PySB model whose influence map is to be generated Returns ------- graph : networkx.MultiDiGraph ...
[ "def", "generate_im", "(", "self", ",", "model", ")", ":", "kappa", "=", "kappy", ".", "KappaStd", "(", ")", "model_str", "=", "export", ".", "export", "(", "model", ",", "'kappa'", ")", "kappa", ".", "add_model_string", "(", "model_str", ")", "kappa", ...
Return a graph representing the influence map generated by Kappa Parameters ---------- model : pysb.Model The PySB model whose influence map is to be generated Returns ------- graph : networkx.MultiDiGraph A MultiDiGraph representing the influenc...
[ "Return", "a", "graph", "representing", "the", "influence", "map", "generated", "by", "Kappa" ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/explanation/model_checker.py#L196-L215
train
sorgerlab/indra
indra/explanation/model_checker.py
ModelChecker.draw_im
def draw_im(self, fname): """Draw and save the influence map in a file. Parameters ---------- fname : str The name of the file to save the influence map in. The extension of the file will determine the file format, typically png or pdf. """ ...
python
def draw_im(self, fname): """Draw and save the influence map in a file. Parameters ---------- fname : str The name of the file to save the influence map in. The extension of the file will determine the file format, typically png or pdf. """ ...
[ "def", "draw_im", "(", "self", ",", "fname", ")", ":", "im", "=", "self", ".", "get_im", "(", ")", "im_agraph", "=", "nx", ".", "nx_agraph", ".", "to_agraph", "(", "im", ")", "im_agraph", ".", "draw", "(", "fname", ",", "prog", "=", "'dot'", ")" ]
Draw and save the influence map in a file. Parameters ---------- fname : str The name of the file to save the influence map in. The extension of the file will determine the file format, typically png or pdf.
[ "Draw", "and", "save", "the", "influence", "map", "in", "a", "file", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/explanation/model_checker.py#L217-L229
train
sorgerlab/indra
indra/explanation/model_checker.py
ModelChecker.get_im
def get_im(self, force_update=False): """Get the influence map for the model, generating it if necessary. Parameters ---------- force_update : bool Whether to generate the influence map when the function is called. If False, returns the previously generated influ...
python
def get_im(self, force_update=False): """Get the influence map for the model, generating it if necessary. Parameters ---------- force_update : bool Whether to generate the influence map when the function is called. If False, returns the previously generated influ...
[ "def", "get_im", "(", "self", ",", "force_update", "=", "False", ")", ":", "if", "self", ".", "_im", "and", "not", "force_update", ":", "return", "self", ".", "_im", "if", "not", "self", ".", "model", ":", "raise", "Exception", "(", "\"Cannot get influen...
Get the influence map for the model, generating it if necessary. Parameters ---------- force_update : bool Whether to generate the influence map when the function is called. If False, returns the previously generated influence map if available. Defaults to Tr...
[ "Get", "the", "influence", "map", "for", "the", "model", "generating", "it", "if", "necessary", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/explanation/model_checker.py#L231-L327
train
sorgerlab/indra
indra/explanation/model_checker.py
ModelChecker.check_model
def check_model(self, max_paths=1, max_path_length=5): """Check all the statements added to the ModelChecker. Parameters ---------- max_paths : Optional[int] The maximum number of specific paths to return for each Statement to be explained. Default: 1 max...
python
def check_model(self, max_paths=1, max_path_length=5): """Check all the statements added to the ModelChecker. Parameters ---------- max_paths : Optional[int] The maximum number of specific paths to return for each Statement to be explained. Default: 1 max...
[ "def", "check_model", "(", "self", ",", "max_paths", "=", "1", ",", "max_path_length", "=", "5", ")", ":", "results", "=", "[", "]", "for", "stmt", "in", "self", ".", "statements", ":", "result", "=", "self", ".", "check_statement", "(", "stmt", ",", ...
Check all the statements added to the ModelChecker. Parameters ---------- max_paths : Optional[int] The maximum number of specific paths to return for each Statement to be explained. Default: 1 max_path_length : Optional[int] The maximum length of spe...
[ "Check", "all", "the", "statements", "added", "to", "the", "ModelChecker", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/explanation/model_checker.py#L329-L350
train
sorgerlab/indra
indra/explanation/model_checker.py
ModelChecker.check_statement
def check_statement(self, stmt, max_paths=1, max_path_length=5): """Check a single Statement against the model. Parameters ---------- stmt : indra.statements.Statement The Statement to check. max_paths : Optional[int] The maximum number of specific paths ...
python
def check_statement(self, stmt, max_paths=1, max_path_length=5): """Check a single Statement against the model. Parameters ---------- stmt : indra.statements.Statement The Statement to check. max_paths : Optional[int] The maximum number of specific paths ...
[ "def", "check_statement", "(", "self", ",", "stmt", ",", "max_paths", "=", "1", ",", "max_path_length", "=", "5", ")", ":", "self", ".", "get_im", "(", ")", "if", "not", "isinstance", "(", "stmt", ",", "(", "Modification", ",", "RegulateAmount", ",", "...
Check a single Statement against the model. Parameters ---------- stmt : indra.statements.Statement The Statement to check. max_paths : Optional[int] The maximum number of specific paths to return for each Statement to be explained. Default: 1 ...
[ "Check", "a", "single", "Statement", "against", "the", "model", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/explanation/model_checker.py#L352-L423
train
sorgerlab/indra
indra/explanation/model_checker.py
ModelChecker.score_paths
def score_paths(self, paths, agents_values, loss_of_function=False, sigma=0.15, include_final_node=False): """Return scores associated with a given set of paths. Parameters ---------- paths : list[list[tuple[str, int]]] A list of paths obtained from path ...
python
def score_paths(self, paths, agents_values, loss_of_function=False, sigma=0.15, include_final_node=False): """Return scores associated with a given set of paths. Parameters ---------- paths : list[list[tuple[str, int]]] A list of paths obtained from path ...
[ "def", "score_paths", "(", "self", ",", "paths", ",", "agents_values", ",", "loss_of_function", "=", "False", ",", "sigma", "=", "0.15", ",", "include_final_node", "=", "False", ")", ":", "obs_model", "=", "lambda", "x", ":", "scipy", ".", "stats", ".", ...
Return scores associated with a given set of paths. Parameters ---------- paths : list[list[tuple[str, int]]] A list of paths obtained from path finding. Each path is a list of tuples (which are edges in the path), with the first element of the tuple the name...
[ "Return", "scores", "associated", "with", "a", "given", "set", "of", "paths", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/explanation/model_checker.py#L642-L728
train
sorgerlab/indra
indra/explanation/model_checker.py
ModelChecker.prune_influence_map
def prune_influence_map(self): """Remove edges between rules causing problematic non-transitivity. First, all self-loops are removed. After this initial step, edges are removed between rules when they share *all* child nodes except for each other; that is, they have a mutual relationshi...
python
def prune_influence_map(self): """Remove edges between rules causing problematic non-transitivity. First, all self-loops are removed. After this initial step, edges are removed between rules when they share *all* child nodes except for each other; that is, they have a mutual relationshi...
[ "def", "prune_influence_map", "(", "self", ")", ":", "im", "=", "self", ".", "get_im", "(", ")", "logger", ".", "info", "(", "'Removing self loops'", ")", "edges_to_remove", "=", "[", "]", "for", "e", "in", "im", ".", "edges", "(", ")", ":", "if", "e...
Remove edges between rules causing problematic non-transitivity. First, all self-loops are removed. After this initial step, edges are removed between rules when they share *all* child nodes except for each other; that is, they have a mutual relationship with each other and share all of...
[ "Remove", "edges", "between", "rules", "causing", "problematic", "non", "-", "transitivity", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/explanation/model_checker.py#L730-L782
train
sorgerlab/indra
indra/explanation/model_checker.py
ModelChecker.prune_influence_map_subj_obj
def prune_influence_map_subj_obj(self): """Prune influence map to include only edges where the object of the upstream rule matches the subject of the downstream rule.""" def get_rule_info(r): result = {} for ann in self.model.annotations: if ann.subject ==...
python
def prune_influence_map_subj_obj(self): """Prune influence map to include only edges where the object of the upstream rule matches the subject of the downstream rule.""" def get_rule_info(r): result = {} for ann in self.model.annotations: if ann.subject ==...
[ "def", "prune_influence_map_subj_obj", "(", "self", ")", ":", "def", "get_rule_info", "(", "r", ")", ":", "result", "=", "{", "}", "for", "ann", "in", "self", ".", "model", ".", "annotations", ":", "if", "ann", ".", "subject", "==", "r", ":", "if", "...
Prune influence map to include only edges where the object of the upstream rule matches the subject of the downstream rule.
[ "Prune", "influence", "map", "to", "include", "only", "edges", "where", "the", "object", "of", "the", "upstream", "rule", "matches", "the", "subject", "of", "the", "downstream", "rule", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/explanation/model_checker.py#L784-L809
train
sorgerlab/indra
indra/tools/reading/util/reporter.py
Reporter.add_section
def add_section(self, section_name): """Create a section of the report, to be headed by section_name Text and images can be added by using the `section` argument of the `add_text` and `add_image` methods. Sections can also be ordered by using the `set_section_order` method. By ...
python
def add_section(self, section_name): """Create a section of the report, to be headed by section_name Text and images can be added by using the `section` argument of the `add_text` and `add_image` methods. Sections can also be ordered by using the `set_section_order` method. By ...
[ "def", "add_section", "(", "self", ",", "section_name", ")", ":", "self", ".", "section_headings", ".", "append", "(", "section_name", ")", "if", "section_name", "in", "self", ".", "sections", ":", "raise", "ValueError", "(", "\"Section %s already exists.\"", "%...
Create a section of the report, to be headed by section_name Text and images can be added by using the `section` argument of the `add_text` and `add_image` methods. Sections can also be ordered by using the `set_section_order` method. By default, text and images that have no section wi...
[ "Create", "a", "section", "of", "the", "report", "to", "be", "headed", "by", "section_name" ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/util/reporter.py#L31-L47
train
sorgerlab/indra
indra/tools/reading/util/reporter.py
Reporter.set_section_order
def set_section_order(self, section_name_list): """Set the order of the sections, which are by default unorderd. Any unlisted sections that exist will be placed at the end of the document in no particular order. """ self.section_headings = section_name_list[:] for sectio...
python
def set_section_order(self, section_name_list): """Set the order of the sections, which are by default unorderd. Any unlisted sections that exist will be placed at the end of the document in no particular order. """ self.section_headings = section_name_list[:] for sectio...
[ "def", "set_section_order", "(", "self", ",", "section_name_list", ")", ":", "self", ".", "section_headings", "=", "section_name_list", "[", ":", "]", "for", "section_name", "in", "self", ".", "sections", ".", "keys", "(", ")", ":", "if", "section_name", "no...
Set the order of the sections, which are by default unorderd. Any unlisted sections that exist will be placed at the end of the document in no particular order.
[ "Set", "the", "order", "of", "the", "sections", "which", "are", "by", "default", "unorderd", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/util/reporter.py#L49-L59
train
sorgerlab/indra
indra/tools/reading/util/reporter.py
Reporter.add_text
def add_text(self, text, *args, **kwargs): """Add text to the document. Text is shown on the final document in the order it is added, either within the given section or as part of the un-sectioned list of content. Parameters ---------- text : str The text to...
python
def add_text(self, text, *args, **kwargs): """Add text to the document. Text is shown on the final document in the order it is added, either within the given section or as part of the un-sectioned list of content. Parameters ---------- text : str The text to...
[ "def", "add_text", "(", "self", ",", "text", ",", "*", "args", ",", "**", "kwargs", ")", ":", "section_name", "=", "kwargs", ".", "pop", "(", "'section'", ",", "None", ")", "para", ",", "sp", "=", "self", ".", "_preformat_text", "(", "text", ",", "...
Add text to the document. Text is shown on the final document in the order it is added, either within the given section or as part of the un-sectioned list of content. Parameters ---------- text : str The text to be added. style : str Choose the ...
[ "Add", "text", "to", "the", "document", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/util/reporter.py#L61-L104
train
sorgerlab/indra
indra/tools/reading/util/reporter.py
Reporter.add_image
def add_image(self, image_path, width=None, height=None, section=None): """Add an image to the document. Images are shown on the final document in the order they are added, either within the given section or as part of the un-sectioned list of content. Parameters ------...
python
def add_image(self, image_path, width=None, height=None, section=None): """Add an image to the document. Images are shown on the final document in the order they are added, either within the given section or as part of the un-sectioned list of content. Parameters ------...
[ "def", "add_image", "(", "self", ",", "image_path", ",", "width", "=", "None", ",", "height", "=", "None", ",", "section", "=", "None", ")", ":", "if", "width", "is", "not", "None", ":", "width", "=", "width", "*", "inch", "if", "height", "is", "no...
Add an image to the document. Images are shown on the final document in the order they are added, either within the given section or as part of the un-sectioned list of content. Parameters ---------- image_path : str A path to the image on the local file sys...
[ "Add", "an", "image", "to", "the", "document", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/util/reporter.py#L106-L135
train
sorgerlab/indra
indra/tools/reading/util/reporter.py
Reporter.make_report
def make_report(self, sections_first=True, section_header_params=None): """Create the pdf document with name `self.name + '.pdf'`. Parameters ---------- sections_first : bool If True (default), text and images with sections are presented first and un-sectioned co...
python
def make_report(self, sections_first=True, section_header_params=None): """Create the pdf document with name `self.name + '.pdf'`. Parameters ---------- sections_first : bool If True (default), text and images with sections are presented first and un-sectioned co...
[ "def", "make_report", "(", "self", ",", "sections_first", "=", "True", ",", "section_header_params", "=", "None", ")", ":", "full_story", "=", "list", "(", "self", ".", "_preformat_text", "(", "self", ".", "title", ",", "style", "=", "'Title'", ",", "fonts...
Create the pdf document with name `self.name + '.pdf'`. Parameters ---------- sections_first : bool If True (default), text and images with sections are presented first and un-sectioned content is appended afterword. If False, sectioned text and images will b...
[ "Create", "the", "pdf", "document", "with", "name", "self", ".", "name", "+", ".", "pdf", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/util/reporter.py#L137-L171
train
sorgerlab/indra
indra/tools/reading/util/reporter.py
Reporter._make_sections
def _make_sections(self, **section_hdr_params): """Flatten the sections into a single story list.""" sect_story = [] if not self.section_headings and len(self.sections): self.section_headings = self.sections.keys() for section_name in self.section_headings: secti...
python
def _make_sections(self, **section_hdr_params): """Flatten the sections into a single story list.""" sect_story = [] if not self.section_headings and len(self.sections): self.section_headings = self.sections.keys() for section_name in self.section_headings: secti...
[ "def", "_make_sections", "(", "self", ",", "**", "section_hdr_params", ")", ":", "sect_story", "=", "[", "]", "if", "not", "self", ".", "section_headings", "and", "len", "(", "self", ".", "sections", ")", ":", "self", ".", "section_headings", "=", "self", ...
Flatten the sections into a single story list.
[ "Flatten", "the", "sections", "into", "a", "single", "story", "list", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/util/reporter.py#L173-L186
train
sorgerlab/indra
indra/tools/reading/util/reporter.py
Reporter._preformat_text
def _preformat_text(self, text, style='Normal', space=None, fontsize=12, alignment='left'): """Format the text for addition to a story list.""" if space is None: space=(1,12) ptext = ('<para alignment=\"%s\"><font size=%d>%s</font></para>' % (...
python
def _preformat_text(self, text, style='Normal', space=None, fontsize=12, alignment='left'): """Format the text for addition to a story list.""" if space is None: space=(1,12) ptext = ('<para alignment=\"%s\"><font size=%d>%s</font></para>' % (...
[ "def", "_preformat_text", "(", "self", ",", "text", ",", "style", "=", "'Normal'", ",", "space", "=", "None", ",", "fontsize", "=", "12", ",", "alignment", "=", "'left'", ")", ":", "if", "space", "is", "None", ":", "space", "=", "(", "1", ",", "12"...
Format the text for addition to a story list.
[ "Format", "the", "text", "for", "addition", "to", "a", "story", "list", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/reading/util/reporter.py#L188-L197
train
sorgerlab/indra
indra/databases/mesh_client.py
get_mesh_name_from_web
def get_mesh_name_from_web(mesh_id): """Get the MESH label for the given MESH ID using the NLM REST API. Parameters ---------- mesh_id : str MESH Identifier, e.g. 'D003094'. Returns ------- str Label for the MESH ID, or None if the query failed or no label was found...
python
def get_mesh_name_from_web(mesh_id): """Get the MESH label for the given MESH ID using the NLM REST API. Parameters ---------- mesh_id : str MESH Identifier, e.g. 'D003094'. Returns ------- str Label for the MESH ID, or None if the query failed or no label was found...
[ "def", "get_mesh_name_from_web", "(", "mesh_id", ")", ":", "url", "=", "MESH_URL", "+", "mesh_id", "+", "'.json'", "resp", "=", "requests", ".", "get", "(", "url", ")", "if", "resp", ".", "status_code", "!=", "200", ":", "return", "None", "mesh_json", "=...
Get the MESH label for the given MESH ID using the NLM REST API. Parameters ---------- mesh_id : str MESH Identifier, e.g. 'D003094'. Returns ------- str Label for the MESH ID, or None if the query failed or no label was found.
[ "Get", "the", "MESH", "label", "for", "the", "given", "MESH", "ID", "using", "the", "NLM", "REST", "API", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/mesh_client.py#L28-L51
train
sorgerlab/indra
indra/databases/mesh_client.py
get_mesh_name
def get_mesh_name(mesh_id, offline=False): """Get the MESH label for the given MESH ID. Uses the mappings table in `indra/resources`; if the MESH ID is not listed there, falls back on the NLM REST API. Parameters ---------- mesh_id : str MESH Identifier, e.g. 'D003094'. offline : b...
python
def get_mesh_name(mesh_id, offline=False): """Get the MESH label for the given MESH ID. Uses the mappings table in `indra/resources`; if the MESH ID is not listed there, falls back on the NLM REST API. Parameters ---------- mesh_id : str MESH Identifier, e.g. 'D003094'. offline : b...
[ "def", "get_mesh_name", "(", "mesh_id", ",", "offline", "=", "False", ")", ":", "indra_mesh_mapping", "=", "mesh_id_to_name", ".", "get", "(", "mesh_id", ")", "if", "offline", "or", "indra_mesh_mapping", "is", "not", "None", ":", "return", "indra_mesh_mapping", ...
Get the MESH label for the given MESH ID. Uses the mappings table in `indra/resources`; if the MESH ID is not listed there, falls back on the NLM REST API. Parameters ---------- mesh_id : str MESH Identifier, e.g. 'D003094'. offline : bool Whether to allow queries to the NLM RE...
[ "Get", "the", "MESH", "label", "for", "the", "given", "MESH", "ID", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/mesh_client.py#L54-L79
train
sorgerlab/indra
indra/databases/mesh_client.py
get_mesh_id_name
def get_mesh_id_name(mesh_term, offline=False): """Get the MESH ID and name for the given MESH term. Uses the mappings table in `indra/resources`; if the MESH term is not listed there, falls back on the NLM REST API. Parameters ---------- mesh_term : str MESH Descriptor or Concept name...
python
def get_mesh_id_name(mesh_term, offline=False): """Get the MESH ID and name for the given MESH term. Uses the mappings table in `indra/resources`; if the MESH term is not listed there, falls back on the NLM REST API. Parameters ---------- mesh_term : str MESH Descriptor or Concept name...
[ "def", "get_mesh_id_name", "(", "mesh_term", ",", "offline", "=", "False", ")", ":", "indra_mesh_id", "=", "mesh_name_to_id", ".", "get", "(", "mesh_term", ")", "if", "indra_mesh_id", "is", "not", "None", ":", "return", "indra_mesh_id", ",", "mesh_term", "indr...
Get the MESH ID and name for the given MESH term. Uses the mappings table in `indra/resources`; if the MESH term is not listed there, falls back on the NLM REST API. Parameters ---------- mesh_term : str MESH Descriptor or Concept name, e.g. 'Breast Cancer'. offline : bool Whet...
[ "Get", "the", "MESH", "ID", "and", "name", "for", "the", "given", "MESH", "term", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/databases/mesh_client.py#L82-L119
train
sorgerlab/indra
indra/tools/machine/cli.py
make
def make(directory): """Makes a RAS Machine directory""" if os.path.exists(directory): if os.path.isdir(directory): click.echo('Directory already exists') else: click.echo('Path exists and is not a directory') sys.exit() os.makedirs(directory) os.mkdir(o...
python
def make(directory): """Makes a RAS Machine directory""" if os.path.exists(directory): if os.path.isdir(directory): click.echo('Directory already exists') else: click.echo('Path exists and is not a directory') sys.exit() os.makedirs(directory) os.mkdir(o...
[ "def", "make", "(", "directory", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "directory", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "directory", ")", ":", "click", ".", "echo", "(", "'Directory already exists'", ")", "else", ":...
Makes a RAS Machine directory
[ "Makes", "a", "RAS", "Machine", "directory" ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/machine/cli.py#L30-L42
train
sorgerlab/indra
indra/tools/machine/cli.py
run_with_search
def run_with_search(model_path, config, num_days): """Run with PubMed search for new papers.""" from indra.tools.machine.machine import run_with_search_helper run_with_search_helper(model_path, config, num_days=num_days)
python
def run_with_search(model_path, config, num_days): """Run with PubMed search for new papers.""" from indra.tools.machine.machine import run_with_search_helper run_with_search_helper(model_path, config, num_days=num_days)
[ "def", "run_with_search", "(", "model_path", ",", "config", ",", "num_days", ")", ":", "from", "indra", ".", "tools", ".", "machine", ".", "machine", "import", "run_with_search_helper", "run_with_search_helper", "(", "model_path", ",", "config", ",", "num_days", ...
Run with PubMed search for new papers.
[ "Run", "with", "PubMed", "search", "for", "new", "papers", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/machine/cli.py#L50-L53
train
sorgerlab/indra
indra/tools/machine/cli.py
run_with_pmids
def run_with_pmids(model_path, pmids): """Run with given list of PMIDs.""" from indra.tools.machine.machine import run_with_pmids_helper run_with_pmids_helper(model_path, pmids)
python
def run_with_pmids(model_path, pmids): """Run with given list of PMIDs.""" from indra.tools.machine.machine import run_with_pmids_helper run_with_pmids_helper(model_path, pmids)
[ "def", "run_with_pmids", "(", "model_path", ",", "pmids", ")", ":", "from", "indra", ".", "tools", ".", "machine", ".", "machine", "import", "run_with_pmids_helper", "run_with_pmids_helper", "(", "model_path", ",", "pmids", ")" ]
Run with given list of PMIDs.
[ "Run", "with", "given", "list", "of", "PMIDs", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/tools/machine/cli.py#L68-L71
train
sorgerlab/indra
indra/literature/pmc_client.py
id_lookup
def id_lookup(paper_id, idtype=None): """This function takes a Pubmed ID, Pubmed Central ID, or DOI and use the Pubmed ID mapping service and looks up all other IDs from one of these. The IDs are returned in a dictionary.""" if idtype is not None and idtype not in ('pmid', 'pmcid', 'doi'): r...
python
def id_lookup(paper_id, idtype=None): """This function takes a Pubmed ID, Pubmed Central ID, or DOI and use the Pubmed ID mapping service and looks up all other IDs from one of these. The IDs are returned in a dictionary.""" if idtype is not None and idtype not in ('pmid', 'pmcid', 'doi'): r...
[ "def", "id_lookup", "(", "paper_id", ",", "idtype", "=", "None", ")", ":", "if", "idtype", "is", "not", "None", "and", "idtype", "not", "in", "(", "'pmid'", ",", "'pmcid'", ",", "'doi'", ")", ":", "raise", "ValueError", "(", "\"Invalid idtype %s; must be '...
This function takes a Pubmed ID, Pubmed Central ID, or DOI and use the Pubmed ID mapping service and looks up all other IDs from one of these. The IDs are returned in a dictionary.
[ "This", "function", "takes", "a", "Pubmed", "ID", "Pubmed", "Central", "ID", "or", "DOI", "and", "use", "the", "Pubmed", "ID", "mapping", "service", "and", "looks", "up", "all", "other", "IDs", "from", "one", "of", "these", ".", "The", "IDs", "are", "r...
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/pmc_client.py#L40-L74
train
sorgerlab/indra
indra/literature/pmc_client.py
get_xml
def get_xml(pmc_id): """Returns XML for the article corresponding to a PMC ID.""" if pmc_id.upper().startswith('PMC'): pmc_id = pmc_id[3:] # Request params params = {} params['verb'] = 'GetRecord' params['identifier'] = 'oai:pubmedcentral.nih.gov:%s' % pmc_id params['metadataPrefix']...
python
def get_xml(pmc_id): """Returns XML for the article corresponding to a PMC ID.""" if pmc_id.upper().startswith('PMC'): pmc_id = pmc_id[3:] # Request params params = {} params['verb'] = 'GetRecord' params['identifier'] = 'oai:pubmedcentral.nih.gov:%s' % pmc_id params['metadataPrefix']...
[ "def", "get_xml", "(", "pmc_id", ")", ":", "if", "pmc_id", ".", "upper", "(", ")", ".", "startswith", "(", "'PMC'", ")", ":", "pmc_id", "=", "pmc_id", "[", "3", ":", "]", "params", "=", "{", "}", "params", "[", "'verb'", "]", "=", "'GetRecord'", ...
Returns XML for the article corresponding to a PMC ID.
[ "Returns", "XML", "for", "the", "article", "corresponding", "to", "a", "PMC", "ID", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/pmc_client.py#L81-L109
train
sorgerlab/indra
indra/literature/pmc_client.py
extract_paragraphs
def extract_paragraphs(xml_string): """Returns list of paragraphs in an NLM XML. Parameters ---------- xml_string : str String containing valid NLM XML. Returns ------- list of str List of extracted paragraphs in an NLM XML """ tree = etree.fromstring(xml_string.enc...
python
def extract_paragraphs(xml_string): """Returns list of paragraphs in an NLM XML. Parameters ---------- xml_string : str String containing valid NLM XML. Returns ------- list of str List of extracted paragraphs in an NLM XML """ tree = etree.fromstring(xml_string.enc...
[ "def", "extract_paragraphs", "(", "xml_string", ")", ":", "tree", "=", "etree", ".", "fromstring", "(", "xml_string", ".", "encode", "(", "'utf-8'", ")", ")", "paragraphs", "=", "[", "]", "for", "element", "in", "tree", ".", "iter", "(", ")", ":", "if"...
Returns list of paragraphs in an NLM XML. Parameters ---------- xml_string : str String containing valid NLM XML. Returns ------- list of str List of extracted paragraphs in an NLM XML
[ "Returns", "list", "of", "paragraphs", "in", "an", "NLM", "XML", "." ]
79a70415832c5702d7a820c7c9ccc8e25010124b
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/literature/pmc_client.py#L132-L156
train