iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🐥

[WSL] [Bioinformatics] Downloading Data from GDC Using the GDC Data Transfer Tool

に公開
2023/06/29
What is GDC? (From ChatGPT)

The Genomic Data Commons (GDC) is a platform designed to facilitate the sharing and access of cancer genomic data. Operated by the National Cancer Institute (NCI), the GDC makes cancer genomic data accessible to a wide range of users, including cancer researchers, clinicians, and bioinformatics researchers.

The GDC provides functions for the collection, integration, storage, analysis, and distribution of cancer genomic data. Specifically, it collects genomic data from cancer patients along with related clinical and trial data, integrating them into a unified format for storage. It also provides tools and pipelines for bioinformatics analysis, supporting users in effectively analyzing the data.

The main objective of the GDC is to accelerate progress in cancer research through the sharing and reuse of cancer genomic data. Researchers and physicians can obtain datasets from the GDC to gain new insights for research and treatment. Furthermore, the GDC works on the standardization and quality control of cancer genomic data to ensure the reliability and quality of the data.

The GDC's datasets include data related to various cancer types and stages, aggregating data from various research projects such as the TCGA (The Cancer Genome Atlas) project. This allows users to access a diverse range of cancer genomic data, which can be useful for their own research and the development of treatment strategies.

The GDC is based on the principles of open access, allowing anyone to register as a user and access cancer genomic data.

While many items, such as processed RNA-seq data and virtual slide data, can be obtained via Open Access, downloading them through a browser can be unstable due to their large file sizes.
This article introduces the GDC Data Transfer Tool, which is used to download data via the command line.

Download the version for Ubuntu from the GDC Data Transfer Tool Client at the bottom of the GDC Data Transfer Tool page.

I placed it in the WSL home directory for easy access.

Installation

  1. Extracting the installer
unzip gdc-client_v1.6.1_Ubuntu_x64.zip

Once extraction is complete, a single file named gdc-client will be created.

  1. Setting the PATH
    There are several ways to make the gdc-client in your home directory recognizable by WSL, such as adding the home directory to your PATH or moving the file to a directory that is already in your PATH.
    Here, I decided to create a Tools folder, move gdc-client into it, and add the Tools folder to my permanent PATH.
# Create folder
mkdir Tools

# Move file
mv gdc-client Tools/

# Set PATH
echo 'export PATH=~/Tools:$PATH' >> .profile

Check if gdc-client is recognized as shown below.

# Re-execute .profile (or you can restart Ubuntu)
. .profile

# List current PATHs
echo $PATH

# Verify the path of gdc-client
which gdc-client

Usage

The user guide can be found here:
https://docs.gdc.cancer.gov/Data_Transfer_Tool/Users_Guide/Getting_Started/

Specify either a manifest file or a file ID after gdc-client download.


https://docs.gdc.cancer.gov/Data_Transfer_Tool/Users_Guide/Data_Download_and_Upload/



Use the -m option to specify the path to the manifest file and the -d option to specify the destination directory.
If you have access permissions for controlled-access files, you can specify a TOKEN file using the -t option.

Help for gdc-client download
gdc-client download --help
usage: gdc-client download [-h] [--debug] [--log-file LOG_FILE] [--color_off]
                           [-t TOKEN_FILE] [-d DIR] [-s server]
                           [--no-segment-md5sums] [--no-file-md5sum]
                           [-n N_PROCESSES]
                           [--http-chunk-size HTTP_CHUNK_SIZE]
                           [--save-interval SAVE_INTERVAL] [-k]
                           [--no-related-files] [--no-annotations]
                           [--no-auto-retry] [--retry-amount RETRY_AMOUNT]
                           [--wait-time WAIT_TIME] [--latest] [--config FILE]
                           [-m MANIFEST]
                           [file_id [file_id ...]]

positional arguments:
  file_id               The GDC UUID of the file(s) to download

optional arguments:
  -h, --help            show this help message and exit
  --debug               Enable debug logging. If a failure occurs, the program
                        will stop.
  --log-file LOG_FILE   Save logs to file. Amount logged affected by --debug
  --color_off           Disable colored output
  -t TOKEN_FILE, --token-file TOKEN_FILE
                        GDC API auth token file
  -d DIR, --dir DIR     Directory to download files to. Defaults to current
                        directory
  -s server, --server server
                        The TCP server address server[:port]
  --no-segment-md5sums  Do not calculate inbound segment md5sums and/or do not
                        verify md5sums on restart
  --no-file-md5sum      Do not verify file md5sum after download
  -n N_PROCESSES, --n-processes N_PROCESSES
                        Number of client connections.
  --http-chunk-size HTTP_CHUNK_SIZE, -c HTTP_CHUNK_SIZE
                        Size in bytes of standard HTTP block size.
  --save-interval SAVE_INTERVAL
                        The number of chunks after which to flush state file.
                        A lower save interval will result in more frequent
                        printout but lower performance.
  -k, --no-verify       Perform insecure SSL connection and transfer
  --no-related-files    Do not download related files.
  --no-annotations      Do not download annotations.
  --no-auto-retry       Ask before retrying to download a file
  --retry-amount RETRY_AMOUNT
                        Number of times to retry a download
  --wait-time WAIT_TIME
                        Amount of seconds to wait before retrying
  --latest              Download latest version of a file if it exists
  --config FILE         Path to INI-type config file
  -m MANIFEST, --manifest MANIFEST
                        GDC download manifest file


Preparing the Manifest File

Obtain the manifest containing the file information you want to download from the GDC Data Portal.
https://portal.gdc.cancer.gov/


Repository

From the Cases and Files tabs on the Repository page, filter the results to include only the files you want by selecting the appropriate criteria.
Here, we obtain 1,231 RNA-seq data files using the following criteria:

Cases:
	Program:
		TCGA
	Project:
		TCGA-BRCA
		
Files:
	Experimental Strategy:
		STAR-count
	Access:
		Open


After filtering files from the Repository

Download the manifest file using the Manifest button on the right side of the screen.

A manifest is a text file that contains file names, file IDs, and other information.

Manifest.txt


Download

Execute the download using the manifest file.

# Create output folder
mkdir TCGA-BRCA

# Download
gdc-client download -d TCGA-BRCA -m gdc_manifest.2023-06-28.txt

The download starts as follows. Downloads are executed case by case.

Immediately after starting

There were cases where errors occurred, but it was stated that the annotation files could not be downloaded, while the expression matrices themselves were downloaded. (Since I don't specifically use annotation files, it might be a good idea to include the --no-annotations option.)

Max retries exceeded

Some cases encountered the "Max retries exceeded" error.

According to the Troubleshooting page, the connection is timing out.


There is a folder for each Case, containing the target file (in this case, the expression matrix).

Downloaded folders


Contents of one folder

Looking at the expression matrix for one sample, there were 6 header lines, containing gene IDs/gene names, count values/TPM values/FPKM values, etc.

Expression matrix


Converting File IDs to Sample IDs

The names of the downloaded files and folders are assigned long IDs, and they do not include Sample ID (Patient ID) information.
To convert these lengthy file names into Sample IDs, a Sample sheet file is required. This can also be obtained from the GDC Data Portal.

Steps

  1. Add all the filtered files from the Repository screen to the Cart at once. Select Add All Files to Cart.

  2. The number of files will be displayed in the Cart section at the top right.

  3. Click on the Cart to navigate to the page for managing files within the Cart.

  4. Click Sample Sheet in the middle right of the screen to download it.

By the way, you can also download the Manifest file from the Cart screen.


Sample sheet

In the Sample sheet, the File ID column contains the folder names, and the File Name column contains the filenames. Since there is also a Sample ID column, you can use this as a mapping table for conversion.

Discussion