Contents

1 Motivation & Introduction

The purpose of this vignette is to explore the file manifests available from the Human Cell Atlas project.

These files provide a metadata summary for a collection of files in a tabular format, including but not limited to information about process and workflow used to generate the file, information about the specimens the file data were derived from, and identifiers connect specific projects, files, and specimens.

The WARP (WDL Analysis Research Pipelines) repository contains information on a variety of pipelines, and can be used alongside a manifest to better understand the metadata.

1.1 Installation and getting started

Evaluate the following code chunk to install packages required for this vignette.

## install from Bioconductor if you haven't already
pkgs <- c("LoomExperiment", "hca")
pkgs_needed <- pkgs[!pkgs %in% rownames(installed.packages())]
BiocManager::install(pkgs_needed)

Load the packages into your R session.

library(dplyr)
library(SummarizedExperiment)
library(LoomExperiment)
library(hca)

2 Example: manifests

The manifest for all files available can be obtained with

default_manifest_tbl <- hca::manifest()
default_manifest_tbl

This is seldom useful; instead, create a filter identifying the files of interest.

manifest_filter <- hca::filters(
    projectId = list(is = "4a95101c-9ffc-4f30-a809-f04518a23803"),
    fileFormat = list(is = "loom"),
    workflow = list(is = c("optimus_v4.2.2", "optimus_v4.2.3"))
)

Retrieve the manifest

manifest_tibble <- hca::manifest(filters = manifest_filter)
manifest_tibble
## # A tibble: 0 × 56
## # … with 56 variables: source_id <chr>, source_spec <chr>, bundle_uuid <chr>,
## #   bundle_version <chr>, file_document_id <chr>, file_type <chr>,
## #   file_name <chr>, file_format <chr>, read_index <chr>, file_size <chr>,
## #   file_uuid <chr>, file_version <chr>, file_crc32c <chr>, file_sha256 <chr>,
## #   file_content_type <chr>, file_drs_uri <chr>, file_url <chr>,
## #   cell_suspension.provenance.document_id <chr>,
## #   cell_suspension.biomaterial_core.biomaterial_id <chr>, …

And perform additional filtering, e.g., identifying the specimen organs represented in the files.

manifest_tibble |>
    dplyr::count(specimen_from_organism.organ)
## # A tibble: 0 × 2
## # … with 2 variables: specimen_from_organism.organ <chr>, n <int>

3 Example: Using manifest data to select files

manifest_tibble
## # A tibble: 0 × 56
## # … with 56 variables: source_id <chr>, source_spec <chr>, bundle_uuid <chr>,
## #   bundle_version <chr>, file_document_id <chr>, file_type <chr>,
## #   file_name <chr>, file_format <chr>, read_index <chr>, file_size <chr>,
## #   file_uuid <chr>, file_version <chr>, file_crc32c <chr>, file_sha256 <chr>,
## #   file_content_type <chr>, file_drs_uri <chr>, file_url <chr>,
## #   cell_suspension.provenance.document_id <chr>,
## #   cell_suspension.biomaterial_core.biomaterial_id <chr>, …
file_uuid <- "24a8a323-7ecd-504e-a253-b0e0892dd730"
file_filter <- hca::filters(
    fileId = list(is = file_uuid)
)

file_tbl <- hca::files(filters = file_filter)

file_tbl
## # A tibble: 1 × 8
##   fileId                      name  fileF…¹   size version proje…² proje…³ url  
##   <chr>                       <chr> <chr>    <int> <chr>   <chr>   <chr>   <chr>
## 1 24a8a323-7ecd-504e-a253-b0… t-ce… loom    3.90e8 2021-0… A sing… 4a9510… http…
## # … with abbreviated variable names ¹​fileFormat, ²​projectTitle, ³​projectId
file_location <-
    file_tbl |>
    hca::files_download()
file_location
## 24a8a323-7ecd-504e-a253-b0e0892dd730-2021-02-11T19:00:05.000000Z 
##  "/home/biocbuild/.cache/R/hca/d3a61301464e5_d3a61301464e5.loom"
loom <- LoomExperiment::import(file_location)
metadata(loom) |>
    dplyr::glimpse()
## List of 15
##  $ last_modified                                             : chr "20210211T185949.186062Z"
##  $ CreationDate                                              : chr "20210211T185658.758915Z"
##  $ LOOM_SPEC_VERSION                                         : chr "3.0.0"
##  $ donor_organism.genus_species                              : chr "Homo sapiens"
##  $ expression_data_type                                      : chr "exonic"
##  $ input_id                                                  : chr "58a18a4c-5423-4c59-9b3c-50b7f30b1ca5, c763f679-e13d-4f81-844f-c2c80fc90f46, c76d90b8-c190-4c58-b9bc-b31f586ec7f"| __truncated__
##  $ input_id_metadata_field                                   : chr "sequencing_process.provenance.document_id"
##  $ input_name                                                : chr "PP012_suspension, PP003_suspension, PP004_suspension, PP011_suspension"
##  $ input_name_metadata_field                                 : chr "sequencing_input.biomaterial_core.biomaterial_id"
##  $ library_preparation_protocol.library_construction_approach: chr "10X v2 sequencing"
##  $ optimus_output_schema_version                             : chr "1.0.0"
##  $ pipeline_version                                          : chr "Optimus_v4.2.2"
##  $ project.project_core.project_name                         : chr "HumanTissueTcellActivation"
##  $ project.provenance.document_id                            : chr "4a95101c-9ffc-4f30-a809-f04518a23803"
##  $ specimen_from_organism.organ                              : chr "hematopoietic system"
colData(loom) |>
    dplyr::as_tibble() |>
    dplyr::glimpse()
## Rows: 91,713
## Columns: 43
## $ CellID                                                 <chr> "GCTTCCATCACCGT…
## $ antisense_reads                                        <int> 0, 0, 0, 0, 0, …
## $ cell_barcode_fraction_bases_above_30_mean              <dbl> 0.9846281, 0.98…
## $ cell_barcode_fraction_bases_above_30_variance          <dbl> 0.003249023, 0.…
## $ cell_names                                             <chr> "GCTTCCATCACCGT…
## $ duplicate_reads                                        <int> 0, 0, 0, 0, 0, …
## $ emptydrops_FDR                                         <dbl> 1.000000000, 0.…
## $ emptydrops_IsCell                                      <raw> 00, 01, 00, 00,…
## $ emptydrops_Limited                                     <raw> 00, 01, 00, 00,…
## $ emptydrops_LogProb                                     <dbl> -689.6831, -120…
## $ emptydrops_PValue                                      <dbl> 0.91840816, 0.0…
## $ emptydrops_Total                                       <int> 255, 16705, 681…
## $ fragments_per_molecule                                 <dbl> 1.693252, 8.453…
## $ fragments_with_single_read_evidence                    <int> 504, 139828, 58…
## $ genes_detected_multiple_observations                   <int> 82, 2873, 1552,…
## $ genomic_read_quality_mean                              <dbl> 36.62988, 36.87…
## $ genomic_read_quality_variance                          <dbl> 25.99015, 20.19…
## $ genomic_reads_fraction_bases_quality_above_30_mean     <dbl> 0.8584288, 0.86…
## $ genomic_reads_fraction_bases_quality_above_30_variance <dbl> 0.03981779, 0.0…
## $ input_id                                               <chr> "58a18a4c-5423-…
## $ molecule_barcode_fraction_bases_above_30_mean          <dbl> 0.9820324, 0.98…
## $ molecule_barcode_fraction_bases_above_30_variance      <dbl> 0.005782884, 0.…
## $ molecules_with_single_read_evidence                    <int> 276, 5028, 2041…
## $ n_fragments                                            <int> 552, 202060, 84…
## $ n_genes                                                <int> 227, 3381, 1826…
## $ n_mitochondrial_genes                                  <int> 5, 22, 17, 5, 2…
## $ n_mitochondrial_molecules                              <int> 8, 3528, 2928, …
## $ n_molecules                                            <int> 326, 23902, 998…
## $ n_reads                                                <int> 679, 341669, 13…
## $ noise_reads                                            <int> 0, 0, 0, 0, 0, …
## $ pct_mitochondrial_molecules                            <dbl> 1.1782032, 1.03…
## $ perfect_cell_barcodes                                  <int> 667, 336674, 13…
## $ perfect_molecule_barcodes                              <int> 384, 227854, 89…
## $ reads_mapped_exonic                                    <int> 343, 210716, 84…
## $ reads_mapped_intergenic                                <int> 39, 19439, 8042…
## $ reads_mapped_intronic                                  <int> 175, 58833, 276…
## $ reads_mapped_multiple                                  <int> 162, 90968, 365…
## $ reads_mapped_too_many_loci                             <int> 0, 0, 0, 0, 0, …
## $ reads_mapped_uniquely                                  <int> 450, 227309, 93…
## $ reads_mapped_utr                                       <int> 55, 29289, 1039…
## $ reads_per_fragment                                     <dbl> 1.230072, 1.690…
## $ reads_unmapped                                         <int> 67, 23392, 9340…
## $ spliced_reads                                          <int> 99, 73817, 2987…

4 Example: Using manifest data to annotate a .loom file

The function optimus_loom_annotation() takes in the file path of a .loom file generated by the Optimus pipeline and returns a LoomExperiment object whose colData has been annotated with additional specimen data extracted from a manifest.

annotated_loom <- optimus_loom_annotation(file_location)
annotated_loom
## class: SingleCellLoomExperiment 
## dim: 58347 91713 
## metadata(16): last_modified CreationDate ...
##   specimen_from_organism.organ manifest
## assays(1): matrix
## rownames: NULL
## rowData names(29): Gene antisense_reads ... reads_per_molecule
##   spliced_reads
## colnames: NULL
## colData names(98): input_id CellID ...
##   sequencing_input.biomaterial_core.biomaterial_id
##   sequencing_input_type
## reducedDimNames(0):
## mainExpName: NULL
## altExpNames(0):
## rowGraphs(0): NULL
## colGraphs(0): NULL


## new metadata
setdiff(
    names(metadata(annotated_loom)),
    names(metadata(loom))
)
## [1] "manifest"
metadata(annotated_loom)$manifest
## # A tibble: 4 × 56
##   source_id  sourc…¹ bundl…² bundle_version      file_…³ file_…⁴ file_…⁵ file_…⁶
##   <chr>      <chr>   <chr>   <dttm>              <chr>   <chr>   <chr>   <chr>  
## 1 423338be-… tdr:da… e3ecdf… 2021-02-02 23:55:00 5bc232… analys… c763f6… loom   
## 2 423338be-… tdr:da… 81df10… 2021-02-02 23:55:00 9f8bc0… analys… 58a18a… loom   
## 3 423338be-… tdr:da… 54fb0e… 2021-02-02 23:55:00 dfd990… analys… c76d90… loom   
## 4 423338be-… tdr:da… 751656… 2021-02-02 23:55:00 e07ca7… analys… fb72f4… loom   
## # … with 48 more variables: read_index <chr>, file_size <dbl>, file_uuid <chr>,
## #   file_version <dttm>, file_crc32c <chr>, file_sha256 <chr>,
## #   file_content_type <chr>, file_drs_uri <chr>, file_url <chr>,
## #   cell_suspension.provenance.document_id <chr>,
## #   cell_suspension.biomaterial_core.biomaterial_id <chr>,
## #   cell_suspension.estimated_cell_count <lgl>,
## #   cell_suspension.selected_cell_type <chr>, …

## new colData columns
setdiff(
    names(colData(annotated_loom)),
    names(colData(loom))
)
##  [1] "source_id"                                                      
##  [2] "source_spec"                                                    
##  [3] "bundle_uuid"                                                    
##  [4] "bundle_version"                                                 
##  [5] "file_document_id"                                               
##  [6] "file_type"                                                      
##  [7] "file_name"                                                      
##  [8] "file_format"                                                    
##  [9] "read_index"                                                     
## [10] "file_size"                                                      
## [11] "file_uuid"                                                      
## [12] "file_version"                                                   
## [13] "file_crc32c"                                                    
## [14] "file_sha256"                                                    
## [15] "file_content_type"                                              
## [16] "file_drs_uri"                                                   
## [17] "file_url"                                                       
## [18] "cell_suspension.provenance.document_id"                         
## [19] "cell_suspension.biomaterial_core.biomaterial_id"                
## [20] "cell_suspension.estimated_cell_count"                           
## [21] "cell_suspension.selected_cell_type"                             
## [22] "sequencing_protocol.instrument_manufacturer_model"              
## [23] "sequencing_protocol.paired_end"                                 
## [24] "library_preparation_protocol.library_construction_approach"     
## [25] "library_preparation_protocol.nucleic_acid_source"               
## [26] "project.provenance.document_id"                                 
## [27] "project.contributors.institution"                               
## [28] "project.contributors.laboratory"                                
## [29] "project.project_core.project_short_name"                        
## [30] "project.project_core.project_title"                             
## [31] "project.estimated_cell_count"                                   
## [32] "specimen_from_organism.provenance.document_id"                  
## [33] "specimen_from_organism.diseases"                                
## [34] "specimen_from_organism.organ"                                   
## [35] "specimen_from_organism.organ_part"                              
## [36] "specimen_from_organism.preservation_storage.preservation_method"
## [37] "donor_organism.sex"                                             
## [38] "donor_organism.biomaterial_core.biomaterial_id"                 
## [39] "donor_organism.provenance.document_id"                          
## [40] "donor_organism.genus_species"                                   
## [41] "donor_organism.development_stage"                               
## [42] "donor_organism.diseases"                                        
## [43] "donor_organism.organism_age"                                    
## [44] "cell_line.provenance.document_id"                               
## [45] "cell_line.biomaterial_core.biomaterial_id"                      
## [46] "organoid.provenance.document_id"                                
## [47] "organoid.biomaterial_core.biomaterial_id"                       
## [48] "organoid.model_organ"                                           
## [49] "organoid.model_organ_part"                                      
## [50] "_entity_type"                                                   
## [51] "sample.provenance.document_id"                                  
## [52] "sample.biomaterial_core.biomaterial_id"                         
## [53] "sequencing_input.provenance.document_id"                        
## [54] "sequencing_input.biomaterial_core.biomaterial_id"               
## [55] "sequencing_input_type"

5 Session info

sessionInfo()
## R version 4.2.1 (2022-06-23)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.5 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.16-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.16-bioc/R/lib/libRlapack.so
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_GB              LC_COLLATE=C              
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] hca_1.6.0                   LoomExperiment_1.16.0      
##  [3] BiocIO_1.8.0                rhdf5_2.42.0               
##  [5] SingleCellExperiment_1.20.0 SummarizedExperiment_1.28.0
##  [7] Biobase_2.58.0              GenomicRanges_1.50.0       
##  [9] GenomeInfoDb_1.34.0         IRanges_2.32.0             
## [11] S4Vectors_0.36.0            BiocGenerics_0.44.0        
## [13] MatrixGenerics_1.10.0       matrixStats_0.62.0         
## [15] dplyr_1.0.10                BiocStyle_2.26.0           
## 
## loaded via a namespace (and not attached):
##  [1] httr_1.4.4             tidyr_1.2.1            sass_0.4.2            
##  [4] vroom_1.6.0            bit64_4.0.5            jsonlite_1.8.3        
##  [7] bslib_0.4.0            shiny_1.7.3            assertthat_0.2.1      
## [10] BiocManager_1.30.19    BiocFileCache_2.6.0    blob_1.2.3            
## [13] GenomeInfoDbData_1.2.9 yaml_2.3.6             pillar_1.8.1          
## [16] RSQLite_2.2.18         lattice_0.20-45        glue_1.6.2            
## [19] digest_0.6.30          promises_1.2.0.1       XVector_0.38.0        
## [22] htmltools_0.5.3        httpuv_1.6.6           Matrix_1.5-1          
## [25] pkgconfig_2.0.3        bookdown_0.29          zlibbioc_1.44.0       
## [28] purrr_0.3.5            xtable_1.8-4           archive_1.1.5         
## [31] HDF5Array_1.26.0       later_1.3.0            tzdb_0.3.0            
## [34] tibble_3.1.8           generics_0.1.3         ellipsis_0.3.2        
## [37] DT_0.26                withr_2.5.0            cachem_1.0.6          
## [40] cli_3.4.1              crayon_1.5.2           mime_0.12             
## [43] magrittr_2.0.3         memoise_2.0.1          evaluate_0.17         
## [46] fansi_1.0.3            tools_4.2.1            hms_1.1.2             
## [49] lifecycle_1.0.3        stringr_1.4.1          Rhdf5lib_1.20.0       
## [52] DelayedArray_0.24.0    compiler_4.2.1         jquerylib_0.1.4       
## [55] rlang_1.0.6            grid_4.2.1             RCurl_1.98-1.9        
## [58] rhdf5filters_1.10.0    rappdirs_0.3.3         htmlwidgets_1.5.4     
## [61] miniUI_0.1.1.1         bitops_1.0-7           rmarkdown_2.17        
## [64] DBI_1.1.3              curl_4.3.3             R6_2.5.1              
## [67] knitr_1.40             fastmap_1.1.0          bit_4.0.4             
## [70] utf8_1.2.2             filelock_1.0.2         readr_2.1.3           
## [73] stringi_1.7.8          parallel_4.2.1         Rcpp_1.0.9            
## [76] vctrs_0.5.0            dbplyr_2.2.1           tidyselect_1.2.0      
## [79] xfun_0.34