Builds a MultiAssayExperiment whose experiments are HTAN files and whose
colData is one row per participant from the clinical tables
(clinical_tier1_demographics, plus the first clinical_tier1_diagnosis
row per participant). The sampleMap links each experiment column (cell,
spot or sample) to its participant:
Usage
htan_experiment(x, participant_col = NULL, con = htan_con())Arguments
- x
A named list of
SummarizedExperiments (for example fromread_htan()) withHTAN_Data_File_IDs as names, or the result ofhtan_download(), whose files are read withread_htan().- participant_col
character(1)orNULL. For multi-participant files, thecolDatacolumn with each column's participant or biospecimen ID.- con
A connection from
htan_con().
Details
a file derived from one participant (about 98 percent of r7 files) maps every column to that participant;
for a multi-participant file,
participant_colnames thecolDatacolumn holding each column'sHTAN_Participant_ID(or biospecimen ID, from which the participant is taken).
This is a thin first version: it does not yet join biospecimen
annotations or follow id_provenance below the participant.
Examples
fixture <- system.file("extdata", "snapshot", package = "HTAN")
con <- htan_con("r7", base_url = fixture)
hta12_251 <- htan_file_participants(con) |>
dplyr::filter(HTAN_Participant_ID == "HTA12_251")
f <- htan_files(con) |>
dplyr::filter(level == 4) |>
dplyr::semi_join(hta12_251, by = "HTAN_Data_File_ID") |>
utils::head(1L) |>
dplyr::pull(HTAN_Data_File_ID)
se <- SummarizedExperiment::SummarizedExperiment(
list(counts = matrix(1:6, 2, dimnames = list(c("g1", "g2"),
c("c1", "c2", "c3")))))
#> Warning: replacing previous import ‘S4Arrays::makeNindexFromArrayViewport’ by ‘DelayedArray::makeNindexFromArrayViewport’ when loading ‘SummarizedExperiment’
mae <- htan_experiment(stats::setNames(list(se), f), con = con)
MultiAssayExperiment::sampleMap(mae)
#> DataFrame with 3 rows and 3 columns
#> assay primary colname
#> <factor> <character> <character>
#> 1 HTA12_251_4000 HTA12_251 c1
#> 2 HTA12_251_4000 HTA12_251 c2
#> 3 HTA12_251_4000 HTA12_251 c3