1. Import and read mtg file

note: Requirement for this tutorial: you must have to create an MTG file and upload .mtg file in share/data (cf. tutorial XXX)

1.1. Modules requierement

1.1.1. Import openalea module

[1]:
from openalea.mtg.algo import split
from openalea.mtg import algo
import pandas as pd
from collections import OrderedDict, defaultdict

1.1.2. Import oawidget module

[2]:
from oawidgets.mtg import plot

1.1.3. Import strawberry modules

[3]:
import openalea.strawberry #import openalea.strawberry module
from openalea.strawberry.import_mtgfile import import_mtgfile
from openalea.strawberry.import_mtgfile import plant_number_by_varieties

1.2. Import mtg and read

NOTE: In our package each mtg file correspond to some plant of one variety

  • Import and read one mtg file (MTG file corresponding to one varity)

[4]:
g = import_mtgfile(filename= ["Breadding_value"])
print(g)

MTG : nb_vertices=158, nb_scales=4
  • import several mtg file for meta-analysis (Some varieties)

[5]:
metaMTG= import_mtgfile(filename=["Capriss", "Ciflorette", "Clery", "Cir107", "Darselect", "Gariguette"])
print(metaMTG)
g=metaMTG
MTG : nb_vertices=37860, nb_scales=4

1.3. Somes functions to check if mtg are correctly read

1.3.1. Display mtg

[ ]:
# display in the console the MTG stored in g (here one genotype)
# g.display()

Each plant in the MTG can be displayed as a graph

[6]:
straws = split(g)
stade= straws[0].property("Stade")
# plot(straws[0])

1.3.2. Check properties contains in mtg

In mtg properties correspond to all parameters which define mtg (Measurements, label, edge_type…)

[7]:
metaMTG.properties().keys()
[7]:
dict_keys(['edge_type', 'label', 'Experiment_name', 'Sample_date', 'Genotype', 'Modality', 'Plant_ID', '_line', 'DBI', 'Stade', 'PETLG', 'LFTLG_CENTRAL', 'LFTLG_LEFT', 'INFLOLG', 'FLWRNUMBER', 'FLWRNUMBER_OPEN', 'FLWRNUMBER_ABORTED', 'SAMPLING', 'FLWRNUMBER_CLOSED'])

1.3.3. Check varieties and the number of plant contain in mtg files

[8]:
plant_number_by_varieties(g=metaMTG)
Darselect : 54 plants
Cir107 : 54 plants
Ciflorette : 54 plants
Gariguette : 54 plants
Capriss : 54 plants
Clery : 54 plants
[ ]: