Open KaWingLee9 opened 4 months ago
Could you provide more details of the code you're using? I'll try to check if I can find anything.
Here are my codes:
# meta_data contains three columns: 'cell_type_lv1','cell_type_lv2','cell_type_lv3'; each row represents one cell
ref_type=unique(meta_data[,c('cell_type_lv1','cell_type_lv2','cell_type_lv3')])
ref_type[,'count']=1
tree_1=rep(1,length(unique(ref_type[,'cell_type_lv1'])))
names(tree_1)=unique(ref_type[,'cell_type_lv1'])
tree_2=reshape2::dcast(ref_type,cell_type_lv1~cell_type_lv2,value.var='count') %>% data.frame(row.names=1,check.names=FALSE)
tree_2[tree_2!=0]=1
tree_2[is.na(tree_2)]=0
tree_2=tree_2[names(tree_1),]
tree_3=reshape2::dcast(ref_type,cell_type_lv2~cell_type_lv3,value.var='count') %>% data.frame(row.names=1,check.names=FALSE)
tree_3[tree_3!=0]=1
tree_3[is.na(tree_3)]=0
tree_3=tree_3[colnames(tree_2),]
order.type=colnames(tree_3) # the cell type order of bottom layer of the given hierarchical tree
B=list(tree_1,tree_2,tree_3)
ref.type=meta_data[,'cell_type_lv3']
bulk.dat=as.matrix(stRNA_sce@assays$RNA@data)
ref.dat=as.matrix(seurat_obj@assays$RNA@data)
example.res <- HiDecon(bulk = bulk.dat, ref = ref.dat, B = B, cell_type = ref.type, type_order = order.type,
lambda = 40)
and errors occur:
Warning message in `[<-.factor`(`*tmp*`, cell_type_2 %in% CT.in.cluster, value = "cluster1"):
“invalid factor level, NA generated”
Warning message in `[<-.factor`(`*tmp*`, cell_type_2 %in% CT.in.cluster, value = "cluster2"):
“invalid factor level, NA generated”
Warning message in `[<-.factor`(`*tmp*`, cell_type_2 %in% CT.in.cluster, value = "cluster3"):
“invalid factor level, NA generated”
Warning message in `[<-.factor`(`*tmp*`, cell_type_2 %in% CT.in.cluster, value = "cluster4"):
“invalid factor level, NA generated”
Warning message in `[<-.factor`(`*tmp*`, cell_type_2 %in% CT.in.cluster, value = "cluster5"):
“invalid factor level, NA generated”
Warning message in `[<-.factor`(`*tmp*`, cell_type_2 %in% CT.in.cluster, value = "cluster6"):
“invalid factor level, NA generated”
Warning message in `[<-.factor`(`*tmp*`, cell_type_2 %in% CT.in.cluster, value = "cluster7"):
“invalid factor level, NA generated”
Warning message in `[<-.factor`(`*tmp*`, cell_type_2 %in% CT.in.cluster, value = "cluster8"):
“invalid factor level, NA generated”
Warning message in `[<-.factor`(`*tmp*`, cell_type_2 %in% CT.in.cluster, value = "cluster9"):
“invalid factor level, NA generated”
Warning message in `[<-.factor`(`*tmp*`, cell_type_2 %in% CT.in.cluster, value = "cluster10"):
“invalid factor level, NA generated”
Warning message in `[<-.factor`(`*tmp*`, cell_type_2 %in% CT.in.cluster, value = "cluster11"):
“invalid factor level, NA generated”
Warning message in `[<-.factor`(`*tmp*`, cell_type_2 %in% CT.in.cluster, value = "cluster12"):
“invalid factor level, NA generated”
Warning message in `[<-.factor`(`*tmp*`, cell_type_2 %in% CT.in.cluster, value = "cluster13"):
...
Warning message in FUN(...):
“no within-block comparison between HSC_C3 and Neutrophil”
Warning message in FUN(...):
“no within-block comparison between HSC_C3 and PlasmaCell_IGA”
Could you please provide the B matrix and the order.type? I think it might be something in the marker selection process...
Here is three matrixes of B
, and I select colnames of the third one as order.type
.
B.xlsx
When running select_HiDecon, warnings occurs:
Warning message in
[<-.factor(
tmp, cell_type_2 %in% CT.in.cluster, value = "cluster1"): “invalid factor level, NA generated”
Warning message in FUN(...): “no within-block comparison between HSC_C3 and PlasmaCell_IGA”
but return nothing. What's wrong with my codes or data?