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


Java ValidationStringency.STRICT属性代码示例

本文整理汇总了Java中htsjdk.samtools.ValidationStringency.STRICT属性的典型用法代码示例。如果您正苦于以下问题:Java ValidationStringency.STRICT属性的具体用法?Java ValidationStringency.STRICT怎么用?Java ValidationStringency.STRICT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在htsjdk.samtools.ValidationStringency的用法示例。


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

示例1: testMissingPhasingValuesStrict

/** Ensures that an exception is thrown when we encounter a tile without phasing/pre-phasing metrics. */
@Test(expectedExceptions = PicardException.class)
public void testMissingPhasingValuesStrict() {
    final ReadStructure readStructure = new ReadStructure("151T8B8B151T");
    for (final boolean useReadStructure : Arrays.asList(true, false)) {
        final File runDirectory = TEST_MISSING_PHASING_DIRECTORY;
        final CollectIlluminaLaneMetrics clp = new CollectIlluminaLaneMetrics();
        clp.OUTPUT_DIRECTORY = IOUtil.createTempDir("illuminaLaneMetricsCollectorTest", null);
        clp.RUN_DIRECTORY = runDirectory;
        clp.OUTPUT_PREFIX = "test";
        clp.VALIDATION_STRINGENCY = ValidationStringency.STRICT;
        if (useReadStructure) clp.READ_STRUCTURE = readStructure;
        clp.doWork();

        final File phasingMetricsFile = buildOutputFile(clp.OUTPUT_DIRECTORY, clp.OUTPUT_PREFIX, IlluminaPhasingMetrics.getExtension());
        final File canonicalPhasingFile = buildOutputFile(runDirectory, runDirectory.getName(), IlluminaPhasingMetrics.getExtension());
        IOUtil.assertFilesEqual(canonicalPhasingFile, phasingMetricsFile);

        final File laneMetricsFile = buildOutputFile(clp.OUTPUT_DIRECTORY, clp.OUTPUT_PREFIX, IlluminaLaneMetrics.getExtension());
        final File canonicalLaneFile = buildOutputFile(runDirectory, runDirectory.getName(), IlluminaLaneMetrics.getExtension());
        IOUtil.assertFilesEqual(canonicalLaneFile, laneMetricsFile);
        IOUtil.deleteDirectoryTree(clp.OUTPUT_DIRECTORY);
    }
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:24,代码来源:IlluminaLaneMetricsCollectorTest.java

示例2: decodeAll

@Override
public Iterator<PicardAlignment> decodeAll(InputStream is, boolean strictParsing) throws IOException {
    SAMFileReader reader = new SAMFileReader(is);
    ValidationStringency stringency =
            strictParsing ? ValidationStringency.STRICT : ValidationStringency.SILENT;
    reader.setValidationStringency(stringency);
    return new WrappedIterator(reader.iterator());
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:8,代码来源:AlignmentDecoder.java

示例3: initHetPulldownCalculator

@BeforeClass
public void initHetPulldownCalculator() {
    calculator = new BayesianHetPulldownCalculator(REF_FILE, IntervalList.fromFile(SNP_FILE),
            MINIMUM_MAPPING_QUALITY, MINIMUM_BASE_QUALITY, READ_DEPTH_THRESHOLD,
            ValidationStringency.STRICT, ERROR_PROBABILITY_ADJUSTMENT_FACTOR,
            new HeterogeneousHeterozygousPileupPriorModel(MIN_ABNORMAL_FRACTION, MAX_ABNORMAL_FRACTION,
                    MAX_COPY_NUMBER, QUADRATURE_ORDER));
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:8,代码来源:BayesianHetPulldownCalculatorUnitTest.java

示例4: doWork

/**
 * Do the work after command line has been parsed.
 * RuntimeException may be thrown by this method, and are reported appropriately.
 *
 * @return program exit status.
 */
@Override
protected int doWork() {
    IOUtil.assertFileIsReadable(INPUT);
    IOUtil.assertFileIsWritable(OUTPUT);
    final SamReaderFactory factory = SamReaderFactory.makeDefault().referenceSequence(REFERENCE_SEQUENCE);
    if (VALIDATION_STRINGENCY == ValidationStringency.STRICT) {
        factory.validationStringency(ValidationStringency.LENIENT);
    }
    final SamReader reader = factory.open(INPUT);
    final SAMFileWriter writer = new SAMFileWriterFactory().makeSAMOrBAMWriter(reader.getFileHeader(), true, OUTPUT);
    final CloseableIterator<SAMRecord> it = reader.iterator();
    final ProgressLogger progress = new ProgressLogger(Log.getInstance(CleanSam.class));

    // If the read (or its mate) maps off the end of the alignment, clip it
    while (it.hasNext()) {
        final SAMRecord rec = it.next();

        // If the read (or its mate) maps off the end of the alignment, clip it
        AbstractAlignmentMerger.createNewCigarsIfMapsOffEndOfReference(rec);

        // check the read's mapping quality
        if (rec.getReadUnmappedFlag() && 0 != rec.getMappingQuality()) {
            rec.setMappingQuality(0);
        }

        writer.addAlignment(rec);
        progress.record(rec);
    }

    writer.close();
    it.close();
    CloserUtil.close(reader);
    return 0;
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:40,代码来源:CleanSam.java

示例5: getTilePhasingValues

/**
 * Pulls out the phasing & prephasing value for the template reads and returns a collection of TilePhasingValues representing these
 */
private static Collection<TilePhasingValue> getTilePhasingValues(final Map<Integer, ? extends Collection<IlluminaTileMetrics>> codeMetricsMap, final ReadStructure readStructure, final ValidationStringency validationStringency) {
    boolean isFirstRead = true;
    final Collection<TilePhasingValue> tilePhasingValues = new ArrayList<>();
    for (int descriptorIndex = 0; descriptorIndex < readStructure.descriptors.size(); descriptorIndex++) {
        if (readStructure.descriptors.get(descriptorIndex).type == ReadType.Template) {
            final TileTemplateRead tileTemplateRead = isFirstRead ? TileTemplateRead.FIRST : TileTemplateRead.SECOND;
            // For both phasing & prephasing, pull out the value and create a TilePhasingValue for further processing
            final int phasingCode = IlluminaMetricsCode.getPhasingCode(descriptorIndex, IlluminaMetricsCode.PHASING_BASE);
            final int prePhasingCode = IlluminaMetricsCode.getPhasingCode(descriptorIndex, IlluminaMetricsCode.PREPHASING_BASE);

            final float phasingValue, prePhasingValue;

            // If both the phasing and pre-phasing data are missing, then likely something went wrong when imaging
            // this tile, for example a grain of sand disrupting the path of light to the sensor.  If only one of them
            // is missing, then likely the data is corrupt.
            if (codeMetricsMap.containsKey(phasingCode) && codeMetricsMap.containsKey(prePhasingCode)) {
                phasingValue = CollectionUtil.getSoleElement(codeMetricsMap.get(phasingCode)).getMetricValue();
                prePhasingValue = CollectionUtil.getSoleElement(codeMetricsMap.get(prePhasingCode)).getMetricValue();
            } else {
                final String message = String.format(
                        "Don't have both phasing and prephasing values for %s read cycle %s.  Phasing code was %d and prephasing code was %d.",
                        tileTemplateRead.toString(), descriptorIndex + 1, phasingCode, prePhasingCode
                );
                if (!codeMetricsMap.containsKey(phasingCode) && !codeMetricsMap.containsKey(prePhasingCode) && validationStringency != ValidationStringency.STRICT) {
                    // Ignore the error, and use the default (zero) for the phasing values
                    if (validationStringency == ValidationStringency.LENIENT) {
                        LOG.warn(message);
                    }
                } else {
                    throw new PicardException(message);
                }
                phasingValue = 0;
                prePhasingValue = 0;
            }

            tilePhasingValues.add(new TilePhasingValue(tileTemplateRead, phasingValue, prePhasingValue));
            isFirstRead = false;
        }
    }

    return tilePhasingValues;
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:45,代码来源:TileMetricsUtil.java

示例6: getValidationStringency

static ValidationStringency getValidationStringency(
	final Configuration conf)
{
	final String p = conf.get(VALIDATION_STRINGENCY_PROPERTY);
	return p == null ? ValidationStringency.STRICT : ValidationStringency.valueOf(p);
}
 
开发者ID:HadoopGenomics,项目名称:Hadoop-BAM,代码行数:6,代码来源:VCFRecordReader.java

示例7: nextKeyValue

@Override public boolean nextKeyValue() throws IOException {
	while (true) {
		String line;
		while (true) {
			if (!lineRecordReader.nextKeyValue()) {
				return false;
			}
			line = lineRecordReader.getCurrentValue().toString();
			if (!line.startsWith("#")) {
				break;
			}
		}

                       final VariantContext v;
                       try {
			v = codec.decode(line);
		} catch (TribbleException e) {
			if (stringency == ValidationStringency.STRICT) {
				if (logger.isErrorEnabled()) {
					logger.error("Parsing line {} failed with {}.", line, e);
				}
				throw e;
			} else {
				if (stringency == ValidationStringency.LENIENT &&
                                           logger.isWarnEnabled()) {
					logger.warn("Parsing line {} failed with {}. Skipping...",
                                                           line, e);
				}
				continue;
			}
		}

		if (!overlaps(v)) {
			continue;
		}

		Integer chromIdx = contigDict.get(v.getContig());
		if (chromIdx == null)
			chromIdx = (int) MurmurHash3.murmurhash3(v.getContig(), 0);

		key.set((long) chromIdx << 32 | (long) (v.getStart() - 1));
		vc.set(v, header);

		return true;
	}
}
 
开发者ID:HadoopGenomics,项目名称:Hadoop-BAM,代码行数:46,代码来源:VCFRecordReader.java

示例8: main

public static void main(String[] args) throws IOException, IllegalArgumentException, IllegalAccessException {
	Params params = new Params();
	JCommander jc = new JCommander(params);
	try {
		jc.parse(args);
	} catch (Exception e) {
		System.out.println("Failed to parse parameteres, detailed message below: ");
		System.out.println(e.getMessage());
		System.out.println();
		System.out.println("See usage: -h");
		System.exit(1);
	}

	if (args.length == 0 || params.help) {
		printUsage(jc);
		System.exit(1);
	}

	if (params.reference == null) {
		System.out.println("A reference fasta file is required.");
		System.exit(1);
	}

	if (params.cramFile == null) {
		System.out.println("A CRAM input file is required. ");
		System.exit(1);
	}

	Log.setGlobalLogLevel(Log.LogLevel.INFO);

	ReferenceSequenceFile referenceSequenceFile = ReferenceSequenceFileFactory
			.getReferenceSequenceFile(params.reference);

	FileInputStream fis = new FileInputStream(params.cramFile);
	BufferedInputStream bis = new BufferedInputStream(fis);

	CRAMIterator iterator = new CRAMIterator(bis, new ReferenceSource(params.reference),
			ValidationStringency.STRICT);
	CramHeader cramHeader = iterator.getCramHeader();

	iterator.close();

	ProgressLogger progress = new ProgressLogger(log, 100000, "Validated Read");
	SamFileValidator v = new SamFileValidator(new PrintWriter(System.out), 1);
	final SamReader reader = SamReaderFactory.make().referenceSequence(params.reference).open(params.cramFile);
	List<SAMValidationError.Type> errors = new ArrayList<SAMValidationError.Type>();
	errors.add(SAMValidationError.Type.MATE_NOT_FOUND);
	// errors.add(Type.MISSING_TAG_NM);
	v.setErrorsToIgnore(errors);
	v.validateSamFileSummary(reader, ReferenceSequenceFileFactory.getReferenceSequenceFile(params.reference));
	log.info("Elapsed seconds: " + progress.getElapsedSeconds());
}
 
开发者ID:enasequence,项目名称:cramtools,代码行数:52,代码来源:ValidateCramFile.java


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