Closed willbradshaw closed 4 years ago
Hi Will, Indeed your three questions can be answered by a single answer:
g.marginals[0]["even_nickname"]
is a vector or higher order array of probabilities. Additional dimensions will be present in case the realization of the considered event is conditionally dependent on other events. g.marginals[1]["even_nickname"]
will give you the order of the dimensions. R.name
: the realization name, e.g for gene choices the name of the geneR.value
: the actual value associated with the realization name, e.g for gene choice the actual gene sequenceR.index
: the realization index on the marginal array. So if you want the probability of the realization R
just access ``g.marginals[0]["even_nickname"][R.index]
(note this only works with the 1 dimensional example, otherwise you will have to specify indices for the others dimensions too)These properties are the same than the ones described for the C++ interface: https://github.com/qmarcou/IGoR#inference-and-evaluation-output
The fact that for insertions the 3 properties are equal is true only if the model has been constructed in a special way defining a range of authorized number of insertions. Bottom line: stick with using R.index
even for insertions
Hope this helps
Hi there,
I'm trying to access the insertion/deletion/gene-choice/etc probabilities from an inferred IGoR model for visualisation using
pygor
. I imported thepygor.models.genmodel.GenModel
object and rang = GenModel(<path_to_parms_file>,<path_to_marginals_file>)
for the
final_parms.txt
andfinal_marginals.txt
files in theigor/evaluate
directory. Sticking with VD-insertions for now as an example, I could find two entries that looked promising:g.marginals[0]["vd_ins"]
gives me a vector of what look like probabilities, presumably of different numbers of insertions.g.get_event("vd_ins", True).realizations
gives me a list ofEvent_realization
objects of the same length as the marginal array from the previous point. Each realisation R has an associated integer accessible byR.value
(orR.index
- the two are always the same).To get from here to a plot I need some more information about how data is organised in the GenModel object, which I'd be grateful if you could shed some light on:
realization.value
integers the number of insertions associated with each realization? What does the order of realizations in the event tell me?Some of these questions are probably redundant. :-)
Thanks! Will