本文整理汇总了Java中htsjdk.tribble.TribbleException.InvalidHeader方法的典型用法代码示例。如果您正苦于以下问题:Java TribbleException.InvalidHeader方法的具体用法?Java TribbleException.InvalidHeader怎么用?Java TribbleException.InvalidHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htsjdk.tribble.TribbleException
的用法示例。
在下文中一共展示了TribbleException.InvalidHeader方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validVersion
import htsjdk.tribble.TribbleException; //导入方法依赖的package包/类
private static boolean validVersion(File filepath) throws IOException {
BufferedReader reader = Files.newBufferedReader(filepath.toPath(), UTF_8);
// The first line must be the header
String firstLine = reader.readLine();
reader.close();
try {
VCFHeaderVersion version = VCFHeaderVersion.getHeaderVersion(firstLine);
// If the version is greater than or equal to 4.2, we cannot handle it
if (version.isAtLeastAsRecentAs(VCFHeaderVersion.VCF4_2)) {
return false;
}
} catch (TribbleException.InvalidHeader msg) {
throw new IOException(msg);
}
return true;
}
示例2: readHeader
import htsjdk.tribble.TribbleException; //导入方法依赖的package包/类
/**
* Some codecs, e.g. VCF files, need the header to decode features. This is a rather poor design,
* the internal header is set as a side-affect of reading it, but we have to live with it for now.
*/
private FeatureCodecHeader readHeader() {
try {
final S sourceFromStream = this.codec.makeSourceFromStream(initStream(inputFile, 0));
final FeatureCodecHeader header = this.codec.readHeader(sourceFromStream);
codec.close(sourceFromStream);
return header;
} catch (IOException e) {
LOGGER.error(MessageHelper.getMessage(MessagesConstants.ERROR_FILE_HEADER_READING), e);
throw new TribbleException.InvalidHeader(e.getMessage());
}
}
示例3: readHeader
import htsjdk.tribble.TribbleException; //导入方法依赖的package包/类
private FeatureCodecHeader readHeader(PositionalBufferedStream stream) {
try {
final S sourceFromStream = this.codec.makeSourceFromStream(stream);
return this.codec.readHeader(sourceFromStream);
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
throw new TribbleException.InvalidHeader(e.getMessage());
}
}
示例4: readActualHeader
import htsjdk.tribble.TribbleException; //导入方法依赖的package包/类
/**
* Reads all of the header from the provided iterator, but no reads no further.
* @param lineIterator the line reader to take header lines from
* @return The parsed header
*/
@SuppressWarnings("static-access")
@Override
public Object readActualHeader(final LineIterator lineIterator) {
final List<String> headerStrings = new ArrayList<String>();
String line;
boolean foundHeaderVersion = false;
while (lineIterator.hasNext()) {
line = lineIterator.peek();
lineNo++;
if (line.startsWith(VCFHeader.METADATA_INDICATOR)) {
final String[] lineFields = line.substring(2).split("=");
if (lineFields.length == 2 && VCFHeaderVersion.isFormatString(lineFields[0]) ) {
if ( !VCFHeaderVersion.isVersionString(lineFields[1]) )
throw new TribbleException.InvalidHeader(lineFields[1] + " is not a supported version");
foundHeaderVersion = true;
version = VCFHeaderVersion.toHeaderVersion(lineFields[1]);
if ( ! version.isAtLeastAsRecentAs(VCFHeaderVersion.VCF4_0) )
throw new TribbleException.InvalidHeader("This codec is strictly for VCFv4; please use the VCF3 codec for " + lineFields[1]);
if ( version != VCFHeaderVersion.VCF4_0 && version != VCFHeaderVersion.VCF4_1 && version != VCFHeaderVersion.VCF4_2 )
throw new TribbleException.InvalidHeader("This codec is strictly for VCFv4 and does not support " + lineFields[1]);
}
headerStrings.add(lineIterator.next());
}
else if (line.startsWith(VCFHeader.HEADER_INDICATOR)) {
if (!foundHeaderVersion) {
throw new TribbleException.InvalidHeader("We never saw a header line specifying VCF version");
}
headerStrings.add(lineIterator.next());
super.parseHeaderFromLines(headerStrings, version);
return this.header;
}
else {
throw new TribbleException.InvalidHeader("We never saw the required CHROM header line (starting with one #) for the input VCF file");
}
}
throw new TribbleException.InvalidHeader("We never saw the required CHROM header line (starting with one #) for the input VCF file");
}