I want to download ALL currently known protein sequences for all SARS-CoV-2 strains. I am not sure how up

import requests
import pandas as pd

from matplotlib import pyplot as plt
from scipy.stats import gamma
import numpy as np

import c3aidatalake

url = 'https://api.c3.ai/covid/api/1/sequence/fetch'

json_request = {
  "spec": {
      "filter": "sequenceType == 'complete'",
      "limit": 10

headers = {
    'Accept': 'application/json',
    'Content-Type': 'application/json'

response = requests.post(url=url, json=json_request, headers=headers)


result = response.json()


This request returns something like:

   {'objs': [{'type': 'ProteinSequence',
   'id': 'BCA87360',
   'meta': {'tenantTagId': 4,
    'tenant': 'covid',
    'tag': 'prod',
    'created': '2020-06-06T14:51:45Z',
    'createdBy': 'dataloader',
    'updated': '2020-11-16T06:03:38Z',
    'updatedBy': 'dataloader',
    'timestamp': '2020-11-16T06:03:49Z',
    'sourceFile': 'proteins_sequence_metadata.csv',
    'fetchInclude': '[]',
    'fetchType': 'Sequence'},
   'version': 65539,
   'parent': {'id': 'BCA87360'},
   'sequence': 'MESLVPGFNEK...',
   'sequenceType': 'complete',
   'length': 7096,
   'typeIdent': 'PRTN'},

I guess, I need to filter the results for the 'objs': [{'type': 'ProteinSequence', field. But I am not so familiar with elastic search syntax.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.