jsa-aerial / js-local-vcf Goto Github PK
View Code? Open in Web Editor NEWJavascript local VCF and Tabix index file parsing and processing
License: MIT License
Javascript local VCF and Tabix index file parsing and processing
License: MIT License
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.
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);
});
});
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!
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.
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!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.