google-apigoogle-cloud-platformgoogle-genomics

Google Genomics API - Internal Server Error + ReferenceIDs


I'm pretty new to Google genomics APIs. I'm trying to create an annotation. I used both web version and Python API call:

service.annotations().create(body={ 'annotationSetId': '101', 'name': 'TestAnnotation', 'referenceName': 'chrM', 'start': '1', 'end': '1'}, fields='id') 

Here is a sample annotation:

{
  "annotationSetId": "101",
  "name": "TestAnnotation",
  "referenceName": "chrM",
  "start": "1",
  "end": "1",
}

I get the following error for both cases:

500 Internal Server Error
{
 "error": {
  "code": 500,
  "message": "Unknown Error.",
  "status": "UNKNOWN"
 }
} 

Any Suggestion?

One more observation.

We can add a variant set by only submitting datasetId and name; no need to specify referenceId, but we cannot create an annotation set w/o referenceId. Why?

400 HTTP/2.0 400
- SHOW HEADERS -
{
 "error": {
  "code": 400,
  "message": "Invalid value for field \"annotationSet.referenceSetId\": empty or not specified",
  "status": "INVALID_ARGUMENT"
 }
}

BTW, how can I set the WRITE permission for the caller?

Caller must have WRITE permission for the associated annotation set.

Thank you in advance!


Solution

  • So to have an annotationset associated to a dataset, you would need write permission to that dataset. If you created the dataset then you would have write permission, which would be associated with your account. If it is a public dataset, then you might need to ask for permission from the person who loaded that dataset to add you with write permissions to it, or you could reload it under you account.

    Now assuming you created a dataset, then you can create an AnnotationSet via curl directly - you will need to use your API key from the console (please don't post your API key publicly here). Below is the command and what you would fill in:

    curl -v -X POST -H "Content-Type: application/json" -d '{"datasetId":"YourActualDatasetID", "referenceSetId":"YourActualReferencesetID"}' https://genomics.googleapis.com/v1/annotationsets?fields=asdf&key=YOUR_API_KEY

    Let me know if this worked for you, and if there is anything else that I can help you with.

    Thanks,

    Paul