From c3e77b1c716fdf15cc84fec747b80cbdbd9b0b4b Mon Sep 17 00:00:00 2001 From: Michael Milton Date: Mon, 7 Nov 2022 22:34:06 +1100 Subject: [PATCH] Update readme with get_seurat() and genes argument --- README.Rmd | 31 ++++++++++++++- README.md | 111 +++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 112 insertions(+), 30 deletions(-) diff --git a/README.Rmd b/README.Rmd index 41eb024..b60c744 100644 --- a/README.Rmd +++ b/README.Rmd @@ -4,7 +4,7 @@ output: github_document always_allow_html: true --- -Load Metadata +Load the package ```{r, message=FALSE, warning=FALSE} library(HCAquery) @@ -16,7 +16,7 @@ options("restore_SingleCellExperiment_show" = TRUE) ``` -Load the data +Load the metadata ```{r} get_metadata() @@ -65,4 +65,31 @@ sce = sce ``` +Extract only a subset of genes: + +```{r} +get_metadata() |> + filter( + ethnicity == "African" & + assay %LIKE% "%10x%" & + tissue == "lung parenchyma" & + cell_type %LIKE% "%CD4%" + ) |> +get_SingleCellExperiment(genes = "PUM1") +``` + +Extract the counts as a Seurat object: + +```{r} +get_metadata() |> + filter( + ethnicity == "African" & + assay %LIKE% "%10x%" & + tissue == "lung parenchyma" & + cell_type %LIKE% "%CD4%" + ) |> +get_seurat() +``` + + diff --git a/README.md b/README.md index d4e1a55..4f57696 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ HCAquery ================ -Load Metadata +Load the package ``` r library(HCAquery) @@ -12,33 +12,33 @@ library(tidySingleCellExperiment) options("restore_SingleCellExperiment_show" = TRUE) ``` -Load the data +Load the metadata ``` r get_metadata() ``` - ## # Source: table [?? x 52] - ## # Database: sqlite 3.39.2 [/vast/projects/RCP/human_cell_atlas/metadata.sqlite] - ## .cell .sample .samp…¹ assay assay…² cell_…³ cell_…⁴ devel…⁵ devel…⁶ disease - ## - ## 1 AAACCT… 5f20d7… D17PrP… 10x … EFO:00… basal … CL:000… 31-yea… HsapDv… normal - ## 2 AAACCT… 5f20d7… D17PrP… 10x … EFO:00… basal … CL:000… 31-yea… HsapDv… normal - ## 3 AAACCT… 5f20d7… D17PrP… 10x … EFO:00… lumina… CL:000… 31-yea… HsapDv… normal - ## 4 AAACCT… 5f20d7… D17PrP… 10x … EFO:00… lumina… CL:000… 31-yea… HsapDv… normal - ## 5 AAACCT… 5f20d7… D17PrP… 10x … EFO:00… basal … CL:000… 31-yea… HsapDv… normal - ## 6 AAACCT… 5f20d7… D17PrP… 10x … EFO:00… basal … CL:000… 31-yea… HsapDv… normal - ## 7 AAACCT… 5f20d7… D17PrP… 10x … EFO:00… basal … CL:000… 31-yea… HsapDv… normal - ## 8 AAACGG… 5f20d7… D17PrP… 10x … EFO:00… basal … CL:000… 31-yea… HsapDv… normal - ## 9 AAACGG… 5f20d7… D17PrP… 10x … EFO:00… lumina… CL:000… 31-yea… HsapDv… normal - ## 10 AAACGG… 5f20d7… D17PrP… 10x … EFO:00… basal … CL:000… 31-yea… HsapDv… normal - ## # … with more rows, 42 more variables: disease_ontology_term_id , - ## # ethnicity , ethnicity_ontology_term_id , file_id , - ## # is_primary_data.x , organism , organism_ontology_term_id , - ## # sample_placeholder , sex , sex_ontology_term_id , - ## # tissue , tissue_ontology_term_id , dataset_id , - ## # collection_id , cell_count , dataset_deployments , - ## # is_primary_data.y , is_valid , linked_genesets , … + ## # Source: table [?? x 56] + ## # Database: sqlite 3.39.3 [/vast/projects/RCP/human_cell_atlas/metadata.sqlite] + ## .cell sampl…¹ .sample .samp…² assay assay…³ file_…⁴ cell_…⁵ cell_…⁶ devel…⁷ + ## + ## 1 AAACCT… 8a0fe0… 5f20d7… D17PrP… 10x … EFO:00… 1e334b… basal … CL:000… 31-yea… + ## 2 AAACCT… 8a0fe0… 5f20d7… D17PrP… 10x … EFO:00… 1e334b… basal … CL:000… 31-yea… + ## 3 AAACCT… 02eb2e… 5f20d7… D17PrP… 10x … EFO:00… 30f754… lumina… CL:000… 31-yea… + ## 4 AAACCT… 02eb2e… 5f20d7… D17PrP… 10x … EFO:00… 30f754… lumina… CL:000… 31-yea… + ## 5 AAACCT… 8a0fe0… 5f20d7… D17PrP… 10x … EFO:00… 1e334b… basal … CL:000… 31-yea… + ## 6 AAACCT… 8a0fe0… 5f20d7… D17PrP… 10x … EFO:00… 1e334b… basal … CL:000… 31-yea… + ## 7 AAACCT… 8a0fe0… 5f20d7… D17PrP… 10x … EFO:00… 1e334b… basal … CL:000… 31-yea… + ## 8 AAACGG… 8a0fe0… 5f20d7… D17PrP… 10x … EFO:00… 1e334b… basal … CL:000… 31-yea… + ## 9 AAACGG… 02eb2e… 5f20d7… D17PrP… 10x … EFO:00… 30f754… lumina… CL:000… 31-yea… + ## 10 AAACGG… 8a0fe0… 5f20d7… D17PrP… 10x … EFO:00… 1e334b… basal … CL:000… 31-yea… + ## # … with more rows, 46 more variables: + ## # development_stage_ontology_term_id , disease , + ## # disease_ontology_term_id , ethnicity , + ## # ethnicity_ontology_term_id , file_id , is_primary_data.x , + ## # organism , organism_ontology_term_id , sample_placeholder , + ## # sex , sex_ontology_term_id , tissue , + ## # tissue_ontology_term_id , tissue_harmonised , age_days , … Explore the HCA content @@ -50,7 +50,7 @@ get_metadata() |> ``` ## # Source: SQL [?? x 2] - ## # Database: sqlite 3.39.2 [/vast/projects/RCP/human_cell_atlas/metadata.sqlite] + ## # Database: sqlite 3.39.3 [/vast/projects/RCP/human_cell_atlas/metadata.sqlite] ## # Ordered by: desc(n) ## tissue n ## @@ -97,8 +97,8 @@ sce ## rowData names(0): ## colnames(1571): ACAGCCGGTCCGTTAA_F02526 GGGAATGAGCCCAGCT_F02526 ... ## TACAACGTCAGCATTG_SC84 CATTCGCTCAATACCG_F02526 - ## colData names(51): .sample .sample_name ... cell_annotation_azimuth_l2 - ## cell_annotation_blueprint_singler + ## colData names(55): sample_id_db .sample ... n_cell_type_in_tissue + ## n_tissue_in_cell_type ## reducedDimNames(0): ## mainExpName: NULL ## altExpNames(0): @@ -135,8 +135,63 @@ sce ## rowData names(0): ## colnames(1571): ACAGCCGGTCCGTTAA_F02526 GGGAATGAGCCCAGCT_F02526 ... ## TACAACGTCAGCATTG_SC84 CATTCGCTCAATACCG_F02526 - ## colData names(51): .sample .sample_name ... cell_annotation_azimuth_l2 - ## cell_annotation_blueprint_singler + ## colData names(55): sample_id_db .sample ... n_cell_type_in_tissue + ## n_tissue_in_cell_type ## reducedDimNames(0): ## mainExpName: NULL ## altExpNames(0): + +Extract only a subset of genes: + +``` r +get_metadata() |> + filter( + ethnicity == "African" & + assay %LIKE% "%10x%" & + tissue == "lung parenchyma" & + cell_type %LIKE% "%CD4%" + ) |> +get_SingleCellExperiment(genes = "PUM1") +``` + + ## Reading 1 files. + + ## . + + ## class: SingleCellExperiment + ## dim: 1 1571 + ## metadata(0): + ## assays(1): counts + ## rownames(1): PUM1 + ## rowData names(0): + ## colnames(1571): ACAGCCGGTCCGTTAA_F02526 GGGAATGAGCCCAGCT_F02526 ... + ## TACAACGTCAGCATTG_SC84 CATTCGCTCAATACCG_F02526 + ## colData names(55): sample_id_db .sample ... n_cell_type_in_tissue + ## n_tissue_in_cell_type + ## reducedDimNames(0): + ## mainExpName: NULL + ## altExpNames(0): + +Extract the counts as a Seurat object: + +``` r +get_metadata() |> + filter( + ethnicity == "African" & + assay %LIKE% "%10x%" & + tissue == "lung parenchyma" & + cell_type %LIKE% "%CD4%" + ) |> +get_seurat() +``` + + ## Reading 1 files. + + ## . + + ## Warning: Feature names cannot have underscores ('_'), replacing with dashes + ## ('-') + + ## An object of class Seurat + ## 60661 features across 1571 samples within 1 assay + ## Active assay: originalexp (60661 features, 0 variable features)