GithubHelp home page GithubHelp logo

Comments (3)

simonbrent avatar simonbrent commented on May 24, 2024

I'm not sure I understand what you mean? Do you mean you want to connect client-side javascript directly to your database? That is not possible.

You have to write a web server to extract results from the database and format then into a JSON which is consumable by Genoverse. You then need to set the URL of your track's model to be the URL of the web server which returns the data you want for that track.

from genoverse.

carlosmoraes avatar carlosmoraes commented on May 24, 2024

Thanks for your reply, Simon.

I have several sequences stored in a database. These sequences are currently under analisys and Genoverse would come in handy to visualize these sequences and help people during the annotation process. So what I need to do is exactly what you mentioned: create a web service that generates a JSON which will be consumed by Genoverse.

Do you have any examples on how to make Genoverse consume a JSON? Or how is the format of that JSON? Maybe the steps needed to "load" a JSON into Genoverse?

Another question: for every sequence I must have a JS like "tomato.js" or "grch38.js"?

Thanks in advance,

Carlos.

from genoverse.

simonbrent avatar simonbrent commented on May 24, 2024

Ok, so sequences are a little different - you don't want them to be JSON, you just want to return the sequence of letters for a given chr, start and end position (content-type should be text/plain).

You can set up a sequence track as follows:

Genoverse.Track.extend({
  name       : 'Sequence',
  controller : Genoverse.Track.Controller.Sequence,
  model      : Genoverse.Track.Model.Sequence.extend({ url: '/path/to/your/server?chr=__CHR__&start=__START__&end=__END__' }),
  view       : Genoverse.Track.View.Sequence,
  100000     : false,
  resizable  : 'auto'
})

You can do this once for each sequence file you have, with different URLs.

Alternatively, if you have FASTA files for your sequences, you can use

Genoverse.Track.Model.Sequence.Fasta.extend({ url: '/path/to/your/server/where/the/fasta/file/is' })

Doing that will mean you don't have to worry about creating a web server that extracts sequences from the database, instead you just have to expose your fasta files to the web server instead, which is much simpler to do!

Your question about genome files ("tomato.js") concerns me slightly however. Genoverse requires one genome file per instance (tomato.js is the minimum amount of data you need - chromosome names as keys in the hash, with the size of each chromosome and an empty bands array). If your sequence files come from different genomes, they might not render properly on the same instance of Genoverse - see the following example:

sequence 1: AAAATTTTCCCCGGGG
sequence 2: ATCGATCGATCGATCGATCG
genome file says chr has size of 16 (based on sequence 1).
when rendering sequence 2, the last 4 bases are out of range, and won't be drawn.

If this is a problem for you, but all you care about is the sequences (i.e., you have no other datasets that you want to display alongside the sequences), you can cheat by creating a genome file where the size of each chromosome is the length of the longest sequence you have for that chromosome. That way everything will be drawn, and you'll have shorter sequences ending before the end of the chromosome.

Does that make sense?

from genoverse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.