### Install UCSCXenaTools with Vignettes Source: https://github.com/ropensci/ucscxenatools/blob/master/README.md Installs the development version of the UCSCXenaTools package from GitHub, including building vignettes. This option also installs all necessary dependencies. ```r remotes::install_github("ropensci/UCSCXenaTools", build_vignettes = TRUE, dependencies = TRUE) ``` -------------------------------- ### Install UCSCXenaTools Development Version Source: https://github.com/ropensci/ucscxenatools/blob/master/README.md Installs the development version of the UCSCXenaTools package directly from GitHub. This is useful for accessing the latest features or bug fixes. ```r # install.packages("remotes") remotes::install_github("ropensci/UCSCXenaTools") ``` -------------------------------- ### Install UCSCXenaTools from CRAN Source: https://github.com/ropensci/ucscxenatools/blob/master/README.md Installs the stable release of the UCSCXenaTools package from the r-universe/CRAN repository. Ensure you have the necessary repositories configured. ```r install.packages('UCSCXenaTools', repos = c('https://ropensci.r-universe.dev', 'https://cloud.r-project.org')) ``` -------------------------------- ### Get available TCGA File Types Source: https://context7.com/ropensci/ucscxenatools/llms.txt Call availTCGA("FileType") to see the various file formats in which TCGA data is stored. This is important for selecting the correct format for downstream analysis. ```r # Get all available file types availTCGA("FileType") ``` -------------------------------- ### Get available TCGA Project IDs Source: https://context7.com/ropensci/ucscxenatools/llms.txt Use availTCGA("ProjectID") to retrieve a list of all available TCGA project identifiers. This helps in identifying which cancer projects are available in the TCGA dataset. ```r library(UCSCXenaTools) # Get all available project IDs availTCGA("ProjectID") #> [1] "LAML" "ACC" "CHOL" "BLCA" "BRCA" "CESC" "COADREAD" "COAD" "UCEC" #> [10] "ESCA" "FPPP" "GBM" "HNSC" "KICH" "KIRC" "KIRP" "DLBC" "LIHC" #> ... ``` -------------------------------- ### Get available TCGA Data Types Source: https://context7.com/ropensci/ucscxenatools/llms.txt Use availTCGA("DataType") to list all the different types of data available for TCGA projects, such as gene expression or copy number variations. This is useful for understanding the omics data available. ```r # Get all available data types availTCGA("DataType") #> [1] "Gene Level Copy Number" "Copy Number Segments" "DNA Methylation" #> [4] "Exon Expression RNASeq" "Gene Expression Array" "Gene Expression RNASeq" #> ... ``` -------------------------------- ### Load Data into R with XenaPrepare Source: https://context7.com/ropensci/ucscxenatools/llms.txt Loads downloaded datasets into R as tibbles. Can accept output from XenaDownload, file paths, directories, or URLs. Supports chunked reading for large files and subsetting rows. ```r library(UCSCXenaTools) # Complete workflow ending with data preparation XenaGenerate(subset = XenaHostNames == "tcgaHub") %>% XenaFilter(filterDatasets = "clinical") %>% XenaFilter(filterDatasets = "LUAD|LUSC|LUNG") %>% XenaQuery() %>% XenaDownload() -> xe_download # Load downloaded data into R cli <- XenaPrepare(xe_download) class(cli) #> [1] "list" names(cli) #> [1] "LUNG_clinicalMatrix" "LUAD_clinicalMatrix" "LUSC_clinicalMatrix" ``` ```r # Load from local file paths cli_data <- XenaPrepare("/path/to/downloaded/file.tsv") ``` ```r # Load from directory cli_data <- XenaPrepare("/path/to/download/directory/") ``` ```r # Load with chunked reading for large files cli_large <- XenaPrepare( xe_download, use_chunk = TRUE, chunk_size = 1000, select_cols = colnames(x)[1:5] ) ``` ```r # Subset rows while loading cli_subset <- XenaPrepare( xe_download, use_chunk = TRUE, subset_rows = sample == "TCGA-02-0047-01" ) ``` -------------------------------- ### Query and Download Selected Datasets Source: https://github.com/ropensci/ucscxenatools/blob/master/README.md Query the selected datasets from the XenaHub object and then initiate the download of these datasets. The process includes checks for URL status and specifies the directory for downloaded files. ```r XenaQuery(df_todo) %>% XenaDownload() -> xe_download #> This will check url status, please be patient. #> All downloaded files will under directory /var/folders/h0/s_35svc15n1glmp65lbbkx9w0000gn/T//RtmpmgBjSb. #> The 'trans_slash' option is FALSE, keep same directory structure as Xena. #> Creating directories for datasets... #> Downloading TCGA.LUNG.sampleMap/LUNG_clinicalMatrix #> Downloading TCGA.LUAD.sampleMap/LUAD_clinicalMatrix #> Downloading TCGA.LUSC.sampleMap/LUSC_clinicalMatrix ``` -------------------------------- ### Prepare Downloaded Data for Analysis Source: https://github.com/ropensci/ucscxenatools/blob/master/README.md Prepare the downloaded Xena data into an R list format suitable for analysis. This function processes the downloaded files and returns a list where each element corresponds to a dataset. ```r cli = XenaPrepare(xe_download) class(cli) #> [1] "list" names(cli) #> [1] "LUNG_clinicalMatrix" "LUAD_clinicalMatrix" "LUSC_clinicalMatrix" ``` -------------------------------- ### availTCGA - List Available TCGA Data Options Source: https://context7.com/ropensci/ucscxenatools/llms.txt Lists available TCGA project IDs, data types, and file types. ```APIDOC ## availTCGA - List Available TCGA Data Options ### Description Lists available TCGA project IDs, data types, and file types. ### Method GET ### Endpoint /api/v1/availTCGA ### Parameters #### Query Parameters - **category** (string) - Optional - The category to list ('all', 'ProjectID', 'DataType', 'FileType'). Defaults to 'all'. ### Response #### Success Response (200) - **options** (object) - An object containing lists of available TCGA options. #### Response Example ```json { "ProjectID": ["LAML", "ACC", "CHOL", ...], "DataType": ["Gene Level Copy Number", "Copy Number Segments", ...], "FileType": ["Gistic2", "Gistic2 thresholded", ...] } ``` ``` -------------------------------- ### Show TCGA data structure for all projects Source: https://context7.com/ropensci/ucscxenatools/llms.txt Execute showTCGA("all") to view the data structure, including data types and file types, for all available TCGA projects. This provides a comprehensive overview of the TCGA data landscape. ```r # Show all projects showTCGA("all") ``` -------------------------------- ### XenaHub - Direct Hub Access Source: https://context7.com/ropensci/ucscxenatools/llms.txt Creates a XenaHub object by directly querying UCSC Xena hosts. Useful for real-time data access. ```APIDOC ## XenaHub - Direct Hub Access ### Description Creates a XenaHub object by directly querying UCSC Xena hosts. This is useful when you need real-time data from the hubs rather than using the built-in XenaData. ### Method GET ### Endpoint /api/v1/XenaHub ### Parameters #### Query Parameters - **hostName** (string) - Optional - The name or URL of the Xena hub to connect to. - **cohorts** (string or array of strings) - Optional - Specifies the cohorts to retrieve. - **datasets** (string or array of strings) - Optional - Specifies the datasets to retrieve. ### Request Example ```json { "hostName": "tcgaHub", "cohorts": "Cancer Cell Line Encyclopedia (CCLE)" } ``` ### Response #### Success Response (200) - **XenaHub object** - An object representing the Xena hub connection, with methods to access hosts, cohorts, datasets, and samples. #### Response Example (Accessing hosts) ```json ["https://ucscpublic.xenahubs.net", "https://tcga.xenahubs.net"] ``` ``` -------------------------------- ### Query Dataset Download URLs Source: https://context7.com/ropensci/ucscxenatools/llms.txt Queries and checks the availability of download URLs for datasets within a XenaHub object. Returns a data frame containing hosts, datasets, and their corresponding download URLs. ```r library(UCSCXenaTools) # Create a XenaHub object and query URLs XenaGenerate(subset = XenaHostNames == "tcgaHub") %>% XenaFilter(filterDatasets = "clinical") %>% XenaFilter(filterDatasets = "LUAD") -> xe xe_query <- XenaQuery(xe) #> This will check url status, please be patient. ``` -------------------------------- ### Download Datasets with XenaDownload Source: https://context7.com/ropensci/ucscxenatools/llms.txt Downloads datasets from UCSC Xena hubs. Supports specifying destination directory, forcing re-downloads, and downloading associated ProbeMap files. ```r library(UCSCXenaTools) # Complete workflow: generate, filter, query, download XenaGenerate(subset = XenaHostNames == "tcgaHub") %>% XenaFilter(filterDatasets = "clinical") %>% XenaFilter(filterDatasets = "LUAD|LUSC") %>% XenaQuery() %>% XenaDownload(destdir = tempdir()) -> xe_download #> This will check url status, please be patient. #> All downloaded files will under directory /tmp/... #> Creating directories for datasets... #> Downloading TCGA.LUAD.sampleMap/LUAD_clinicalMatrix #> Downloading TCGA.LUSC.sampleMap/LUSC_clinicalMatrix ``` ```r # Download with ProbeMap for gene mapping XenaGenerate(subset = XenaHostNames == "tcgaHub") %>% XenaFilter(filterDatasets = "HiSeqV2$") %>% XenaFilter(filterCohorts = "LUAD") %>% XenaQuery() %>% XenaDownload(destdir = "~/xena_data/", download_probeMap = TRUE) ``` ```r # Force re-download even if files exist XenaDownload(xe_query, destdir = "~/xena_data/", force = TRUE) ``` ```r # Resume download from breakpoint using curl XenaDownload(xe_query, destdir = "~/xena_data/", method = "curl", extra = "-C - -L") ``` -------------------------------- ### Generate XenaHub Objects Source: https://context7.com/ropensci/ucscxenatools/llms.txt Creates a XenaHub object, which represents a connection to a UCSC Xena hub. Supports subsetting by host, cohort, or dataset using logical expressions. ```r library(UCSCXenaTools) # Generate a XenaHub object with all datasets xe_all <- XenaGenerate() xe_all #> class: XenaHub #> hosts(): #> https://ucscpublic.xenahubs.net #> https://tcga.xenahubs.net #> ... # Generate XenaHub for specific data hub xe_tcga <- XenaGenerate(subset = XenaHostNames == "tcgaHub") xe_tcga #> class: XenaHub #> hosts(): #> https://tcga.xenahubs.net # Generate XenaHub for specific cohort xe_brca <- XenaGenerate(subset = XenaCohorts == "TCGA Breast Cancer (BRCA)") # Generate XenaHub using pattern matching xe_lung <- XenaGenerate(subset = grepl("LUNG", XenaCohorts)) ``` -------------------------------- ### Scan XenaData for Datasets by Keyword Source: https://context7.com/ropensci/ucscxenatools/llms.txt Searches the XenaData data frame for datasets matching a specified keyword pattern. Useful for finding data when only partial information is known. Results can be converted to XenaHub objects. ```r library(UCSCXenaTools) # Scan for datasets containing "Blood" x1 <- XenaScan(pattern = "Blood") # Case-sensitive search for "LUNG" x2 <- XenaScan(pattern = "LUNG", ignore.case = FALSE) # Convert scan results to XenaHub objects x1 %>% XenaGenerate() x2 %>% XenaGenerate() # Search for specific gene or feature x_tp53 <- XenaScan(pattern = "TP53") ``` -------------------------------- ### Fetch Sparse Mutation Data Source: https://context7.com/ropensci/ucscxenatools/llms.txt Fetches mutation data from sparse datasets for specified genes and samples. Requires host, dataset, and gene identifiers. ```r library(UCSCXenaTools) # Query mutation data from CCLE host <- "https://ucscpublic.xenahubs.net" dataset <- "ccle/CCLE_DepMap_18Q2_maf_20180502" genes <- c("TP53", "KRAS", "BRAF") mutation_data <- fetch_sparse_values( host = host, dataset = dataset, genes = genes ) # Result contains mutation information per sample str(mutation_data) ``` -------------------------------- ### List of Datasets in UCSCXenaTools Source: https://github.com/ropensci/ucscxenatools/blob/master/NEWS.md This R code snippet displays a list of dataset filenames included in the UCSCXenaTools package. It is useful for understanding the available data resources. ```r [1] "TCGA_survival_data_2.txt" [2] "clinical_CellLinePolyA_21.06_2021-06-15.tsv" [3] "CellLinePolyA_21.06_hugo_log2tpm_58581genes_2021-06-15.tsv" ``` -------------------------------- ### Direct Xena Hub Access Source: https://context7.com/ropensci/ucscxenatools/llms.txt Creates a XenaHub object for direct querying of UCSC Xena hosts. Useful for real-time data access. Allows access to hosts, cohorts, datasets, and samples. ```r library(UCSCXenaTools) # Get all available hosts xena_default_hosts() #> [1] "https://ucscpublic.xenahubs.net" "https://tcga.xenahubs.net" #> [3] "https://gdc.xenahubs.net" "https://icgc.xenahubs.net" #> ... # Create XenaHub for specific host xe <- XenaHub(hostName = "tcgaHub") # Access XenaHub components hosts(xe) # Get hosts cohorts(xe) # Get cohorts datasets(xe) # Get datasets # Get samples for a cohort xe_ccle <- XenaHub(cohorts = "Cancer Cell Line Encyclopedia (CCLE)") sample_list <- samples(xe_ccle, by = "datasets", how = "each") ``` -------------------------------- ### Fetch Dataset Samples and Identifiers Source: https://context7.com/ropensci/ucscxenatools/llms.txt Retrieve sample IDs and identifiers (probes/genes) from a dataset without downloading the full data. Supports limiting the number of results. ```r library(UCSCXenaTools) host <- "https://toil.xenahubs.net" dataset <- "tcga_RSEM_gene_tpm" # Get all sample IDs from a dataset all_samples <- fetch_dataset_samples(host, dataset) length(all_samples) #> [1] 10535 # Get first 10 samples sample_subset <- fetch_dataset_samples(host, dataset, limit = 10) ``` ```r # Get all identifiers (probes/genes) from a dataset all_identifiers <- fetch_dataset_identifiers(host, dataset) length(all_identifiers) #> [1] 60498 head(all_identifiers) #> [1] "ENSG00000000003.14" "ENSG00000000005.5" "ENSG00000000419.12" ``` -------------------------------- ### Open Dataset or Cohort in Xena Browser Source: https://context7.com/ropensci/ucscxenatools/llms.txt Opens the UCSC Xena web page for a specific dataset or cohort in the default browser. Can open single or multiple datasets/cohorts. ```r library(UCSCXenaTools) # Create a XenaHub object with single dataset XenaGenerate(subset = XenaHostNames == "tcgaHub") %>% XenaFilter(filterDatasets = "clinical") %>% XenaFilter(filterDatasets = "LUAD") -> to_browse # Open dataset page in browser XenaBrowse(to_browse) # Open cohort page in browser XenaBrowse(to_browse, type = "cohort") # Browse multiple datasets XenaGenerate(subset = XenaHostNames == "tcgaHub") %>% XenaFilter(filterDatasets = "clinical") %>% XenaFilter(filterDatasets = "LUAD|LUSC") -> to_browse_multi XenaBrowse(to_browse_multi, multiple = TRUE) ``` -------------------------------- ### showTCGA - Show TCGA Data Information Source: https://context7.com/ropensci/ucscxenatools/llms.txt Shows available data types and file types for a given TCGA project. ```APIDOC ## showTCGA - Show TCGA Data Information ### Description Shows available data types and file types for a given TCGA project. ### Method GET ### Endpoint /api/v1/showTCGA ### Parameters #### Query Parameters - **project** (string) - Required - The TCGA project ID (e.g., "LUAD"). ### Response #### Success Response (200) - **data_info** (table) - A table listing the available Data Types and File Types for the specified project. #### Response Example ```json [ { "ProjectID": "LUAD", "DataType": "Gene Level Copy Number", "FileType": "Gistic2" }, { "ProjectID": "LUAD", "DataType": "Gene Level Copy Number", "FileType": "Gistic2 thresholded" } ] ``` ``` -------------------------------- ### Load and Inspect XenaData Source: https://github.com/ropensci/ucscxenatools/blob/master/README.md Load the XenaData data frame from the UCSCXenaTools package and display the first few rows to understand its structure and content. This data frame contains information about datasets available in UCSC Xena Hubs. ```r library(UCSCXenaTools) # ========================================================================================= # UCSCXenaTools version 1.6.0 # Project URL: https://github.com/ropensci/UCSCXenaTools # Usages: https://cran.r-project.org/web/packages/UCSCXenaTools/vignettes/USCSXenaTools.html # # If you use it in published research, please cite: # 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 # ========================================================================================= # --Enjoy it-- data(XenaData) head(XenaData) # # A tibble: 6 × 17 # XenaHosts XenaHostNames XenaCohorts XenaDatasets SampleCount DataSubtype Label # # 1 https://… publicHub Breast Can… ucsfNeve_pu… 51 gene expre… Neve… # 2 https://… publicHub Breast Can… ucsfNeve_pu… 57 phenotype Phen… # 3 https://… publicHub Glioma (Ko… kotliarov20… 194 copy number Kotl… # 4 https://… publicHub Glioma (Ko… kotliarov20… 194 phenotype Phen… # 5 https://… publicHub Lung Cance… weir2007_pu… 383 copy number CGH # 6 https://… publicHub Lung Cance… weir2007_pu… 383 phenotype Phen… # # ℹ 10 more variables: Type , AnatomicalOrigin , SampleType , # # Tags , ProbeMap , LongTitle , Citation , Version , # # Unit , Platform ``` -------------------------------- ### Load and Explore XenaData Metadata Source: https://context7.com/ropensci/ucscxenatools/llms.txt Loads the built-in XenaData data frame containing metadata for all available datasets. Use `head()` to view the first few rows and `colnames()` to check available columns. ```r library(UCSCXenaTools) # Load the built-in dataset information data(XenaData) # Explore the structure head(XenaData) #> # A tibble: 6 x 17 #> XenaHosts XenaHostNames XenaCohorts XenaDatasets SampleCount DataSubtype Label #> #> 1 https://... publicHub Breast Can... ucsfNeve_pu... 51 gene expre... Neve... #> 2 https://... publicHub Breast Can... ucsfNeve_pu... 57 phenotype Phen... # Check available columns colnames(XenaData) #> [1] "XenaHosts" "XenaHostNames" "XenaCohorts" "XenaDatasets" "SampleCount" #> [6] "DataSubtype" "Label" "Type" "AnatomicalOrigin" "SampleType" #> [11] "Tags" "ProbeMap" "LongTitle" "Citation" "Version" "Unit" "Platform" ``` -------------------------------- ### fetch_sparse_values - Query Mutation Data Source: https://context7.com/ropensci/ucscxenatools/llms.txt Fetches mutation data from sparse datasets for specified genes and samples. ```APIDOC ## fetch_sparse_values - Query Mutation Data ### Description Fetches mutation data from sparse datasets for specified genes and samples. ### Method POST ### Endpoint /api/v1/fetchSparseValues ### Parameters #### Query Parameters - **host** (string) - Required - The base URL of the Xena hub. - **dataset** (string) - Required - The identifier of the dataset. - **genes** (array of strings) - Required - A list of gene symbols to query. ### Request Example ```json { "host": "https://ucscpublic.xenahubs.net", "dataset": "ccle/CCLE_DepMap_18Q2_maf_20180502", "genes": ["TP53", "KRAS", "BRAF"] } ``` ### Response #### Success Response (200) - **mutation_data** (object) - An object containing mutation information per sample. #### Response Example ```json { "sample1": { "TP53": "Mutated", "KRAS": "Wildtype", "BRAF": "Mutated" }, "sample2": { "TP53": "Wildtype", "KRAS": "Mutated", "BRAF": "Wildtype" } } ``` ``` -------------------------------- ### Show TCGA data structure for a specific project Source: https://context7.com/ropensci/ucscxenatools/llms.txt Use showTCGA("ProjectID") to display the available data types and file types for a particular TCGA project. Replace 'BRCA' with the desired project ID. ```r # Show data structure for specific projects showTCGA("BRCA") #> ProjectID DataType FileType #> 1 BRCA Gene Level Copy Number Gistic2 #> 2 BRCA Gene Level Copy Number Gistic2 thresholded #> 3 BRCA Copy Number Segments Before remove germline cnv #> ... ``` -------------------------------- ### downloadTCGA - Direct TCGA Download Source: https://context7.com/ropensci/ucscxenatools/llms.txt Provides direct download of TCGA data by specifying project, data type, and file type explicitly. ```APIDOC ## downloadTCGA - Direct TCGA Download ### Description Provides direct download of TCGA data by specifying project, data type, and file type explicitly. ### Method GET ### Endpoint /api/v1/downloadTCGA ### Parameters #### Query Parameters - **project** (string) - Required - The TCGA project ID (e.g., "UVM"). - **data_type** (string) - Required - The type of data to download (e.g., "Gene Expression RNASeq"). - **file_type** (string) - Required - The file type of the data (e.g., "IlluminaHiSeq RNASeqV2"). - **destdir** (string) - Optional - The destination directory for downloaded files. ### Request Example ```json { "project": "UVM", "data_type": "Gene Expression RNASeq", "file_type": "IlluminaHiSeq RNASeqV2", "destdir": "~/tcga_data/" } ``` ``` -------------------------------- ### getTCGAdata - Simplified TCGA Download Source: https://context7.com/ropensci/ucscxenatools/llms.txt Provides a simplified interface for downloading common TCGA datasets by project ID and data type. ```APIDOC ## getTCGAdata - Simplified TCGA Download ### Description Provides a simplified interface for downloading common TCGA datasets by project ID and data type, similar to RTCGAToolbox's getFirehoseData. ### Method GET ### Endpoint /api/v1/getTCGAdata ### Parameters #### Query Parameters - **project** (string or array of strings) - Required - The TCGA project ID(s) (e.g., "LUAD"). - **clinical** (boolean) - Optional - Whether to download clinical data. - **mRNASeq** (boolean) - Optional - Whether to download mRNASeq data. - **mRNASeqType** (string or array of strings) - Optional - Type(s) of mRNASeq data to download (e.g., "normalized"). - **Methylation** (boolean) - Optional - Whether to download methylation data. - **MethylationType** (string) - Optional - Type of methylation data to download (e.g., "450K"). - **GeneMutation** (boolean) - Optional - Whether to download gene mutation data. - **RPPAArray** (boolean) - Optional - Whether to download RPPA array data. - **download** (boolean) - Optional - If TRUE, downloads the data. Defaults to FALSE. - **destdir** (string) - Optional - The destination directory for downloaded files. ### Request Example ```json { "project": "LUAD", "clinical": true, "mRNASeq": true, "mRNASeqType": "normalized", "GeneMutation": true, "download": false } ``` ### Response #### Success Response (200) - **tcga_info** (object) - An object containing information about the TCGA data, including XenaHub object and DataInfo. #### Response Example ```json { "Xena": { ... }, "DataInfo": [ ... ] } ``` ``` -------------------------------- ### XenaBrowse - Open Dataset in Web Browser Source: https://context7.com/ropensci/ucscxenatools/llms.txt Opens the UCSC Xena web page for a specific dataset or cohort in your default browser. ```APIDOC ## XenaBrowse - Open Dataset in Web Browser ### Description Opens the UCSC Xena web page for a specific dataset or cohort in your default browser. ### Method GET ### Endpoint /api/v1/XenaBrowse ### Parameters #### Query Parameters - **data** (object) - Required - A XenaHub object or a list of datasets to browse. - **type** (string) - Optional - The type of page to open ('dataset' or 'cohort'). Defaults to 'dataset'. - **multiple** (boolean) - Optional - If TRUE, allows browsing multiple datasets. Defaults to FALSE. ### Request Example ```json { "data": { "host": "https://tcga.xenahubs.net", "datasets": ["clinical", "LUAD"] }, "type": "dataset", "multiple": false } ``` ``` -------------------------------- ### Update Xena Dataset Information Source: https://context7.com/ropensci/ucscxenatools/llms.txt Retrieves the latest dataset information from UCSC Xena hubs. Can optionally save this information locally. Use `saveTolocal = FALSE` to only retrieve. ```r library(UCSCXenaTools) # Update dataset information (not saved locally) new_data <- XenaDataUpdate(saveTolocal = FALSE) #> => Obtaining info from UCSC Xena hubs... #> ==> Searching cohorts for host https://ucscpublic.xenahubs.net... #> ===> #XX cohorts found. #> ... #> => Done. # Update and save to package data directory (requires write permission) XenaDataUpdate(saveTolocal = TRUE) ``` -------------------------------- ### Direct TCGA Data Download Source: https://context7.com/ropensci/ucscxenatools/llms.txt Provides direct download of TCGA data by specifying project, data type, and file type explicitly. Includes functions to check available options and existing data for a project. ```r library(UCSCXenaTools) # Check available options availTCGA("all") #> $ProjectID #> [1] "LAML" "ACC" "CHOL" "BLCA" "BRCA" ... #> $DataType #> [1] "Gene Level Copy Number" "Copy Number Segments" ... #> $FileType #> [1] "Gistic2" "Gistic2 thresholded" ... # Download specific data type downloadTCGA( project = "UVM", data_type = "Gene Expression RNASeq", file_type = "IlluminaHiSeq RNASeqV2", destdir = "~/tcga_data/" ) # Check what data exists for a project showTCGA("LUAD") #> ProjectID DataType FileType #> 1 LUAD Gene Level Copy Number Gistic2 #> 2 LUAD Gene Level Copy Number Gistic2 thresholded #> ... ``` -------------------------------- ### Simplified TCGA Data Download Source: https://context7.com/ropensci/ucscxenatools/llms.txt Provides a simplified interface for downloading common TCGA datasets by project ID and data type. Can fetch data information without downloading. Supports multiple RNA-seq normalizations. ```r library(UCSCXenaTools) # Get data information without downloading tcga_info <- getTCGAdata( project = "LUAD", clinical = TRUE, mRNASeq = TRUE, mRNASeqType = "normalized", Methylation = TRUE, MethylationType = "450K", GeneMutation = TRUE, download = FALSE ) # View the XenaHub object and data info tcga_info$Xena tcga_info$DataInfo # Download TCGA data for multiple projects getTCGAdata( project = c("LUAD", "LUSC"), clinical = TRUE, mRNASeq = TRUE, RPPAArray = TRUE, GeneMutation = TRUE, download = TRUE, destdir = "~/tcga_data/" ) # Download with all RNA-seq normalizations getTCGAdata( project = "GBM", mRNASeq = TRUE, mRNASeqType = c("normalized", "pancan normalized", "percentile"), download = TRUE ) ``` -------------------------------- ### XenaDataUpdate - Update Dataset Information Source: https://context7.com/ropensci/ucscxenatools/llms.txt Retrieves the latest dataset information from all UCSC Xena hubs and optionally saves it locally. ```APIDOC ## XenaDataUpdate - Update Dataset Information ### Description Retrieves the latest dataset information from all UCSC Xena hubs and optionally saves it locally. ### Method GET ### Endpoint /api/v1/XenaDataUpdate ### Parameters #### Query Parameters - **saveTolocal** (boolean) - Optional - If TRUE, saves the updated dataset information locally. Defaults to FALSE. ### Response #### Success Response (200) - **new_data** (object) - An object containing the latest dataset information from Xena hubs. #### Response Example ```json { "host1": { "cohort1": { "dataset1": { ... }, "dataset2": { ... } } } } ``` ``` -------------------------------- ### Filter XenaHub Datasets Source: https://context7.com/ropensci/ucscxenatools/llms.txt Filters a XenaHub object to select specific cohorts or datasets using regular expressions. Multiple filters can be chained using the pipe operator. ```r library(UCSCXenaTools) # Filter TCGA hub for clinical datasets xe <- XenaGenerate(subset = XenaHostNames == "tcgaHub") # Filter for clinical data xe_clinical <- XenaFilter(xe, filterDatasets = "clinical") datasets(xe_clinical) # Chain multiple filters - get clinical data for specific cancer types XenaGenerate(subset = XenaHostNames == "tcgaHub") %>% XenaFilter(filterDatasets = "clinical") %>% XenaFilter(filterDatasets = "LUAD|LUSC|LUNG") -> df_todo df_todo #> class: XenaHub #> hosts(): #> https://tcga.xenahubs.net #> cohorts() (3 total): #> TCGA Lung Cancer (LUNG) #> TCGA Lung Adenocarcinoma (LUAD) #> TCGA Lung Squamous Cell Carcinoma (LUSC) #> datasets() (3 total): #> TCGA.LUNG.sampleMap/LUNG_clinicalMatrix #> TCGA.LUAD.sampleMap/LUAD_clinicalMatrix #> TCGA.LUSC.sampleMap/LUSC_clinicalMatrix ``` -------------------------------- ### Filter Datasets for Specific Hubs and Types Source: https://github.com/ropensci/ucscxenatools/blob/master/README.md Select datasets from the 'tcgaHub' by filtering for 'clinical' data and then further refining the selection to include datasets related to 'LUAD', 'LUSC', or 'LUNG'. This demonstrates the use of regular expressions for flexible filtering. ```r # The options in XenaFilter function support Regular Expression XenaGenerate(subset = XenaHostNames=="tcgaHub") %>% XenaFilter(filterDatasets = "clinical") %>% XenaFilter(filterDatasets = "LUAD|LUSC|LUNG") -> df_todo df_todo #> class: XenaHub #> hosts(): #> https://tcga.xenahubs.net #> cohorts() (3 total): #> TCGA Lung Cancer (LUNG) #> TCGA Lung Adenocarcinoma (LUAD) #> TCGA Lung Squamous Cell Carcinoma (LUSC) #> datasets() (3 total): #> TCGA.LUNG.sampleMap/LUNG_clinicalMatrix #> TCGA.LUAD.sampleMap/LUAD_clinicalMatrix #> TCGA.LUSC.sampleMap/LUSC_clinicalMatrix ``` -------------------------------- ### Query Gene Expression Values with fetch_dense_values Source: https://context7.com/ropensci/ucscxenatools/llms.txt Fetches expression values for specific genes and samples directly from UCSC Xena without downloading entire datasets. Supports gene symbol queries via ProbeMap. ```r library(UCSCXenaTools) # Define host and dataset host <- "https://toil.xenahubs.net" dataset <- "tcga_RSEM_gene_tpm" # Define samples and genes samples <- c("TCGA-02-0047-01", "TCGA-02-0055-01", "TCGA-02-2483-01", "TCGA-02-2485-01") probes <- c("ENSG00000282740.1", "ENSG00000000005.5", "ENSG00000000419.12") genes <- c("TP53", "RB1", "PIK3CA") # Fetch by probe IDs expr_matrix <- fetch_dense_values( host = host, dataset = dataset, identifiers = probes, samples = samples, check = FALSE ) ``` ```r # Fetch by gene symbols using ProbeMap expr_genes <- fetch_dense_values( host = host, dataset = dataset, identifiers = genes, samples = samples, check = FALSE, use_probeMap = TRUE ) #> -> Checking if the dataset has probeMap... #> -> Done. ProbeMap is found. #> -> Query done. # Result is a matrix with genes as rows and samples as columns expr_genes #> TCGA-02-0047-01 TCGA-02-0055-01 TCGA-02-2483-01 TCGA-02-2485-01 #> TP53 10.234 9.876 10.123 9.987 #> RB1 8.567 8.234 8.901 8.456 #> PIK3CA 7.890 7.654 7.321 7.789 ``` -------------------------------- ### Check for Probe Mapping in Dataset Source: https://context7.com/ropensci/ucscxenatools/llms.txt Checks if a dataset has an associated ProbeMap for converting between probe IDs and gene symbols. Can also return the ProbeMap URL. ```r library(UCSCXenaTools) host <- "https://toil.xenahubs.net" dataset <- "tcga_RSEM_gene_tpm" # Check if ProbeMap exists has_probeMap(host, dataset) #> [1] TRUE # Get the ProbeMap URL probeMap_url <- has_probeMap(host, dataset, return_url = TRUE) probeMap_url #> [1] "https://toil.xenahubs.net/download/probeMap/gencode.v23.annotation.gene.probemap" ``` -------------------------------- ### has_probeMap - Check for Probe Mapping Source: https://context7.com/ropensci/ucscxenatools/llms.txt Checks if a dataset has an associated ProbeMap for converting between probe IDs and gene symbols. ```APIDOC ## has_probeMap - Check for Probe Mapping ### Description Checks if a dataset has an associated ProbeMap for converting between probe IDs and gene symbols. ### Method GET ### Endpoint /api/v1/hasProbeMap ### Parameters #### Query Parameters - **host** (string) - Required - The base URL of the Xena hub. - **dataset** (string) - Required - The identifier of the dataset. - **return_url** (boolean) - Optional - If TRUE, returns the URL of the ProbeMap. ### Response #### Success Response (200) - **result** (boolean or string) - TRUE if ProbeMap exists, FALSE otherwise. If `return_url` is TRUE, returns the ProbeMap URL. #### Response Example (Boolean) ```json true ``` #### Response Example (URL) ```json "https://toil.xenahubs.net/download/probeMap/gencode.v23.annotation.gene.probemap" ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.