Search in sources :

Example 96 with DataProvider

use of org.testng.annotations.DataProvider in project gatk by broadinstitute.

the class CombineReadCountsIntegrationTest method testOneSampleOneFileFullTargetInfo.

@Test(dataProvider = "testData")
public void testOneSampleOneFileFullTargetInfo(final List<Target> targets, final List<String> sampleNames, final double[][] counts) throws IOException {
    final List<File> inputFiles = createInputCountFiles(targets, sampleNames, counts, true, true);
    final File targetFile = createTargetFile(targets);
    final File output = runTool(targetFile, inputFiles, null);
    // Make sure that the input files are not removed by the tool.
    Assert.assertFalse(inputFiles.stream().anyMatch(f -> !f.canRead()));
    inputFiles.forEach(File::delete);
    targetFile.delete();
    Assert.assertTrue(output.canRead());
    assertOutputContents(output, targets, sampleNames, counts);
    // do the testing here:
    output.delete();
}
Also used : PrintWriter(java.io.PrintWriter) IntStream(java.util.stream.IntStream) DataProvider(org.testng.annotations.DataProvider) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) FileWriter(java.io.FileWriter) StandardArgumentDefinitions(org.broadinstitute.hellbender.cmdline.StandardArgumentDefinitions) Test(org.testng.annotations.Test) IOException(java.io.IOException) Random(java.util.Random) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest) SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) Collectors(java.util.stream.Collectors) File(java.io.File) ArrayList(java.util.ArrayList) TableWriter(org.broadinstitute.hellbender.utils.tsv.TableWriter) List(java.util.List) UserException(org.broadinstitute.hellbender.exceptions.UserException) Assert(org.testng.Assert) TableUtils(org.broadinstitute.hellbender.utils.tsv.TableUtils) TableColumnCollection(org.broadinstitute.hellbender.utils.tsv.TableColumnCollection) RealMatrix(org.apache.commons.math3.linear.RealMatrix) Collections(java.util.Collections) SimulatedTargets(org.broadinstitute.hellbender.fakedata.SimulatedTargets) CommandLineException(org.broadinstitute.barclay.argparser.CommandLineException) File(java.io.File) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 97 with DataProvider

use of org.testng.annotations.DataProvider in project gatk by broadinstitute.

the class XHMMSegmentCallerBaseIntegrationTest method simulateChainDataProvider.

@DataProvider(name = "simulatedChainData")
public static Object[][] simulateChainDataProvider() {
    final Random rdn = new Random(131313);
    final List<Object[]> result = simulateChainData(rdn);
    return result.toArray(new Object[result.size()][]);
}
Also used : Random(java.util.Random) DataProvider(org.testng.annotations.DataProvider)

Example 98 with DataProvider

use of org.testng.annotations.DataProvider in project gatk by broadinstitute.

the class HetPulldownCalculatorUnitTest method inputGetTumorHetPulldown.

@DataProvider(name = "inputGetTumorHetPulldown")
public Object[][] inputGetTumorHetPulldown() {
    final Pulldown tumorHetPulldown = new Pulldown(normalHeader);
    tumorHetPulldown.add(new AllelicCount(new SimpleInterval("1", 11522, 11522), 7, 4));
    tumorHetPulldown.add(new AllelicCount(new SimpleInterval("1", 12098, 12098), 8, 6));
    tumorHetPulldown.add(new AllelicCount(new SimpleInterval("1", 14630, 14630), 9, 8));
    tumorHetPulldown.add(new AllelicCount(new SimpleInterval("2", 14689, 14689), 6, 9));
    tumorHetPulldown.add(new AllelicCount(new SimpleInterval("2", 14982, 14982), 6, 5));
    final IntervalList normalHetIntervals = new IntervalList(tumorHeader);
    normalHetIntervals.add(new Interval("1", 11522, 11522));
    normalHetIntervals.add(new Interval("1", 12098, 12098));
    normalHetIntervals.add(new Interval("1", 14630, 14630));
    normalHetIntervals.add(new Interval("2", 14689, 14689));
    normalHetIntervals.add(new Interval("2", 14982, 14982));
    return new Object[][] { { normalHetIntervals, tumorHetPulldown } };
}
Also used : IntervalList(htsjdk.samtools.util.IntervalList) SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) AllelicCount(org.broadinstitute.hellbender.tools.exome.alleliccount.AllelicCount) SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) Interval(htsjdk.samtools.util.Interval) DataProvider(org.testng.annotations.DataProvider)

Example 99 with DataProvider

use of org.testng.annotations.DataProvider in project gatk by broadinstitute.

the class HetPulldownCalculatorUnitTest method inputGetPileupBaseCount.

@DataProvider(name = "inputGetPileupBaseCount")
public Object[][] inputGetPileupBaseCount() throws IOException {
    try (final SamReader bamReader = SamReaderFactory.makeDefault().open(NORMAL_BAM_FILE)) {
        final IntervalList intervals = new IntervalList(bamReader.getFileHeader());
        intervals.add(new Interval("1", 100, 100));
        intervals.add(new Interval("1", 11000, 11000));
        intervals.add(new Interval("1", 14000, 14000));
        intervals.add(new Interval("1", 14630, 14630));
        final SamLocusIterator locusIterator = new SamLocusIterator(bamReader, intervals);
        final Nucleotide.Counter baseCounts1 = makeBaseCounts(0, 0, 0, 0);
        final Nucleotide.Counter baseCounts2 = makeBaseCounts(0, 9, 0, 0);
        final Nucleotide.Counter baseCounts3 = makeBaseCounts(12, 0, 0, 0);
        final Nucleotide.Counter baseCounts4 = makeBaseCounts(0, 0, 8, 9);
        if (!locusIterator.hasNext()) {
            throw new SAMException("Can't get locus to start iteration. Check that " + NORMAL_BAM_FILE.toString() + " contains 1:0-16000.");
        }
        final SamLocusIterator.LocusInfo locus1 = locusIterator.next();
        final SamLocusIterator.LocusInfo locus2 = locusIterator.next();
        final SamLocusIterator.LocusInfo locus3 = locusIterator.next();
        final SamLocusIterator.LocusInfo locus4 = locusIterator.next();
        locusIterator.close();
        return new Object[][] { { locus1, baseCounts1 }, { locus2, baseCounts2 }, { locus3, baseCounts3 }, { locus4, baseCounts4 } };
    }
}
Also used : SamLocusIterator(htsjdk.samtools.util.SamLocusIterator) IntervalList(htsjdk.samtools.util.IntervalList) Nucleotide(org.broadinstitute.hellbender.utils.Nucleotide) SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) Interval(htsjdk.samtools.util.Interval) DataProvider(org.testng.annotations.DataProvider)

Example 100 with DataProvider

use of org.testng.annotations.DataProvider in project gatk by broadinstitute.

the class StructuralVariationDiscoveryPipelineSparkIntegrationTest method createTestData.

@DataProvider(name = "svDiscoverPipelineSparkIntegrationTest")
public Object[][] createTestData() throws IOException {
    List<Object[]> tests = new ArrayList<>();
    final File tempDirLeft = BaseTest.createTempDir("forLeft");
    tempDirLeft.deleteOnExit();
    Files.createDirectories(Paths.get(tempDirLeft.getAbsolutePath() + "/fastq"));
    tests.add(new Object[] { new StructuralVariationDiscoveryPipelineSparkIntegrationTest.StructuralVariationDiscoveryPipelineSparkIntegrationTestArgs(SVIntegrationTestDataProvider.TEST_BAM_LEFT, SVIntegrationTestDataProvider.KMER_KILL_LIST, SVIntegrationTestDataProvider.ALIGNER_INDEX_IMG, tempDirLeft.getAbsolutePath()) });
    final File tempDirRight = BaseTest.createTempDir("forRight");
    tempDirRight.deleteOnExit();
    Files.createDirectories(Paths.get(tempDirRight.getAbsolutePath() + "/fastq"));
    tests.add(new Object[] { new StructuralVariationDiscoveryPipelineSparkIntegrationTest.StructuralVariationDiscoveryPipelineSparkIntegrationTestArgs(SVIntegrationTestDataProvider.TEST_BAM_RIGHT, SVIntegrationTestDataProvider.KMER_KILL_LIST, SVIntegrationTestDataProvider.ALIGNER_INDEX_IMG, tempDirRight.getAbsolutePath()) });
    return tests.toArray(new Object[][] {});
}
Also used : ArrayList(java.util.ArrayList) File(java.io.File) DataProvider(org.testng.annotations.DataProvider)

Aggregations

DataProvider (org.testng.annotations.DataProvider)387 SimpleInterval (org.broadinstitute.hellbender.utils.SimpleInterval)99 ArrayList (java.util.ArrayList)92 Test (org.testng.annotations.Test)85 File (java.io.File)74 List (java.util.List)72 Assert (org.testng.Assert)67 URIDetails (com.linkedin.restli.internal.testutils.URIDetails)65 Collectors (java.util.stream.Collectors)61 HashMap (java.util.HashMap)57 IntStream (java.util.stream.IntStream)54 Random (java.util.Random)50 RealMatrix (org.apache.commons.math3.linear.RealMatrix)44 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)41 IOException (java.io.IOException)39 ByteString (com.linkedin.data.ByteString)37 Array2DRowRealMatrix (org.apache.commons.math3.linear.Array2DRowRealMatrix)34 Stream (java.util.stream.Stream)31 DoubleStream (java.util.stream.DoubleStream)29 HashSet (java.util.HashSet)28