Skip to content

Manual phenotype extraction

Martin Zackrisson edited this page Mar 31, 2016 · 10 revisions

There really should be only one reason to do this and that is to re-use the quality control work done previously but obtain new phenotypes that were released after the feature extraction was run on a project. It can be used to access developmental and experimental phenotypes BUT YOU USE THOSE AT YOUR OWN RISK!

First navigate to the analysis folder of interest and start ipython.

Second import the dependencies needed:

from scanomatic.dataProcessing.growth_phenotypes import PhenotypeDataType
from scanomatic.dataProcessing import phenotyper

Second, load the previous state of the analysis and feature extraction:

P = phenotyper.Phenotyper.LoadFromState(".")

Then, if you intend to obtain phenotypes in development or even experimental phenotypes you need to set the inclusion level:

P.set_phenotype_inclusion_level(PhenotypeDataType.UnderDevelopment)

BUT YOU REALLY SHOULDN'T

The relevant levels are: PhenotypeDataType.Trusted (Default), PhenotypeDataType.UnderDevelopment, and PhenotypeDataType.All.

Third, remove previous phenotypes and extract new ones from the data object (nothing happens in the directory):

P.wipe_extracted_phenotypes()
P.extract_phenotypes()

This takes a little while (5-10 minutes on most computers).

Finally it is time to save the data, in this example we'll overwrite the present by saying that the target directory is ., but it could easily be changed to something else if you wish to keep both versions.

P.save_state('.')

There's currently no fast and easy way to redo spatial normalization, but this will come soon. Instead you would need to use the user interface for quality control at the moment.

If you wish to obtain some specific phenotype's non-normed data you can easily do that by e.g.:

from scanomatic.dataProcessing.growth_phenotypes import Phenotypes
GT = P.get_phenotype(Phenotypes.GenerationTime)

Getting some specific results from an analysis

Load results and if you haven't added meta-data before load meta-data too:

from scanomatic.dataProcessing import phenotyper
P = phenotyper.Phenotyper.LoadFromState(".")
P.load_meta_data("/home/martin/Data2/scan-o-matic/qc_plate_layout.ods")

If we want only the results where meta-data matches a criteria we do:

S = P.find_in_meta_data(u'201-37')

If you want to limit to a column:

S = P.find_in_meta_data(u'201-37', column=0)

of you can give column by header name if they have headers in the meta-data. This selection object can be used and combined with other selection objects (e.g. S1 + S2).

Example plotting a selected groups of curves:

from matplotlib import pyplot as plt
plt.ion()
plt.semilogy(P.times, S.smooth_growth_data[1].T, basey=2)
plt.legend(S.meta_data[1], loc="lower right")
plt.xlabel("Time [h]")
plt.ylabel("Population size [cells]")

This plots the matching curves from plate indexed 1 (plate 2)