Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api example #1463

Merged
merged 4 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion indra/tests/test_crossref_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_get_license_links():
@pytest.mark.webservice
def test_get_url():
url = crossref_client.get_url(test_doi)
assert url == 'http://dx.doi.org/10.1016/j.ccell.2016.02.010'
assert url == 'https://doi.org/10.1016/j.ccell.2016.02.010'
assert unicode_strs(url)
url = crossref_client.get_url('xyz')
assert url is None
8 changes: 7 additions & 1 deletion rest_api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
'genes': fields.List(fields.String, example=['BRAF', 'MAP2K1'])})

# Store the arguments by type
int_args = ['poolsize', 'size_cutoff']
int_args = ['members_allowed', 'protocol', 'poolsize', 'size_cutoff']
float_args = ['score_threshold', 'belief_cutoff']
boolean_args = [
'do_rename', 'use_adeft', 'do_methionine_offset', 'do_orthology_mapping',
Expand All @@ -89,6 +89,8 @@
dict_args = [
'grounding_map', 'misgrounding_map', 'whitelist', 'mutations']

str_args = {'stmt_type': "Modification", 'policy': 'all'}


def _return_stmts(stmts):
if stmts:
Expand Down Expand Up @@ -225,6 +227,8 @@ def make_preassembly_model(func):
fields.String, example=default)
elif arg in dict_args:
model_fields[arg] = fields.Nested(dict_model)
elif arg in str_args.keys():
model_fields[arg] = fields.String(example=str_args[arg])
else:
model_fields[arg] = fields.String(example=default)
new_model = api.inherit(
Expand Down Expand Up @@ -316,6 +320,7 @@ def post(self):
@sources_ns.expect(reach_text_model)
@sources_ns.route('/reach/process_text')
class ReachProcessText(Resource):
# TODO: REACH web service is down. Need to use a local Reach
@api.doc(False)
def options(self):
return {}
Expand Down Expand Up @@ -397,6 +402,7 @@ def post(self):
@sources_ns.expect(reach_pmc_model)
@sources_ns.route('/reach/process_pmc')
class ReachProcessPmc(Resource):
#TODO: REACH web service is down. Need to use a local Reach
@api.doc(False)
def options(self):
return {}
Expand Down
Loading