「r」Obtain RNAseq Values for a Specific Gene in Xena Database

写这篇文档的原因是有使用者问我如何获取单个基因的表达值,这个操作我其实在很久之前的生存分析示例文档中介绍过,但用户有所疑惑,说明我写的不清楚或者无法找到,所以针对性就这类问题进行介绍。

Hi Shixiang,

How can I use Xena tools to extract and compare RNAseq values for a specific gene for TCGA LUAD tumor vs. LUAD adjacent normal?

Are there instructions provided anywhere on how to specifically extract the adjacent normal data?

When using UCSCXenaTools package, you may want to focus on single gene analysis, a typical case has been shown in my previous blog UCSCXenaTools: Retrieve Gene Expression and Clinical Information from UCSC Xena for Survival Analysis. Here I will describe how to get single gene values (especially RNAseq data) in details.

Let’s load package.

library(UCSCXenaTools)

First, Find Your Interest Dataset

UCSC Xena provides more than 1000 datasets, when you want to get values for single gene, you must select a target dataset. You can find them in the following table or from UCSC Xena datasets page.

DT::datatable(UCSCXenaTools::XenaData)

此处是 1000 多行的表格,查看原文 https://shixiangwang.github.io/home/en/post/2020-07-22-ucscxenatools-single-gene/

Pick up a dataset and get its XenaHosts and XenaDatasets, i.e. get its data hub host URL and dataset ID. You can copy them or you can use your R skill to get and store them in a object. For example, I got a reader want to study RNASeq values of TCGA LUAD gene.

I can use R:

library(dplyr)
#> 
#> 载入程辑包:'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
ge <- XenaData %>%
  filter(XenaHostNames == "tcgaHub") %>% # select TCGA Hub
  XenaScan("TCGA Lung Adenocarcinoma") %>%
  filter(DataSubtype == "gene expression RNAseq", Label == "IlluminaHiSeq")
str(ge)
#> tibble [1 × 17] (S3: tbl_df/tbl/data.frame)
#>  $ XenaHosts       : chr "https://tcga.xenahubs.net"
#>  $ XenaHostNames   : chr "tcgaHub"
#>  $ XenaCohorts     : chr "TCGA Lung Adenocarcinoma (LUAD)"
#>  $ XenaDatasets    : chr "TCGA.LUAD.sampleMap/HiSeqV2"
#>  $ SampleCount     : int 576
#>  $ DataSubtype     : chr "gene expression RNAseq"
#>  $ Label           : chr "IlluminaHiSeq"
#>  $ Type            : chr "genomicMatrix"
#>  $ AnatomicalOrigin: chr "Lung"
#>  $ SampleType      : chr "tumor"
#>  $ Tags            : chr "cancer,non-small cell lung cancer"
#>  $ ProbeMap        : chr "probeMap/hugo_gencode_good_hg19_V24lift37_probemap"
#>  $ LongTitle       : chr "TCGA lung adenocarcinoma (LUAD) gene expression by RNAseq (polyA+ IlluminaHiSeq)"
#>  $ Citation        : chr NA
#>  $ Version         : chr "2017-10-13"
#>  $ Unit            : chr "log2(norm_count+1)"
#>  $ Platform        : chr "IlluminaHiSeq_RNASeqV2"

Or I just copy https://tcga.xenahubs.net and TCGA.LUAD.sampleMap/HiSeqV2.

Get Your Gene Values

Once you got dataset information, you can get a specific gene expression (it also works for gene-level CNV, mutation, etc based on your dataset) by fetch_dense_values. Run ?fetch in your R console to see more details.

For example, I will query the gene TP53.

TP53 <- fetch_dense_values(
  host = ge$XenaHosts, # You can also set "https://tcga.xenahubs.net"
  dataset = ge$XenaDatasets, # You can also set "TCGA.LUAD.sampleMap/HiSeqV2"
  identifiers = "TP53",
  use_probeMap = TRUE
) %>%
  .[1, ]
#> -> Checking identifiers...
#> -> use_probeMap is TRUE, skipping checking identifiers...
#> -> Done.
#> -> Checking samples...
#> -> Done.
#> -> Checking if the dataset has probeMap...
#> -> Done. ProbeMap is found.
head(TP53)
#> TCGA-69-7978-01 TCGA-62-8399-01 TCGA-78-7539-01 TCGA-50-5931-11 TCGA-73-4658-01 
#>            9.89            8.31           10.35            9.62           10.02 
#> TCGA-44-6775-01 
#>           10.16

Typically, the TCGA sample ID have 15 letters, and the 14-15th letters mark a sample type. When it <10, it is a tumor sample, otherwise it is a normal sample.

table(as.integer(substr(names(TP53), 14, 15)))
#> 
#>   1   2  11 
#> 515   2  59

Now you can start your analysis with this data.

Other Things May Help

In addition to fetch_* functions, I generated many low-level API functions for UCSC Xena database, which described at https://shixiangwang.github.io/home/en/tools/ucscxenatools-api/. These functions can access different levels of data information in UCSC Xena. Some of them are combined to construct the core functionalities provided by UCSCXenaTools for now.

NOTE: not API functions work well, I haven’t tested them all, they are all generated by dynamic code based on XQuery.

An R Shiny package UCSCXenaShiny provides a web-based platform to download datasets and analyze single genes. Besides, we have constructed some functions to get pan-cancer level single gene expression, CNV and mutation etc.

You can download recent development version in GitHub with:

remotes::install_github("openbiox/XenaShiny")

After you load this package, you can use the following functions to get data easily.

get_ccle_cn_value: Fetch copy number value from CCLE dataset

get_ccle_gene_value: Fetch gene expression value from CCLE dataset

get_ccle_protein_value: Fetch gene protein expression value from CCLE dataset

get_ccle_mutation_status: Fetch gene mutation info from CCLE dataset

get_pancan_value: Fetch identifier value from pan-cancer dataset

get_pancan_gene_value: Fetch gene expression value from pan-cancer dataset

get_pancan_protein_value: Fetch protein expression value from pan-cancer dataset

get_pancan_mutation_status: Fetch mutation status value from pan-cancer dataset

get_pancan_cn_value: Fetch gene copy number value from pan-cancer dataset processed by GISTIC 2.0

Any questions can be posted online at https://github.com/openbiox/UCSCXenaShiny/issues or https://github.com/ropensci/UCSCXenaTools/issues.

总结一下,除了 UCSCXenaTools 的 README,加上本文,我已经写了 4 篇介绍文档了:

References

  • Wang et al., (2019). The UCSCXenaTools R package: a toolkit for accessing genomics data from UCSC Xena platform, from cancer multi-omics to single-cell RNA-seq. Journal of Open Source Software, 4(40), 1627, https://doi.org/10.21105/joss.01627
  • Wang, S.; Xiong, Y.; Gu, K.; Zhao, L.; Li, Y.; Zhao, F.; Li, X.; Liu, X. UCSCXenaShiny: An R Package for Exploring and Analyzing UCSC Xena Public Datasets in Web Browser. Preprints 2020, 2020070179 (doi: 10.20944/preprints202007.0179.v1).
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 206,968评论 6 482
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 88,601评论 2 382
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 153,220评论 0 344
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 55,416评论 1 279
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 64,425评论 5 374
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,144评论 1 285
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,432评论 3 401
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,088评论 0 261
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 43,586评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,028评论 2 325
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,137评论 1 334
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,783评论 4 324
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,343评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,333评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,559评论 1 262
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,595评论 2 355
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,901评论 2 345