• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TribbleException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中htsjdk.tribble.TribbleException的典型用法代码示例。如果您正苦于以下问题:Java TribbleException类的具体用法?Java TribbleException怎么用?Java TribbleException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TribbleException类属于htsjdk.tribble包,在下文中一共展示了TribbleException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: determineReferenceAllele

import htsjdk.tribble.TribbleException; //导入依赖的package包/类
/**
 * Determines the common reference allele
 *
 * @param VCs    the list of VariantContexts
 * @param loc    if not null, ignore records that do not begin at this start location
 * @return possibly null Allele
 */
public static Allele determineReferenceAllele(final List<VariantContext> VCs, final GenomeLoc loc) {
    Allele ref = null;

    for ( final VariantContext vc : VCs ) {
        if ( contextMatchesLoc(vc, loc) ) {
            final Allele myRef = vc.getReference();
            if ( ref == null || ref.length() < myRef.length() )
                ref = myRef;
            else if ( ref.length() == myRef.length() && ! ref.equals(myRef) )
                throw new TribbleException(String.format("The provided variant file(s) have inconsistent references for the same position(s) at %s:%d, %s vs. %s", vc.getChr(), vc.getStart(), ref, myRef));
        }
    }

    return ref;
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:23,代码来源:GATKVariantContextUtils.java


示例2: createStream

import htsjdk.tribble.TribbleException; //导入依赖的package包/类
private InputStream createStream(final FileInputStream fileStream) throws IOException {
    // if this looks like a block compressed file and it in fact is, we will use it
    // otherwise we will use the file as is
    if (!AbstractFeatureReader.hasBlockCompressedExtension(inputFile)) {
        return fileStream;
    }

    // make a buffered stream to test that this is in fact a valid block compressed file
    final int bufferSize = Math.max(Defaults.BUFFER_SIZE,
            BlockCompressedStreamConstants.MAX_COMPRESSED_BLOCK_SIZE);
    final BufferedInputStream bufferedStream = new BufferedInputStream(fileStream, bufferSize);

    if (!BlockCompressedInputStream.isValidFile(bufferedStream)) {
        throw new TribbleException.MalformedFeatureFile(
                "Input file is not in valid block compressed format.", inputFile.getAbsolutePath());
    }

    final ISeekableStreamFactory ssf = SeekableStreamFactory.getInstance();
    // if we got here, the file is valid, make a SeekableStream for the BlockCompressedInputStream
    // to read from
    final SeekableStream seekableStream =
            ssf.getBufferedStream(ssf.getStreamFor(inputFile.getAbsolutePath()));
    return new BlockCompressedInputStream(seekableStream);
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:25,代码来源:FeatureIterator.java


示例3: determineReferenceAllele

import htsjdk.tribble.TribbleException; //导入依赖的package包/类
/**
 * Determines the common reference allele
 *
 * @param VCs
 *            the list of VariantContexts
 * @param loc
 *            if not null, ignore records that do not begin at this start
 *            location
 * @return possibly null Allele
 */
public static Allele determineReferenceAllele(final List<VariantContext> VCs, final GenomeLocation loc) {
	Allele ref = null;

	for (final VariantContext vc : VCs) {
		if (contextMatchesLocation(vc, loc)) {
			final Allele myRef = vc.getReference();
			if (ref == null || ref.length() < myRef.length())
				ref = myRef;
			else if (ref.length() == myRef.length() && !ref.equals(myRef))
				throw new TribbleException(String.format(
						"The provided variant file(s) have inconsistent references for the same position(s) at %s:%d, %s vs. %s",
						vc.getContig(), vc.getStart(), ref, myRef));
		}
	}

	return ref;
}
 
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:28,代码来源:GaeaVariantContextUtils.java


示例4: processVCF

import htsjdk.tribble.TribbleException; //导入依赖的package包/类
private static Collection<EligibilityReport> processVCF(final String patient, final boolean isGermline, final File vcf,
        final BachelorEligibility eligibility) {

    final EligibilityReport.ReportType type =
            isGermline ? EligibilityReport.ReportType.GERMLINE_MUTATION : EligibilityReport.ReportType.SOMATIC_MUTATION;
    LOGGER.info("process {} vcf: {}", type, vcf.getPath());

    try (final VCFFileReader reader = new VCFFileReader(vcf, true)) {
        // TODO: always correct? germline has R,T somatic has just T
        final String sample = reader.getFileHeader().getGenotypeSamples().get(0);
        return eligibility.processVCF(patient, sample, type, reader);
    } catch (final TribbleException e) {
        LOGGER.error("error with VCF file {}: {}", vcf.getPath(), e.getMessage());
        return Collections.emptyList();
    }
}
 
开发者ID:hartwigmedical,项目名称:hmftools,代码行数:17,代码来源:BachelorApplication.java


示例5: decodeLine

import htsjdk.tribble.TribbleException; //导入依赖的package包/类
private VariantContext decodeLine(final String line, final boolean includeGenotypes) {
    // the same line reader is not used for parsing the header and parsing lines, if we see a #, we've seen a header line
    if (line.startsWith(VCFHeader.HEADER_INDICATOR)) return null;

    // our header cannot be null, we need the genotype sample names and counts
    if (header == null) throw new TribbleException("VCF Header cannot be null when decoding a record");

    if (parts == null)
        parts = new String[Math.min(header.getColumnCount(), NUM_STANDARD_FIELDS+1)];

    final int nParts = ParsingUtils.split(line, parts, VCFConstants.FIELD_SEPARATOR_CHAR, true);

    // if we have don't have a header, or we have a header with no genotyping data check that we
    // have eight columns.  Otherwise check that we have nine (normal columns + genotyping data)
    if (( (header == null || !header.hasGenotypingData()) && nParts != NUM_STANDARD_FIELDS) ||
            (header != null && header.hasGenotypingData() && nParts != (NUM_STANDARD_FIELDS + 1)) )
        throw new TribbleException("Line " + lineNo + ": there aren't enough columns for line " + line + " (we expected " + (header == null ? NUM_STANDARD_FIELDS : NUM_STANDARD_FIELDS + 1) +
                " tokens, and saw " + nParts + " )");

    return parseVCFLine(parts, includeGenotypes);
}
 
开发者ID:rkataine,项目名称:BasePlayer,代码行数:22,代码来源:OwnVCFCodec.java


示例6: 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


示例7: doInBackground

import htsjdk.tribble.TribbleException; //导入依赖的package包/类
@Override
protected Index doInBackground() throws Exception {
    int binSize = IgvTools.LINEAR_BIN_SIZE;
    FeatureCodec codec = CodecFactory.getCodec(file.getAbsolutePath(), GenomeManager.getInstance().getCurrentGenome());
    if (codec != null) {
        try {
            Index index = IndexFactory.createLinearIndex(file, codec, binSize);
            if (index != null) {
                IgvTools.writeTribbleIndex(index, idxFile.getAbsolutePath());
            }
            return index;
        } catch (TribbleException.MalformedFeatureFile e) {
            StringBuffer buf = new StringBuffer();
            buf.append("<html>Files must be sorted by start position prior to indexing.<br>");
            buf.append(e.getMessage());
            buf.append("<br><br>Note: igvtools can be used to sort the file, select \"File > Run igvtools...\".");
            MessageUtils.showMessage(buf.toString());
        }
    } else {
        throw new DataLoadException("Unknown File Type", file.getAbsolutePath());
    }
    return null;
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:24,代码来源:IndexCreatorDialog.java


示例8: doWork

import htsjdk.tribble.TribbleException; //导入依赖的package包/类
@Override
protected Object doWork() {
    final FeatureCodec<? extends Feature, ?> codec = FeatureManager.getCodecForFile(inputBedFile);
    final Class<? extends Feature> featureType = codec.getFeatureType();
    if (BEDFeature.class.isAssignableFrom(featureType)) {
        final FeatureDataSource<? extends BEDFeature> source = new FeatureDataSource<>(inputBedFile);
        try {
            final List<Target> targets = StreamSupport.stream(source.spliterator(), false).map(ConvertBedToTargetFile::createTargetFromBEDFeature)
                    .collect(Collectors.toList());
            TargetWriter.writeTargetsToFile(outFile, targets);
        } catch (final TribbleException e) {
            throw new UserException.BadInput(String.format("'%s' has a .bed extension but does not seem to be a valid BED file.", inputBedFile.getAbsolutePath()));
        }
    } else {
        throw new UserException.BadInput(String.format("'%s' does not seem to be a BED file.", inputBedFile.getAbsolutePath()));
    }
    return "SUCCESS";
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:19,代码来源:ConvertBedToTargetFile.java


示例9: determineReferenceAllele

import htsjdk.tribble.TribbleException; //导入依赖的package包/类
/**
 * Determines the common reference allele
 *
 * @param VCs    the list of VariantContexts
 * @param loc    if not null, ignore records that do not begin at this start location
 * @return possibly null Allele
 */
public static Allele determineReferenceAllele(final List<VariantContext> VCs, final Locatable loc) {
    Allele ref = null;

    for ( final VariantContext vc : VCs ) {
        if ( contextMatchesLoc(vc, loc) ) {
            final Allele myRef = vc.getReference();
            if ( ref == null || ref.length() < myRef.length() )
                ref = myRef;
            else if ( ref.length() == myRef.length() && ! ref.equals(myRef) )
                throw new TribbleException(String.format("The provided variant file(s) have inconsistent references for the same position(s) at %s:%d, %s vs. %s", vc.getContig(), vc.getStart(), ref, myRef));
        }
    }

    return ref;
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:23,代码来源:GATKVariantContextUtils.java


示例10: testVcf

import htsjdk.tribble.TribbleException; //导入依赖的package包/类
private void testVcf(File f,InputStream in) throws IOException,TribbleException
 	{
 	long n=0;
 	VcfIterator iter=new VcfIteratorImpl(in);
 	iter.getHeader();
 	while(iter.hasNext() &&  (NUM<0 || n<NUM))
 		{
 		iter.next();
 		++n;
 		}
 	if(n==0)
{
 		emptyFile(f);
}
 	iter.close();
 	}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:17,代码来源:FindCorruptedFiles.java


示例11: checkSorted

import htsjdk.tribble.TribbleException; //导入依赖的package包/类
private void checkSorted(VcfFile vcfFile, VariantContext variantContext, VariantContext lastFeature) {
    if (lastFeature != null && variantContext.getStart() < lastFeature.getStart() &&
            lastFeature.getContig().equals(variantContext.getContig())) {
        throw new TribbleException.MalformedFeatureFile("Input file is not sorted by start position. \n" +
                "We saw a record with a start of " + variantContext.getContig()
                + ":" + variantContext.getStart()
                + " after a record with a start of "
                + lastFeature.getContig() + ":" + lastFeature
                .getStart(), vcfFile.getName());
    }
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:12,代码来源:VcfManager.java


示例12: 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


示例13: readNextFeature

import htsjdk.tribble.TribbleException; //导入依赖的package包/类
/**
 * Read the next feature from the stream
 *
 * @throws TribbleException.MalformedFeatureFile
 */
private void readNextFeature() {
    cachedPosition = ((LocationAware) source).getPosition();
    try {
        nextFeature = null;
        while (nextFeature == null && !codec.isDone(source)) {
            nextFeature = codec.decodeLoc(source);
        }
    } catch (final IOException e) {
        throw new TribbleException.MalformedFeatureFile("Unable to read a line from the file",
                inputFile.getAbsolutePath(), e);
    }
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:18,代码来源:FeatureIterator.java


示例14: checkSorted

import htsjdk.tribble.TribbleException; //导入依赖的package包/类
public static void checkSorted(final File inputFile, final Feature lastFeature,
        final Feature currentFeature, Map<String, Feature> visitedChromos) {
    // if the last currentFeature is after the current currentFeature, exception out
    if (lastFeature != null && currentFeature.getStart() < lastFeature.getStart() && lastFeature
            .getContig().equals(currentFeature.getContig())) {
        throw new TribbleException.MalformedFeatureFile(
                "Input file is not sorted by start position. \n"
                        + "We saw a record with a start of " + currentFeature.getContig() + ":"
                        + currentFeature.getStart() + " after a record with a start of "
                        + lastFeature.getContig() + ":" + lastFeature.getStart(),
                inputFile.getAbsolutePath());
    }

    //should only visit chromosomes once
    final String curChr = currentFeature.getContig();
    final String lastChr = lastFeature != null ? lastFeature.getContig() : null;
    if (!curChr.equals(lastChr)) {
        if (visitedChromos.containsKey(curChr)) {
            String msg = "Input file must have contiguous chromosomes.";
            throw new TribbleException.MalformedFeatureFile(msg,
                    inputFile.getAbsolutePath());
        } else {
            visitedChromos.put(curChr, currentFeature);
        }
    }

}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:28,代码来源:IndexUtils.java


示例15: 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


示例16: readNextFeature

import htsjdk.tribble.TribbleException; //导入依赖的package包/类
/**
 * Read the next feature from the stream
 *
 * @throws TribbleException.MalformedFeatureFile
 */
private void readNextFeature() {
    cachedPosition = ((LocationAware) source).getPosition();
    try {
        nextFeature = null;
        while (nextFeature == null && !codec.isDone(source)) {
            nextFeature = codec.decodeLoc(source);
        }
    } catch (final IOException e) {
        throw new TribbleException.MalformedFeatureFile(
                "Unable to read a line from the file", inputFile.getAbsolutePath(), e);
    }
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:18,代码来源:IndexUtils.java


示例17: getPosition

import htsjdk.tribble.TribbleException; //导入依赖的package包/类
/**
 * @return The position of the InputStream
 */
@Override public long getPosition() {
    if (is == null) {
        throw new TribbleException(
                "getPosition() called but no default stream was provided to the class on creation");
    }
    if (lastPosition < 0) {
        return is.getFilePointer();
    } else {
        return lastPosition;
    }
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:15,代码来源:IndexUtils.java


示例18: readLine

import htsjdk.tribble.TribbleException; //导入依赖的package包/类
@Override public final String readLine() throws IOException {
    if (is == null) {
        throw new TribbleException(
                "readLine() called without an explicit stream argument but no default"
                        + " stream was provided to the class on creation");
    }
    return is.readLine();
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:9,代码来源:IndexUtils.java


示例19: checkSorted

import htsjdk.tribble.TribbleException; //导入依赖的package包/类
/**
 * Checks if two features of a FeatureFile are sorted
 * @param feature a current feature of a file to check
 * @param lastFeature a previous feature of a file to check
 * @param featureFile a file, thai is being checked
 */
public static void checkSorted(Feature feature, Feature lastFeature, FeatureFile featureFile) {
    if (feature.getStart() < lastFeature.getStart() && // Check if file is sorted
        lastFeature.getContig().equals(feature.getContig())) {
        throw new TribbleException.MalformedFeatureFile(
            "Input file is not sorted by start position. \n" +
            "We saw a record with a start of " + feature.getContig() + ":" +
            feature.getStart() + " after a record with a start of " +
            lastFeature.getContig() + ":" + lastFeature.getStart(), featureFile.getName());
    }
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:17,代码来源:Utils.java


示例20: testRegisterInvalidFile

import htsjdk.tribble.TribbleException; //导入依赖的package包/类
private void testRegisterInvalidFile(String path, String expectedMessage) throws IOException {
    String errorMessage = "";
    try {
        Resource resource = context.getResource(path);
        FeatureIndexedFileRegistrationRequest request = new FeatureIndexedFileRegistrationRequest();
        request.setPath(resource.getFile().getAbsolutePath());
        request.setReferenceId(referenceId);
        vcfManager.registerVcfFile(request);
    } catch (TribbleException | IllegalArgumentException | AssertionError e) {
        errorMessage = e.getMessage();
    }
    //check that we received an appropriate message
    Assert.assertTrue(errorMessage.contains(expectedMessage));
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:15,代码来源:VcfManagerTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ApiKeyAuthDefinition类代码示例发布时间:2022-05-21
下一篇:
Java CanvasElement类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap