MuSiC icon indicating copy to clipboard operation
MuSiC copied to clipboard

bugs with weight of cross cell type co-variance

Open Prayforhanluo opened this issue 4 years ago • 1 comments

the code in function music_prop:

  if(ct.cov){
    Sigma.ct = sc.basis$Sigma.ct[, m.sc];

    if(sum(Yjg[, i] == 0) > 0){
      D1.temp = D1[Yjg[, i]!=0, ];
      Yjg.temp = Yjg[Yjg[, i]!=0, i];
      Sigma.ct.temp = Sigma.ct[, Yjg[,i]!=0];
      ...
      ...

Is there miss for loop? like for(i in 1:N.bulk){}

Prayforhanluo avatar Aug 22 '19 02:08 Prayforhanluo

the code in function music.basic.ct

  for(iter in 1:iter.max){
         weight.gene = 1/(nu + r^2 + weight.cal.ct(lm.D$x*S, Sigma.ct))
         Y.weight = Y*sqrt(weight.gene)
         D.weight = X * as.matrix(sqrt(weight.gene))[,rep(1,k)]
         lm.D.weight = nnls(D.weight, Y.weight )
         p.weight.new = lm.D.weight$x/sum(lm.D.weight$x)
         r.new = resid(lm.D.weight)
         if(sum(abs(p.weight.new - p.weight)) < eps){
             p.weight = p.weight.new;
             ...
             ...

lm.D already fixed, will not update.? should it be weight.gene = 1/(nu + r^2 + weight.cal.ct(lm.D.weight$x*S, Sigma.ct))?

Prayforhanluo avatar Aug 22 '19 06:08 Prayforhanluo