This is a test version of Biostars. For the public version, visit https://www.biostars.org.
STRING-DB API can't find my protein but I can find it when I go to the STRING-DB website directly

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!

string-db protein string-db-api

1 answer

first get the main ID in stringdb:

$ wget -qO - "https://string-db.org/api/tsv-no-header/get_string_ids?identifiers=RPS4Y1&species=9606"
0   9606.ENSP00000250784    9606    Homo sapiens    RPS4Y1  Ribosomal protein S4 Y-linked 1; Belongs to the eukaryotic ribosomal protein eS4 family.

then get the interactions:

$ wget -qO - "https://string-db.org/api/tsv-no-header/interaction_partners?identifiers=9606.ENSP00000250784"
9606.ENSP00000250784    9606.ENSP00000431822    RPS4Y1  FAU 9606    0.999   0   0   0   0.963   0.993   0.54    0.443
9606.ENSP00000250784    9606.ENSP00000354722    RPS4Y1  EIF1AY  9606    0.999   0   0   0   0.999   0.581   0   0.845
9606.ENSP00000250784    9606.ENSP00000322408    RPS4Y1  KDM5D   9606    0.999   0   0   0   0.999   0.065   0   0.783
9606.ENSP00000250784    9606.ENSP00000278572    RPS4Y1  RPS3    9606    0.998   0.115   0   0   0.806   0.954   0.54    0.557
9606.ENSP00000250784    9606.ENSP00000375632    RPS4Y1  RPS9    9606    0.998   0.086   0   0   0.797   0.977   0.54    0.501
9606.ENSP00000250784    9606.ENSP00000270625    RPS4Y1  RPS11   9606    0.998   0.115   0   0   0.806   0.977   0.54    0.264
9606.ENSP00000250784    9606.ENSP00000369757    RPS4Y1  RPS6    9606    0.998   0   0   0   0.806   0.977   0.54    0.415
9606.ENSP00000250784    9606.ENSP00000414321    RPS4Y1  RPS24   9606    0.998   0   0   0   0.807   0.978   0.54    0.477
9606.ENSP00000250784    9606.ENSP00000296674    RPS4Y1  RPS23   9606    0.997   0   0   0   0.802   0.954   0.54    0.494
9606.ENSP00000250784    9606.ENSP00000379888    RPS4Y1  RPS8    9606    0.997   0   0   0   0.806   0.955   0.54    0.405

This worked beautifully using 'requests.get()' in python, thank you so much!

Log in to answer this question.