本文整理汇总了Java中htsjdk.variant.vcf.VCFFileReader.query方法的典型用法代码示例。如果您正苦于以下问题:Java VCFFileReader.query方法的具体用法?Java VCFFileReader.query怎么用?Java VCFFileReader.query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htsjdk.variant.vcf.VCFFileReader
的用法示例。
在下文中一共展示了VCFFileReader.query方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processVCF
import htsjdk.variant.vcf.VCFFileReader; //导入方法依赖的package包/类
@NotNull
Collection<EligibilityReport> processVCF(final String patient, final String sample, final EligibilityReport.ReportType type,
final VCFFileReader reader) {
final List<EligibilityReport> results = Lists.newArrayList();
for (final HmfGenomeRegion region : querySet.values()) {
final CloseableIterator<VariantContext> query =
reader.query(region.chromosome(), (int) region.geneStart(), (int) region.geneEnd());
while (query.hasNext()) {
final VariantContext variant = query.next();
results.addAll(processVariant(variant, patient, sample, type));
}
query.close();
}
return results;
}
示例2: testTabixIndexCreationChr20
import htsjdk.variant.vcf.VCFFileReader; //导入方法依赖的package包/类
public void testTabixIndexCreationChr20() throws IOException {
String configFolder = "test-data/configs/hapmap-chr1";
// input folder contains no vcf or vcf.gz files
String inputFolder = "test-data/data/chr20-phased";
// create workflow context
WorkflowTestContext context = buildContext(inputFolder, "hapmap2", "eagle");
// create step instance
InputValidation inputValidation = new InputValidationMock(configFolder);
// run and test
boolean result = run(context, inputValidation);
// check if step is failed
assertEquals(true, result);
assertTrue(context.hasInMemory("[OK] 1 valid VCF file(s) found."));
// test tabix index and count snps
String vcfFilename = inputFolder + "/chr20.R50.merged.1.330k.recode.small.vcf.gz";
VCFFileReader vcfReader = new VCFFileReader(new File(vcfFilename),
new File(vcfFilename + TabixUtils.STANDARD_INDEX_EXTENSION), true);
CloseableIterator<VariantContext> snps = vcfReader.query("20", 1, 1000000000);
int count = 0;
while (snps.hasNext()) {
snps.next();
count++;
}
snps.close();
vcfReader.close();
//check snps
assertEquals(7824, count);
}
示例3: testTabixIndexCreationChr1
import htsjdk.variant.vcf.VCFFileReader; //导入方法依赖的package包/类
public void testTabixIndexCreationChr1() throws IOException {
String configFolder = "test-data/configs/hapmap-chr1";
// input folder contains no vcf or vcf.gz files
String inputFolder = "test-data/data/single";
// create workflow context
WorkflowTestContext context = buildContext(inputFolder, "hapmap2", "eagle");
// create step instance
InputValidation inputValidation = new InputValidationMock(configFolder);
// run and test
boolean result = run(context, inputValidation);
// check if step is failed
assertEquals(true, result);
assertTrue(context.hasInMemory("[OK] 1 valid VCF file(s) found."));
// test tabix index and count snps
String vcfFilename = inputFolder + "/minimac_test.50.vcf.gz";
VCFFileReader vcfReader = new VCFFileReader(new File(vcfFilename),
new File(vcfFilename + TabixUtils.STANDARD_INDEX_EXTENSION), true);
CloseableIterator<VariantContext> snps = vcfReader.query("1", 1, 1000000000);
int count = 0;
while (snps.hasNext()) {
snps.next();
count++;
}
snps.close();
vcfReader.close();
//check snps
assertEquals(905, count);
}
示例4: countEntries
import htsjdk.variant.vcf.VCFFileReader; //导入方法依赖的package包/类
@Test
public void countEntries() throws Exception {
VCFFileReader vcfFileReader =
new VCFFileReader(new File("src/test/resources/" + filename), false);
Iterator<VariantContext> variantIterator;
if (interval == null) {
variantIterator = vcfFileReader.iterator();
} else {
variantIterator = vcfFileReader.query(interval.getContig(),
interval.getStart(), interval.getEnd());
}
int expectedCount = Iterators.size(variantIterator);
int counter = 0;
for (RecordReader<LongWritable, VariantContextWritable> reader : readers) {
while (reader.nextKeyValue()) {
writable = reader.getCurrentValue();
assertNotNull(writable);
VariantContext vc = writable.get();
assertNotNull(vc);
String value = vc.toString();
assertNotNull(value);
counter++;
}
}
assertEquals(expectedCount, counter);
}
示例5: loadVCFs
import htsjdk.variant.vcf.VCFFileReader; //导入方法依赖的package包/类
protected void loadVCFs() {
for(final String vcfFile: IOUtils.unrollFiles(variants)) {
final VCFFileReader vcfFileReader = new VCFFileReader(new File(vcfFile),true);
final CloseableIterator<VariantContext> r=vcfFileReader.query(this.interval.getContig(), this.interval.getStart(), this.interval.getEnd());
while(r.hasNext())
{
this.highlightPositions.add(r.next().getStart());
}
r.close();
vcfFileReader.close();
}
}
示例6: handleSpaceInVCFInfoAndInvalidKey
import htsjdk.variant.vcf.VCFFileReader; //导入方法依赖的package包/类
@Test
public void handleSpaceInVCFInfoAndInvalidKey(){
// This reading would fail on the original htsjdk-1.141
VCFFileReader reader = new VCFFileReader(new File("test_data/malformed.vcf.gz"));
reader.query("chr1", 1, 16000000);
}