本文整理汇总了Java中htsjdk.tribble.index.tabix.TabixFormat.VCF属性的典型用法代码示例。如果您正苦于以下问题:Java TabixFormat.VCF属性的具体用法?Java TabixFormat.VCF怎么用?Java TabixFormat.VCF使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类htsjdk.tribble.index.tabix.TabixFormat
的用法示例。
在下文中一共展示了TabixFormat.VCF属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: trackFormatToTabixFormat
public static TabixFormat trackFormatToTabixFormat(TrackFormat fmt){
TabixFormat tbx= null;
if(fmt.equals(TrackFormat.BAM)){
tbx= TabixFormat.SAM;
} else if (fmt.equals(TrackFormat.BED) || fmt.equals(TrackFormat.BEDGRAPH)){
tbx= TabixFormat.BED;
} else if (fmt.equals(TrackFormat.GFF) || fmt.equals(TrackFormat.GTF)){
tbx= TabixFormat.GFF;
} else if (fmt.equals(TrackFormat.VCF)){
tbx= TabixFormat.VCF;
} else {
throw new RuntimeException();
}
return tbx;
}
示例2: canCompressAndIndexHeaderlessVCF
@Test
public void canCompressAndIndexHeaderlessVCF() throws ClassNotFoundException, IOException, InvalidRecordException, SQLException{
String infile= "test_data/noheader.vcf";
File outfile= new File("test_data/noheader.vcf.gz");
outfile.deleteOnExit();
File expectedTbi= new File(outfile.getAbsolutePath() + TabixUtils.STANDARD_INDEX_EXTENSION);
expectedTbi.deleteOnExit();
new MakeTabixIndex(infile, outfile, TabixFormat.VCF);
assertTrue(outfile.exists());
assertTrue(outfile.length() > 200);
assertTrue(expectedTbi.exists());
assertTrue(expectedTbi.length() > 100);
TabixReader tbx = new TabixReader(outfile.getAbsolutePath());
Iterator x = tbx.query("1", 1, 10000000);
assertTrue(x.next().startsWith("1"));
}
示例3: testRealFileSizeVCF
@Test
public void testRealFileSizeVCF() throws ClassNotFoundException, IOException, InvalidRecordException, SQLException{
// See test_data/README.md for this file. This is fairly large and we want to check it is processed
// in a reasonable amount of time.
String infile= "test_data/ALL.wex.union_illumina_wcmc_bcm_bc_bi.20110521.snps.exome.sites.vcf";
File outfile= new File("deleteme.vcf.gz");
outfile.deleteOnExit();
File expectedTbi= new File(outfile.getAbsolutePath() + TabixUtils.STANDARD_INDEX_EXTENSION);
expectedTbi.deleteOnExit();
long t0= System.currentTimeMillis();
new MakeTabixIndex(infile, outfile, TabixFormat.VCF);
long t1= System.currentTimeMillis();
assertTrue(outfile.exists());
assertTrue(outfile.length() > 1000);
assertTrue((t1 - t0) < 20000); // Should be << than 20 sec, ~2 sec
// Check you can read ok
this.vcfTester(outfile.getAbsolutePath());
}
示例4: canCompressAndIndexVCF_CEU
@Test
public void canCompressAndIndexVCF_CEU() throws ClassNotFoundException, IOException, InvalidRecordException, SQLException{
String infile= "test_data/CEU.exon.2010_06.genotypes.vcf";
File outfile= new File("deleteme.vcf.gz");
outfile.deleteOnExit();
File expectedTbi= new File(outfile.getAbsolutePath() + TabixUtils.STANDARD_INDEX_EXTENSION);
expectedTbi.deleteOnExit();
new MakeTabixIndex(infile, outfile, TabixFormat.VCF);
assertTrue(outfile.exists());
assertTrue(outfile.length() > 1000);
// Check you can read ok
this.vcfTester(outfile.getAbsolutePath());
}
示例5: canCompressAndIndexVCF
@Test
public void canCompressAndIndexVCF() throws ClassNotFoundException, IOException, InvalidRecordException, SQLException{
String infile= "test_data/CHD.exon.2010_03.sites.unsorted.vcf";
File outfile= new File("test_data/tmp6.bed.gz");
outfile.deleteOnExit();
File expectedTbi= new File(outfile.getAbsolutePath() + TabixUtils.STANDARD_INDEX_EXTENSION);
expectedTbi.deleteOnExit();
new MakeTabixIndex(infile, outfile, TabixFormat.VCF);
assertTrue(outfile.exists());
assertTrue(outfile.length() > 1000);
assertTrue(expectedTbi.exists());
assertTrue(expectedTbi.length() > 1000);
TabixReader tbx = new TabixReader(outfile.getAbsolutePath());
Iterator x = tbx.query("1", 20000000, 30000000);
assertTrue(x.next().startsWith("1"));
// Check you can read ok
this.vcfTester(outfile.getAbsolutePath());
}
示例6: createIndex
private static Index createIndex(InputStream is) throws IOException {
TabixIndexCreator ctor = new TabixIndexCreator(TabixFormat.VCF);
VCFCodec codec = new VCFCodec();
VariantContext lastContext = null;
VariantContext currentContext;
final Map<String, VariantContext> visitedChromos = new HashMap<String, VariantContext>();
AsciiLineReader lineReader = new AsciiLineReader(is);
AsciiLineReaderIterator iterator = new AsciiLineReaderIterator(lineReader);
codec.readActualHeader(iterator);
while (iterator.hasNext()) {
final long position = iterator.getPosition();
currentContext = codec.decode(iterator.next());
checkSorted(lastContext, currentContext);
//should only visit chromosomes once
final String curChr = currentContext.getChr();
final String lastChr = lastContext != null ? lastContext.getChr() : null;
if(!curChr.equals(lastChr)){
if(visitedChromos.containsKey(curChr)){
throw new RuntimeException("Input file must have contiguous chromosomes.");
}else{
visitedChromos.put(curChr, currentContext);
}
}
ctor.addFeature(currentContext, position);
lastContext = currentContext;
}
iterator.close();
return ctor.finalizeIndex(iterator.getPosition());
}
示例7: handlingInvalidLines
@Test
public void handlingInvalidLines() throws ClassNotFoundException, IOException, InvalidRecordException, SQLException{
String infile= "test_data/invalid.vcf";
File outfile= new File("test_data/tmp.vcf.gz");
outfile.deleteOnExit();
File expectedTbi= new File(outfile.getAbsolutePath() + TabixUtils.STANDARD_INDEX_EXTENSION);
expectedTbi.deleteOnExit();
new MakeTabixIndex(infile, outfile, TabixFormat.VCF);
}