catavallejos / BASiCS

BASiCS: Bayesian Analysis of Single-Cell Sequencing Data. This is an unstable experimental version. Please see http://bioconductor.org/packages/BASiCS/ for the official release version

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error produced from newBASiCS_Data: 'SpikeInput' row order does not match 'altExp'.

lilythepooh opened this issue · comments

Dear BASiCS Team:

Thanks for reading this message.

I upgraded to BASiCS 3.12 recently. I have some data worked fine with BASiCS 3.8. But when I use these data in BASiCS 3.12:

ZData<-newBASiCS_Data(Counts4, Tech=Tech1, SpikeInfo=SpikesInfo1, BatchInfo = NULL, SpikeType = "ERCC")

it produced the following error:

Error in newBASiCS_Data(Counts4, Tech = Tech1, SpikeInfo = SpikesInfo1,  : 
  'SpikeInput' row order does not match 'altExp'.
In addition: Warning message:
'newBASiCS_Data' is deprecated.
See help("Deprecated'') 

My sessionInfo is:

R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Could you please tell me if there is any new rules for the input of newBASiCS_Data? Thank you very much!

Best regards,
Sijia Li

The easiest way to create input for basics nowadays is to do it manually. This is because of changes in the SingleCellExperiment class that made the old modes of storage that we used a bit too cumbersome. Something like this:

sce <- SingleCellExperiment::SingleCellExperiment(
    assays = list(counts = my_count_matrix)
)
altExp(sce, "spike-ins") <- my_spike_matrix
rowData(altExp(sce, "spike-ins")) <- data.frame(Name = rownames(my_spike_matrix), Molecules = number_of_molecules_per_well), row.names = rownames(my_spike_matrix))

The easiest way to create input for basics nowadays is to do it manually. This is because of changes in the SingleCellExperiment class that made the old modes of storage that we used a bit too cumbersome. Something like this:

sce <- SingleCellExperiment::SingleCellExperiment(
    assays = list(counts = my_count_matrix)
)
altExp(sce, "spike-ins") <- my_spike_matrix
rowData(altExp(sce, "spike-ins")) <- data.frame(Name = rownames(my_spike_matrix), Molecules = number_of_molecules_per_well), row.names = rownames(my_spike_matrix))

Dear Alan,

Thanks a lot for your early reply. I tried the following:

sce <- SingleCellExperiment::SingleCellExperiment(
  assays = list(counts = Counts4[!Tech1,])
)
spike_sce<- SingleCellExperiment::SingleCellExperiment(
  assays = list(counts = Counts4[Tech1,])
)
altExp(sce, "spike-ins") <- spike_sce
rowData(altExp(sce, "spike-ins")) <- data.frame(Name = rownames(Counts4[Tech1,]), Molecules = SpikesInfo1$SpikeInput, row.names = rownames(Counts4[Tech1,]))
Data<-sce

and the resulted sce works in BASiCS_MCMC with default parameters.

However, I ran into another issue when I try to redefine prior parameters like this:

prior.param<-BASiCS_PriorParam(Data, k = 12, mu.mu = NULL,
                               s2.mu = 0.5,
                               s2.delta = 0.5,
                               a.delta = 1,
                               b.delta = 1,
                               p.phi = rep(1, times = ncol(Data)),
                               a.s = 1,
                               b.s = 1,
                               a.theta = 1,
                               b.theta = 1,
                               RBFMinMax = TRUE,
                               FixLocations = !is.null(RBFLocations) | !is.na(MinGenesPerRBF),
                               RBFLocations = NULL,
                               MinGenesPerRBF = NA,
                               variance = 1.2,
                               m = numeric(k),
                               V = diag(k),
                               a.sigma2 = 1,
                               b.sigma2 = 1,
                               eta = 5,
                               PriorMu = "default",
                               PriorDelta = "log-normal",
                               StochasticRef = TRUE,
                               ConstrainProp = 0.2,
                               GeneExponent = 1,
                               CellExponent = 1)

I got the following error:

Error in BASiCS_PriorParam(Data, k = 12, mu.mu = NULL, s2.mu = 0.5,  : 
  object 'RBFLocations' not found

i am not trying to redefine RBFLocations, so I used NULL hoping for a default setting. Could you please tell me what value can I give to RBFLocations to avoid this problem?

Thanks again for your time. Have a good day!

Best regards,
Sijia Li

If you remove this line: FixLocations = !is.null(RBFLocations) | !is.na(MinGenesPerRBF),
then the error should go away.

In general you only need to specify the prior parameters that are different to the defaults. For example if I only wanted to increase the prior variance for mu, I would simply call

BASiCS_PriorParam(Data, s2.mu = 10)

(note: 10 is a crazy value for this prior, this is just an example :) )

If you remove this line: FixLocations = !is.null(RBFLocations) | !is.na(MinGenesPerRBF),
then the error should go away.

In general you only need to specify the prior parameters that are different to the defaults. For example if I only wanted to increase the prior variance for mu, I would simply call

BASiCS_PriorParam(Data, s2.mu = 10)

(note: 10 is a crazy value for this prior, this is just an example :) )
Dear Alan,

Thanks a lot for your early reply. It works very well now.

Thanks again for your time. Have a wonderful weekend!

Best regards,
Sijia Li