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


Java BaseTest.createTempFile方法代码示例

本文整理汇总了Java中org.broadinstitute.hellbender.utils.test.BaseTest.createTempFile方法的典型用法代码示例。如果您正苦于以下问题:Java BaseTest.createTempFile方法的具体用法?Java BaseTest.createTempFile怎么用?Java BaseTest.createTempFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.broadinstitute.hellbender.utils.test.BaseTest的用法示例。


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

示例1: createTargetFile

import org.broadinstitute.hellbender.utils.test.BaseTest; //导入方法依赖的package包/类
private File createTargetFile(final List<Target> targets) throws IOException {
    final File result = BaseTest.createTempFile("targets",".tab");
    final TableWriter<Target> writer = TableUtils.writer(result, new TableColumnCollection(
                    TargetTableColumn.CONTIG,
                    TargetTableColumn.START,
                    TargetTableColumn.END,
                    TargetTableColumn.NAME),
            (t,dataLine) -> {
                final SimpleInterval interval = t.getInterval();
                dataLine.append(interval.getContig())
                        .append(interval.getStart()).append(interval.getEnd())
                        .append(t.getName());
            }
    );
    for (final Target target : targets)
        writer.writeRecord(target);
    writer.close();
    return result;
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:20,代码来源:CombineReadCountsIntegrationTest.java

示例2: testEverything

import org.broadinstitute.hellbender.utils.test.BaseTest; //导入方法依赖的package包/类
@Test(groups = "sv")
void testEverything() {
    final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeaderWithGroups(2, 1, 10000000, 1);
    final String chr1Name = header.getSequenceDictionary().getSequence(0).getSequenceName();
    final String chr2Name = header.getSequenceDictionary().getSequence(1).getSequenceName();
    final String groupName = header.getReadGroups().get(0).getReadGroupId();
    final Set<Integer> crossContigIgnoreSet = new HashSet<>(3);
    crossContigIgnoreSet.add(1);
    final ReadMetadata readMetadata =
            new ReadMetadata(crossContigIgnoreSet, header, LIBRARY_STATISTICS, new ReadMetadata.PartitionBounds[0],
                            1L, 1L, 1);
    Assert.assertEquals(readMetadata.getContigID(chr1Name), 0);
    Assert.assertEquals(readMetadata.getContigID(chr2Name), 1);
    Assert.assertFalse(readMetadata.ignoreCrossContigID(0));
    Assert.assertTrue(readMetadata.ignoreCrossContigID(1));
    Assert.assertThrows(() -> readMetadata.getContigID("not a real name"));
    Assert.assertEquals(readMetadata.getLibraryStatistics(readMetadata.getLibraryName(groupName)),
            LIBRARY_STATISTICS);
    Assert.assertThrows(() -> readMetadata.getLibraryName("not a real name"));

    final File metadataFile = BaseTest.createTempFile("metadata", "");
    ReadMetadata.writeMetadata(readMetadata, metadataFile.toString());
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:24,代码来源:ReadMetadataTest.java

示例3: testCreateHDF5File

import org.broadinstitute.hellbender.utils.test.BaseTest; //导入方法依赖的package包/类
@Test()
public void testCreateHDF5File() {
    final File testFile = BaseTest.createTempFile("hdf5", ".hd5");
    testFile.delete();
    final HDF5File file = new HDF5File(testFile, HDF5File.OpenMode.CREATE);
    file.close();
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:8,代码来源:HDF5LibraryUnitTest.java

示例4: testIsPresent

import org.broadinstitute.hellbender.utils.test.BaseTest; //导入方法依赖的package包/类
@Test(dependsOnMethods = {"testCreateGroup", "testMakeDouble"})
public void testIsPresent() {
    final File testFile = BaseTest.createTempFile("hdf5", ".hd5");
    final HDF5File file = new HDF5File(testFile, HDF5File.OpenMode.CREATE);
    Assert.assertFalse(file.isPresent("test-group"));
    Assert.assertFalse(file.isPresent("test-group/lola-run"));
    Assert.assertFalse(file.isPresent("test-group/lola-run/bernie-follows"));
    Assert.assertFalse(file.isPresent("test-group/lola-run/jill-follows"));
    file.makeGroup("test-group/lola-run");
    Assert.assertTrue(file.isPresent("test-group"));
    Assert.assertTrue(file.isPresent("test-group/lola-run"));
    Assert.assertFalse(file.isPresent("test-group/lola-run/bernie-follows"));
    Assert.assertFalse(file.isPresent("test-group/lola-run/jill-follows"));
    file.makeDouble("test-group/lola-run/bernie-follows", 0.1);
    Assert.assertTrue(file.isPresent("test-group"));
    Assert.assertTrue(file.isPresent("test-group/lola-run"));
    Assert.assertTrue(file.isPresent("test-group/lola-run/bernie-follows"));
    Assert.assertFalse(file.isPresent("test-group/lola-run/jill-follows"));
    Assert.assertFalse(file.isPresent("test-group/lola-run/bernie-follows/and-so-does-jill"));
    file.close();

    final HDF5File file2 = new HDF5File(testFile, HDF5File.OpenMode.READ_ONLY);
    Assert.assertTrue(file2.isPresent("test-group"));
    Assert.assertTrue(file2.isPresent("test-group/lola-run"));
    Assert.assertTrue(file2.isPresent("test-group/lola-run/bernie-follows"));
    Assert.assertFalse(file2.isPresent("test-group/lola-run/jill-follows"));
    Assert.assertFalse(file2.isPresent("test-group/lola-run/bernie-follows/and-so-does-jill"));
    file2.close();
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:30,代码来源:HDF5LibraryUnitTest.java

示例5: testCreateGroup

import org.broadinstitute.hellbender.utils.test.BaseTest; //导入方法依赖的package包/类
@Test()
public void testCreateGroup() {
    final File testFile = BaseTest.createTempFile("hdf5", ".hd5");
    final HDF5File file = new HDF5File(testFile, HDF5File.OpenMode.CREATE);
    Assert.assertTrue(file.makeGroup("test-group/lola-run"));

    Assert.assertFalse(file.makeGroup("test-group"));
    Assert.assertFalse(file.makeGroup("test-group/lola-run"));
    Assert.assertTrue(file.makeGroup("test-group/peter-pan"));
    file.close();
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:12,代码来源:HDF5LibraryUnitTest.java

示例6: testWrongTargetAnnotations

import org.broadinstitute.hellbender.utils.test.BaseTest; //导入方法依赖的package包/类
@Test(dataProvider="wrongTargetAnnotationSetPairs", expectedExceptions = NoSuchElementException.class)
public void testWrongTargetAnnotations(final Set<TargetAnnotation> expectedSet, final Set<TargetAnnotation> actualAnnotationSet) throws IOException {
    final File testFile = BaseTest.createTempFile("ttw-test", ".tsv");
    final int TARGET_COUNT = 5;

    final TargetWriter subject = new TargetWriter(testFile, expectedSet);
    for (int i = 0; i < TARGET_COUNT; i++) {
        final TargetAnnotationCollection annotationCollection =
                createDummyAnnotations(i == TARGET_COUNT - 1 ? actualAnnotationSet : expectedSet, i);
        subject.writeRecord(new Target("target_" + i, new SimpleInterval("1", (i + 1) * 100, (i + 1) * 100 + 50), annotationCollection));
    }
    subject.close();
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:14,代码来源:TargetWriterUnitTest.java

示例7: testExtraTargetAnnotations

import org.broadinstitute.hellbender.utils.test.BaseTest; //导入方法依赖的package包/类
@Test(dataProvider="extraTargetAnnotationSetPairs")
public void testExtraTargetAnnotations(final Set<TargetAnnotation> expectedSet, final Set<TargetAnnotation> actualAnnotationSet) throws IOException {
    final File testFile = BaseTest.createTempFile("ttw-test", ".tsv");
    final int TARGET_COUNT = 5;

    final TargetWriter subject = new TargetWriter(testFile, expectedSet);
    for (int i = 0; i < TARGET_COUNT; i++) {
        final TargetAnnotationCollection annotationCollection =
                createDummyAnnotations(i == TARGET_COUNT - 1 ? actualAnnotationSet : expectedSet, i);
        subject.writeRecord(new Target("target_" + i, new SimpleInterval("1", (i + 1) * 100, (i + 1) * 100 + 50), annotationCollection));
    }
    subject.close();
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:14,代码来源:TargetWriterUnitTest.java

示例8: testNullAnnotationSet

import org.broadinstitute.hellbender.utils.test.BaseTest; //导入方法依赖的package包/类
@Test(expectedExceptions = IllegalArgumentException.class)
public void testNullAnnotationSet() throws IOException {
    final File testFile = BaseTest.createTempFile("ttw-test", ".tsv");
    new TargetWriter(testFile, null).close();
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:6,代码来源:TargetWriterUnitTest.java

示例9: testReadsPipelineSpark

import org.broadinstitute.hellbender.utils.test.BaseTest; //导入方法依赖的package包/类
@Test(dataProvider = "ReadsPipeline", groups = "spark")
public void testReadsPipelineSpark(PipelineTest params) throws IOException {
    File outFile = BaseTest.createTempFile("readSparkPipelineTest", ".vcf");
    File outFileBam = BaseTest.createTempFile("readSparkPipelineTest", params.outputExtension);
    final ArrayList<String> args = new ArrayList<>();

    args.add("-I");
    args.add(new File(params.bam).getAbsolutePath());
    args.add("-O");
    args.add(outFile.getAbsolutePath());
    if (params.expectedBamFileName != null) {
        args.add("--output-bam");
        args.add(outFileBam.getAbsolutePath());
    }

    File referenceFile = null;
    if (params.referenceURL != null) {
        referenceFile = new File(params.referenceURL);
        args.add("-R");
        args.add(referenceFile.getAbsolutePath());
    }
    args.add("-indels");
    args.add("--enable-baq");
    args.add("-pairHMM");
    args.add("AVX_LOGLESS_CACHING");
    args.add("-stand-call-conf");
    args.add("30.0");
    args.add("--known-sites");
    args.add(params.knownSites);
    if (params.args != null) {
        Stream.of(params.args.trim().split(" ")).forEach(args::add);
    }

    runCommandLine(args);

    if (params.expectedBamFileName != null) {
        if (referenceFile != null && !ReferenceTwoBitSource.isTwoBit(referenceFile.getName())) { // htsjdk can't handle 2bit reference files
            SamAssertionUtils.assertEqualBamFiles(outFileBam, new File(params.expectedBamFileName), referenceFile, true, ValidationStringency.SILENT);
        } else {
            SamAssertionUtils.assertEqualBamFiles(outFileBam, new File(params.expectedBamFileName), true, ValidationStringency.SILENT);
        }
    }

    final double concordance = HaplotypeCallerIntegrationTest.calculateConcordance(outFile, new File(params.expectedVcfFileName));
    Assert.assertTrue(concordance >= 0.99, "Concordance with GATK 4 in VCF mode is < 99% (" +  concordance + ")");
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:47,代码来源:ReadsPipelineSparkIntegrationTest.java

示例10: createTempFile

import org.broadinstitute.hellbender.utils.test.BaseTest; //导入方法依赖的package包/类
/**
 * Creates a temp file making sure is going to be remove after testing VM finishes.
 * @param id temporal file name identifiable part.
 * @return never {@code null}.
 */
private File createTempFile(final String id) {
    return BaseTest.createTempFile("GATK4-ERCTest-" + id,".tmp");
}
 
开发者ID:broadinstitute,项目名称:gatk-protected,代码行数:9,代码来源:CalculateTargetCoverageIntegrationTest.java


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