You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having trouble using code adapted from code that successfully mapped to AIT 11.6 using docker://njjai/scrattch_mapping:0.52.2. Currently I'm trying to map to AIT 11.7 using docker://njjai/scrattch_mapping:0.6.6 (also tried 0.6.3 with same outcome). Currently HANN mapping is turned off because of compatibility issues with the patch-seq taxonomy.
suppressPackageStartupMessages({
library("scrattch.mapping")
})
options(stringsAsFactors = FALSE)
options(future.globals.maxSize = 4000 * 1024^2) # Can adjust this value if needed, depending on number of cells
options(future.rng.onMisuse="ignore")
library(scrattch.mapping)
library (dplyr)
library(stringr)
library(scrattch.patchseq)
library(reticulate)
cell_type_mapper <- import("cell_type_mapper")
#reticulate::use_python("/usr/bin/python3")
refFolder = "/allen/programs/celltypes/workgroups/rnaseqanalysis/HMBA/Aim1_Regional_Taxonomies/BasalGanglia/Macaque/"
mappingFolder = "/home/xiaoping.liu/scrattch/mapping/NHP_BG_AIT_117"
data_dir = "/allen/programs/celltypes/workgroups/rnaseqanalysis/SMARTer/STAR/Macaque/patchseq/R_Object/"
data_fn = "20241024_RSC-204-377_macaque_patchseq_star2.7"
mode = 'patchseq'
h5ad_fn = "HMBA_Macaque_BG_082024_AIT.h5ad"
class_colname = 'Class_label'
neigh_colname = 'Neighborhood_label'
subclass_colname = 'Subclass_label'
low_level = 'Group_label'
cluster_colname = 'Group_label' # HACK because hierarchy is different, to match mouse whole brain
proj_strs = "qIVSCC-MET"
roi_strs = "STR|PALGPi|PALGPe|PAL_GPe|HYSTN|OT_L"
off_target = c("Immune", "Astro-Epen", "Vascular", "OPC-Oligo")
if (is.null(h5ad_fn)) {
AIT.anndata <- loadTaxonomy(refFolder)
} else {
AIT.anndata <- loadTaxonomy(refFolder, h5ad_fn)
}
tryCatch({
AIT.anndata = mappingMode(AIT.anndata, mode=mode)
}, error = function(err) {
## Add in the off.target annotation.
AIT.anndata$obs['off_target'] = AIT.anndata$obs[class_colname]
# Setup the taxonomy for patchseqQC to infer off.target contamination
AIT.anndata = buildPatchseqTaxonomy(AIT.anndata,
mode.name = mode, ## Give a name to off.target filterd taxonomy
subsample = 100, ## Subsampling is only for PatchseqQC contamination calculation
subclass.column = low_level, ## Used for subsampling - use lowest level above cluster
class.column = class_colname, ## The column by which off-target types are determined
off.target.types = off_target, ## The off-target class.column labels for patchseqQC
num.markers = 50, ## Number of markers for each annotation in `class_label`
taxonomyDir = refFolder)
AIT.anndata = mappingMode(AIT.anndata, mode=mode)
}
load(paste0(data_dir, paste0(data_fn, "_cpm.Rdata")))
load(paste0(data_dir, paste0(data_fn, "_samp.dat.Rdata")))
query.metadata <- samp.dat
counts <- cpmR # Genes are rows, samples are columns
query.counts <- counts
query.data <- logCPM(query.counts)
# Put annotations and counts in the same order
query.metadata <- query.metadata[match(colnames(query.data),query.metadata$exp_component_name),]
rownames(query.metadata) <- query.metadata$exp_component_name
dend <- json_to_dend(AIT.anndata$uns$dend[[AIT.anndata$uns$mode]])
allMarkers = unique(unlist(get_dend_markers(dend)))
query.data = query.data[intersect(rownames(query.data), allMarkers),]
query.mapping_obj <- taxonomy_mapping(AIT.anndata= AIT.anndata,
query.data = query.data,
corr.map = TRUE, # Flags for which mapping algorithms to run
tree.map = TRUE,
hierarchical.map=FALSE,
seurat.map = FALSE,
label.cols = c(neigh_colname, class_colname, subclass_colname, cluster_colname)
)
a <- strsplit(refFolder,'/')[[1]]
taxname <- a[length(a)]
b <- strsplit(data_fn, '_')[[1]]
dataname <- b[2]
save(query.mapping_obj, file=file.path(mappingFolder, paste(taxname, dataname, 'mapping.Rdata', sep='_')))
query.mapping = getMappingResults(query.mapping_obj)
At the bottom is where I get the error:
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘getMappingResults’ for signature ‘"mappingClass", "missing"’
The rdata file is at: load(file = "/home/xiaoping.liu/scrattch/mapping/NHP_BG_AIT_117/Macaque_RSC-204-377_mapping.Rdata")
The text was updated successfully, but these errors were encountered:
I am having trouble using code adapted from code that successfully mapped to AIT 11.6 using docker://njjai/scrattch_mapping:0.52.2. Currently I'm trying to map to AIT 11.7 using docker://njjai/scrattch_mapping:0.6.6 (also tried 0.6.3 with same outcome). Currently HANN mapping is turned off because of compatibility issues with the patch-seq taxonomy.
At the bottom is where I get the error:
The text was updated successfully, but these errors were encountered: