cozygene / TCA

17 stars 11 forks source link

Tensor function Error #16

Closed hdesale2408 closed 1 year ago

hdesale2408 commented 2 years ago

Hello,

I used TCA to identify cell-type significantly differentially methylated CpGs between two exposure groups (approximately 32 in each group). In order to visualize the spread of data, I would like to present the methylation for each sample in either exposure group. Ideally, results should be graphically presented with a box plot or such for each significant CpG. I am trying to do this using the "tensor" function; however, I am getting an error.

In order to generate my model, I used the following code:

tca.mdl.chagas.2 <- tca(X = beta.values, W = out.l, C1 = pheno.tca, C2 = refactor.mdl.chagas$scores)

where:

In order to find my tensor estimates I used:

tensor.mdl.hit <- tensor(tca.mdl = tca.mdl.chagas.2, X = beta.values[hits.joint,,drop=F])

where:

the error I receive is:

INFO [2022-07-05 20:19:39] Validating input... INFO [2022-07-05 20:19:39] Starting tensor for estimating Z... INFO [2022-07-05 20:19:39] Estimate tensor... Error in X - tcrossprod(C2, deltas_hat) : non-conformable arrays

E-R commented 2 years ago

The tca.mdl argument is "The value returned by applying the function tca to X." (per the documentation of tensor). In your case X is a subset of the matrix which was used for fitting the model in tca.mdl.chagas.2so the dimensions don't match. You can either learn the tensor for the full data matrix and then subset the CpGs you're interested in, or alternatively, you can learn a new model via tca for the CpGs in hits.joint only and then provide that model to your existing tensor call.

hdesale2408 commented 2 years ago

Thank you! In the resulting tensor.mdl.hit list, are the elements then referring to the estimated cell types?

E-R commented 1 year ago

sorry, I missed this somehow. Per the documentation,tensor.mdl.hit will be the estimated cell-type level methylation.