The E. coli datasets
Run the full walkthrough in the browser with nothing installed: open the notebook in Google Colab with the badge above and choose Runtime, Run all.
Four built Escherichia coli K-12 datasets load with one constructor call each, from a plain install of torchcell and with no account or key.
Quick start
pip install torchcell # Python 3.13 or newer; or: uv pip install torchcell
import os
from torchcell.endpoint_http import DEFAULT_URL
os.environ.setdefault("TC_DATA_URL", DEFAULT_URL) # download built stores
from torchcell.datasets.ecoli.campos2018 import GrowthRateCampos2018Dataset
growth = GrowthRateCampos2018Dataset(root="data/torchcell/ecoli_growth_rate_campos2018")
print(len(growth)) # 3664
print(growth[0]["experiment"]["phenotype"]["fitness"])
The constructor downloads the store on first use and opens it from disk after that. Nothing else is needed: no repository checkout, no database, no DATA_ROOT. The four downloads together take seconds to a few tens of seconds (Downloading the E. coli archives).
This page says what each dataset holds and shows one figure of its values. The full walkthrough, with every record, table and plot, is a notebook:
E. coli datasets in torchcell: the notebook rendered here, with its outputs and the plotting code collapsed.
Open it in Google Colab to run it in the browser with nothing installed: the first cell installs
torchcell.Download ecoli_datasets.ipynbto run it yourself.
Dataset |
Loader |
Label of one record |
Records |
Values per record |
Store slug |
|---|---|---|---|---|---|
Campos 2018, growth rate |
|
maximal growth rate relative to the parent strain |
3,664 |
1 |
|
Campos 2018, imaging |
|
cell-shape and cell-cycle features |
3,664 |
15 |
|
Babu 2014, genetic interaction |
|
S-score of a double mutant |
42,705 |
1 |
|
Fuhrer 2017, metabolome |
|
modified z-score per detected ion |
3,806 |
7,534 |
|
At a glance
Every dataset is described by the same rows, counted from the loaded records: the shape of the labels, the genotype and how it was perturbed, and the growth condition. The same card, for one dataset, opens each section below.
Property |
Campos 2018, growth rate |
Campos 2018, imaging |
Babu 2014, genetic interaction |
Fuhrer 2017, metabolome |
|---|---|---|---|---|
Records |
3,664 |
3,664 |
42,705 |
3,806 |
Distinct strains (genotypes) |
3,664 |
3,664 |
42,603 |
3,806 |
Label array (records x values) |
3,664 x 1 |
3,664 x 15 |
42,705 x 1 |
3,806 x 7,534 |
Missing label values |
0 of 3,664 |
1,452 of 54,960 |
0 of 42,705 |
0 of 28,674,404 |
Experiment type |
fitness |
morphology |
gene interaction |
metabolite |
Label field |
fitness |
morphology |
gene_interaction |
metabolite_level |
Label attaches to |
global |
global |
hyperedge |
metabolism |
Measurements behind one record |
1 biological_replicate |
43 to 1,658 cell |
8 colony |
not recorded |
Genes perturbed per record |
1 |
1 |
2 |
1 (3,785); 2 (18); 3 (3) |
Perturbation type |
deletion_strain |
deletion_strain |
deletion_strain (81,777); marked_allele (3,503); released_identifier (130) |
released_identifier |
Perturbation mechanism |
deletion |
deletion |
deletion (81,907); transgenic_insertion (3,503) |
deletion |
Strain collection |
Keio collection |
Keio collection |
Hfr Cavalli (Hfr C) donor query strains (42,705); Keio collection (40,226); SPA-tag essential (2,479) |
KEIO knockout collection |
Distinct genes perturbed |
3,664 |
3,664 |
3,876 |
3,806 |
Gene identifier namespace |
ecoli_k12_bw25113_locus_tag |
ecoli_k12_bw25113_locus_tag |
ecoli_k12_mg1655_bnumber |
ecoli_k12_bw25113_locus_tag |
Medium |
M9, liquid |
M9, liquid |
LB, solid |
M9, liquid |
Temperature |
30 Celsius |
30 Celsius |
32 Celsius |
37 Celsius |
In the figures, red marks values below a reference level and blue marks values above it.
How each dataset names its genes
Every perturbation in every record names its gene twice. perturbed_gene_name is the gene symbol. systematic_gene_name is an identifier in the namespace that gene_namespace names. The identifier is not the same kind in every dataset: the Campos 2018 stores hold BW25113 locus tags that the loader mapped from the released gene symbol, the Babu 2014 store holds the MG1655 b-numbers the paper released, and the Fuhrer 2017 store holds the Keio JW ids its deposit released. A row whose perturbation_type is released_identifier holds the identifier exactly as the source released it, not resolved against a genome annotation.
dataset perturbation_type namespace identifier_kind mapped_from perturbations genes example_symbol example_identifier
ecoli_growth_rate_campos2018 deletion_strain ecoli_k12_bw25113_locus_tag locus identifier gene_symbol 3664 3664 hchA BW25113_1967
ecoli_morphology_campos2018 deletion_strain ecoli_k12_bw25113_locus_tag locus identifier gene_symbol 3664 3664 hchA BW25113_1967
gene_interaction_babu2014 deletion_strain ecoli_k12_mg1655_bnumber locus identifier released as is 81777 3719 thrA b0002
gene_interaction_babu2014 marked_allele ecoli_k12_mg1655_bnumber locus identifier released as is 3503 150 holA b0640
gene_interaction_babu2014 released_identifier ecoli_k12_mg1655_bnumber b-number with a Keio sub-number released as is 93 8 yaaV b0033.1
gene_interaction_babu2014 released_identifier ecoli_k12_mg1655_bnumber Keio JW number released as is 33 2 fucT JW5447
gene_interaction_babu2014 released_identifier ecoli_k12_mg1655_bnumber gene symbol released as is 4 1 xylU cscR
metabolome_fuhrer2017 released_identifier ecoli_k12_bw25113_locus_tag Keio JW id released as is 3830 3830 aaeA JW3210
The gene symbol is the one name all four datasets carry, so it is the key to join them on. The table counts the symbols each pair of datasets shares, with each dataset’s own count on the diagonal.
ecoli_growth_rate_campos2018 ecoli_morphology_campos2018 gene_interaction_babu2014 metabolome_fuhrer2017
ecoli_growth_rate_campos2018 3664 3664 3176 3154
ecoli_morphology_campos2018 3664 3664 3176 3154
gene_interaction_babu2014 3176 3176 3876 3510
metabolome_fuhrer2017 3154 3154 3510 3806
The genome behind each dataset
Every record names the genome assembly it is written against, and genome_for(dataset) returns that genome: it reads the assembly id from the records, downloads the files into ./torchcell-genomes/ and builds the genome object. Each file is taken from its original source when the bytes there still match the recorded sha256 and from the torchcell mirror otherwise. load_genome("<assembly set>") loads one of these by its id without a dataset.
ecoli_B_REL606_ASM1798v1 Escherichia coli B REL606 -> EcoliBREL606Genome
ecoli_K12_BW25113_ASM75055v1 Escherichia coli K-12 BW25113 -> EcoliK12BW25113Genome
ecoli_K12_MG1655_ASM584v2 Escherichia coli K-12 MG1655 -> EcoliK12MG1655Genome
ecoli_K12_W3110_ASM1024v1 Escherichia coli K-12 W3110 -> EcoliK12W3110Genome
pputida_KT2440_ASM756v2 Pseudomonas putida KT2440 -> PPutidaKT2440Genome
scerevisiae_CENPK113-7D_ASM257140v2 Saccharomyces cerevisiae CEN.PK113-7D -> CenPk1137DGenome
sgd_S288C_R64-4-1_20230830 Saccharomyces cerevisiae S288C -> SCerevisiaeGenome
Three of the four datasets are written against BW25113, the Keio parent strain, and the Babu 2014 pairs against MG1655. resolve_gene_name maps each identifier a dataset stores to a locus tag of its genome and reports how it resolved: current, renamed (an alias of one current gene), non_gene_feature (a locus the annotation does not class as a gene) or retired (not in the annotation). The records themselves are never filtered by the genome.
ecoli_growth_rate_campos2018
genome EcoliK12BW25113Genome (ecoli_K12_BW25113_ASM75055v1)
genome genes 4,303
dataset genes 3,664: {'current': 3573, 'non_gene_feature': 91}
ecoli_morphology_campos2018
genome EcoliK12BW25113Genome (ecoli_K12_BW25113_ASM75055v1)
genome genes 4,303
dataset genes 3,664: {'current': 3573, 'non_gene_feature': 91}
gene_interaction_babu2014
genome EcoliK12MG1655Genome (ecoli_K12_MG1655_ASM584v2)
genome genes 4,506
dataset genes 3,880: {'current': 3726, 'non_gene_feature': 136, 'renamed': 1, 'retired': 17}
metabolome_fuhrer2017
genome EcoliK12BW25113Genome (ecoli_K12_BW25113_ASM75055v1)
genome genes 4,303
dataset genes 3,830: {'non_gene_feature': 151, 'renamed': 3632, 'retired': 47}
The genes of the genome are the nodes of a cell graph. A record becomes model input as the indices of the nodes its strain perturbs, with the phenotype as the label, and each node carries its sequence, protein and GO terms.
stored identifiers ['b0002', 'b0015']
genome locus tags ['b0002', 'b0015']
perturbed nodes [1, 14] of 4,506
label gene_interaction
b0002 thrA: 2,463 bp, protein 820 aa, GO terms 13
b0015 dnaJ: 1,131 bp, protein 376 aa, GO terms 22
Growth rate (Campos 2018)
Property |
Campos 2018, growth rate |
|---|---|
Records |
3,664 |
Distinct strains (genotypes) |
3,664 |
Label array (records x values) |
3,664 x 1 |
Missing label values |
0 of 3,664 |
Experiment type |
fitness |
Label field |
fitness |
Label attaches to |
global |
Measurements behind one record |
1 biological_replicate |
Genes perturbed per record |
1 |
Perturbation type |
deletion_strain |
Perturbation mechanism |
deletion |
Strain collection |
Keio collection |
Distinct genes perturbed |
3,664 |
Gene identifier namespace |
ecoli_k12_bw25113_locus_tag |
Medium |
M9, liquid |
Temperature |
30 Celsius |
One record per strain of the Keio collection, the single-gene deletion strains of E. coli K-12 BW25113. The label is the strain’s maximal growth rate in M9 medium with casamino acids and glucose at 30 °C, as a ratio to the parent strain, so the reference level is 1.0. Each value comes from one growth curve, and the release gives no spread.
from torchcell.datasets.ecoli.campos2018 import GrowthRateCampos2018Dataset
dataset = GrowthRateCampos2018Dataset(root="data/torchcell/ecoli_growth_rate_campos2018")
record = dataset[0] # a dict: experiment, reference, publication
Fig. 8 Growth rate of the Keio strains in GrowthRateCampos2018Dataset. a, strains per 0.02-wide bin of growth rate relative to the parent, slower than the parent in red and faster in blue, with the parent level of 1.0 dashed. b, the strains ranked from slowest to fastest, with the five slowest named. c, the median (dot) and the interquartile range (bar) of the strains on each Keio plate.
Cell shape and cell cycle (Campos 2018)
Property |
Campos 2018, imaging |
|---|---|
Records |
3,664 |
Distinct strains (genotypes) |
3,664 |
Label array (records x values) |
3,664 x 15 |
Missing label values |
1,452 of 54,960 |
Experiment type |
morphology |
Label field |
morphology |
Label attaches to |
global |
Measurements behind one record |
43 to 1,658 cell |
Genes perturbed per record |
1 |
Perturbation type |
deletion_strain |
Perturbation mechanism |
deletion |
Strain collection |
Keio collection |
Distinct genes perturbed |
3,664 |
Gene identifier namespace |
ecoli_k12_bw25113_locus_tag |
Medium |
M9, liquid |
Temperature |
30 Celsius |
The same Keio strains from the same screen, imaged in phase contrast and, for most strains, with a DAPI nucleoid channel. A record summarizes the cells measured for one strain (the paper reports 291 ± 116 cells per strain), and its n_samples is that strain’s number of cells. The features fall in two groups. The cell-shape features (length, width, area, volume, surface area, perimeter, circularity, aspect ratio, surface-to-volume ratio) are stored as a mean in morphology and as a coefficient of variation in morphology_coefficient_of_variation. The nucleoid and cell-cycle features (nucleoid area, the timing of constriction and of nucleoid separation, the fraction of cells with two nucleoids) exist only for strains imaged with a nucleoid channel, so a strain without one holds 9 mean features and not 15. Feature names are the symbols the paper gives them:
symbol name group statistic unit
<L> Mean cell length morphological mean µm
CV_L Cell length variability morphological coefficient_of_variation None
<W> Mean cell width morphological mean µm
CV_W Cell width variability morphological coefficient_of_variation None
<A> Mean cell area morphological mean µm2
CV_A Cell area variability morphological coefficient_of_variation None
<V> Mean cell volume morphological mean µm3
CV_V Cell volume variability morphological coefficient_of_variation None
<SA> Mean cell surface area morphological mean µm2
CV_SA Cell surface area variability morphological coefficient_of_variation None
<P> Mean cell perimeter morphological mean µm
CV_P Cell perimeter variability morphological coefficient_of_variation None
<C> Mean circularity morphological mean None
CV_C Circularity variability morphological coefficient_of_variation None
<Ar> Mean aspect ratio morphological mean None
CV_Ar Aspect ratio variability morphological coefficient_of_variation None
<SA/V> Mean surface area-to-volume ratio morphological mean µm-1
CV_SA/V Surface area-to-volume ratio variability morphological coefficient_of_variation None
CV_DR Division ratio variability morphological coefficient_of_variation None
<NA> Mean nucleoid area morphological mean µm2
CV_NA Nucleoid area variability morphological coefficient_of_variation None
rho_CD Correlation in nucleoid and cell constriction cell_cycle pearson_correlation None
CDN_C0 Nucleoid constriction degree at the initiation of cell constriction cell_cycle regression_intercept None
Rel.timing div Relative timing of cell constriction cell_cycle inferred_relative_timing None
Rel.timing nuc Relative timing of nucleoid separation cell_cycle inferred_relative_timing None
%2N Fraction of cells with 2 nucleoids cell_cycle fraction_of_cells None
from torchcell.datasets.ecoli.campos2018 import MorphologyCampos2018Dataset
dataset = MorphologyCampos2018Dataset(root="data/torchcell/ecoli_morphology_campos2018")
record = dataset[0] # a dict: experiment, reference, publication
Fig. 9 Cell shape of the Keio strains in MorphologyCampos2018Dataset, one point or count per strain. a, strains per 0.04 µm bin of mean cell length. b, mean cell width against mean cell length. c, mean cell area against the growth rate of the same strain from GrowthRateCampos2018Dataset, strains slower than the parent in red and faster in blue.
Genetic interactions (Babu 2014)
Property |
Babu 2014, genetic interaction |
|---|---|
Records |
42,705 |
Distinct strains (genotypes) |
42,603 |
Label array (records x values) |
42,705 x 1 |
Missing label values |
0 of 42,705 |
Experiment type |
gene interaction |
Label field |
gene_interaction |
Label attaches to |
hyperedge |
Measurements behind one record |
8 colony |
Genes perturbed per record |
2 |
Perturbation type |
deletion_strain (81,777); marked_allele (3,503); released_identifier (130) |
Perturbation mechanism |
deletion (81,907); transgenic_insertion (3,503) |
Strain collection |
Hfr Cavalli (Hfr C) donor query strains (42,705); Keio collection (40,226); SPA-tag essential (2,479) |
Distinct genes perturbed |
3,876 |
Gene identifier namespace |
ecoli_k12_mg1655_bnumber |
Medium |
LB, solid |
Temperature |
32 Celsius |
One record per double mutant. A donor strain carrying one marked deletion is crossed by conjugation with an arrayed recipient strain carrying another, and the double mutant’s colony size is measured. The label is the interaction score \(S\) of the pair. Butland et al. 2008, the method paper, define it in words: “We then calculated an interaction score (S) to quantify the strength and confidence of genetic interaction determined for each mutant gene pair. Negative \(S\) scores correspond to putative aggravating interactions and positive S scores, to putative alleviating interactions.” Babu et al. 2014 average eight replicate colony measurements of each pair into one score. The release holds only the high-confidence pairs, which the paper states as
42,705 pairs in all, so no stored score lies near zero. Neither paper prints the formula that turns colony sizes into \(S\): both refer to Collins et al. 2006 (Genome Biology 7, R63) for it.
from torchcell.datasets.ecoli.babu2014 import GeneInteractionBabu2014Dataset
dataset = GeneInteractionBabu2014Dataset(root="data/torchcell/gene_interaction_babu2014")
record = dataset[0] # a dict: experiment, reference, publication
Fig. 10 S-scores in GeneInteractionBabu2014Dataset. a, gene pairs per unit-wide bin of S-score, negative scores in red and positive scores in blue. The gap around zero is the high-confidence cut. b, genes by the number of scored pairs each takes part in, on logarithmically spaced bins. c, positive against negative pairs per gene, one point per gene, on axes that are linear from 0 to 1 and logarithmic above.
Metabolome (Fuhrer 2017)
Property |
Fuhrer 2017, metabolome |
|---|---|
Records |
3,806 |
Distinct strains (genotypes) |
3,806 |
Label array (records x values) |
3,806 x 7,534 |
Missing label values |
0 of 28,674,404 |
Experiment type |
metabolite |
Label field |
metabolite_level |
Label attaches to |
metabolism |
Measurements behind one record |
not recorded |
Genes perturbed per record |
1 (3,785); 2 (18); 3 (3) |
Perturbation type |
released_identifier |
Perturbation mechanism |
deletion |
Strain collection |
KEIO knockout collection |
Distinct genes perturbed |
3,806 |
Gene identifier namespace |
ecoli_k12_bw25113_locus_tag |
Medium |
M9, liquid |
Temperature |
37 Celsius |
One record per Keio strain, measured by flow-injection time-of-flight mass spectrometry. The label maps each detected ion to a modified z-score, the strain’s level of that ion standardized across strains. An ion here is a mass feature, a peak at one mass-to-charge ratio in the negative or the positive ionization mode, keyed neg_0001, pos_0001 and so on. The store does not name a metabolite for an ion: preprocess/ions.csv gives each ion’s mode and mass-to-charge ratio, and matching an ion to a compound is left to the reader. Every record holds the same ions in the same order, so the labels stack into one strains-by-ions matrix. The first lines printed on loading give the number of ions in each mode and their mass-to-charge range:
3,806 records
strain aaeA
ions 7534 first {'neg_0001': -0.4309, 'neg_0002': -0.1195, 'neg_0003': -0.6621, 'neg_0004': 0.9284}
size min max
mode
neg 3169 56.9972 998.7170
pos 4365 55.0177 998.7871
from torchcell.datasets.ecoli.fuhrer2017 import MetabolomeFuhrer2017Dataset
dataset = MetabolomeFuhrer2017Dataset(root="data/torchcell/metabolome_fuhrer2017")
record = dataset[0] # a dict: experiment, reference, publication
Fig. 11 Modified z-scores in MetabolomeFuhrer2017Dataset. a, all strain and ion values per 0.5-wide bin, negative values in red and positive values in blue, on a logarithmic count axis. b, strains by the number of ions whose z-score is beyond 5 in absolute value, in bins of 10 ions. c, for each ion, the number of strains beyond 5 against the ion’s mass-to-charge ratio, colored by ionization mode.
Provenance
Notebook:
experiments/034-showcase-datasets/notebooks/ecoli_datasets.ipynb, built byexperiments/034-showcase-datasets/scripts/ecoli_download_tutorial_page.pyfrom the blocks ofecoli_download_tutorial.pyand run in a Jupyter kernel.The figures and tables on this page are from the same code run as a script, 179 mm wide with 7 pt Arial text and colors from
torchcell.utils.PLOT_PALETTE.The S-score quotes are from Butland et al. 2008 (main text) and Babu et al. 2014 (Protocol S2 and Results), as pinned in
torchcell/datasets/ecoli/babu2014.py.The printed output was byte-identical on a repository checkout and on a new environment installed from PyPI (Install timings and release checks).