0

I'm trying to create riverplot from two single-cell datasets, when I run the tutorial dataset it works but when I run my data I get the next error:

here is my code:


library(riverplot)
library(Seurat)
library(rliger)

output_path = ".../Adipose/adipocytes/"
input_path= "..../Adipose/adipocytes/"

# pbmc.10x <- read.table(paste0(input_path,'vis_Gene_Count_per_Cell.tsv'),
#                        stringsAsFactors=F,header=T,row.names = 1)
# pbmc.seqwell <- read.table(paste0(input_path,'sub_Gene_Count_per_Cell.tsv'),
#                           stringsAsFactors=F,header=T,row.names = 1)

sub <- readRDS(paste0(input_path,'sub5_Asses_nodes.rds'))
sub <- RenameCells(sub, add.cell.id="subcutan")
# sub <- RunTSNE(sub)
vis <- readRDS(paste0(input_path,'vis_adipo10.rds'))
vis <- RenameCells(vis, add.cell.id="vis")

#pbmc.data = list(tenx=pbmc.10x, seqwell=pbmc.seqwell)
pbmc.data = list(tenx=sub@assays[["RNA"]]@counts, seqwell=vis@assays[["RNA"]]@counts)



a.pbmc <- createLiger(pbmc.data)
a.pbmc <- normalize(a.pbmc)
a.pbmc <- selectGenes(a.pbmc, var.thresh = c(0.3, 0.875), do.plot = F)
# 
#s.var.genes <- readRDS('/Users/mayaziv/Downloads/pbmc_alignment/var_genes.RDS')
#a.pbmc@var.genes <- s.var.genes
a.pbmc <- scaleNotCenter(a.pbmc)
#k.suggest <- suggestK(a.pbmc, num.cores = 5, gen.new = T, plot.log2 = F,
#                     nrep = 5)
a.pbmc <- optimizeALS(a.pbmc, k=22, thresh = 5e-5, nrep = 3)
a.pbmc <- runTSNE(a.pbmc, use.raw = T)
p1 <- plotByDatasetAndCluster(a.pbmc, return.plots = T)
# Plot by dataset
print(p1[[1]])
a.pbmc <- quantileAlignSNF(a.pbmc, resolution = 0.4, small.clust.thresh = 20)

clusters_prior <- readRDS(paste0(input_path,'com_cluster.RDS'))
tenx_c <- droplevels(clusters_prior[rownames(a.pbmc@H[[1]])])
seqwell_c <- droplevels(clusters_prior[rownames(a.pbmc@H[[2]])])
# Set specific node order for cleaner visualization (can also leave to default value for 
# automatic ordering)


makeRiverplot(a.pbmc, tenx_c, seqwell_c, min.frac = 0.05, 
              river.usr = c(0, 1, -0.6, 1.6))

and the error is:

Error in edge_list[[nodes1[i]]] <- temp : 
  attempt to select less than one element in OneIndex

does anyone have an idea why this error is occurring?

Thanks!

I wanted to get a riverplot that matches between the clusters from the two single cell datasets.

I keep getting this error://

Progman
  • 16,827
  • 6
  • 33
  • 48

0 Answers0