本文整理汇总了Java中htsjdk.samtools.util.Log类的典型用法代码示例。如果您正苦于以下问题:Java Log类的具体用法?Java Log怎么用?Java Log使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Log类属于htsjdk.samtools.util包,在下文中一共展示了Log类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: mockPrimitiveLoadFromTo
import htsjdk.samtools.util.Log; //导入依赖的package包/类
public static void mockPrimitiveLoadFromTo(S3InputStreamFactory factory, int dataSize) {
PowerMockito.mockStatic(S3InputStreamFactory.class);
PowerMockito.when(factory.loadFromTo(Mockito.any(AmazonS3URI.class), Mockito.anyLong(), Mockito.anyLong()))
.then((invocation) -> new InputStream() {
final Log log = Log.getInstance(InputStream.class);
private int size = dataSize;
@Override
public int read() throws IOException {
final int returnByte = (size-- > 0) ? FROM_STREAM_CHAR : -1;
log.debug("Stream(", this.hashCode(), " size = ", size, " return: ", returnByte);
return returnByte;
}
}
);
}
开发者ID:epam,项目名称:htsjdk-s3-plugin,代码行数:17,代码来源:S3DataLoaderMocker.java
示例2: createRecordReader
import htsjdk.samtools.util.Log; //导入依赖的package包/类
@Override
public RecordReader<LongWritable, SAMRecordWritable> createRecordReader(
InputSplit inputSplit, TaskAttemptContext context)
throws IOException, InterruptedException {
Log.setGlobalLogLevel(LogLevel.ERROR);
Configuration conf = context.getConfiguration();
int type = conf.getInt("cram.inputformat.type", 0);
CramInputFormatType inputType = CramInputFormatType.valueOf(type);
RecordReader<LongWritable, SAMRecordWritable> rr = null;
if(inputType == CramInputFormatType.ALL)
rr = new GaeaCramRecordReader();
else if(inputType == CramInputFormatType.CHROMOSOME)
rr = new GaeaCramChromosomeRecordReader();
return rr;
}
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:17,代码来源:GaeaCramInputFormat.java
示例3: dataBiasCorrection
import htsjdk.samtools.util.Log; //导入依赖的package包/类
@DataProvider(name = "biasCorrection")
public Object[][] dataBiasCorrection() {
LoggingUtils.setLoggingLevel(Log.LogLevel.INFO);
final AllelicCountCollection sampleNormal = new AllelicCountCollection(SAMPLE_NORMAL_FILE);
final AllelicCountCollection sampleWithBadSNPs = new AllelicCountCollection(SAMPLE_WITH_BAD_SNPS_FILE);
final AllelicCountCollection sampleWithEvent = new AllelicCountCollection(SAMPLE_WITH_EVENT_FILE);
final AllelicPanelOfNormals allelicPoNNormal = new AllelicPanelOfNormals(new AllelicCountCollection(ALLELIC_PON_NORMAL_COUNTS_FILE));
final AllelicPanelOfNormals allelicPoNWithBadSNPs = new AllelicPanelOfNormals(new AllelicCountCollection(ALLELIC_PON_WITH_BAD_SNPS_COUNTS_FILE));
final double minorFractionExpectedInMiddleSegmentNormal = 0.5;
final double minorFractionExpectedInMiddleSegmentWithBadSNPsAndNormalPoN = 0.4;
final double minorFractionExpectedInMiddleSegmentWithEvent = 0.33;
return new Object[][]{
{sampleNormal, allelicPoNNormal, minorFractionExpectedInMiddleSegmentNormal},
{sampleWithBadSNPs, allelicPoNNormal, minorFractionExpectedInMiddleSegmentWithBadSNPsAndNormalPoN},
{sampleWithEvent, allelicPoNNormal, minorFractionExpectedInMiddleSegmentWithEvent},
{sampleWithBadSNPs, allelicPoNWithBadSNPs, minorFractionExpectedInMiddleSegmentNormal}
};
}
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:22,代码来源:AlleleFractionModellerUnitTest.java
示例4: testPoNHyperparameterInitialization
import htsjdk.samtools.util.Log; //导入依赖的package包/类
@Test
public void testPoNHyperparameterInitialization() {
LoggingUtils.setLoggingLevel(Log.LogLevel.INFO);
final AllelicPanelOfNormals allelicPoN = new AllelicPanelOfNormals(new AllelicCountCollection(ALLELIC_PON_NORMAL_COUNTS_FILE));
final SimpleInterval firstSite = new SimpleInterval("1", 1, 1);
final SimpleInterval siteNotInPoN = new SimpleInterval("2", 1, 1); //all sites in PoN are from chr1
// test initialization of hyperparameters for first site in PoN (a = 1218, r = 1317)
final double alphaAtFirstSite = allelicPoN.getAlpha(firstSite);
final double betaAtFirstSite = allelicPoN.getBeta(firstSite);
Assert.assertEquals(alphaAtFirstSite, ALPHA_EXPECTED_AT_FIRST_SITE, DELTA);
Assert.assertEquals(betaAtFirstSite, BETA_EXPECTED_AT_FIRST_SITE, DELTA);
// test initialization of MLE hyperparameters (which are default values for sites not in PoN)
final double alphaNotInPoN = allelicPoN.getAlpha(siteNotInPoN);
final double betaNotInPoN = allelicPoN.getBeta(siteNotInPoN);
final double meanBias = allelicPoN.getGlobalMeanBias();
final double biasVariance = allelicPoN.getGlobalBiasVariance();
Assert.assertEquals(alphaNotInPoN, MLE_ALPHA_EXPECTED, DELTA);
Assert.assertEquals(betaNotInPoN, MLE_BETA_EXPECTED, DELTA);
Assert.assertEquals(meanBias, MLE_MEAN_BIAS_EXPECTED, DELTA);
Assert.assertEquals(biasVariance, MLE_BIAS_VARIANCE_EXPECTED, DELTA);
}
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:27,代码来源:AllelicPanelOfNormalsUnitTest.java
示例5: testPrintStackTrace
import htsjdk.samtools.util.Log; //导入依赖的package包/类
@Test(singleThreaded = true)
public void testPrintStackTrace() throws Exception {
try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
final PrintStream printStream = new PrintStream(outputStream)) {
// set the main class with the custom exception output
final Main main = new Main();
main.exceptionOutput = printStream;
// set to debug mode an try to print the stack-trace
LoggingUtils.setLoggingLevel(Log.LogLevel.DEBUG);
main.printStackTrace(new RuntimeException());
// assert non-empty stack-trace message
Assert.assertFalse(main.exceptionOutput.toString().isEmpty());
} finally {
// set back to normal verbosity
setTestVerbosity();
}
}
开发者ID:magicDGS,项目名称:ReadTools,代码行数:19,代码来源:MainUnitTest.java
示例6: doWork
import htsjdk.samtools.util.Log; //导入依赖的package包/类
protected int doWork() {
IOUtil.assertFileIsReadable(INPUT);
IOUtil.assertFileIsWritable(OUTPUT);
final SamReader reader = SamReaderFactory.makeDefault().referenceSequence(REFERENCE_SEQUENCE).open(INPUT);
final SAMFileWriter writer = new SAMFileWriterFactory().makeWriter(reader.getFileHeader(), true, OUTPUT, REFERENCE_SEQUENCE);
if (CREATE_INDEX && writer.getFileHeader().getSortOrder() != SAMFileHeader.SortOrder.coordinate) {
throw new PicardException("Can't CREATE_INDEX unless sort order is coordinate");
}
final ProgressLogger progress = new ProgressLogger(Log.getInstance(SamFormatConverter.class));
for (final SAMRecord rec : reader) {
writer.addAlignment(rec);
progress.record(rec);
}
CloserUtil.close(reader);
writer.close();
return 0;
}
开发者ID:broadinstitute,项目名称:picard,代码行数:20,代码来源:SamFormatConverter.java
示例7: standardReheader
import htsjdk.samtools.util.Log; //导入依赖的package包/类
private void standardReheader(final SAMFileHeader replacementHeader) {
final SamReader recordReader = SamReaderFactory.makeDefault().referenceSequence(REFERENCE_SEQUENCE).validationStringency(ValidationStringency.SILENT).open(INPUT);
if (replacementHeader.getSortOrder() != recordReader.getFileHeader().getSortOrder()) {
throw new PicardException("Sort orders of INPUT (" + recordReader.getFileHeader().getSortOrder().name() +
") and HEADER (" + replacementHeader.getSortOrder().name() + ") do not agree.");
}
final SAMFileWriter writer = new SAMFileWriterFactory().makeSAMOrBAMWriter(replacementHeader, true, OUTPUT);
final ProgressLogger progress = new ProgressLogger(Log.getInstance(ReplaceSamHeader.class));
for (final SAMRecord rec : recordReader) {
rec.setHeader(replacementHeader);
writer.addAlignment(rec);
progress.record(rec);
}
writer.close();
CloserUtil.close(recordReader);
}
开发者ID:broadinstitute,项目名称:picard,代码行数:18,代码来源:ReplaceSamHeader.java
示例8: makeOverlapDetector
import htsjdk.samtools.util.Log; //导入依赖的package包/类
public static OverlapDetector<Interval> makeOverlapDetector(final File samFile, final SAMFileHeader header, final File ribosomalIntervalsFile, final Log log) {
final OverlapDetector<Interval> ribosomalSequenceOverlapDetector = new OverlapDetector<Interval>(0, 0);
if (ribosomalIntervalsFile != null) {
final IntervalList ribosomalIntervals = IntervalList.fromFile(ribosomalIntervalsFile);
if (ribosomalIntervals.size() == 0) {
log.warn("The RIBOSOMAL_INTERVALS file, " + ribosomalIntervalsFile.getAbsolutePath() + " does not contain intervals");
}
try {
SequenceUtil.assertSequenceDictionariesEqual(header.getSequenceDictionary(), ribosomalIntervals.getHeader().getSequenceDictionary());
} catch (SequenceUtil.SequenceListsDifferException e) {
throw new PicardException("Sequence dictionaries differ in " + samFile.getAbsolutePath() + " and " + ribosomalIntervalsFile.getAbsolutePath(),
e);
}
final IntervalList uniquedRibosomalIntervals = ribosomalIntervals.uniqued();
final List<Interval> intervals = uniquedRibosomalIntervals.getIntervals();
ribosomalSequenceOverlapDetector.addAll(intervals, intervals);
}
return ribosomalSequenceOverlapDetector;
}
开发者ID:broadinstitute,项目名称:picard,代码行数:22,代码来源:RnaSeqMetricsCollector.java
示例9: createSnpAndIndelBitSets
import htsjdk.samtools.util.Log; //导入依赖的package包/类
/** Factory method to create both a SNP bitmask and an indel bitmask in a single pass of the VCF.
* If intervals are given, consider only SNP and indel sites that overlap the intervals. If log is given,
* progress loading the variants will be written to the log. */
public static DbSnpBitSets createSnpAndIndelBitSets(final File dbSnpFile,
final SAMSequenceDictionary sequenceDictionary,
final IntervalList intervals,
final Optional<Log> log) {
final DbSnpBitSets sets = new DbSnpBitSets();
sets.snps = new DbSnpBitSetUtil();
sets.indels = new DbSnpBitSetUtil();
final Map<DbSnpBitSetUtil, Set<VariantType>> map = new HashMap<>();
map.put(sets.snps, EnumSet.of(VariantType.SNP));
map.put(sets.indels, EnumSet.of(VariantType.insertion, VariantType.deletion));
loadVcf(dbSnpFile, sequenceDictionary, map, intervals, log);
return sets;
}
开发者ID:broadinstitute,项目名称:picard,代码行数:19,代码来源:DbSnpBitSetUtil.java
示例10: testMaxSetSize
import htsjdk.samtools.util.Log; //导入依赖的package包/类
@Test
public void testMaxSetSize() {
final Log log = Log.getInstance(OpticalDuplicateFinderTest.class);
List<PhysicalLocation> locs = Arrays.asList(
loc(7, 1500, 1500),
loc(7, 1501, 1501),
loc(7, 1490, 1502));
// there should be at least 1 optical duplicate
final OpticalDuplicateFinder normalFinder = new OpticalDuplicateFinder(OpticalDuplicateFinder.DEFAULT_READ_NAME_REGEX, 100, log);
Assert.assertTrue(countTrue(normalFinder.findOpticalDuplicates(locs, null)) > 0);
// there should be zero optical duplicates
final OpticalDuplicateFinder constrainedFinder = new OpticalDuplicateFinder(OpticalDuplicateFinder.DEFAULT_READ_NAME_REGEX, 100, 1, log);
Assert.assertEquals(countTrue(constrainedFinder.findOpticalDuplicates(locs, null)), 0);
}
开发者ID:broadinstitute,项目名称:picard,代码行数:17,代码来源:OpticalDuplicateFinderTest.java
示例11: setJavaUtilLoggingLevel
import htsjdk.samtools.util.Log; //导入依赖的package包/类
/**
* Set the java.util.logging level since some of our dependencies write messages using it.
*
* Taken with modifications from a post by michel.iamit
* http://stackoverflow.com/users/369060/michel-iamit
* from http://stackoverflow.com/questions/470430/java-util-logging-logger-doesnt-respect-java-util-logging-level
*/
private static void setJavaUtilLoggingLevel(final Log.LogLevel verbosity) {
Logger topLogger = java.util.logging.Logger.getLogger("");
Handler consoleHandler = null;
for (Handler handler : topLogger.getHandlers()) {
if (handler instanceof ConsoleHandler) {
consoleHandler = handler;
break;
}
}
if (consoleHandler == null) {
consoleHandler = new ConsoleHandler();
topLogger.addHandler(consoleHandler);
}
consoleHandler.setLevel(levelToJavaUtilLevel(verbosity));
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:25,代码来源:LoggingUtils.java
示例12: logConfigFields
import htsjdk.samtools.util.Log; //导入依赖的package包/类
/**
* Logs all the parameters in the given {@link Config} object at the given {@link Log.LogLevel}
* @param config A {@link Config} object from which to log all parameters and values.
* @param logLevel The log {@link htsjdk.samtools.util.Log.LogLevel} at which to log the data in {@code config}
* @param <T> any {@link Config} type to use to log all configuration information.
*/
public static <T extends Config> void logConfigFields(final T config, final Log.LogLevel logLevel) {
Utils.nonNull(config);
Utils.nonNull(logLevel);
final Level level = LoggingUtils.levelToLog4jLevel(logLevel);
// Only continue in this method here if we would log the given level:
if ( !logger.isEnabled(level) ) {
return;
}
logger.log(level, "Configuration file values: ");
for ( final Map.Entry<String, Object> entry : getConfigMap(config, false).entrySet() ) {
logger.log(level, "\t" + entry.getKey() + " = " + entry.getValue());
}
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:24,代码来源:ConfigFactory.java
示例13: injectDefaultVerbosity
import htsjdk.samtools.util.Log; //导入依赖的package包/类
/**
* Inject the verbosity parameter into the list.
*
* Default behaviour look for --verbosity argument; if not found, supply a default value that minimizes the amount of logging output.
*/
default List<String> injectDefaultVerbosity(final List<String> args) {
// global toggle for BunnyLog output.
BunnyLog.setEnabled(false);
for (String arg : args) {
if (arg.equalsIgnoreCase("--" + StandardArgumentDefinitions.VERBOSITY_NAME) || arg.equalsIgnoreCase("-" + StandardArgumentDefinitions.VERBOSITY_NAME)) {
return args;
}
}
List<String> argsWithVerbosity = new ArrayList<>(args);
argsWithVerbosity.add("--" + StandardArgumentDefinitions.VERBOSITY_NAME);
argsWithVerbosity.add(Log.LogLevel.ERROR.name());
return argsWithVerbosity;
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:21,代码来源:CommandLineProgramTester.java
示例14: printSettings
import htsjdk.samtools.util.Log; //导入依赖的package包/类
/**
* Output a curated set of important settings to the logger.
*
* May be overridden by subclasses to specify a different set of settings to output.
*/
protected void printSettings() {
if ( VERBOSITY != Log.LogLevel.DEBUG ) {
logger.info("HTSJDK Defaults.COMPRESSION_LEVEL : " + Defaults.COMPRESSION_LEVEL);
logger.info("HTSJDK Defaults.USE_ASYNC_IO_READ_FOR_SAMTOOLS : " + Defaults.USE_ASYNC_IO_READ_FOR_SAMTOOLS);
logger.info("HTSJDK Defaults.USE_ASYNC_IO_WRITE_FOR_SAMTOOLS : " + Defaults.USE_ASYNC_IO_WRITE_FOR_SAMTOOLS);
logger.info("HTSJDK Defaults.USE_ASYNC_IO_WRITE_FOR_TRIBBLE : " + Defaults.USE_ASYNC_IO_WRITE_FOR_TRIBBLE);
}
else {
// At DEBUG verbosity, print all the HTSJDK defaults:
Defaults.allDefaults().entrySet().stream().forEach(e->
logger.info("HTSJDK " + Defaults.class.getSimpleName() + "." + e.getKey() + " : " + e.getValue())
);
}
// Log the configuration options:
ConfigFactory.logConfigFields(ConfigFactory.getInstance().getGATKConfig(), Log.LogLevel.DEBUG);
final boolean usingIntelDeflater = (BlockCompressedOutputStream.getDefaultDeflaterFactory() instanceof IntelDeflaterFactory && ((IntelDeflaterFactory)BlockCompressedOutputStream.getDefaultDeflaterFactory()).usingIntelDeflater());
logger.info("Deflater: " + (usingIntelDeflater ? "IntelDeflater": "JdkDeflater"));
final boolean usingIntelInflater = (BlockGunzipper.getDefaultInflaterFactory() instanceof IntelInflaterFactory && ((IntelInflaterFactory)BlockGunzipper.getDefaultInflaterFactory()).usingIntelInflater());
logger.info("Inflater: " + (usingIntelInflater ? "IntelInflater": "JdkInflater"));
logger.info("GCS max retries/reopens: " + BucketUtils.getCloudStorageConfiguration(NIO_MAX_REOPENS).maxChannelReopens());
logger.info("Using google-cloud-java patch 6d11bef1c81f885c26b2b56c8616b7a705171e4f from https://github.com/droazen/google-cloud-java/tree/dr_all_nio_fixes");
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:31,代码来源:CommandLineProgram.java
示例15: main
import htsjdk.samtools.util.Log; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
Log.setGlobalLogLevel(LogLevel.INFO);
File bamFile = new File(args[0]);
File outCramFile = new File(args[1]);
ReferenceSource source = new ReferenceSource(new File(args[2]));
int maxThreads = Integer.valueOf(args[3]);
BAMFileReader reader = new BAMFileReader(bamFile, null, false, false, ValidationStringency.SILENT,
new DefaultSAMRecordFactory());
OutputStream os = new FileOutputStream(outCramFile);
CRAMFileWriter writer = new CRAMFileWriter(os, source, reader.getFileHeader(), outCramFile.getName(),
maxThreads);
CloseableIterator<SAMRecord> iterator = reader.getIterator();
while (iterator.hasNext()) {
SAMRecord record = iterator.next();
writer.addAlignment(record);
}
writer.close();
reader.close();
}
开发者ID:enasequence,项目名称:cramtools,代码行数:24,代码来源:CRAMFileWriter.java
示例16: main
import htsjdk.samtools.util.Log; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
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);
}
Log.setGlobalLogLevel(params.logLevel);
dist(params.inputFile, (byte) (0xFF & params.defaultQualityScore));
}
开发者ID:enasequence,项目名称:cramtools,代码行数:23,代码来源:QualityScoreStats.java
示例17: getRecordWriter
import htsjdk.samtools.util.Log; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
public RecordWriter<K, SamRecordWritable> getRecordWriter(
TaskAttemptContext context, Path outputPath) throws IOException {
Log.setGlobalLogLevel(LogLevel.ERROR);
return new GaeaKeyIgnoringBamRecordWriter(outputPath,
Boolean.valueOf(this.writeHeader), context);
}
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:8,代码来源:GaeaBamOutputFormat.java
示例18: getRecordWriter
import htsjdk.samtools.util.Log; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
public RecordWriter<K, SAMRecordWritable> getRecordWriter(
TaskAttemptContext context, Path outputPath) throws IOException {
Log.setGlobalLogLevel(LogLevel.ERROR);
return new GaeaKeyIgnoringCramRecordWriter(outputPath,
Boolean.valueOf(this.writeHeader), context);
}
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:8,代码来源:GaeaCramOutputFormat.java
示例19: createRecordReader
import htsjdk.samtools.util.Log; //导入依赖的package包/类
@Override
public RecordReader<LongWritable, SAMRecordWritable> createRecordReader(
InputSplit split, TaskAttemptContext context) throws IOException {
Log.setGlobalLogLevel(Log.LogLevel.ERROR);
RecordReader<LongWritable, SAMRecordWritable> rr = new GaeaCombineCramFileRecordReader(
split, context);
return rr;
}
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:9,代码来源:GaeaCombineCramFileInputFormat.java
示例20: testCreate
import htsjdk.samtools.util.Log; //导入依赖的package包/类
@Test(dataProvider = "dataCreate")
public void testCreate(final double siteFrequencyThreshold, final AllelicPanelOfNormals expected) {
LoggingUtils.setLoggingLevel(Log.LogLevel.INFO);
final AllelicPanelOfNormalsCreator allelicPoNCreator = new AllelicPanelOfNormalsCreator(PULLDOWN_FILES);
final AllelicPanelOfNormals result = allelicPoNCreator.create(siteFrequencyThreshold);
AllelicPoNTestUtils.assertAllelicPoNsEqual(result, expected);
}
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:8,代码来源:AllelicPanelOfNormalsCreatorUnitTest.java
注:本文中的htsjdk.samtools.util.Log类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论