Cnv.model_amplicons

Cnv.model_amplicons#

missionbio.mosaic.cnv.Cnv.model_amplicons

Cnv.model_amplicons() LikelihoodMethod#

Fit the CNV amplicon model and return the LikelihoodMethod object.

It is an alternative to running normalization and ploidy calculation. The model can be saved to the assay using LikelihoodMethod.save_model(cnv). Only assays which are compatible with the LikelihoodMethod can store the model. Compatibility requires the assay used to create the model and the assay storing the model to have the same spikein.hash info attribute.

Snippets#

>>> import missionbio.mosaic as ms
>>> spikein = ms.load("/path/to/spikein.h5")
>>> sample = ms.load("/path/to/sample.h5")
>>>
>>> lm = spikein.cnv.model_amplicons()
>>> lm.save_model(sample.cnv)
>>> result = sample.sparc([], cnamps=sample.cnv.ids(), min_loh_group_size=2)
>>>
>>> # Add the results to the assay
>>> sample.cnv.add_labels(result.labels.values)  # Add the cluster labels to the assay
>>> sample.cnv.add_layer("flat-ploidy", result.profile.flat_ploidy.values)  # Integer CNV
>>> sample.cnv.add_layer("ploidy", result.profile.relative_ploidy.values)
>>> sample.cnv.signaturemap("ploidy", kind="mean")
Returns:
LikelihoodMethod

This object can be used to predict the CNV calls for other assays.


Cnv