Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BASiCS_PlotVG not working in Chain data from #220

Closed
ilibarra opened this issue Dec 15, 2020 · 3 comments
Closed

BASiCS_PlotVG not working in Chain data from #220

ilibarra opened this issue Dec 15, 2020 · 3 comments

Comments

@ilibarra
Copy link

Dear BASiCS dev,

The function BASiCS_PlotVG seems to work with the default object provided in the tutorial, which seems to have been created in version 1.1.20 according to its log. However, for newly created objects in R 4.0 the same throws an error, which seems to ber related to the new version of Chain.

data(ChainSC)
ChainSC
An object of class BASiCS_Chain
 75 MCMC samples.
 Dataset contains 350 biological genes and 5 cells (2 batches). 
 Object stored using BASiCS version:  1.1.20 
 Parameters:  mu delta phi s nu theta 

HVG <- BASiCS_DetectHVG(ChainSC, VarThreshold = 0.6)

# no problem
ChainSC <- BASiCS_MCMC(Data = DataExample,
                     N = 1000, Thin = 10, Burn = 500, 
                     # N = 1000, Thin = 10, Burn = 500, 
                     PrintProgress = FALSE, Regression = TRUE)
HVG <- BASiCS_DetectHVG(ChainSC, VarThreshold = 0.6)

ChainSC 
An object of class BASiCS_Chain
 50 MCMC samples.
 Dataset contains 40 biological genes and 40 cells (2 batches). 
 **Object stored using BASiCS version:  2.2.0** 
 Parameters:  mu delta phi s nu theta beta sigma2 epsilon RBFLocations 

# error here.
HVG <- BASiCS_DetectHVG(ChainSC, VarThreshold = 0.6)

Error in .HeaderDetectHVG_LVG(Chain = Chain, PercentileThreshold = PercentileThreshold, : 'Chain' includes residual over-dispersion parameters.

           'VarThreshold' will be ignored. 

           'PercentileThreshold'must be provided instead. 

Traceback:

1. BASiCS_DetectHVG(ChainSC, VarThreshold = 0.6)
2. BASiCS_DetectVG(Chain = Chain, Task = "HVG", ...)
3. .HeaderDetectHVG_LVG(Chain = Chain, PercentileThreshold = PercentileThreshold, 
 .     EpsilonThreshold = EpsilonThreshold, VarThreshold = VarThreshold, 
 .     Plot = Plot)
4. stop("'Chain' includes residual over-dispersion parameters.\n\n           'VarThreshold' will be ignored. \n\n           'PercentileThreshold'must be provided instead. \n")

I was thinking in using this function in an older version of BASiCS, e.g. BASiCS_1.8.1, but the function seems not to be available in this one.

Can the ChainSC be confirmed to work with the latest BASiCS version and then plotted? If this is not possible, what is the latest version where both MCMC + plotting steps work together?

I hope not to be wrong in the described behavior. If more clarifications required happy to send scripts and test cases.

Cheers,
Ignacio

@alanocallaghan
Copy link
Collaborator

The error is intended and informative. If you create a chain with Regression=FALSE then it will not occur:

ChainSC <- BASiCS_MCMC(Data = DataExample,
                     N = 1000, Thin = 10, Burn = 500, 
                     PrintProgress = FALSE, Regression = FALSE)

This means that residual overdispersion parameters ("epsilon") are not estimated. These are a measure of variability above or below that expected based on mean expression alone.

Alternatively you could create a chain using the example you posted and supply PercentileThreshold as suggested, or EpsilonThreshold to directly use the residual overdispersion parameters directly to call HVGs

ChainSC <- BASiCS_MCMC(Data = DataExample,
                     N = 1000, Thin = 10, Burn = 500, 
                     PrintProgress = FALSE, Regression = TRUE)
HVG <- BASiCS_DetectHVG(ChainSC, PercentileThreshold=0.1)

@ilibarra
Copy link
Author

ilibarra commented Dec 16, 2020

Thank you for the prompt reply! Working now.

@alanocallaghan
Copy link
Collaborator

No worries! Thanks for flagging it - probably a good sign that the documentation needs to be more explicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants