Load the source code of the API call at http://pmb-bordeaux.fr/scripts/PyODAM.py


In [1]:
%load http://pmb-bordeaux.fr/scripts/PyODAM.py

Load the source code of the PCA at http://pmb-bordeaux.fr/scripts/PyODAM_pca.py


In [2]:
%load http://pmb-bordeaux.fr/scripts/PyODAM_pca.py

Get the data from ODAM


In [3]:
## API Call to retrieve data
dataset = 'frim1'
subset = 'qNMR_metabo'
d = getSubsetFromODAM(dataset, subset)

## Retrieve factors
d['factor']['Attribute']


Out[3]:
0    Treatment
1     DevStage
2     FruitAge
Name: Attribute, dtype: object

In [4]:
# Matrix X
X = d['data'][d['numvars']]

# Choose 'DevStage' as Factor (index=1)
facname = d['factor'].Attribute[1]
Y = d['data'][facname]

# Factor levels
factorlevels = []
for f in Y:
    if f not in factorlevels:
        factorlevels.append(f)
factorlevels


Out[4]:
['FF.01', 'FF.03', 'FR.01', 'FR.04', 'FR.02', 'FF.04', 'FF.02', 'FR.03']

Compute then plot PCA


In [5]:
# Compute PCA
res_pca = PCA_compute(X, Y, n=3, scale=True)

# Factor level selection
FacLevSel = ['FF.01', 'FF.02', 'FF.04', 'FR.02', 'FR.04']

# Plot PCA Scores
plotPCA(res_pca, 1, 3, FacLevSel)



In [6]:
# Explained Variance (%)
res_pca['EV']


Out[6]:
array([38.27177796, 23.22130007, 14.47418228])

0ct, 4 2019 - Daniel Jacob INRA UMR 1332 - MetaboHub Bordeaux