1 package jalview.ext.htsjdk;
3 import htsjdk.tribble.CloseableTribbleIterator;
4 import htsjdk.tribble.TabixFeatureReader;
5 import htsjdk.variant.variantcontext.VariantContext;
6 import htsjdk.variant.vcf.VCFCodec;
8 import java.io.IOException;
10 import org.testng.annotations.Test;
12 public class TabixFeatureReaderTest
14 // gnomAD exome variant dataset
15 private static final String VCF_PATH = "/Volumes/gjb/smacgowan/NOBACK/resources/gnomad/gnomad.exomes.r2.0.1.sites.vcf.gz";
17 // "https://storage.cloud.google.com/gnomad-public/release/2.0.1/vcf/exomes/gnomad.exomes.r2.0.1.sites.vcf.gz";
20 * A 'test' that demonstrates querying an indexed VCF file for features in a
26 public void testQuery() throws IOException
29 * if not specified, assumes index file is filename.tbi
31 TabixFeatureReader<VariantContext, VCFCodec> reader = new TabixFeatureReader<>(
32 VCF_PATH, VCF_PATH, new VCFCodec());
35 * gene NMT1 (human) is on chromosome 17
36 * GCHR38 (Ensembl): 45051610-45109016
37 * GCHR37 (gnoMAD): 43128978-43186384
38 * CDS begins at offset 9720, first CDS variant at offset 9724
40 CloseableTribbleIterator<VariantContext> features = reader.query("17",
41 43128978 + 9724, 43128978 + 9734); // first 11 CDS positions
42 while (features.hasNext())
44 System.out.println(features.next().toString());