Search in sources :

Example 1 with ReferenceAPISource

use of org.broadinstitute.hellbender.engine.datasources.ReferenceAPISource in project gatk by broadinstitute.

the class ReferenceAPISourceUnitTest method testSequenceDictionarySorting.

@Test(dataProvider = "sortData")
public void testSequenceDictionarySorting(String inputs, String outputs) {
    final String[] input = inputs.split(",");
    final String[] expected = outputs.split(",");
    final ReferenceAPISource ref = new ReferenceAPISource(createDummyReferenceMap(input));
    final SAMSequenceDictionary seq = ref.getReferenceSequenceDictionary(null);
    checkSequenceDictionary(seq, expected);
}
Also used : ReferenceAPISource(org.broadinstitute.hellbender.engine.datasources.ReferenceAPISource) SAMSequenceDictionary(htsjdk.samtools.SAMSequenceDictionary) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 2 with ReferenceAPISource

use of org.broadinstitute.hellbender.engine.datasources.ReferenceAPISource in project gatk by broadinstitute.

the class ReferenceAPISourceUnitTest method queryReferenceAPI.

private ReferenceBases queryReferenceAPI(final String referenceName, final SimpleInterval interval, int pageSize) {
    final Pipeline p = setupPipeline();
    ReferenceAPISource refAPISource = makeReferenceAPISource(referenceName, p);
    return refAPISource.getReferenceBases(p.getOptions(), interval, pageSize);
}
Also used : ReferenceAPISource(org.broadinstitute.hellbender.engine.datasources.ReferenceAPISource) TestPipeline(com.google.cloud.dataflow.sdk.testing.TestPipeline) Pipeline(com.google.cloud.dataflow.sdk.Pipeline)

Example 3 with ReferenceAPISource

use of org.broadinstitute.hellbender.engine.datasources.ReferenceAPISource in project gatk by broadinstitute.

the class ReferenceAPISourceUnitTest method testCreateByAssemblyID.

@Test(groups = "cloud", dataProvider = "assemblyIDData")
public void testCreateByAssemblyID(final String assemblyID, final String refID) throws Exception {
    final Pipeline p = setupPipeline();
    final ReferenceAPISource apiSourceByAssemblyName = ReferenceAPISource.fromReferenceSetAssemblyID(p.getOptions(), assemblyID);
    final ReferenceAPISource apiSourceByID = makeReferenceAPISource(refID, p);
    Assert.assertEquals(apiSourceByAssemblyName.getReferenceMap(), apiSourceByID.getReferenceMap());
}
Also used : ReferenceAPISource(org.broadinstitute.hellbender.engine.datasources.ReferenceAPISource) TestPipeline(com.google.cloud.dataflow.sdk.testing.TestPipeline) Pipeline(com.google.cloud.dataflow.sdk.Pipeline) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 4 with ReferenceAPISource

use of org.broadinstitute.hellbender.engine.datasources.ReferenceAPISource in project gatk by broadinstitute.

the class ReferenceAPISourceUnitTest method testDummy.

@Test(groups = "cloud")
public void testDummy() {
    String referenceName = HS37D5_REF_ID;
    final String expected = "AAACAGGTTA";
    // -1 because we're using closed intervals
    SimpleInterval interval = new SimpleInterval("1", 50001, 50001 + expected.length() - 1);
    Logger logger = LogManager.getLogger(ReferenceAPISourceUnitTest.class);
    GenomicsOptions options = PipelineOptionsFactory.create().as(GenomicsOptions.class);
    options.setApiKey(getGCPTestApiKey());
    options.setProject(getGCPTestProject());
    // We don't use GATKTestPipeline because we need specific options.
    final Pipeline p = TestPipeline.create(options);
    ReferenceAPISource refAPISource = makeReferenceAPISource(referenceName, p);
    ReferenceBases bases = refAPISource.getReferenceBases(p.getOptions(), interval);
    final String actual = new String(bases.getBases());
    Assert.assertEquals(actual, expected, "Wrong bases returned");
    p.run();
}
Also used : ReferenceBases(org.broadinstitute.hellbender.utils.reference.ReferenceBases) ReferenceAPISource(org.broadinstitute.hellbender.engine.datasources.ReferenceAPISource) GenomicsOptions(com.google.cloud.genomics.dataflow.utils.GenomicsOptions) SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) Logger(org.apache.logging.log4j.Logger) TestPipeline(com.google.cloud.dataflow.sdk.testing.TestPipeline) Pipeline(com.google.cloud.dataflow.sdk.Pipeline) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 5 with ReferenceAPISource

use of org.broadinstitute.hellbender.engine.datasources.ReferenceAPISource in project gatk by broadinstitute.

the class ReferenceAPISourceUnitTest method testCreateByAssemblyIDMultipleReferenceSets.

@Test(groups = "cloud", dataProvider = "assemblyIDDataMultiple", expectedExceptions = UserException.MultipleReferenceSets.class)
public void testCreateByAssemblyIDMultipleReferenceSets(final String assemblyID, final String refID) throws Exception {
    final Pipeline p = setupPipeline();
    final ReferenceAPISource apiSourceByAssemblyName = ReferenceAPISource.fromReferenceSetAssemblyID(p.getOptions(), assemblyID);
    final ReferenceAPISource apiSourceByID = makeReferenceAPISource(refID, p);
    Assert.assertEquals(apiSourceByAssemblyName.getReferenceMap(), apiSourceByID.getReferenceMap());
}
Also used : ReferenceAPISource(org.broadinstitute.hellbender.engine.datasources.ReferenceAPISource) TestPipeline(com.google.cloud.dataflow.sdk.testing.TestPipeline) Pipeline(com.google.cloud.dataflow.sdk.Pipeline) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Aggregations

ReferenceAPISource (org.broadinstitute.hellbender.engine.datasources.ReferenceAPISource)6 Pipeline (com.google.cloud.dataflow.sdk.Pipeline)5 TestPipeline (com.google.cloud.dataflow.sdk.testing.TestPipeline)5 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)4 Test (org.testng.annotations.Test)4 GenomicsOptions (com.google.cloud.genomics.dataflow.utils.GenomicsOptions)1 SAMSequenceDictionary (htsjdk.samtools.SAMSequenceDictionary)1 Logger (org.apache.logging.log4j.Logger)1 SimpleInterval (org.broadinstitute.hellbender.utils.SimpleInterval)1 ReferenceBases (org.broadinstitute.hellbender.utils.reference.ReferenceBases)1