1
$\begingroup$

I can do something like this:

$ tabix ${url} ${range}

where ${range} spans a region on a single chromosome, e.g., chrA:X-Y.

Can a tabix query span multiple chromosomes, e.g., where ${range} looks like chrA:X-chrN:Y (or similar), which returns data between chrA:X and chrN:Y (using either a lexicographical or natural sort order between chrA and chrN)?

Note: I do not want to pass in a BED file of intervals. If it can't be done without passing in a separate file, that's fine. I only want to provide a one-liner to give to someone who can run tabix on their end, to do this type of query directly and remotely.

$\endgroup$
3
$\begingroup$

Looking at the htslib source code, it seems like the answer is no, a single region specifier cannot span multliple chromosomes.

Seems like the closest you can get is to enumerate all the chromosomes as separate regions on the command line. So to get everything between chrA:X and chrN:Y, you would have to write:

tabix inputfile.gz chrA:X chrB chrC ... chrN:1-Y

(If you omit the end coordinate like chrA:X, the region encompasses chrA from the specified coordinate to the end. If only specify the chromosome name without the coordinates, like chrB, the region encompasses the whole named chromosome, and for the last chromosome, you can specify up to the desired point by starting from the beginning: chrN:1-Y.)

$\endgroup$
1
  • $\begingroup$ Okay, thanks, that worked great. I was able to order chromosomes as desired to write standard output in BEDOPS sort-bed order. $\endgroup$ May 20 '19 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.