Code Monkey home page Code Monkey logo

js-local-vcf's People

Contributors

jsa-aerial avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

bmpvieira-forks

js-local-vcf's Issues

Retrieving Multiple Discontinuous Records

Hi,

Again, thanks for building such a great library, and for being so willing to provide support for it. I also sent you guys an email about this issue; I'm realizing now that I should have posted it here.

Basically, what I'd like to do is use the getRecords() method multiple times—with the same files—but in different chromosomes, from different start points to different points, in sections which are not contiguous.

I have a working solution, but it's slow and seems overcomplicated. I'm not an experienced JavaScript developer, and with other, simpler approaches I tried (like using the same object for multiple getRecords() calls—dumb, I know; or recursion, for example), I ran into problems with asynchronicity and certain properties (like indexReader.bhash) seemingly uninitialized when I wanted to use them.

var d = []; 
var readers = []; 
var callbacksRemaining = regions.length; 

regions.forEach(function(item, i) {

    readers[i] = new readBinaryVCF(tabix, vcf, function(tabixReader) {

        reader = readers[i];

        var index = 0; 

        for (key in tabixReader.idxContent.namehash) {
            if (key == regions[i][0]) {
                index = tabixReader.idxContent.namehash[key];
            }
        }

        reader.getRecords(index, regions[i][1], regions[i][2], function(data) {; 

            d[i] = data; 
            callbacksRemaining--; 

            if (callbacksRemaining <= 0) {
                processData(d);
            }
        });
    });
});

If there's a better way to do this (which I assume there is), please let me know.

Detect Mismatched Tabix and VCF

Hi,

I'm using readBinaryVCF() and getRecords() to access data from a VCF.

I know this is a fringe case, but I'm wondering if there's some way to detect if someone is using a VCF and a Tabix that don't match—meaning the Tabix is the index file for another VCF. Right now, it just outputs a bunch of errors to the console; instead, I'd like to change something on my graphical interface.

I've had little success with try...catch, too, unfortunately.

Thank you for your help.

var reader = new readBinaryVCF(tabix, vcf, function(vcfR) {
    reader.getRecords(index, parseInt(item[1]), parseInt(item[1]), function(data) {
        processData(data);
    });
});

initialize bgzf

Hi I have one other question - I'm still trying to play around and figure things out. How do you initialize the BGZF file spec?

"// readBinaryVCF which takes a tabix filespec and a BGZF VCF filespec
// initializes a tabix reader and builds binary VCF reader. Provides
// methods"

Would I be able to do something like this?

var tbx = new readTabixFile("http://local_file/20150510_V4_WI.vcf.gz.csi")
var vcf_file = new bgzf("http://local_file/20150510_V4_WI.vcf.gz");

var vcf = new readBinaryVCF(tbx, vcf)

I think if I can get access to the functions and the vcf is loaded I should be good to go. Thanks!

Find Records by rsID

Hi,

Is there any way to retrieve data (either using getRecords() or not) from a compressed VCF and Tabix by the rsID, not by chromosome and position?

Thanks.

Load vcf file from predefined URL

Hi - I am trying to load a VCF File from a predefined URL within the browser. Is there a way to go about doing that with this?

Thank you!

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.