GMOD / Apollo

Genome annotation editor with a Java Server backend and a Javascript client that runs in a web browser as a JBrowse plugin.
http://genomearchitect.readthedocs.io/
Other
128 stars 85 forks source link

Get gene sequence #2643

Open mictadlo opened 2 years ago

mictadlo commented 2 years ago

Hi all, Apollo allows to drag-n-drop a gene into the yellow field, and from the gene menu, you can select Get Sequence and get, for example, the peptide sequence for the gene as shown below:

image

image

The above solution works, but most users forget to delete the genes from the yellow Apollo's annotation field. Therefore, I wrote a small web app based on Python's Flask framework, which can be found here. To add it to Apollo, I need to add the following lines to trackList.json for the gene track:

{
  "menuTemplate": [
    {},
    {},
    {
      "action": "iframeDialog",
      "label": "Get Sequence",
      "title": "{Name}",
      "iconClass": "dijitIconDatabase",
      "url": "[https://apollo.nbenth.com/getseq/{ID}](https://apollo.nbenth.com/getseq/%7BID%7D)"
    }
  ],
  "storeClass": "JBrowse/Store/SeqFeature/NCList",
  "urlTemplate": "tracks/SeqViewer-test/{refseq}/trackData.jsonz",
  "style": {
    "className": "feature"
  },
  "label": "SeqViewer-test",
  "apollo": {
    "topType": "mRNA",
    "source": "upload",
    "type": "GFF3_JSON"
  },
  "type": "JBrowse/View/Track/HTMLFeatures",
  "key": "SeqViewer-test"
}

The user needs to select a gene and click right-mouse click and select Get Sequence from the menu:

image

However, the problem with my solution is that I need to create a new database for each annotation. How is it possible to access Apollo's database, or how can Get Sequence be extracted from Apollo and replace my code?

I really appreciate any help you can provide. Michal

cmdcolin commented 2 years ago

this doesn't necessarily help with your apollo and jbrowse 1, but jbrowse 2 has code that can calculate the protein sequence client side. example screenshot (can get live demo at https://jbrowse.org/jb2 also)

Screenshot from 2022-03-09 17-55-29

garrettjstevens commented 2 years ago

I am not able to see the code on BitBucket you linked (looks like I don't have permission), but I might have an idea. You can access the sequence by using Apollo's Web Service APIs. Here is an example of how this would look using a feature on our demo sequence:

curl --header 'Content-Type:application/json' --data '{"organismString":"Honeybee","sequenceName":"Group1.25","featureName":"afaad855-7b99-4e86-8828-b3b7cfb5891d","type":"peptide","username":"demo@demo.com","password":"demo"}' http://demo.genomearchitect.io/Apollo2/sequence/sequenceByName

or equivalently in JS

fetch('http://demo.genomearchitect.io/Apollo2/sequence/sequenceByName', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    organismString: 'Honeybee',
    sequenceName: 'Group1.25',
    featureName: 'afaad855-7b99-4e86-8828-b3b7cfb5891d',
    type: 'peptide',
    username: 'demo@demo.com',
    password: 'demo',
  }),
})
  .then(response => response.text())
  .then(console.log)

The possible types are genomic, cds, cdna, and peptide. Let me know if this doesn't work for you.