dasmoth / dalliance

Interactive web-based genome browser.
http://www.biodalliance.org/
BSD 2-Clause "Simplified" License
226 stars 68 forks source link

Unable to extract sequence information from a 2bit file. #191

Closed sthz closed 8 years ago

sthz commented 8 years ago

Is it possible to give a command to dalliance that will extract the nucleotide code from a 2bit fle ?

Dalliance does this, but I have no clue how to manually do this.

dasmoth commented 8 years ago

Could you be a bit clearer about what you're trying to achieve here? Do you want a user-interface for retrieving sequence, or are you trying to do so programatically?

In the latter case, the following JS should get you some sequence:

         makeTwoBit(
                new URLFetchable('http://my.server/genome.2bit'),
                function(twoBit, err) {
                     twoBit.fetch('22', 20000000, 20010000, function(seq) {
                         console.log(seq);
                     });
                }
          )

...or are you after something more subtle?

sthz commented 8 years ago

Hi dasmoth, thank you very much for the quick reply.

That was indeed what my problem was I wanted to get a part out of the 2bit sequence with the dalliance code. I currently solved the problem with the following code:

TwoBitSequenceSource.fetch(chr,min,max,null,function(a,b){
    console.log(b);
}

In the dalliance: TwoBitSequenceSource.prototype.fetch = function(chr, min, max, pool, callback) { I don't know what the purpose of 'pool' is in this case.

dasmoth commented 8 years ago

Yes, that will work.

The "pool" argument is meant to be one of these:

          https://github.com/dasmoth/dalliance/blob/master/js/kspace.js#L44-L61

Some data sources use them to allow cancelling of in-flight requests, and also to facilitate coordination when several requests get sent to the same datasource at once. However, TwoBitSequenceSource doesn't use this, so passing null is fine.