本文整理汇总了Java中org.broadinstitute.hellbender.utils.test.BaseTest类的典型用法代码示例。如果您正苦于以下问题:Java BaseTest类的具体用法?Java BaseTest怎么用?Java BaseTest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BaseTest类属于org.broadinstitute.hellbender.utils.test包,在下文中一共展示了BaseTest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: testPipeForPicardTools
import org.broadinstitute.hellbender.utils.test.BaseTest; //导入依赖的package包/类
@Test
// Asserting that Picard programs are able to pipe their output without errors
public void testPipeForPicardTools() {
File output = createTempFile("testOutput",".bam");
BaseTest.runProcess(ProcessController.getThreadLocal(), new String[]{"/bin/sh","-c"," ./gatk SortSam -I "+INPUT_BAM+" -O /dev/stdout -SO coordinate " +
"| ./gatk SetNmMdAndUqTags -I /dev/stdin -O "+ output.getAbsolutePath()+ " --CREATE_INDEX true -R "+b37_reference_20_21});//.split(" "));
try (ReadsDataSource inputReads = new ReadsDataSource(new File(INPUT_BAM).toPath());
ReadsDataSource outputReads = new ReadsDataSource(output.toPath())) {
Assert.assertTrue(inputReads.iterator().hasNext());
Assert.assertTrue(outputReads.iterator().hasNext());
final int[] count = {0};
inputReads.forEach(r -> {
count[0]++;});
outputReads.forEach(r -> {
count[0]--;});
Assert.assertEquals(count[0],0);
}
}
示例3: createTestData
import org.broadinstitute.hellbender.utils.test.BaseTest; //导入依赖的package包/类
@DataProvider(name = "svDiscoverPipelineSparkIntegrationTest")
public Object[][] createTestData() throws IOException {
List<Object[]> tests = new ArrayList<>();
final File tempDirNew = BaseTest.createTempDir("new");
tempDirNew.deleteOnExit();
Files.createDirectories(Paths.get(tempDirNew.getAbsolutePath()+"/fastq"));
tests.add(new Object[]{
new StructuralVariationDiscoveryPipelineSparkIntegrationTest.StructuralVariationDiscoveryPipelineSparkIntegrationTestArgs(
SVIntegrationTestDataProvider.TEST_BAM,
SVIntegrationTestDataProvider.KMER_KILL_LIST,
SVIntegrationTestDataProvider.ALIGNER_INDEX_IMG,
SVIntegrationTestDataProvider.EXTERNAL_CNV_CALLS,
tempDirNew.getAbsolutePath()
)
});
return tests.toArray(new Object[][]{});
}
开发者ID:broadinstitute,项目名称:gatk,代码行数:20,代码来源:StructuralVariationDiscoveryPipelineSparkIntegrationTest.java
示例4: 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());
}
示例5: testFlagStatDataflowTransform
import org.broadinstitute.hellbender.utils.test.BaseTest; //导入依赖的package包/类
@Test(groups = "dataflow")
public void testFlagStatDataflowTransform(){
File bam = new File(BaseTest.publicTestDir, "org/broadinstitute/hellbender/tools/dataflow/pipelines/FlagStatDataflow/flag_stat.bam");
Pipeline p = GATKTestPipeline.create();
DataflowUtils.registerGATKCoders(p);
List<SimpleInterval> intervals = Lists.newArrayList(new SimpleInterval("chr1", 1, 101),
new SimpleInterval("chr2", 1, 101),
new SimpleInterval("chr3", 1, 101),
new SimpleInterval("chr4", 1, 101),
new SimpleInterval("chr5", 1, 101),
new SimpleInterval("chr6", 1, 202),
new SimpleInterval("chr7", 1, 202),
new SimpleInterval("chr8", 1, 202));
PCollection<GATKRead> preads = DataflowUtils.getReadsFromLocalBams(p, intervals, Lists.newArrayList(bam));
PCollection<FlagStat.FlagStatus> presult = preads.apply(new FlagStatusDataflowTransform());
ReadsDataSource nonDataflow = new ReadsDataSource(bam);
nonDataflow.setIntervalsForTraversal(intervals);
FlagStat.FlagStatus expectedNonDataflow = new FlagStat.FlagStatus();
for (GATKRead read : nonDataflow){
expectedNonDataflow.add(read);
}
DataflowAssert.thatSingleton(presult).isEqualTo(expectedNonDataflow);
p.run();
}
示例6: 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();
}
示例7: 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();
}
示例8: 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();
}
示例9: createInputCountFiles
import org.broadinstitute.hellbender.utils.test.BaseTest; //导入依赖的package包/类
private List<File> createInputCountFiles(final List<Target> targets, final List<String> sampleNames, final double[][] counts, final boolean withTargetName, final boolean withTargetCoordinates) throws IOException {
final List<File> inputFiles = sampleNames.stream()
.map(s -> BaseTest.createTempFile(s, ".tab"))
.collect(Collectors.toList());
for (int i = 0; i < sampleNames.size(); i++) {
createCountFile(inputFiles.get(i), targets, sampleNames.get(i), counts[i], withTargetName, withTargetCoordinates);
}
return inputFiles;
}
示例10: 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();
}
示例11: 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();
}
示例12: testNonExistentScriptException
import org.broadinstitute.hellbender.utils.test.BaseTest; //导入依赖的package包/类
@Test(groups = "python", dependsOnMethods = "testPythonExists", expectedExceptions = PythonScriptExecutorException.class)
public void testNonExistentScriptException() throws IOException {
final PythonScriptExecutor executor = new PythonScriptExecutor(true);
executor.executeScript(
BaseTest.getSafeNonExistentFile("Nonexistent" + PythonScriptExecutor.PYTHON_EXTENSION).getAbsolutePath(),
null,
null);
}
示例13: testNonExistentScriptNoException
import org.broadinstitute.hellbender.utils.test.BaseTest; //导入依赖的package包/类
@Test(groups = "python", dependsOnMethods = "testPythonExists")
public void testNonExistentScriptNoException() {
final PythonScriptExecutor executor = new PythonScriptExecutor(true);
executor.setIgnoreExceptions(true);
Assert.assertFalse(
executor.executeScript(
BaseTest.getSafeNonExistentFile("Nonexistent" + PythonScriptExecutor.PYTHON_EXTENSION).getAbsolutePath(),
null,
null
),
"Exec should have returned false when the job failed");
}
示例14: testNonExistentScriptNoException
import org.broadinstitute.hellbender.utils.test.BaseTest; //导入依赖的package包/类
@Test(groups = {"R"}, dependsOnMethods = "testRscriptExists")
public void testNonExistentScriptNoException() {
logger.warn("Testing that warning is printed an no exception thrown for missing script.");
RScriptExecutor executor = new RScriptExecutor();
executor.addScript(BaseTest.getSafeNonExistentFile("does_not_exists.R"));
executor.setIgnoreExceptions(true);
Assert.assertFalse(executor.exec(), "Exec should have returned false when the job failed");
}
示例15: testOwnerConfigurationWithClassPathOverridesAndVariableFileInput
import org.broadinstitute.hellbender.utils.test.BaseTest; //导入依赖的package包/类
@Test
public void testOwnerConfigurationWithClassPathOverridesAndVariableFileInput() throws IOException {
// Start with the name of the properties file to copy:
final String overrideFilename = "AdditionalTestOverrides.properties";
// Create a temporary folder in which to place the config file:
final File outputDir = BaseTest.createTempDir("testOwnerConfigurationWithClassPathOverridesAndVariableFileInput");
outputDir.deleteOnExit();
// Put the known config file in the new directory:
Files.copy(new File("src/test/resources/org/broadinstitute/hellbender/utils/config/" + overrideFilename).toPath(),
new File(outputDir.getAbsolutePath() + File.separator + overrideFilename).toPath(),
StandardCopyOption.REPLACE_EXISTING);
// Assert that our config property is not set:
Assert.assertEquals( org.aeonbits.owner.ConfigFactory.getProperty(BasicTestConfigWithClassPathOverridesAndVariableFile.CONFIG_FILE_VARIABLE_FILE_NAME), null);
// Set our file location here:
org.aeonbits.owner.ConfigFactory.setProperty(BasicTestConfigWithClassPathOverridesAndVariableFile.CONFIG_FILE_VARIABLE_FILE_NAME, outputDir.getAbsolutePath() + File.separator + overrideFilename);
// Test with the class that overrides on the class path:
final BasicTestConfigWithClassPathOverridesAndVariableFile basicTestConfigWithClassPathOverridesAndVariableFile =
org.aeonbits.owner.ConfigFactory.create(BasicTestConfigWithClassPathOverridesAndVariableFile.class);
// List properties for inspection:
listAndStoreConfigToStdOut(basicTestConfigWithClassPathOverridesAndVariableFile);
Assert.assertEquals(basicTestConfigWithClassPathOverridesAndVariableFile.booleanDefFalse(), true);
Assert.assertEquals(basicTestConfigWithClassPathOverridesAndVariableFile.booleanDefTrue(), false);
Assert.assertEquals(basicTestConfigWithClassPathOverridesAndVariableFile.intDef207(), 999);
Assert.assertEquals(basicTestConfigWithClassPathOverridesAndVariableFile.listOfStringTest(), new ArrayList<>(Arrays.asList("string4", "string3", "string2", "string1")));
Assert.assertEquals(basicTestConfigWithClassPathOverridesAndVariableFile.customBoolean().booleanValue(), false);
// Reset the config factory:
org.aeonbits.owner.ConfigFactory.clearProperty(BasicTestConfigWithClassPathOverridesAndVariableFile.CONFIG_FILE_VARIABLE_FILE_NAME);
Assert.assertEquals(org.aeonbits.owner.ConfigFactory.getProperty(BasicTestConfigWithClassPathOverridesAndVariableFile.CONFIG_FILE_VARIABLE_FILE_NAME), null);
}