Skip to content

Commit

Permalink
HLCA v2 publication updates
Browse files Browse the repository at this point in the history
  • Loading branch information
AustinHartman committed May 31, 2023
1 parent ed9c0e4 commit 92ff09f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions human_lung_v2/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ rule build_reference:
annotations = "data/annotations.parquet",
dr = "data/scanvi.parquet"
output:
ref = "reference/ref.Rds",
idx = "reference/idx.annoy",
obj = "full_reference.Rds"
ref = protected("reference/ref.Rds"),
idx = protected("reference/idx.annoy"),
obj = protected("full_reference.Rds")
shell:
"""
Rscript {input.script} {input.counts} {input.annotations} {input.dr} {output.ref} {output.idx} {output.obj}
Expand Down
9 changes: 5 additions & 4 deletions human_lung_v2/scripts/build_reference.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ obj <- CreateSeuratObject(counts = mtx)

# load annotations
annotations <- read_parquet(annotations.path)
rownames(annotations) <- annotations$X
annotations$X <- NULL
annotations <- as.data.frame(annotations)[,c("ann_level_1", "ann_level_2", "ann_level_3", "ann_level_4", "ann_level_5", "ann_finest_level")]
rownames(annotations) <- Cells(obj)
obj <- AddMetaData(obj, metadata = annotations)
print(head(obj))

# load in the scANVI latent space which contains 30 dimensions
latent.space <- read_parquet(dr.path)
latent.space <- as.matrix(read_parquet(dr.path))
rownames(latent.space) <- Cells(obj)
scanvi.dr <- CreateDimReducObject(embeddings = as.matrix(latent.space), key = "SCANVI")
obj[["scanvi"]] <- scanvi.dr
Expand All @@ -51,7 +52,7 @@ ref <- AzimuthReference(obj,
refDR = 'spca',
dims = 1:50, # use 50 dimensions from the sPCA dimensional reduction
plotref = 'umap',
reference.version = '2.0.0',
reference.version = '2.0.1',
metadata = annotations)

saveRDS(object = ref, file = ref.path, compress = F)
Expand Down

0 comments on commit 92ff09f

Please sign in to comment.