Explore the tables from Python

Explore the tables from Python

Everything the window shows is available from Python. A Context is one organism's gene table, its measured networks and the leakage guard every analysis applies.

In [1]:
from starplast import strategies as Sctx = S.shipped('Tg')print(ctx.organism, ctx.n, 'genes,', len(ctx.nodes.columns), 'columns')
Out[1]:
Tg 8140 genes, 438 columns
In [2]:
hits = ctx.nodes[ctx.nodes['product'].str.contains('microneme protein', na=False)]hits[['gene_id', 'product', 'compartment', 'fit_invitro_hff']].head(8)
Out[2]:
gene_id product compartment fit_invitro_hff
TGME49_267680 microneme protein MIC12 micronemes 0.5
TGME49_201780 microneme protein MIC2 micronemes -1.17
TGME49_245490 microneme protein MIC8 micronemes -1.71
TGME49_289630 microneme protein MIC16 micronemes 1.98
TGME49_254430 microneme protein, putative unassigned -0.27
TGME49_200230 microneme protein MIC17C unassigned NaN
TGME49_208030 microneme protein MIC4 micronemes 0.83
TGME49_222188 microneme protein MIC21L1 unassigned -0.8
In [3]:
ctx.truth('compartment').value_counts().head(10)
Out[3]:
count
compartment
nucleus - chromatin 769
cytosol 599
nucleus - non-chromatin 461
mitochondrion - soluble 274
ER 248
dense granules 193
mitochondrion - membranes 193
apicoplast 167
Golgi 153
PM - integral 135
In [4]:
print(len(ctx.categorical_columns()), 'labels can be held out, e.g.', ctx.categorical_columns()[:6])print(len(ctx.numeric_columns()), 'measurements are available as features')
Out[4]:
18 labels can be held out, e.g. ['dtm_class', 'lopit_map', 'lopit_mcmc', 'compartment', 'lopit_unified', 'ortholopit_label']
367 measurements are available as features

What a held-out analysis never sees

Holding a label out removes the label, anything that restates it (measured association of 0.8 or more, on values or ranks), the experiment that produced it, the same quantity measured another way, and any edge layer built from it. This is what makes a recovered label mean something.

In [5]:
sorted(ctx.banned('compartment'))
Out[5]:
['compartment', 'compartment_best', 'compartment_source', 'cyst_wall_max_spectral', 'cyst_wall_n_baits', 'lopit_confident', 'lopit_map', 'lopit_mcmc', 'lopit_methods_agree', 'lopit_prob_map', 'lopit_prob_mcmc', 'lopit_unified', 'ortholopit_accepted', 'ortholopit_accuracy', 'ortholopit_donors', 'ortholopit_label', 'pvm_proximity_positive', 'secretome_soluble_over_vesicle_log2']
In [6]:
print('edge layers:', ctx.layers())print('banned when compartment is held out:', sorted(ctx.banned_layers('compartment')))
Out[6]:
edge layers: ['coexpression', 'cofitness', 'comention', 'comention_ft', 'compartment', 'cotranslation', 'domain', 'ip_ms', 'orthogroup', 'struct', 'structural_hole', 'unwritten_interaction', 'xlms']
banned when compartment is held out: ['compartment']