In [9]:
%matplotlib inline
import pandas as pd

Figure 3 csv data generation

Figure data consolidation for Figure 3, which shows patterns of nestedness in beta diversity

Figure 3a: phyla occupancy plot, all samples


In [3]:
# read in nestedness output for all samples

fig3a = pd.read_csv('../../../data/nestedness/nest_phylum_allsamples.csv')

fig3a.head()


Out[3]:
SAMPLE_RANK OBSERVATION_RANK SAMPLE_ID OBSERVATION_ID empo_3 METADATA_NUMERIC_CODE
0 1171 68 1747.DZF.6252012.A.log k__Bacteria;p__Fusobacteria Plant corpus 1
1 1171 82 1747.DZF.6252012.A.log k__Bacteria;p__Cyanobacteria Plant corpus 1
2 1171 71 1747.DZF.6252012.A.log k__Bacteria;p__Armatimonadetes Plant corpus 1
3 1171 78 1747.DZF.6252012.A.log k__Bacteria;p__Planctomycetes Plant corpus 1
4 1171 81 1747.DZF.6252012.A.log k__Bacteria;p__Firmicutes Plant corpus 1

Fig 3b: phyla occupancy plot, individual Empo_2 categories


In [4]:
fig3b_animal = pd.read_csv('../../../data/nestedness/nest_phylum_Animal.csv')
fig3b_plant = pd.read_csv('../../../data/nestedness/nest_phylum_Plant.csv')
fig3b_saline = pd.read_csv('../../../data/nestedness/nest_phylum_Saline.csv')
fig3b_nonsaline = pd.read_csv('../../../data/nestedness/nest_phylum_Non-saline.csv')

Fig 3c: NODF model results


In [37]:
fig3c = pd.read_csv('../../../data/nestedness/nestedness_null_model_results_2017-09-19.csv')

fig3c.head()


Out[37]:
EMPO_SUBSET TAXONOMIC_LEVEL NODF_NULL_MEAN NODF_NULL_STDEV NODF_OBSERVED
0 All class 0.254916 0.006882 0.732128
1 All family 0.187935 0.005303 0.434909
2 All genus 0.072319 0.004046 0.256224
3 All order 0.225096 0.005760 0.582832
4 All otu 0.010253 0.000911 0.039439

Write to Excel notebook


In [40]:
fig3 = pd.ExcelWriter('Figure3_data.xlsx')

fig3a.to_excel(fig3,'Fig-3a')
fig3b_animal.to_excel(fig3,'Fig-3b_animal')
fig3b_plant.to_excel(fig3,'Fig-3b_plant')
fig3b_saline.to_excel(fig3,'Fig-3b_saline')
fig3b_nonsaline.to_excel(fig3,'Fig-3b_nonsaline')
fig3c.to_excel(fig3,'Fig-3c')

fig3.save()

In [ ]: