Hi, 

I'm trying to reproduce the calculation of moderated z-score (MODZ) described in PMID: 29195078 for some microarray data. Calculation is described as follows:

> Replicate-consensus signatures (MODZ) L1000 experiments are typically
> done in 3 or more biological replicates. We derive a consensus
> replicate signature by applying the moderated z-score (MODZ) procedure
> as follows. First, a pairwise Spearman correlation matrix is computed
> between the replicate signatures in the space of landmark genes with
> trivial self-correlations being ignored (set to 0). Then, weights for
> each replicate are computed as the sum of its correlations to the
> other replicates, normalized such that all weights sum to 1. Finally,
> the consensus signature is given by the linear combination of the
> replicate signatures with the coefficients set to the weights. This
> procedure serves to mitigate the effects of uncorrelated or outlier
> replicates, and can be thought of as a ‘de-noised’ representation of
> the given experiment’s transcriptional consequences.

I already calculated robust z-score for each gene (n=900) at every sample (n=6, 3 controls, 3 treatments) and I used the transposed matrix (genes as columns, samples as rows) to calculate pairwise spearman correlation using:

    cor<- cor(tm, use="pairwise.complete.obs","spearman")

but I'm sure I'm missing something because I get error 

    Error in cor(tm, use = "pairwise.complete.obs", "spearman") : 
      'y' must be numeric

I don't know how to define x or y (I'm quite newby with R), but as I understand, I have to correlate control 1 to control 2, control 2 to control 3 and control 1 to control 3 individually and same for treatments and then compute the weights.

Any ideas about the code or how to proceed will be very much welcome!!!

Gema


As just mentioned on your other post, you need `method="spearman"`, since otherwise R is seeing the unnamed argument as the thing you should be correlating `tm` with. Also, you want `t(tm)`, as Kevin mentioned.