热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

如何使用`org.opencb.opencga.core.results.VariantQueryResult.getSource()`方法及其代码示例详解

本文整理了Java中org.opencb.opencga.core.results.VariantQueryResult.getSource()方法的一些代码示例,展示了VariantQueryRes

本文整理了Java中org.opencb.opencga.core.results.VariantQueryResult.getSource()方法的一些代码示例,展示了VariantQueryResult.getSource()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。VariantQueryResult.getSource()方法的具体详情如下:
包路径:org.opencb.opencga.core.results.VariantQueryResult
类名称:VariantQueryResult
方法名:getSource

VariantQueryResult.getSource介绍

暂无

代码示例

代码示例来源:origin: opencb/opencga

@Test
public void testSummary() {
queryResult = query(new Query(), new QueryOptions(VariantField.SUMMARY, true).append(QueryOptions.LIMIT, 1000));
System.out.println("queryResult = " + ((VariantQueryResult) queryResult).getSource());
assertEquals(allVariants.getResult().size(), queryResult.getResult().size());
for (Variant variant : queryResult.getResult()) {
assertThat(variant.getStudies().get(0).getSamplesData(), is(Collections.emptyList()));
assertThat(variant.getStudies().get(0).getFiles(), is(Collections.emptyList()));
}
}

代码示例来源:origin: opencb/opencga

@SuppressWarnings("unchecked")
public VariantQueryResult get(Query query, QueryOptions queryOptions, String sessionId, Class clazz)
throws CatalogException, IOException, StorageEngineException {
VariantQueryResult result = get(query, queryOptions, sessionId);
List variants;
if (clazz == Variant.class) {
return (VariantQueryResult) result;
} else if (clazz == org.ga4gh.models.Variant.class) {
Ga4ghVariantConverter cOnverter= new Ga4ghVariantConverter<>(new AvroGa4GhVariantFactory());
variants = (List) converter.apply(result.getResult());
} else if (clazz == ga4gh.Variants.Variant.class) {
Ga4ghVariantConverter cOnverter= new Ga4ghVariantConverter<>(new ProtoGa4GhVariantFactory());
variants = (List) converter.apply(result.getResult());
} else {
throw new IllegalArgumentException("Unknown variant format " + clazz);
}
return new VariantQueryResult<>(
result.getId(),
result.getDbTime(),
result.getNumResults(),
result.getNumTotalResults(),
result.getWarningMsg(),
result.getErrorMsg(),
variants,
result.getSamples(),
result.getSource(),
result.getApproximateCount(),
result.getApproximateCountSamplingSize());
}

代码示例来源:origin: opencb/opencga

public void testGetBySampleName(String expectedSource, QueryOptions options) throws Exception {
query = new Query()
.append(VariantQueryParam.STUDY.key(), "S_1")
.append(VariantQueryParam.SAMPLE.key(), "NA12877");
// queryResult = dbAdaptor.get(query, options);
queryResult = variantStorageEngine.get(query, options);
VariantQueryResult allVariants = dbAdaptor.get(new Query()
.append(VariantQueryParam.INCLUDE_STUDY.key(), "S_1")
.append(VariantQueryParam.INCLUDE_SAMPLE.key(), "NA12877")
.append(VariantQueryParam.INCLUDE_FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz"), options);
assertEquals(expectedSource, queryResult.getSource());
assertThat(queryResult, everyResult(allVariants, withStudy("S_1", allOf(withFileId("1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz"), withSampleData("NA12877", "GT", containsString("1"))))));
}

代码示例来源:origin: opencb/opencga

public void testGetBySamplesName(String expectedSource, QueryOptions options) throws Exception {
query = new Query()
.append(VariantQueryParam.STUDY.key(), "S_1")
.append(VariantQueryParam.SAMPLE.key(), "NA12877;NA12878");
// queryResult = dbAdaptor.get(query, options);
queryResult = variantStorageEngine.get(query, options);
VariantQueryResult allVariants = dbAdaptor.get(new Query()
.append(VariantQueryParam.INCLUDE_STUDY.key(), "S_1")
.append(VariantQueryParam.INCLUDE_SAMPLE.key(), "NA12877,NA12878")
.append(VariantQueryParam.INCLUDE_FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz,1K.end.platinum-genomes-vcf-NA12878_S1.genome.vcf.gz"), options);
assertEquals(expectedSource, queryResult.getSource());
assertThat(queryResult, everyResult(allVariants, withStudy("S_1", allOf(
allOf(
withFileId("1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz"),
withSampleData("NA12877", "GT", containsString("1"))),
allOf(
withFileId("1K.end.platinum-genomes-vcf-NA12878_S1.genome.vcf.gz"),
withSampleData("NA12878", "GT", containsString("1")))))));
}

代码示例来源:origin: opencb/opencga

public void testGetByGenotypes(String expectedSource, QueryOptions options) throws Exception {
VariantQueryResult allVariants = dbAdaptor.get(new Query()
.append(VariantQueryParam.INCLUDE_STUDY.key(), "S_1")
.append(VariantQueryParam.INCLUDE_SAMPLE.key(), "NA12877,NA12878")
.append(VariantQueryParam.INCLUDE_FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz,1K.end.platinum-genomes-vcf-NA12878_S1.genome.vcf.gz"), options);
queryResult = variantStorageEngine.get(new Query()
.append(VariantQueryParam.STUDY.key(), "S_1")
.append(VariantQueryParam.GENOTYPE.key(), "NA12877:0/1,NA12878:1/1")
.append(VariantQueryParam.INCLUDE_SAMPLE.key(), "NA12877,NA12878"), options);
assertThat(queryResult, everyResult(allVariants, withStudy("S_1", anyOf(
allOf(
withFileId("1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz"),
withSampleData("NA12877", "GT", containsString("0/1"))),
allOf(
withFileId("1K.end.platinum-genomes-vcf-NA12878_S1.genome.vcf.gz"),
withSampleData("NA12878", "GT", containsString("1/1")))))));
assertEquals(expectedSource, queryResult.getSource());
queryResult = variantStorageEngine.get(new Query()
.append(VariantQueryParam.STUDY.key(), "S_1")
.append(VariantQueryParam.GENOTYPE.key(), "NA12877:" + GenotypeClass.HET_REF + ",NA12878:" + GenotypeClass.HOM_ALT)
.append(VariantQueryParam.INCLUDE_SAMPLE.key(), "NA12877,NA12878"), options);
assertThat(queryResult, everyResult(allVariants, withStudy("S_1", anyOf(
allOf(
withFileId("1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz"),
withSampleData("NA12877", "GT", containsString("0/1"))),
allOf(
withFileId("1K.end.platinum-genomes-vcf-NA12878_S1.genome.vcf.gz"),
withSampleData("NA12878", "GT", containsString("1/1")))))));
assertEquals(expectedSource, queryResult.getSource());
}

代码示例来源:origin: opencb/opencga

public void testGetByFileName(String expectedSource, QueryOptions options) throws Exception {
query = new Query()
// .append(VariantQueryParam.STUDY.key(), "S_1")
.append(VariantQueryParam.FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz");
// queryResult = dbAdaptor.get(query, options);
queryResult = variantStorageEngine.get(query, options);
VariantQueryResult allVariants = dbAdaptor.get(new Query()
.append(VariantQueryParam.INCLUDE_STUDY.key(), "all")
.append(VariantQueryParam.INCLUDE_SAMPLE.key(), "NA12877")
.append(VariantQueryParam.INCLUDE_FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz"), options);
assertEquals(expectedSource, queryResult.getSource());
assertThat(queryResult, everyResult(allVariants, withStudy("S_1", withFileId("1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz"))));
}

代码示例来源:origin: opencb/opencga

public void testGetByGenotypesWithRefMix(String expectedSource, QueryOptions options) throws Exception {
query = new Query()
.append(VariantQueryParam.STUDY.key(), "S_1")
.append(VariantQueryParam.GENOTYPE.key(), "NA12877:0/1;NA12878:0/0,0/1")
.append(VariantQueryParam.INCLUDE_SAMPLE.key(), "NA12877,NA12878")
.append(VariantQueryParam.UNKNOWN_GENOTYPE.key(), "0/0");
// queryResult = dbAdaptor.get(query, options);
queryResult = variantStorageEngine.get(query, options);
VariantQueryResult allVariants = dbAdaptor.get(new Query()
.append(VariantQueryParam.INCLUDE_STUDY.key(), "S_1")
.append(VariantQueryParam.INCLUDE_SAMPLE.key(), "NA12877,NA12878")
.append(VariantQueryParam.INCLUDE_FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz,1K.end.platinum-genomes-vcf-NA12878_S1.genome.vcf.gz")
.append(VariantQueryParam.UNKNOWN_GENOTYPE.key(), "0/0"), options);
assertThat(queryResult, everyResult(allVariants, withStudy("S_1", allOf(
allOf(
withFileId("1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz"),
withSampleData("NA12877", "GT", containsString("0/1"))),
anyOf(
withSampleData("NA12878", "GT", containsString("0/0")),
withSampleData("NA12878", "GT", containsString("0/1"))
)
))));
assertEquals(expectedSource, queryResult.getSource());
}

代码示例来源:origin: opencb/opencga

public void testGetByGenotypesWithRef(String expectedSource, QueryOptions options) throws Exception {
query = new Query()
.append(VariantQueryParam.STUDY.key(), "S_1")
.append(VariantQueryParam.GENOTYPE.key(), "NA12877:0/1;NA12878:0/0")
.append(VariantQueryParam.INCLUDE_SAMPLE.key(), "NA12877,NA12878")
.append(VariantQueryParam.UNKNOWN_GENOTYPE.key(), "0/0");
// queryResult = dbAdaptor.get(query, options);
queryResult = variantStorageEngine.get(query, options);
VariantQueryResult allVariants = dbAdaptor.get(new Query()
.append(VariantQueryParam.INCLUDE_STUDY.key(), "S_1")
.append(VariantQueryParam.INCLUDE_SAMPLE.key(), "NA12877,NA12878")
.append(VariantQueryParam.INCLUDE_FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz,1K.end.platinum-genomes-vcf-NA12878_S1.genome.vcf.gz")
.append(VariantQueryParam.UNKNOWN_GENOTYPE.key(), "0/0"), options);
assertThat(queryResult, everyResult(allVariants, withStudy("S_1", allOf(
allOf(
withFileId("1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz"),
withSampleData("NA12877", "GT", containsString("0/1"))),
withSampleData("NA12878", "GT", containsString("0/0"))))));
assertEquals(expectedSource, queryResult.getSource());
}

代码示例来源:origin: opencb/opencga

public void testGetBySampleNameMultiRegion(String expectedSource, QueryOptions options) throws Exception {
query = new Query()
.append(VariantQueryParam.STUDY.key(), "S_1")
.append(VariantQueryParam.SAMPLE.key(), "NA12877")
.append(VariantQueryParam.REGION.key(), "1:1-12783,M");
// queryResult = dbAdaptor.get(query, options);
queryResult = variantStorageEngine.get(query, options);
VariantQueryResult allVariants = dbAdaptor.get(new Query()
.append(VariantQueryParam.INCLUDE_STUDY.key(), "S_1")
.append(VariantQueryParam.INCLUDE_SAMPLE.key(), "NA12877")
.append(VariantQueryParam.INCLUDE_FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz"), options);
assertEquals(expectedSource, queryResult.getSource());
assertThat(queryResult, everyResult(allVariants, allOf(anyOf(overlaps(new Region("1:1-12783")), overlaps(new Region("M"))), withStudy("S_1", allOf(withFileId("1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz"), withSampleData("NA12877", "GT", containsString("1")))))));
}

代码示例来源:origin: opencb/opencga

public void testGetByGenotypeMultiRegion(String expectedSource, QueryOptions options) throws Exception {
query = new Query()
.append(VariantQueryParam.STUDY.key(), "S_1")
.append(VariantQueryParam.GENOTYPE.key(), "NA12877:1/1")
.append(VariantQueryParam.REGION.key(), "1:1-12783,M");
// queryResult = dbAdaptor.get(query, options);
queryResult = variantStorageEngine.get(query, options);
VariantQueryResult allVariants = dbAdaptor.get(new Query()
.append(VariantQueryParam.INCLUDE_STUDY.key(), "S_1")
.append(VariantQueryParam.INCLUDE_SAMPLE.key(), "NA12877")
.append(VariantQueryParam.INCLUDE_FILE.key(), "1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz"), options);
assertEquals(expectedSource, queryResult.getSource());
assertThat(queryResult, everyResult(allVariants, allOf(anyOf(overlaps(new Region("1:1-12783")), overlaps(new Region("M"))), withStudy("S_1", allOf(withFileId("1K.end.platinum-genomes-vcf-NA12877_S1.genome.vcf.gz"), withSampleData("NA12877", "GT", is("1/1")))))));
}

推荐阅读
author-avatar
hytyj_989
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有