R/create_rse_manual.R
create_rse_manual.Rd
This function is used internally by create_rse()
to construct a recount3
RangedSummarizedExperiment-class
object that contains the base-pair coverage counts at the gene
or exon
feature level for a given annotation.
create_rse_manual(
project,
project_home = project_homes(organism = organism, recount3_url = recount3_url),
type = c("gene", "exon", "jxn"),
organism = c("human", "mouse"),
annotation = annotation_options(organism),
bfc = recount3_cache(),
jxn_format = c("ALL", "UNIQUE"),
recount3_url = getOption("recount3_url", "http://duffel.rail.bio/recount3"),
verbose = getOption("recount3_verbose", TRUE)
)
A character(1)
with the ID for a given study.
A character(1)
with the home directory for the
project
. You can find these using project_homes()
.
A character(1)
specifying whether you want to access gene,
exon, or exon-exon junction counts.
A character(1)
specifying which organism you want to
download data from. Supported options are "human"
or "mouse"
.
A character(1)
specifying which annotation you want to
download. Only used when type
is either gene
or exon
.
A BiocFileCache-class
object where the files will be cached to, typically created by
recount3_cache()
.
A character(1)
specifying whether the exon-exon junction
files are derived from all the reads (ALL
) or only the uniquely mapping
read counts (UNIQUE
). Note that UNIQUE
is only available for some
projects: GTEx and TCGA for human.
A character(1)
specifying the home URL for recount3
or a local directory where you have mirrored recount3
. Defaults to the
load balancer http://duffel.rail.bio/recount3, but can also be
https://recount-opendata.s3.amazonaws.com/recount3/release from
https://registry.opendata.aws/recount/ or SciServer datascope from
IDIES at JHU https://sciserver.org/public-data/recount3/data. You can
set the R option recount3_url
(for example in your .Rprofile
) if
you have a favorite mirror.
A logical(1)
indicating whether to show messages with
updates.
A RangedSummarizedExperiment-class object.
https://doi.org/10.12688/f1000research.12223.1 for details on the base-pair coverage counts used in recount2 and recount3.
Other internal functions for accessing the recount3 data:
annotation_ext()
,
file_retrieve()
,
locate_url_ann()
,
locate_url()
,
project_homes()
,
read_counts()
,
read_metadata()
## Unlike create_rse(), here we create an RSE object by
## fully specifying all the arguments for locating this study
rse_gene_SRP009615_manual <- create_rse_manual(
"SRP009615",
"data_sources/sra"
)
#> 2024-12-10 22:01:15.956605 downloading and reading the metadata.
#> 2024-12-10 22:01:16.450202 caching file sra.sra.SRP009615.MD.gz.
#> 2024-12-10 22:01:16.843767 caching file sra.recount_project.SRP009615.MD.gz.
#> 2024-12-10 22:01:17.282748 caching file sra.recount_qc.SRP009615.MD.gz.
#> 2024-12-10 22:01:17.718456 caching file sra.recount_seq_qc.SRP009615.MD.gz.
#> 2024-12-10 22:01:18.133807 caching file sra.recount_pred.SRP009615.MD.gz.
#> 2024-12-10 22:01:18.194561 downloading and reading the feature information.
#> 2024-12-10 22:01:18.57243 caching file human.gene_sums.G026.gtf.gz.
#> 2024-12-10 22:01:18.939992 downloading and reading the counts: 12 samples across 63856 features.
#> 2024-12-10 22:01:19.316672 caching file sra.gene_sums.SRP009615.G026.gz.
#> 2024-12-10 22:01:20.721078 constructing the RangedSummarizedExperiment (rse) object.
rse_gene_SRP009615_manual
#> class: RangedSummarizedExperiment
#> dim: 63856 12
#> metadata(8): time_created recount3_version ... annotation recount3_url
#> assays(1): raw_counts
#> rownames(63856): ENSG00000278704.1 ENSG00000277400.1 ...
#> ENSG00000182484.15_PAR_Y ENSG00000227159.8_PAR_Y
#> rowData names(10): source type ... havana_gene tag
#> colnames(12): SRR387777 SRR387778 ... SRR389077 SRR389078
#> colData names(175): rail_id external_id ...
#> recount_pred.curated.cell_line BigWigURL
## Check how much memory this RSE object uses
pryr::object_size(rse_gene_SRP009615_manual)
#> 24.81 MB
## Test with a collection that has a single sample
## NOTE: this requires loading the full data for this study when
## creating the RSE object
rse_gene_ERP110066_collection_manual <- create_rse_manual(
"ERP110066",
"collections/geuvadis_smartseq",
recount3_url = "http://snaptron.cs.jhu.edu/data/temp/recount3"
)
#> 2024-12-10 22:01:20.818954 downloading and reading the metadata.
#> 2024-12-10 22:01:21.366222 caching file geuvadis_smartseq.recount_project.gz.
#> 2024-12-10 22:01:21.566189 caching file sra.sra.ERP110066.MD.gz.
#> 2024-12-10 22:01:21.75569 caching file sra.recount_project.ERP110066.MD.gz.
#> 2024-12-10 22:01:21.94748 caching file sra.recount_qc.ERP110066.MD.gz.
#> Warning: The 'url' <http://snaptron.cs.jhu.edu/data/temp/recount3/human/data_sources/sra/metadata/66/ERP110066/sra.recount_seq_qc.ERP110066.MD.gz> does not exist or is not available.
#> 2024-12-10 22:01:22.28931 caching file sra.recount_pred.ERP110066.MD.gz.
#> 2024-12-10 22:01:22.482653 caching file geuvadis_smartseq.custom.gz.
#> 2024-12-10 22:01:22.670555 downloading and reading the feature information.
#> 2024-12-10 22:01:22.818949 caching file human.gene_sums.G026.gtf.gz.
#> 2024-12-10 22:01:23.168626 downloading and reading the counts: 1 sample across 63856 features.
#> 2024-12-10 22:01:23.318131 caching file sra.gene_sums.ERP110066.G026.gz.
#> 2024-12-10 22:01:24.675643 constructing the RangedSummarizedExperiment (rse) object.
rse_gene_ERP110066_collection_manual
#> class: RangedSummarizedExperiment
#> dim: 63856 1
#> metadata(8): time_created recount3_version ... annotation recount3_url
#> assays(1): raw_counts
#> rownames(63856): ENSG00000278704.1 ENSG00000277400.1 ...
#> ENSG00000182484.15_PAR_Y ENSG00000227159.8_PAR_Y
#> rowData names(10): source type ... havana_gene tag
#> colnames(1): ERR2713106
#> colData names(162): rail_id external_id ... custom.sequencing_type
#> BigWigURL
## Check how much memory this RSE object uses
pryr::object_size(rse_gene_ERP110066_collection_manual)
#> 19.16 MB
## Mouse example
rse_gene_DRP002367_manual <- create_rse_manual(
"DRP002367",
"data_sources/sra",
organism = "mouse"
)
#> 2024-12-10 22:01:24.768728 downloading and reading the metadata.
#> 2024-12-10 22:01:25.562307 caching file sra.sra.DRP002367.MD.gz.
#> 2024-12-10 22:01:25.997055 caching file sra.recount_project.DRP002367.MD.gz.
#> 2024-12-10 22:01:26.438528 caching file sra.recount_qc.DRP002367.MD.gz.
#> 2024-12-10 22:01:26.885771 caching file sra.recount_seq_qc.DRP002367.MD.gz.
#> 2024-12-10 22:01:27.320311 caching file sra.recount_pred.DRP002367.MD.gz.
#> 2024-12-10 22:01:27.387908 downloading and reading the feature information.
#> 2024-12-10 22:01:27.768896 caching file mouse.gene_sums.M023.gtf.gz.
#> 2024-12-10 22:01:28.108315 downloading and reading the counts: 4 samples across 55421 features.
#> 2024-12-10 22:01:28.473004 caching file sra.gene_sums.DRP002367.M023.gz.
#> 2024-12-10 22:01:28.588882 constructing the RangedSummarizedExperiment (rse) object.
rse_gene_DRP002367_manual
#> class: RangedSummarizedExperiment
#> dim: 55421 4
#> metadata(8): time_created recount3_version ... annotation recount3_url
#> assays(1): raw_counts
#> rownames(55421): ENSMUSG00000079800.2 ENSMUSG00000095092.1 ...
#> ENSMUSG00000096850.1 ENSMUSG00000099871.1
#> rowData names(11): source type ... havana_gene tag
#> colnames(4): DRR023307 DRR023308 DRR023309 DRR023310
#> colData names(177): rail_id external_id ...
#> recount_pred.curated.cell_line BigWigURL
## Information about how this RSE was made
metadata(rse_gene_DRP002367_manual)
#> $time_created
#> [1] "2024-12-10 22:01:28 UTC"
#>
#> $recount3_version
#> package ondiskversion loadedversion path
#> recount3 recount3 1.17.0 1.17.0 /__w/_temp/Library/recount3
#> loadedpath attached is_base date source
#> recount3 /__w/_temp/Library/recount3 TRUE FALSE 2024-12-10 Bioconductor
#> md5ok library
#> recount3 NA /__w/_temp/Library
#>
#> $project
#> [1] "DRP002367"
#>
#> $project_home
#> [1] "data_sources/sra"
#>
#> $type
#> [1] "gene"
#>
#> $organism
#> [1] "mouse"
#>
#> $annotation
#> [1] "gencode_v23"
#>
#> $recount3_url
#> [1] "http://duffel.rail.bio/recount3"
#>
## Test with a collection that has one sample, at the exon level
## NOTE: this requires loading the full data for this study (nearly 6GB!)
if (FALSE) { # \dontrun{
rse_exon_ERP110066_collection_manual <- create_rse_manual(
"ERP110066",
"collections/geuvadis_smartseq",
type = "exon",
recount3_url = "http://snaptron.cs.jhu.edu/data/temp/recount3"
)
rse_exon_ERP110066_collection_manual
## Check how much memory this RSE object uses
pryr::object_size(rse_exon_ERP110066_collection_manual)
# 409 MB
## Test with a collection that has one sample, at the junction level
## NOTE: this requires loading the full data for this study
system.time(rse_jxn_ERP110066_collection_manual <- create_rse_manual(
"ERP110066",
"collections/geuvadis_smartseq",
type = "jxn",
recount3_url = "http://snaptron.cs.jhu.edu/data/temp/recount3"
))
rse_jxn_ERP110066_collection_manual
## Check how much memory this RSE object uses
## NOTE: this doesn't run since 2 files are missing on the test site!
pryr::object_size(rse_jxn_ERP110066_collection_manual)
} # }
if (FALSE) { # \dontrun{
## For testing and debugging
project <- "ERP110066"
project_home <- "collections/geuvadis_smartseq"
project <- "SRP009615"
project_home <- "data_sources/sra"
type <- "gene"
organism <- "human"
annotation <- "gencode_v26"
jxn_format <- "ALL"
bfc <- recount3_cache()
recount3_url <- "http://idies.jhu.edu/recount3/data"
verbose <- TRUE
} # }