Entering edit mode
6 months ago
brandon
▴
10
Hello, I am trying to return interaction partners for proteins using the STRING-DB API in python, but for many of the proteins it seems unable to find them, even though when I search for the same protein under the same taxon on the STRING-DB website, I am able to find it.
When I use the debugger, I can see that in the text field of the response object, it says this:
Error ErrorMessage
not found <p>Sorry, STRING did not find a protein called 'RPS4Y1' in the taxon '9606'.</p><p>Generally, STRING understands a number of different names/symbols for proteins.<br/>Here is a selection of typical names: 'YEL036C', 'TRPB_ECOLI', 'trpB', 'ENSP00000249373', 'BRCA1', 'CG11561', 'daf-3', ...</p><p>Try to identify your protein with a different name/symbol that you might know. Alternatively, you can paste the raw amino-acid sequence of your protein into the input-form, and STRING will try to identify it via a similarity search.</p>
Here is my code:
Parameters for querying
string_api_url = "https://version-11-5.string-db.org/api"
output_format = "tsv-no-header"
method = "interaction_partners"
my_proteins = proteins['protein'])
# Construct the request
request_url = "/".join([string_api_url, output_format, method])
# Set parameters
params = {
"identifiers" : "%0d".join(my_proteins), # your protein
"species" : 9606, # species NCBI identifier
"limit" : 15,
}
# Call STRING
response = requests.post(request_url, data=params)
# Read and parse the results
for line in response.text.strip().split("\n"):
l = line.strip().split("\t")
query_ensp = l[0]
query_name = l[2]
partner_ensp = l[1]
partner_name = l[3]
combined_score = l[5]
print("\t".join([query_ensp, query_name, partner_name, combined_score]))
Any help would be greatly appreciated, thank you!
This worked beautifully using 'requests.get()' in python, thank you so much!