Tutorial:Bulk RNA-seq: TCGA database preprocess
Entering edit mode
3 months ago
Julia Ma ▴ 120

Content copied verbatim from: https://omicverse.readthedocs.io/en/latest/Tutorials-bulk/t_tcga/

We often download patient survival data from the TCGA database for analysis in order to verify the importance of genes in cancer. However, the pre-processing of the TCGA database is often a headache. Here, we have introduced the TCGA module in ov, a way to quickly process the file formats we download from the TCGA database. We need to prepare 3 files as input:

  • gdc_sample_sheet: The Sample Sheet button of TCGA, and we can get tsv file from it
  • gdc_download_files: The Download/Cart button of TCGA, and we get tar.gz included all file you selected/
  • clinical_cart: The Clinical button of TCGA, and we can get tar.gz included all clinical of your files
import omicverse as ov
import scanpy as sc
sc.settings.verbosity = 3             # verbosity: errors (0), warnings (1), info (2), hints (3)
sc.settings.set_figure_params(dpi=80, facecolor='white')

TCGA counts read

Here, we use ov.bulk.TCGA to perform the gdc_sample_sheet, gdc_download_files and clinical_cart you download before. The raw count, fpkm and tpm matrix will be stored in anndata object


tcga module init success
...index init
... expression matrix init
...anndata construct
CPU times: user 24.7 s, sys: 2.52 s, total: 27.2 s
Wall time: 27.8 s

We can save the anndata object for the next use


Note: Each time we read the anndata file, we need to initialize the TCGA object using three paths so that the subsequent TCGA functions such as survival analysis can be used properly


tcga module init success
... anndata reading

Meta init

As the TCGA reads the gene_id, we need to convert it to gene_name as well as adding basic information about the patient. Therefore we need to initialise the patient's meta information.


...anndata meta init ['gene_name', 'gene_type'] ['Case ID', 'Sample Type']

AnnData object with n_obs × n_vars = 151 × 60664
    obs: 'Case ID', 'Sample Type'
    var: 'gene_name', 'gene_type', 'gene_id'
    layers: 'deseq_normalize', 'fpkm', 'tpm'

Survial init

We set up the path for Clinical earlier, but in fact we did not import the patient information in the previous process, we only initially determined the id of the patient's TCGA, so we attracted to initialize the clinical information


AnnData object with n_obs × n_vars = 151 × 60664
    obs: 'Case ID', 'Sample Type', 'vital_status', 'days'
    var: 'gene_name', 'gene_type', 'gene_id'
    layers: 'deseq_normalize', 'fpkm', 'tpm'

To visualize the gene you interested, we can use survival_analysis to finish it.



enter image description here

If you want to calculate the survival of all genes, you can also use the survial_analysis_all to finish it. It may calculate a lot of times.


Don't forget to save your result.

RNA-seq • 235 views

Login before adding your answer.

Traffic: 1329 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6