当前位置: 首页>>代码示例>>Java>>正文


Java TribbleException.InvalidHeader方法代码示例

本文整理汇总了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;
}
 
开发者ID:verilylifesciences,项目名称:genomewarp,代码行数:21,代码来源:VcfToVariant.java

示例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());
    }
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:16,代码来源:FeatureIterator.java

示例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());
    }
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:10,代码来源:IndexUtils.java

示例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");
   }
 
开发者ID:rkataine,项目名称:BasePlayer,代码行数:45,代码来源:OwnVCFCodec.java


注:本文中的htsjdk.tribble.TribbleException.InvalidHeader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。