SRR_2_GSM: Convert SRR identifiers to GSM identifiers (GEO)

View source: R/functions_expr_data.R

SRR_2_GSMR Documentation

Convert SRR identifiers to GSM identifiers (GEO)

Description

Maps SRR identifiers to GSM identifiers using information from the SRA ftp server (see Details). Note that this function assumes that the command line tool grep has been installed to extract relevant information for the study.

Usage

SRR_2_GSM(counts, global.mapping.file, study.mapping.file)

Arguments

counts

[data.frame or matrix] raw counts with genes in rows and samples in columns

global.mapping.file

[character(1)] path to local copy of SRA_Accessions.tab

study.mapping.file

[character(1)] name of file to save study specific mapping information

Details

The global.mapping.file SRA_Accessions.tab has to be downloaded from https://ftp.ncbi.nlm.nih.gov/sra/reports/Metadata/SRA_Accessions.tab If study.mapping.file exists, it will be loaded without repeating the extraction process.

Value

[data.frame or matrix] raw counts with colnames replaced by GSM identifiers

Examples

## Not run: 
# define temporary directory for storing file from recount
temp.dir = tempdir()

# get counts from recount
library(recount)
recount::download_study(
  project = "SRP057087",
  type = "counts-gene",
  outdir = temp.dir)
counts = read.table(
  file.path(temp.dir, "counts_gene.tsv.gz"),
  header = TRUE,
  row.names = 29)

# mapping
counts.new = SRR_2_GSM(
  counts = counts,
  global.mapping.file = system.file(
    "extdata",
    "SRA_Accessions_example.tab",
    package = "harmonizeGeneExprData"),
  study.mapping.file = file.path(temp.dir, "mapping.rds"))
  
## End(Not run)

szymczak-lab/harmonizeGeneExprData documentation built on Dec. 1, 2022, 9:07 p.m.