本文整理汇总了Java中htsjdk.samtools.SAMSequenceDictionary.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java SAMSequenceDictionary.isEmpty方法的具体用法?Java SAMSequenceDictionary.isEmpty怎么用?Java SAMSequenceDictionary.isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htsjdk.samtools.SAMSequenceDictionary
的用法示例。
在下文中一共展示了SAMSequenceDictionary.isEmpty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setSamSeqDictFromBam
import htsjdk.samtools.SAMSequenceDictionary; //导入方法依赖的package包/类
private boolean setSamSeqDictFromBam(String bamfile) {
/* ------------------------------------------------------ */
/* This chunk prepares SamReader from local bam */
SamReaderFactory srf=SamReaderFactory.make();
srf.validationStringency(ValidationStringency.SILENT);
SamReader samReader;
samReader= srf.open(new File(bamfile));
/* ------------------------------------------------------ */
SAMSequenceDictionary seqDict = samReader.getFileHeader().getSequenceDictionary();
if(seqDict != null && !seqDict.isEmpty()){
this.setSamSeqDictSource(new File(bamfile).getAbsolutePath());
this.setSamSeqDict(seqDict);
return true;
}
return false;
}
示例2: collectFileReadersAndHeaders
import htsjdk.samtools.SAMSequenceDictionary; //导入方法依赖的package包/类
private void collectFileReadersAndHeaders(final List<String> sampleList, SAMSequenceDictionary samSequenceDictionary) {
for (final File input : INPUT) {
final VCFFileReader in = new VCFFileReader(input, false);
final VCFHeader header = in.getFileHeader();
final SAMSequenceDictionary dict = in.getFileHeader().getSequenceDictionary();
if (dict == null || dict.isEmpty()) {
if (null == samSequenceDictionary) {
throw new IllegalArgumentException("Sequence dictionary was missing or empty for the VCF: " + input.getAbsolutePath() + " Please add a sequence dictionary to this VCF or specify SEQUENCE_DICTIONARY.");
}
header.setSequenceDictionary(samSequenceDictionary);
} else {
if (null == samSequenceDictionary) {
samSequenceDictionary = dict;
} else {
try {
samSequenceDictionary.assertSameDictionary(dict);
} catch (final AssertionError e) {
throw new IllegalArgumentException(e);
}
}
}
if (sampleList.isEmpty()) {
sampleList.addAll(header.getSampleNamesInOrder());
} else {
if (!sampleList.equals(header.getSampleNamesInOrder())) {
throw new IllegalArgumentException("Input file " + input.getAbsolutePath() + " has sample names that don't match the other files.");
}
}
inputReaders.add(in);
inputHeaders.add(header);
}
}
示例3: getSequenceDictionary
import htsjdk.samtools.SAMSequenceDictionary; //导入方法依赖的package包/类
/**
* Returns the sequence dictionary for this source of Features.
* Uses the dictionary from the VCF header (if present) for variant inputs,
* otherwise attempts to create a sequence dictionary from the index file (if present).
* Returns null if no dictionary could be created from either the header or the index.
*/
public SAMSequenceDictionary getSequenceDictionary() {
SAMSequenceDictionary dict = null;
final Object header = getHeader();
if (header instanceof VCFHeader) {
dict = ((VCFHeader) header).getSequenceDictionary();
}
if (dict != null && !dict.isEmpty()) {
return dict;
}
if (hasIndex) {
return IndexUtils.createSequenceDictionaryFromFeatureIndex(new File(featureInput.getFeaturePath()));
}
return null;
}