本文整理汇总了Java中htsjdk.tribble.index.tabix.TabixIndex类的典型用法代码示例。如果您正苦于以下问题:Java TabixIndex类的具体用法?Java TabixIndex怎么用?Java TabixIndex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TabixIndex类属于htsjdk.tribble.index.tabix包,在下文中一共展示了TabixIndex类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: makeBedIndex
import htsjdk.tribble.index.tabix.TabixIndex; //导入依赖的package包/类
/**
* Creates an index for a specified BedFile
* @param bedFile BedFile to create index for
*/
public void makeBedIndex(final BedFile bedFile) {
final Map<String, Object> params = new HashMap<>();
params.put(DIR_ID.name(), bedFile.getId());
params.put(USER_ID.name(), bedFile.getCreatedBy());
File file = new File(bedFile.getPath());
File indexFile = new File(toRealPath(substitute(BED_INDEX, params)));
NggbBedCodec bedCodec = new NggbBedCodec();
TabixIndex index = IndexUtils.createTabixIndex(file, bedCodec, TabixFormat.BED);
index.write(indexFile);
BiologicalDataItem indexItem = new BiologicalDataItem();
indexItem.setCreatedDate(new Date());
indexItem.setPath(indexFile.getAbsolutePath());
indexItem.setFormat(BiologicalDataItemFormat.BED_INDEX);
indexItem.setType(BiologicalDataItemResourceType.FILE);
indexItem.setName("");
indexItem.setCreatedBy(AuthUtils.getCurrentUserId());
bedFile.setIndex(indexItem);
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:27,代码来源:FileManager.java
示例2: makeSegIndex
import htsjdk.tribble.index.tabix.TabixIndex; //导入依赖的package包/类
/**
* Creates an index for a specified SegFile
* @param segFile SegFile to create index for
*/
public void makeSegIndex(final SegFile segFile) {
final Map<String, Object> params = new HashMap<>();
params.put(DIR_ID.name(), segFile.getId());
params.put(USER_ID.name(), segFile.getCreatedBy());
File file = new File(segFile.getPath());
File indexFile = new File(toRealPath(substitute(SEG_INDEX, params)));
LOGGER.debug("Writing SEG index at {}", indexFile.getAbsolutePath());
SegCodec segCodec = new SegCodec();
TabixIndex index = IndexUtils.createTabixIndex(file, segCodec, SEG_TABIX_FORMAT);
index.write(indexFile);
BiologicalDataItem indexItem = new BiologicalDataItem();
indexItem.setCreatedDate(new Date());
indexItem.setPath(indexFile.getAbsolutePath());
indexItem.setFormat(BiologicalDataItemFormat.SEG_INDEX);
indexItem.setType(BiologicalDataItemResourceType.FILE);
indexItem.setName("");
indexItem.setCreatedBy(AuthUtils.getCurrentUserId());
segFile.setIndex(indexItem);
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:28,代码来源:FileManager.java
示例3: getChromosomeNames
import htsjdk.tribble.index.tabix.TabixIndex; //导入依赖的package包/类
@Override
public List<String> getChromosomeNames(){
if(this.getTrackFormat().equals(TrackFormat.TDF)){
ResourceLocator resourceLocator= new ResourceLocator(this.getWorkFilename());
TDFReader reader= new TDFReader(resourceLocator);
List<String> chroms= new ArrayList<String>(reader.getChromosomeNames());
if(chroms.get(0).equals("All")){
chroms.remove(0);
}
return chroms;
// chroms.addAll();
}
if(this.getTrackFormat().equals(TrackFormat.BEDGRAPH)){
TabixIndex tbi= (TabixIndex) IndexFactory.loadIndex(this.getWorkFilename() + TabixUtils.STANDARD_INDEX_EXTENSION);
return tbi.getSequenceNames();
}
if(this.getTrackFormat().equals(TrackFormat.BIGWIG)){
return this.bigWigReader.getChromosomeNames();
}
return null;
}
开发者ID:dariober,项目名称:ASCIIGenome,代码行数:24,代码来源:TrackWiggles.java
示例4: testVCFGZIndex_tabix
import htsjdk.tribble.index.tabix.TabixIndex; //导入依赖的package包/类
@Test
public void testVCFGZIndex_tabix() {
final File ORIG_FILE = getTestFile("test_variants_for_index.vcf.blockgz.gz"); //made by bgzip
final File outName = createTempFile("test_variants_for_index.blockgz.gz.", TabixUtils.STANDARD_INDEX_EXTENSION);
final String[] args = {
"--feature-file" , ORIG_FILE.getAbsolutePath(),
"-O" , outName.getAbsolutePath()
};
final Object res = this.runCommandLine(args);
Assert.assertEquals(res, outName.getAbsolutePath());
final Index index = IndexFactory.loadIndex(res.toString());
Assert.assertTrue(index instanceof TabixIndex);
Assert.assertEquals(index.getSequenceNames(), Arrays.asList("1", "2", "3", "4"));
checkIndex(index, Arrays.asList("1", "2", "3", "4"));
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:19,代码来源:IndexFeatureFileIntegrationTest.java
示例5: testVCFGZIndex_inferredName
import htsjdk.tribble.index.tabix.TabixIndex; //导入依赖的package包/类
@Test
public void testVCFGZIndex_inferredName(){
final File ORIG_FILE = getTestFile("test_variants_for_index.vcf.blockgz.gz"); //made by bgzip
final String[] args = {
"--feature-file" , ORIG_FILE.getAbsolutePath(),
};
final Object res = this.runCommandLine(args);
final File tabixIndex = new File(ORIG_FILE.getAbsolutePath() + TabixUtils.STANDARD_INDEX_EXTENSION);
Assert.assertEquals(res, tabixIndex.getAbsolutePath());
tabixIndex.deleteOnExit();
Assert.assertTrue(tabixIndex.exists(), tabixIndex + " does not exists");
final Index index = IndexFactory.loadIndex(tabixIndex.toString());
Assert.assertTrue(index instanceof TabixIndex);
Assert.assertEquals(index.getSequenceNames(), Arrays.asList("1", "2", "3", "4"));
checkIndex(index, Arrays.asList("1", "2", "3", "4"));
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:19,代码来源:IndexFeatureFileIntegrationTest.java
示例6: makeVcfIndex
import htsjdk.tribble.index.tabix.TabixIndex; //导入依赖的package包/类
/**
* Creates a Tribble index for an uncompressed VCF file and a Tabix index for a compressed one. Writes it
* to .idx or .tbi file
*
* @param vcfFile {@code VcfFile} a VcfFile object, representing a file in the system with set id, name and
* compressed options
* @param userId {@code Long} a user for whom file was saved.
* @throws IOException
*/
public void makeVcfIndex(VcfFile vcfFile, Long userId) throws IOException {
final Map<String, Object> params = new HashMap<>();
params.put(DIR_ID.name(), vcfFile.getId());
params.put(FILE_NAME.name(), vcfFile.getCompressed() ? VcfFileNames.VCF_COMPRESSED_FILE_NAME.getName() :
VcfFileNames.VCF_FILE_NAME.getName());
params.put(USER_ID.name(), userId);
File file = new File(vcfFile.getPath());
VCFCodec codec = new VCFCodec();
File indexFile;
if (vcfFile.getCompressed()) {
indexFile = new File(toRealPath(substitute(VCF_COMPRESSED_INDEX, params)));
LOGGER.info(getMessage(MessagesConstants.INFO_VCF_INDEX_WRITING, indexFile.getAbsolutePath()));
TabixIndex index = IndexUtils.createTabixIndex(file, codec, TabixFormat.VCF);
index.write(indexFile);
} else {
indexFile = new File(toRealPath(substitute(VCF_INDEX, params)));
LOGGER.info(getMessage(MessagesConstants.INFO_VCF_INDEX_WRITING, indexFile.getAbsolutePath()));
IntervalTreeIndex intervalTreeIndex = IndexFactory.createIntervalIndex(file, codec); // Create an index
IndexFactory.writeIndex(intervalTreeIndex, indexFile); // Write it to a file
}
BiologicalDataItem indexItem = new BiologicalDataItem();
indexItem.setCreatedDate(new Date());
indexItem.setPath(indexFile.getAbsolutePath());
indexItem.setFormat(BiologicalDataItemFormat.VCF_INDEX);
indexItem.setType(BiologicalDataItemResourceType.FILE);
indexItem.setName("");
indexItem.setCreatedBy(AuthUtils.getCurrentUserId());
vcfFile.setIndex(indexItem);
}
开发者ID:epam,项目名称:NGB,代码行数:43,代码来源:FileManager.java
示例7: makeBedGraphIndex
import htsjdk.tribble.index.tabix.TabixIndex; //导入依赖的package包/类
/**
* Creates an index for a specified BedGraphFile
* @param bedGraphFile BedGraphFile to create index for
*/
public void makeBedGraphIndex(final WigFile bedGraphFile) throws IOException {
final Map<String, Object> params = new HashMap<>();
params.put(DIR_ID.name(), bedGraphFile.getId());
params.put(USER_ID.name(), bedGraphFile.getCreatedBy());
File file = new File(bedGraphFile.getPath());
File indexFile;
BedGraphCodec bedGraphCodec = new BedGraphCodec();
if (bedGraphFile.getCompressed()) {
indexFile = new File(toRealPath(substitute(BED_GRAPH_COMPRESSED_INDEX, params)));
LOGGER.debug("Writing BED_GRAPH index at {}", indexFile.getAbsolutePath());
TabixIndex index = IndexUtils.createTabixIndex(file, bedGraphCodec, BED_GRAPH_TABIX_FORMAT);
index.write(indexFile);
} else {
indexFile = new File(toRealPath(substitute(BED_GRAPH_INDEX, params)));
LOGGER.debug("Writing BED_GRAPH index at {}", indexFile.getAbsolutePath());
// Create an index
IntervalTreeIndex intervalTreeIndex = IndexFactory.createIntervalIndex(file, bedGraphCodec);
IndexFactory.writeIndex(intervalTreeIndex, indexFile); // Write it to a file
}
BiologicalDataItem indexItem = new BiologicalDataItem();
indexItem.setCreatedDate(new Date());
indexItem.setPath(indexFile.getAbsolutePath());
indexItem.setFormat(BiologicalDataItemFormat.BED_GRAPH_INDEX);
indexItem.setType(BiologicalDataItemResourceType.FILE);
indexItem.setName("");
indexItem.setCreatedBy(AuthUtils.getCurrentUserId());
bedGraphFile.setIndex(indexItem);
}
开发者ID:epam,项目名称:NGB,代码行数:37,代码来源:FileManager.java
示例8: determineFileName
import htsjdk.tribble.index.tabix.TabixIndex; //导入依赖的package包/类
private File determineFileName(final Index index) {
if (outputFile != null) {
return outputFile;
} else if (index instanceof TabixIndex) {
return Tribble.tabixIndexFile(featureFile);
} else {
return Tribble.indexFile(featureFile);
}
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:10,代码来源:IndexFeatureFile.java
示例9: makeTabixIndex
import htsjdk.tribble.index.tabix.TabixIndex; //导入依赖的package包/类
private void makeTabixIndex(final File sourceFile, final File indexFile,
final AsciiFeatureCodec codec, final TabixFormat format) throws IOException {
TabixIndex index = IndexFactory.createTabixIndex(sourceFile, codec, format, null);
index.write(indexFile);
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:6,代码来源:FileManager.java
示例10: makeGeneIndex
import htsjdk.tribble.index.tabix.TabixIndex; //导入依赖的package包/类
/**
* Creates an index for gene file, determined by a {@code GeneFile} object
*
* @param geneFeatureClass {@code Class<? extends GeneFeature>} defines gene file type, that will be indexed
* @param geneFile {@code GeneFile} that represents a file in the system
*/
public void makeGeneIndex(Class<? extends GeneFeature> geneFeatureClass, final GeneFile geneFile, final GeneFileType
type) throws IOException {
GffCodec.GffType gffType = GffCodec.GffType.forGeneFile(geneFeatureClass, geneFile);
final Map<String, Object> params = new HashMap<>();
params.put(DIR_ID.name(), geneFile.getId());
params.put(USER_ID.name(), geneFile.getCreatedBy());
params.put(GENE_EXTENSION.name(), gffType.getExtensions()[0]);
File file;
File indexFile;
switch (type) {
case ORIGINAL:
file = new File(geneFile.getPath());
indexFile = new File(toRealPath(substitute(GENE_INDEX, params)));
break;
case LARGE_SCALE:
file = new File(toRealPath(substitute(GENE_LARGE_SCALE_FILE, params)));
indexFile = new File(toRealPath(substitute(GENE_LARGE_SCALE_INDEX, params)));
break;
case TRANSCRIPT:
file = new File(toRealPath(substitute(GENE_TRANSCRIPT_FILE, params)));
indexFile = new File(toRealPath(substitute(GENE_TRANSCRIPT_INDEX, params)));
break;
default:
throw new UnsupportedGeneFileTypeException(type);
}
LOGGER.info(getMessage(MessagesConstants.INFO_GENE_INDEX_WRITING, indexFile.getAbsolutePath()));
if (geneFile.getCompressed()) {
createGeneCompressedIndex(indexFile, file, gffType);
} else {
AsciiFeatureCodec<GeneFeature> codec = new GffCodec(gffType);
TabixIndex index = IndexUtils.createTabixIndex(file, codec, TabixFormat.GFF);
index.write(indexFile);
}
if (type.equals(GeneFileType.ORIGINAL)) {
BiologicalDataItem indexItem = new BiologicalDataItem();
indexItem.setCreatedDate(new Date());
indexItem.setPath(indexFile.getAbsolutePath());
indexItem.setFormat(BiologicalDataItemFormat.GENE_INDEX);
indexItem.setType(BiologicalDataItemResourceType.FILE);
indexItem.setName("");
indexItem.setCreatedBy(AuthUtils.getCurrentUserId());
geneFile.setIndex(indexItem);
}
}
开发者ID:epam,项目名称:NGB,代码行数:57,代码来源:FileManager.java
示例11: testBedGZIndex
import htsjdk.tribble.index.tabix.TabixIndex; //导入依赖的package包/类
@Test
public void testBedGZIndex() {
// made with bgzip
testBedIndex(getTestFile("test_bed_for_index.bed.gz"), TabixIndex.class);
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:6,代码来源:IndexFeatureFileIntegrationTest.java
示例12: createTabixIndex
import htsjdk.tribble.index.tabix.TabixIndex; //导入依赖的package包/类
/**
* If file isn't compressed HTSJDK method is used, for compressed files our methods are
* used, which create the tabix index correctly.
*
* @param inputFile
* @param codec
* @param tabixFormat
* @param <F>
* @param <S>
* @return
*/
public static <F extends Feature, S> TabixIndex createTabixIndex(final File inputFile,
final FeatureCodec<F, S> codec, final TabixFormat tabixFormat) {
if (AbstractFeatureReader.hasBlockCompressedExtension(inputFile)) {
final TabixIndexCreator indexCreator = new TabixIndexCreator(null, tabixFormat);
return (TabixIndex) createIndex(inputFile, new FeatureIterator<>(inputFile, codec),
indexCreator);
} else {
return IndexFactory.createTabixIndex(inputFile, codec, tabixFormat, null);
}
}
开发者ID:react-dev26,项目名称:NGB-master,代码行数:22,代码来源:IndexUtils.java
注:本文中的htsjdk.tribble.index.tabix.TabixIndex类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论