Skip to content

Commit

Permalink
reannotate difficult cells
Browse files Browse the repository at this point in the history
  • Loading branch information
stemangiola committed Oct 18, 2022
1 parent c04342d commit c45b4a5
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
33 changes: 33 additions & 0 deletions dev/reannotate_cd4.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
library(scuttle)
library(celldex)
library(SingleR)
library(BiocParallel)
library(HCAquery)
library(SingleCellExperiment)
library(tidySingleCellExperiment)
library(digest)
library(openssl)
library(stringr)
library(HDF5Array)
monocyte_reference = celldex::MonacoImmuneData()


readRDS("/vast/projects/RCP/human_cell_atlas/metadata.rds") |>
filter(.cell %in% (
readRDS("dev/curated_annotation.rds") |>
filter(cell_type_harmonised=="cd4 t") |>
pull(.cell)
)) |>
unite("file_id_db", c(file_id, cell_type), remove = FALSE) |>
mutate(file_id_db = file_id_db |> md5() |> as.character()) |>

get_SingleCellExperiment("/vast/projects/RCP/human_cell_atlas/splitted_DB2_data") |>

# Annotate
logNormCounts(assay.type = "X") |>
SingleR(
ref = monocyte_reference,
assay.type.test=1,
labels = monocyte_reference$label.fine
) |>
saveRDS("reannotate_cd4.rds")
34 changes: 34 additions & 0 deletions dev/reannotate_cd8.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
library(scuttle)
library(celldex)
library(SingleR)
library(BiocParallel)
library(HCAquery)
library(SingleCellExperiment)
library(tidySingleCellExperiment)
library(digest)
library(openssl)
library(stringr)
library(HDF5Array)
monocyte_reference =celldex::MonacoImmuneData()


readRDS("/vast/projects/RCP/human_cell_atlas/metadata.rds") |>
filter(.cell %in% (
readRDS("dev/curated_annotation.rds") |>
filter(cell_type_harmonised=="cd8 t") |>
pull(.cell)
)) |>
unite("file_id_db", c(file_id, cell_type), remove = FALSE) |>
mutate(file_id_db = file_id_db |> md5() |> as.character()) |>

get_SingleCellExperiment("/vast/projects/RCP/human_cell_atlas/splitted_DB2_data") |>

# Annotate
logNormCounts(assay.type = "X") |>

SingleR(
ref = monocyte_reference,
assay.type.test=1,
labels = monocyte_reference$label.fine
) |>
saveRDS("reannotate_cd8.rds")
34 changes: 34 additions & 0 deletions dev/reannotate_monocytes.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
library(scuttle)
library(celldex)
library(SingleR)
library(BiocParallel)
library(HCAquery)
library(SingleCellExperiment)
library(tidySingleCellExperiment)
library(digest)
library(openssl)
library(stringr)
library(HDF5Array)
monocyte_reference =celldex::MonacoImmuneData()



readRDS("/vast/projects/RCP/human_cell_atlas/metadata.rds") |>
filter(.cell %in% (
readRDS("dev/curated_annotation.rds") |>
filter(cell_type_harmonised=="monocytes") |>
pull(.cell)
)) |>
unite("file_id_db", c(file_id, cell_type), remove = FALSE) |>
mutate(file_id_db = file_id_db |> md5() |> as.character()) |>

get_SingleCellExperiment("/vast/projects/RCP/human_cell_atlas/splitted_DB2_data") |>

# Annotate
logNormCounts(assay.type = "X") |>
SingleR(
ref = monocyte_reference,
assay.type.test=1,
labels = monocyte_reference$label.fine
) |>
saveRDS("reannotate_monocytes.rds")

0 comments on commit c45b4a5

Please sign in to comment.