Skip to contents

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 from read_htan()) with HTAN_Data_File_IDs as names, or the result of htan_download(), whose files are read with read_htan().

participant_col

character(1) or NULL. For multi-participant files, the colData column with each column's participant or biospecimen ID.

con

A connection from htan_con().

Value

A MultiAssayExperiment.

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_col names the colData column holding each column's HTAN_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)
f <- dplyr::pull(htan_files(level == 4, participants = "HTA12_251",
    con = con), HTAN_Data_File_ID)[1]
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