All figures can be reproduced using the following three scripts:
estate_vintage_clf.py
: Decoding estate and vintage from wine chromatogramsparker_clf.py
: Decoding Parker's rating from wine chromatogramsembed.py
: Embedding wine chromatograms in 2d (3d) space using umap and tSNE
Each script contains functions to process raw data that is found in Source_Data/data
resulting in files for plotting, stored in Source_Data/res
, precomputed for your convenience.
Running all analyses from the raw data takes about 3 h on a laptop in total. All figures
are precomputed in Source_Data/figs
.
The Source_Data/data
contains the following:
oak.npy
, 80 wines x 30275 GC features, each wine e.g. with nameA_2012
, i.e. estate A, vintage 2012esters.npy
, 80x7881offFla.npy
, 80x10480concat.npy
, 80x48636
m_oak.npy
, 80x13m_esters.npy
, 80x16m_offFla.npy
, 80x3m_concat.npy
, 80x32
32_compound_names.npy
, chemical names for 32 compoundsparker_ratings.npy
, 80x1, Parker ratings (int between 0 and 100)varietals.npy
, 80x4, percentage of 4 grape types per winebordeaux_map.png
, map of Bordeaux area
In your python environment (for example installed via anaconda, latest version) install required libraries:
pip install --requirement requirements.txt
- Figure 1
plot_tile_main()
inembed.py
- Figure 2, 5(c,d)
plot_violin()
inestate_vintage_clf.py
- Figure 3, S9
plot_chunks2()
andplot_all_survival()
inestate_vintage_clf.py
- Figure 4, Table S1, Figure 5e,f
plot_violin_p()
inparker_clf.py
- Figure 5a,b
plot_tile_chem32()
inembed.py
- Figure S2
plot_tile_supp()
inembed.py
- Figure S3
plot_best_concat()
inestate_vintage_clf.py
- Figure S4
plot_vintage_decoding_per_wine()
inestate_vintage_clf.py
- Figure S5
PCA_features()
inestate_vintage_clf.py
- Figure S6
plot_weights()
inestate_vintage_clf.py
- Figure S7, S8, S11
plot_all_survival()
inestate_vintage_clf.py
- Figure S12
plot_weights_m_abs()
inestate_vintage_clf.py
- Figure S10
plot_chunk2()
inparker_clf.py
- Figure S13
plot_chunks_m_dists()
inestate_vintage_clf.py
- Table S2
varietals_table()
inembed.py
To clone this repository into your home directory, type in a terminal:
git clone https://github.com/mschart/wine_decoding.git
To reproduce figure 1, navigate into directory wine_decoding
,
start an ipython session and type:
# read in script (pip install missing libraries if needed) for figure 1
run '/home/mic/wine_decoding/embed.py'
# activate interactive plotting
plt.ion()
# plot figure 1 by running listed function (loading in raw data directly)
plot_tile_main()
Some figures need manual assembly (figure 5, 3, S2).