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

Modulo operation in updates.h

lilythepooh opened this issue · comments

Dear BASiCS team,

Thanks so much for reading this email.

I am reading the Metropolis-Hastings code in /src/updates.h. These is a lot of modulo operations "%" in this Metropolis-Hastings code. For example, in line 36:

arma::vec log_aux = (log(mu1) - log(mu0)) % sum_bycell_bio;

while I thought this line meant (log(μ1)-log(μ0))*Σ_j Counts(j), which was from the (μ_i)^(Σ x(i,j)) in (S12), Vallejos et al. 2016 (Supplementary). Could you please tell me if there is any reason for these modulo operations? or does it mean other operations?

Thanks again for your time. I am looking forward to hearing from you.

Best regards,
Sijia Li

Hi Sijia! Actually this isn't modulo, it's elementwise multiplication. I remember also being extremely confused about this at first, wondering why so many modulo operations were appearing when I could find none in the conditionals

The C++ code is based on RcppArmadillo, and I find the Armadillo documentation very helpful for a reference. I believe there's some nice sections about converting from matlab http://arma.sourceforge.net/docs.html#operators