Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Making GenomicDataCommons less daunting to use for the average user

未关闭
#94 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
文档
描述清晰度
基本清楚
活跃度
停滞
技术栈
r
领域
documentation

调研方向

Review the existing vignette and the query/result entry points mentioned here, including files(), select(), and results_all(), alongside the nested result structure in the issue. Add clear examples showing how suitable query results can be represented as data frames and explain when multiple queries and joins are needed.

由索引模型根据 Issue 内容生成。

描述

GenomicDataCommons is a very powerful library and can query pretty much anything at the GDC, though many users prefer other libraries like e.g.,TCGAbiolinks because the GenomicDataCommons query results data structure, a deeply nested list of recursive lists of data frames of lists (an R representation of JSON), can be quite daunting for the average user to work with.

Users generally want to get and look at data frames. While all query results cannot easily be transformed into a single data frame, many can. It would help users a lot to show how to do this.

I use rrapply to recursively alter anything I need inside the query results data structure (which is a nice library made for dealing with things like GenomicDataCommons recursive data structures), then make a data frame like e.g.:

stopifnot(GenomicDataCommons::status()$status == "OK")
gdc_query <-
    files() %>%
    GenomicDataCommons::filter(
        cases.project.project_id %in% project_ids
        & cases.samples.sample_type %in% sample_types
        & analysis.workflow_type == workflow_type
    ) %>%
    GenomicDataCommons::select(c(
        "file_name",
        "analysis.workflow_type",
        "cases.project.project_id",
        "cases.case_id",
        "cases.submitter_id",
        "cases.samples.sample_id",
        "cases.samples.submitter_id",
        "cases.samples.sample_type",
        "cases.samples.is_ffpe",
        "cases.samples.portions.is_ffpe",
        "cases.samples.portions.analytes.aliquots.aliquot_id",
        "cases.samples.portions.analytes.aliquots.submitter_id"
    ))
gdc_results <- results_all(gdc_query)

gdc_results <- rrapply(
    gdc_results, f=function(x) NA, condition=is.null, how="replace"
)

gdc_df <- data.frame(
    file_uuid=gdc_results$file_id,
    file_name=gdc_results$file_name,
    workflow_type=gdc_results$analysis$workflow_type,
    project_id=vapply(
        sapply(gdc_results$cases, `[[`, "project"), `[`, "project_id"
    ),
    case_uuid=sapply(gdc_results$cases, `[[`, "case_id"),
    case_submitter_id=sapply(gdc_results$cases, `[[`, "submitter_id"),
    sample_uuid=sapply(
        sapply(gdc_results$cases, `[[`, "samples"), `[[`, "sample_id"
    ),
    sample_submitter_id=sapply(
        sapply(gdc_results$cases, `[[`, "samples"), `[[`, "submitter_id"
    ),
    sample_type=sapply(
        sapply(gdc_results$cases, `[[`, "samples"), `[[`, "sample_type"
    ),
    sample_is_ffpe=sapply(
        sapply(gdc_results$cases, `[[`, "samples"), `[[`, "is_ffpe"
    ),
    portion_is_ffpe=sapply(
        sapply(
            sapply(
                gdc_results$cases, `[[`, "samples"
            ), `[[`, "portions"
        ), `[[`, "is_ffpe"
    ),
    aliquot_uuid=sapply(
        sapply(
            sapply(
                sapply(
                    sapply(
                        gdc_results$cases, `[[`, "samples"
                    ), `[[`, "portions"
                ), `[[`, "analytes"
            ), `[[`, "aliquots"
        ), `[[`, "aliquot_id"
    ),
    aliquot_submitter_id=sapply(
        sapply(
            sapply(
                sapply(
                    sapply(
                        gdc_results$cases, `[[`, "samples"
                    ), `[[`, "portions"
                ), `[[`, "analytes"
            ), `[[`, "aliquots"
        ), `[[`, "submitter_id"
    ),
    row.names=gdc_results$file_id,
    stringsAsFactors=FALSE
)

For single query results that cannot be easily transformed back to a data frame using the above method (due to GDC DB key relationship structure), I make multiple queries, transform them to individual data frames like above, and then do joining of the data frames to get a single one the way I need it.

Anyway, this is probably a bit challenging for the average user? Maybe there is an easier way to work with GenomicDataCommons that I've totally missed. But if not, and what I'm doing is generally a good way, maybe it's worth adding to the vignette some examples of how to make data frames from query results.

主要语言
R
星标
90
派生
25
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Bioconductor/GenomicDataCommons 的其他 Issue

查看 Bioconductor/GenomicDataCommons 的全部 Issue

相似的 Issue

更多 R Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。