stefpeschel / NetCoMi

Network construction, analysis, and comparison for microbial compositional data
GNU General Public License v3.0
143 stars 24 forks source link

Adjusting parameters for cclasso in NetConstruct() #80

Closed SMBKrause closed 1 year ago

SMBKrause commented 1 year ago

Hi there,

I am currently working with NetCoMi and it is a great resource.

However, I can't figure out how to change the parameters using the cclasso approach in NetConstruct().

I already know that the pseudocount argument can be resolved like this in NetConstruct()

zeroPar = list(pseudocount = 0.5),

But how can I specify the other parameters from the cclasso function in NetConstruct():

cclasso(x, counts = F, pseudo = 0.5, sig = NULL, lams = 10^(seq(0, -8, by = -0.01)), K = 3, kmax = 5000, verbose = TRUE)

In addition, in the Rcode attached to the manuscript "NetCoMi: Network Construction and Comparision..." a cclasso example code is given. It uses # normMethod = "none" as argument. When I run the code then # Normalization: Counts normalized by total sum scaling is shown. Is this the approach of cclasso to normalize the counts to get compositional data? I thought that total sum scaling is a proportional measure and not a compositional one.

Kind regards, Sascha Krause

stefpeschel commented 1 year ago

Hey Sascha, The approach for changing the parameters of the association estimation method is quite similar. You just need to pass the list with parameters to measurePar. Here's an example:

netConstruct(data = ...,
             measure = "cclasso", 
             measurePar = list(sig = ..., 
                               lams = ...))

As for the normalization method: cclasso log-transforms the data internally and expects either counts or fractions as input. If the input is counts, they will be transformed into fractions within cclasso anyway. Therefore, netConstruct sets the cclasso parameter "counts" to false and converts the counts to fractions beforehand. Also, most zero replacement methods return fractions so that the data would have to be transformed back and forth otherwise. So, the two cclasso parameters "counts" and "pseudo" are set within netConstruct, which cannot be overwritten.

Best, Stefanie

SMBKrause commented 1 year ago

Hi Stefanie,

Thank you for your explanation!

Best wishes, Sascha