Last updated: 2021-10-08

Checks: 6 1

Knit directory: Bonfini_eLife_2021/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20211008) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Using absolute paths to the files within your workflowr project makes it difficult for you and others to run your code on a different machine. Change the absolute path(s) below to the suggested relative path(s) to make your code more reproducible.

absolute relative
F:/Dropbox/Github/Bonfini_eLife_2021/data/ data
F:/Dropbox/Github/Bonfini_eLife_2021/data/1A.jpg data/1A.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/1C.jpg data/1C.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/1D.jpg data/1D.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_1.tiff data/Figures/Figure_1.tiff
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_1S1.tiff data/Figures/Figure_1S1.tiff
F:/Dropbox/Github/Bonfini_eLife_2021/data/1- S2A.jpg data/1- S2A.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/Plot_Fig1S2B.jpeg data/Plot_Fig1S2B.jpeg
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_1S2.tiff data/Figures/Figure_1S2.tiff
F:/Dropbox/Github/Bonfini_eLife_2021/data/1 - S3.jpg data/1 - S3.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_1S3.tiff data/Figures/Figure_1S3.tiff
F:/Dropbox/Github/Bonfini_eLife_2021/data/Plot_Fig2A.jpeg data/Plot_Fig2A.jpeg
F:/Dropbox/Github/Bonfini_eLife_2021/data/Nutri_geo_graph.jpg data/Nutri_geo_graph.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_2.tiff data/Figures/Figure_2.tiff
F:/Dropbox/Github/Bonfini_eLife_2021/data/Plot_Fig2-S1B.jpeg data/Plot_Fig2-S1B.jpeg
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_2S1.tiff data/Figures/Figure_2S1.tiff
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_2S2.tiff data/Figures/Figure_2S2.tiff
F:/Dropbox/Github/Bonfini_eLife_2021/data/3A.jpg data/3A.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/3B.jpg data/3B.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/3E.jpg data/3E.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/3F.jpg data/3F.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_3.tiff data/Figures/Figure_3.tiff
F:/Dropbox/Github/Bonfini_eLife_2021/data/3 - S1B.jpg data/3 - S1B.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/3 - S1D.jpg data/3 - S1D.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/3 - S1E.jpg data/3 - S1E.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/3 - S1F.jpg data/3 - S1F.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/3 - S1G.jpg data/3 - S1G.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_3S1.tiff data/Figures/Figure_3S1.tiff
F:/Dropbox/Github/Bonfini_eLife_2021/data/4E.jpg data/4E.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/4F.jpg data/4F.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/4G.jpg data/4G.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/4H.jpg data/4H.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/4I.jpg data/4I.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/4J.jpg data/4J.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_4.tiff data/Figures/Figure_4.tiff
F:/Dropbox/Github/Bonfini_eLife_2021/data/4 - S1B.jpg data/4 - S1B.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/Plot_Fig4-S1F.jpeg data/Plot_Fig4-S1F.jpeg
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_4S1.tiff data/Figures/Figure_4S1.tiff
F:/Dropbox/Github/Bonfini_eLife_2021/data/4 - S2A.jpg data/4 - S2A.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_4S2.tiff data/Figures/Figure_4S2.tiff
F:/Dropbox/Github/Bonfini_eLife_2021/data/5C.jpg data/5C.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/5F.jpg data/5F.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/5F data/5F
F:/Dropbox/Github/Bonfini_eLife_2021/data/5G.jpg data/5G.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/5G data/5G
F:/Dropbox/Github/Bonfini_eLife_2021/data/5I.jpg data/5I.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/5I data/5I
F:/Dropbox/Github/Bonfini_eLife_2021/data/5J.jpg data/5J.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/5J data/5J
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_5.tiff data/Figures/Figure_5.tiff
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_5S1.tiff data/Figures/Figure_5S1.tiff
F:/Dropbox/Github/Bonfini_eLife_2021/data/5 - S2A.jpg data/5 - S2A.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/5 - S2A data/5 - S2A
F:/Dropbox/Github/Bonfini_eLife_2021/data/5 - S2B.jpg data/5 - S2B.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/5 - S2B data/5 - S2B
F:/Dropbox/Github/Bonfini_eLife_2021/data/5 - S2C.jpg data/5 - S2C.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/5 - S2C data/5 - S2C
F:/Dropbox/Github/Bonfini_eLife_2021/data/5 - S2D.jpg data/5 - S2D.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/5 - S2D data/5 - S2D
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_5S2.tiff data/Figures/Figure_5S2.tiff
F:/Dropbox/Github/Bonfini_eLife_2021/data/6B.jpg data/6B.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/6C.jpg data/6C.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/6H.jpg data/6H.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/6I.jpg data/6I.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_6.tiff data/Figures/Figure_6.tiff
F:/Dropbox/Github/Bonfini_eLife_2021/data/6 - S1B.jpg data/6 - S1B.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/6 - S1C.jpg data/6 - S1C.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/6 - S1D.jpg data/6 - S1D.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/6 - S1E.jpg data/6 - S1E.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_6S1.tiff data/Figures/Figure_6S1.tiff
F:/Dropbox/Github/Bonfini_eLife_2021/data/7B.jpg data/7B.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/7C.jpg data/7C.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/7E.jpg data/7E.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/7F.jpg data/7F.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/7I.jpg data/7I.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_7.tiff data/Figures/Figure_7.tiff
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_7S1.tiff data/Figures/Figure_7S1.tiff
F:/Dropbox/Github/Bonfini_eLife_2021/data/7- S2A.jpg data/7- S2A.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/7- S2A1.jpg data/7- S2A1.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/7- S2B.jpg data/7- S2B.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/7- S2B1.jpg data/7- S2B1.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_7S2.tiff data/Figures/Figure_7S2.tiff
F:/Dropbox/Github/Bonfini_eLife_2021/data/7 - S3A.jpg data/7 - S3A.jpg
F:/Dropbox/Github/Bonfini_eLife_2021/data/Figures/Figure_7S3.tiff data/Figures/Figure_7S3.tiff

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 8fa9317. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    analysis/Bonfini_eLife_2021.html
    Ignored:    analysis/site_libs/

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/Bonfini_eLife_2021.Rmd) and HTML (docs/Bonfini_eLife_2021.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 8fa9317 dduneau 2021-10-08 Bonfini eLife 2021 project


Table of contents

Library, Data import and reformatting

Library

library(devtools)
library(reshape2)
library(lattice)
library(MASS)
library(car)
library(lmtest)
library(ggplot2)
library(survival)
library(plotrix)
library(grid)
library(gridExtra)
library(agricolae)
library(nparLD)
library(psych)
library(doBy)
library(xlsxjars)
library(xlsx)
library(dplyr)
library(stringr)
library(scales)
library(tidyr)
library(phia)
library(data.table)
library(spaMM)
library(lme4)
library(fields)
library(EBImage)
library(gplots)
library(RColorBrewer)
library(gridGraphics)
library(fields)
library(multcomp)
library(ggrepel)
library(metR)
library(forcats)
library(ggh4x)#remotes::install_github("teunbrand/ggh4x")
library(GenomicRanges)
library(DESeq2)
library(RColorBrewer)
library(coxme)
library(ggplotify)
#library(base2grob)
library(knitr)
library(kableExtra)
library(plotfunctions)
library(ggsignif)
#Function to include factor that are NOT in a list
'%!in%' = function(x,y)!('%in%'(x,y))

#Function to Grab graph and display it as a ggplot graph
grab_grob = function(){
  grid.echo()
  grid.grab()
}


#Function to calculate standard deviaion 
sd = function(x) sqrt(var(x,na.rm=T))


#Function to calculate standard error 
se = function(x) sqrt(var(x,na.rm=T)/length(x))

# Function to graph survival with ggplot and displaying the checkpoints
ggplotprep2 <- function(x, times){
  #spreading the surfit dataframe into dataframe per day. 
  d <- data.frame(condition=rep(names(x$strata), x$strata), time=x$time, survival=x$surv, upper=x$upper, lower=x$lower)
  # function to add time point 0 
  fillup0 <- function(s) rbind(c(condition=s, time=0, survival=1, upper=1, lower=1), d[d$condition==s, ], deparse.level = 0)
  
  # function to determine the missing time points
  indexes <- function(x, time) {
    if(x%in%time) return(x)
    return(time[which.min(abs(time[time<x]-x))])
  }
  #Function to complete the missing time points
  fillup <- function(s) {
    d.temp <- d[d$condition==s, ]
    time <- as.numeric(d.temp$time)
    id <- sapply(times, indexes, time=time)
    d.temp <- d.temp[match(id, time), ]
    d.temp$time <- times
    return(d.temp)
  }
  
  if(times[1]==0) d <- do.call("rbind", sapply(names(x$strata), fillup0, simplify=F))
  d <- do.call("rbind", sapply(names(x$strata), fillup, simplify=F))
  clean.name <- function(name) unlist(lapply(strsplit(as.character(name), split="="), function(x) x[2]))
  d <- data.frame(Condition=clean.name(d$condition), Time=as.numeric(d$time), Survival=as.numeric(d$survival), upper=as.numeric(d$upper), lower=as.numeric(d$lower))
  return(d)
}  


#function to select colours for GF-style plot (function mapping colors)
seeMahPal <- function(x, pal){
    pal[round(x)]
}

    #a function to take x,y,z
    #and return a GF-style plot with points per diet
geomPlotta <- function(x,y,z,alf,...){
    dat <- data.frame(x=x, y=y, z=z)
    d.means <- aggregate(z ~ x * y, dat, mean)
    surf.te <- Tps(cbind(dat$x, dat$y), dat$z, lambda = 0) 

    experiColours <- data.frame(z=d.means$z, rank=rank(d.means$z), rnd=round(d.means$z), rankRnd=rank(round(d.means$z)))
    mahPal <- colorRampPalette(c("darkblue", "blue", "turquoise", "yellow", "orange", "red", "darkred"))(max(experiColours$rank)) #Decide colors

d.means$colour <- seeMahPal(x=d.means$z, pal=mahPal)

surface(predictSurface(surf.te, extrap=F), col=alpha(mahPal, alf), ...)
points(d.means$x, d.means$y, bg=seeMahPal(x=experiColours$rank, pal=mahPal), col="white", pch=21, cex=1, ...)
}


left = function(text, num_char) {
  substr(text, 1, num_char)
}
 
mid = function(text, start_num, num_char) {
  substr(text, start_num, start_num + num_char - 1)
}
 
right = function(text, num_char) {
  substr(text, nchar(text) - (num_char-1), nchar(text))
}

Font size and palettes

SuperSmallfont= 6
xSmallfont = 8
Smallfont= 10
Mediumfont= 12
Largefont= 14
verylargefont = 16
pointsize= 0.7
linesize=0.35
meansize = 1.5
Margin=c(0,0,0,0)

fontsizeaxes = 14
fontsizeaxes2 = 10

palette_diet_2 = c("#FFB4B4", "#C3E6FC")
palette_component_3 = c("#f4ead0","#2d5ad7","gold")
palette_mean = c("yellow","green","red","white","magenta","skyblue", "blue", "deeppink", "gold")
cbbPalette_4 = c("#BDE6BD", "#C3E6FC", "#FFE5E5", "#E5E5FF") #Green eclosion, HY, HYtoHS, HStoHY
cbbHS_HStoHY = c("#FFB4B4","#E5E5FF")
cbbHY_HYtoHS = c("#C3E6FC","#FFE5E5")

Warning: The above code chunk cached its results, but it won’t be re-run if previous chunks it depends on are updated. If you need to use caching, it is highly recommended to also set knitr::opts_chunk$set(autodep = TRUE) at the top of the file (in a chunk that is not cached). Alternatively, you can customize the option dependson for each individual chunk that is cached. Using either autodep or dependson will remove this warning. See the knitr cache options for more details.

Import dataset

path.to.data = "F:/Dropbox/Github/Bonfini_eLife_2021/data/"

rm(d,path)
d = list()
path = list()
for(f in list.files(path=path.to.data,pattern="*.csv$",recursive=T,full.names=T)) {
  nom = gsub(".*/(.*).csv","\\1",f)    
  cat(nom,"\n")
  path[[nom]] = gsub("(.*)/.*csv","\\1/",f)
  d[[nom]] = read.table(f,header=T,sep=",")
}

Warning: The above code chunk cached its results, but it won’t be re-run if previous chunks it depends on are updated. If you need to use caching, it is highly recommended to also set knitr::opts_chunk$set(autodep = TRUE) at the top of the file (in a chunk that is not cached). Alternatively, you can customize the option dependson for each individual chunk that is cached. Using either autodep or dependson will remove this warning. See the knitr cache options for more details.

Data meaning - DGRP GWAS

wolb = d[["DGRP_wolbachia_DFD"]]
colnames(wolb) = c("dgrp_id", "wolbachia")
Error in `colnames<-`(`*tmp*`, value = c("dgrp_id", "wolbachia")): tentative de modification de 'colnames' sur un objet ayant moins de deux dimensions
wolb$dgrp_id = gsub("line_", "DGRP-", wolb$dgrp_id)

weight = d[["weights"]]
decode = d[["stockDecode"]]

weight$mg = weight$weightPerFlyGram * 1000
weight$diet = tolower(weight$diet)
decode$shortID = as.factor(as.character(decode$shortID))
weight$stockNumber = as.factor(as.character(weight$dgrp))
weight = merge(weight, decode, by.x="stockNumber", by.y="shortID")
colnames(weight) = tolower(colnames(weight))
weight = weight[,which(!colnames(weight) %in% c("stockNumber", "dgrp.x"))]
colnames(weight)[which(colnames(weight) == "dgrp.y")] = "dgrp"
weight$dgrp_number = substr(as.character(weight$dgrp), 1, 3)
weight$dgrpDiet = factor(paste(weight$dgrp_number, weight$diet, sep="_"))

tab_GWAS_gut = d[["1F - G"]]

#edit the data
table(complete.cases(tab_GWAS_gut))
Error in complete.cases(tab_GWAS_gut): aucune entrée n'a déterminé le nombre de cas
#str(tab_GWAS_gut)
tab_GWAS_gut= mutate_if(tab_GWAS_gut,is.integer,as.factor)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
colnames(tab_GWAS_gut) = tolower(colnames(tab_GWAS_gut))
Error in `colnames<-`(`*tmp*`, value = character(0)): tentative de modification de 'colnames' sur un objet ayant moins de deux dimensions
tab_GWAS_gut = tab_GWAS_gut[,!colnames(tab_GWAS_gut) %in% c("notes", "image", "bloomington_id")]

#remove the samples that subsequently proved crazy
tab_GWAS_gut = subset(tab_GWAS_gut, anteriorwidth < 1000)
Error in subset.default(tab_GWAS_gut, anteriorwidth < 1000): objet 'anteriorwidth' introuvable
tab_GWAS_gut = subset(tab_GWAS_gut, middlelength < 1500)
Error in subset.default(tab_GWAS_gut, middlelength < 1500): objet 'middlelength' introuvable
#remove lines that don't appear in both diets
dgrpLines = levels(tab_GWAS_gut$dgrp_number)
yDat = droplevels(subset(tab_GWAS_gut, diet=="y"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'droplevels' : objet 'diet' introuvable
xDat = droplevels(subset(tab_GWAS_gut, diet=="x"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'droplevels' : objet 'diet' introuvable
length(dgrpLines)
dgrpLines = dgrpLines[dgrpLines %in% yDat$dgrp_number]
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'table' lors de la s�lection d'une m�thode pour la fonction '%in%' : objet 'yDat' introuvable
#length(dgrpLines)
dgrpLines = dgrpLines[dgrpLines %in% xDat$dgrp_number]
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'table' lors de la s�lection d'une m�thode pour la fonction '%in%' : objet 'xDat' introuvable
#length(dgrpLines)

tab_GWAS_gut = droplevels(subset(tab_GWAS_gut, dgrp_number %in% dgrpLines))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'droplevels' : erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction '%in%' : objet 'dgrp_number' introuvable
yDat = droplevels(subset(yDat, dgrp_number %in% dgrpLines))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'droplevels' : erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'yDat' introuvable
xDat = droplevels(subset(xDat, dgrp_number %in% dgrpLines))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'droplevels' : erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'xDat' introuvable
#link up Wolbachia
tab_GWAS_gut = merge(tab_GWAS_gut, wolb, by="dgrp_id")
Error in fix.by(by.x, x): 'by' doit spécifier une colonne unique correcte
tab_GWAS_gut= mutate_if(tab_GWAS_gut,is.character,as.factor)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"

Warning: The above code chunk cached its results, but it won’t be re-run if previous chunks it depends on are updated. If you need to use caching, it is highly recommended to also set knitr::opts_chunk$set(autodep = TRUE) at the top of the file (in a chunk that is not cached). Alternatively, you can customize the option dependson for each individual chunk that is cached. Using either autodep or dependson will remove this warning. See the knitr cache options for more details.

1 Figure 1. Diet composition affects size and regional allometry of the midgut

1.1 Figure 1 - main

1.1.1 Figure 1A

Illustration of general dietary treatment design. Flies were reared on pre-experiment diet during development. At eclosion, flies were allocated to either HS or HY before midgut dissection at 5 days post eclosion.

img1A = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/1A.jpg") 
Error in transpose(y): object is NULL
gob_imageFig1A = rasterGrob(img1A)
Error in rasterGrob(img1A): objet 'img1A' introuvable
grid.draw(gob_imageFig1A)
Error in grid.draw(gob_imageFig1A): objet 'gob_imageFig1A' introuvable

1.1.2 Figure 1B

Nutritional composition (proteins, carbohydrates, and lipids) of the two isocaloric diets used as a basis for this study as calories per liter of food: enriched in sugars (High sugar, HS) or yeast (High yeast, HY).

general_info_diet =d[["1B"]]
general_info_diet = mutate_if(general_info_diet,is.character,as.factor)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
general_info_diet$Component <- factor(general_info_diet$Component, levels = c("Lipids","Proteins","Carbohydrates"))
Limits = c("Lipids","Proteins","Carbohydrates")
Labels = c("Lipids","Proteins","Carbohydrates")

Plot_Fig1B=
ggplot(general_info_diet,aes(x=Diet,y=Calories.contributed))+
geom_bar(stat="identity",aes(fill=Component),color="black",width=.90)+
  scale_fill_manual(limits=Limits,
                      values=palette_component_3,
                      labels=Labels)+
  scale_x_discrete("",
                     limits=c("HS", "HY"),
                     breaks=c("HS", "HY"))+
  scale_y_continuous("Calories/L of food",
                     breaks=c(seq(0,650,by=200),696))+
  theme(axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y =  element_text(size=Smallfont,colour="black"),
        axis.line.x = element_line(colour="black"),
        axis.line.y = element_line(colour="black"),
        axis.ticks.x = element_line(),
        axis.ticks.y = element_line(),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        panel.grid = element_blank(),
        plot.margin = unit(c(0,0,0,0), "cm"),
        legend.direction = "vertical", 
        legend.box = "vertical",
        legend.position = c(0.5,-0.3),
        legend.key.height = unit(0.3, "cm"),
        legend.key.width= unit(0.3, "cm"),
        legend.margin=margin(t=-0.9, r=-0, b=-0, l=-0, unit="cm"),
        legend.title = element_blank(), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=xSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size =Smallfont, colour = "black",face="italic"),
        strip.text.y = element_text(size =Smallfont, colour = "black",face="italic"),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside",
        panel.background = element_rect(fill="transparent"))+
  guides(fill=guide_legend(ncol=1))
Error: `data` must be a data frame, or other object coercible by `fortify()`, not a list.
Plot_Fig1B
Error in eval(expr, envir, enclos): objet 'Plot_Fig1B' introuvable

1.1.3 Figure 1C-D

Canton S (Cs) flies fed on HS diet (C, first image) have shorter midguts than flies on HY (D, Second image). Complete graphical annotation can be found in manuscript figures

Error in transpose(y): object is NULL
Error in rasterGrob(img1C): objet 'img1C' introuvable
Error in grid.draw(gob_imageFig1C): objet 'gob_imageFig1C' introuvable
Error in transpose(y): object is NULL
Error in rasterGrob(img1D): objet 'img1D' introuvable
Error in grid.draw(gob_imageFig1D): objet 'gob_imageFig1D' introuvable

1.1.4 Figure 1E

Quantification of midgut length for HS vs HY at 5 days post eclosion.

Length_HSHY = 
  d[["1E - 1S1A"]]%>%
  mutate_at(vars(starts_with("Total")),~./1000)%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  dplyr::rename(Total_Length_mm=Total.L,
                Total_width_mm=Total.W,
                Day_of_treatment=Day)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  Length_HSHY%>%
  group_by(Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet): objet 'Length_HSHY' introuvable
Averages <- summarise(group_by(Length_HSHY, Diet), mean = mean(Total_Length_mm, na.rm = TRUE))
Error in group_by(Length_HSHY, Diet): objet 'Length_HSHY' introuvable
###Stats
mod.gen = fitme(log(Total_Length_mm) ~  Diet + (1 | Repeat), data = Length_HSHY)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Length_HSHY' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = Length_HSHY) 
Error in is.data.frame(data): objet 'Length_HSHY' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = Length_HSHY) 
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Length_HSHY' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
#Now we make a tab with the results
tab_stat = data.frame(Variable = as.character("HS vs HY"),
                      Rep = nlevels(Length_HSHY$Repeat),
                      chi2_LR = format(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Length_HSHY' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
                      ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
                             ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%
  add_header_above(c("log(Total_Length_mm) ~  Diet + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
### Plot
Limits = c("HS", "HY")
z= max(Length_HSHY$Total_Length_mm)
Error in eval(expr, envir, enclos): objet 'Length_HSHY' introuvable
Plot_Fig1E=
  ggplot(Length_HSHY, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/50) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 2.3, label = paste("(",Sample_size,")",sep="")),size=3)+
  geom_signif(annotation = formatC(paste("p=",tab_stat$Pvalue), digits = 2), textsize = 3, y_position = 7.3, xmin = 1, xmax = 2, tip_length = c(0.02, 0.02), vjust = -0.2)+
  scale_fill_manual(limits=Limits,
                    values=palette_diet_2)+
  scale_x_discrete("",
                   limits=c("HS", "HY"),
                   labels=c("HS", "HY"))+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(2,8),
                     breaks=seq(2,8,by=1),
                     minor_breaks = seq(3, 7,by= 1))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(aspect.ratio=2,
        panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA))
Error in ggplot(Length_HSHY, aes(x = Diet, y = Total_Length_mm)): objet 'Length_HSHY' introuvable
#+
 # annotate("segment", x = 1, xend = 2, y = 7.2, yend = 7.2,
  #colour = "black", size =1.5)



Plot_Fig1E
Error in eval(expr, envir, enclos): objet 'Plot_Fig1E' introuvable

1.1.5 Figure 1F

Midgut length response to diet is strongly variable across the DGRP, with HY being generally longer than HS (i.e. the ratio length on HY/length on HS is between 1 and 1.4).

tab_GWAS_gut_mean = 
  tab_GWAS_gut%>%
  group_by(dgrp_number,diet)%>%
  summarise(mean_gut_length=mean(totallength,na.rm=T))%>%
  spread(diet,mean_gut_length)%>%
  dplyr::rename(Mean_length_HS=x,
         Mean_length_HY=y)%>%
  mutate(Ratio = Mean_length_HY/Mean_length_HS)
Error in UseMethod("group_by"): pas de méthode pour 'group_by' applicable pour un objet de classe "NULL"
tab_GWAS_gut_se = 
  tab_GWAS_gut%>%
  group_by(dgrp_number,diet)%>%
  summarise(se_gut_length = se(totallength))%>%
  spread(diet,se_gut_length)%>%
  dplyr::rename(SE_length_HS=x,
         SE_length_HY=y)
Error in UseMethod("group_by"): pas de méthode pour 'group_by' applicable pour un objet de classe "NULL"
tab_GWAS_gut_mean= left_join(tab_GWAS_gut_mean,tab_GWAS_gut_se)
Error in left_join(tab_GWAS_gut_mean, tab_GWAS_gut_se): objet 'tab_GWAS_gut_mean' introuvable
colors=c("HS"="#FFB4B4","HY"="#C3E6FC","Ratio"="black") 

plot_ratio_DGRP=
ggplot(tab_GWAS_gut_mean,aes(x = reorder(dgrp_number,Ratio))) + 
  geom_point(aes(y=Mean_length_HS/1000,colour="HS"),stat="identity",size=0.7,shape=16)+
  geom_errorbar(aes(ymax = (Mean_length_HS+ SE_length_HS)/1000 , ymin = (Mean_length_HS - SE_length_HS)/1000 ,colour="HS"),width=0.1, show.legend=FALSE)+
  geom_point(aes(y=Mean_length_HY/1000,colour="HY"),stat="identity",size=0.7,shape=16)+
  geom_errorbar(aes(ymax = (Mean_length_HY+ SE_length_HY)/1000 , ymin = (Mean_length_HY - SE_length_HY)/1000 ,colour="HY"),width=0.1, show.legend=FALSE)+
  geom_point(aes(y=Ratio*3.9,colour="Ratio"),shape=17,size=0.7)+
  geom_hline(yintercept=3.9,linetype=2)+
  scale_y_continuous("Midgut length (mm)\n [mean \u00B1 se]",
                     limits=c(3,7.2),
                     sec.axis = sec_axis(~./3.9, name = "Ratio (HY/HS)", breaks = seq(0.8,1.8,0.2)))+
  scale_x_discrete("DGRP lines",expand=c(0.03,0.03))+
  scale_color_manual(values = colors )+
  theme(panel.background = element_blank(),
        (panel.border = element_blank()),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_blank(),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_blank(),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "horizontal", 
        legend.box = "horizontal",
        legend.position = c(0.25,0.98),
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.4, "cm"),
        legend.title = element_blank(), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=Smallfont),
        legend.background = element_rect(fill=NA))+
  guides(color=guide_legend(ncol=3))
Error in ggplot(tab_GWAS_gut_mean, aes(x = reorder(dgrp_number, Ratio))): objet 'tab_GWAS_gut_mean' introuvable
plot_ratio_DGRP
Error in eval(expr, envir, enclos): objet 'plot_ratio_DGRP' introuvable
list_lines = unique(tab_GWAS_gut$dgrp_id)
Tab = NULL
for(i in list_lines){
  tmp= subset(tab_GWAS_gut,dgrp_id==i)
sample_size= tmp %>% group_by(diet)%>%summarize(n=n())
      
test= t.test(totallength~diet ,data=tmp)  
Tab = rbind(Tab, c(i,test$parameter,test$statistic,test$p.value,test$estimate,sample_size[1,2],sample_size[2,2]))
}

colnames(Tab)=c("Line","df","t","Pvalue","Mean_HS","Mean_HY","Sample_size_HS","Sample_size_HY")
Tab = as.data.frame(Tab)%>%
  mutate(Pvalue=as.numeric(Pvalue),
         Mean_HS =as.numeric(Mean_HS),
         Mean_HY =as.numeric(Mean_HY),
         Difference = Mean_HY-Mean_HS )

Tab$Pv_adjust = p.adjust(Tab$Pvalue,method = "BH") # Here I control 

length(which(Tab$Pv_adjust>0.05))
# 56 lines have no significant difference in size between diets
length(which(Tab$Pv_adjust<=0.05))
#132 lines have a significant difference in size between diets

Tab_sign = subset(Tab,Pv_adjust<=0.05)

length(which(Tab_sign$Difference<=0))
# 0 line was significantly smaller on HY

length(which(Tab_sign$Difference>0))
# 132 lines (i.e. all of those that were different) were significantly larger on HY

1.1.6 Figure 1G

Midgut re-sizing is allometric between regions of the midgut. Posterior midguts of flies fed HY exhibit a greater increase than anterior regions.

tab_GWAS_gut=
  tab_GWAS_gut%>%
  mutate(allometry=posteriorlength/anteriorlength)
Error in UseMethod("mutate"): pas de méthode pour 'mutate' applicable pour un objet de classe "NULL"
tab_GWAS_gut_allometry_mean=
  tab_GWAS_gut%>%
  group_by(diet,dgrp_number)%>%
  summarise(mean_allometry=mean(allometry,na.rm=T))
Error in UseMethod("group_by"): pas de méthode pour 'group_by' applicable pour un objet de classe "NULL"
Sample_size=
  tab_GWAS_gut_allometry_mean%>%
  group_by(diet)%>%
  summarise(Sample_size=n())
Error in group_by(., diet): objet 'tab_GWAS_gut_allometry_mean' introuvable
###Stats

mod.gen = fitme(mean_allometry ~  diet + (1 | dgrp_number) , data = tab_GWAS_gut_allometry_mean)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_GWAS_gut_allometry_mean' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(mean_allometry ~ diet + (1 / dgrp_number) , data = tab_GWAS_gut_allometry_mean) 
Error in is.data.frame(data): objet 'tab_GWAS_gut_allometry_mean' introuvable
mod.gen1 = fitme(mean_allometry ~ 1 + (1 | dgrp_number), data = tab_GWAS_gut_allometry_mean) 
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_GWAS_gut_allometry_mean' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
#Now we make a tab with the results
tab_stat = data.frame(Variable = as.character(paste("HS vs HY")),
                               Rep = 1,
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in test$basicLRT: objet de type 'closure' non indiçable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("mean_allometry ~  diet + (1 | dgrp_number)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
### Plot

Plot_Fig1G=
  ggplot(tab_GWAS_gut_allometry_mean, aes(diet,mean_allometry, group=dgrp_number,color=diet)) +
  geom_path(size=0.3,color=grey(0.65))+
  geom_point(shape=16,size= 1)+
  scale_x_discrete("",
                   expand=c(0.1,0.1),
                   limits=c("x","y"),
                   labels=c("HS", "HY"))+
  scale_y_continuous("Posterior / anterior length",
                     limits=c(0.6, 1.4),
                     breaks=c(c(seq(0.5,1.4,by=0.1))))+
  scale_color_manual(limits=c("x","y"),
                    values=palette_diet_2)+
  annotate("text", label=paste("p=",tab_stat$Pvalue,sep=""), x= 1.5, y=1.4,size=3)+
  stat_summary(fun = mean, aes(group = 1),geom = "point", colour = "black", fill = "yellow", size = 3, shape = 23) +
  stat_summary(fun=mean, colour="black", geom="line", aes(group = 1),size=1,linetype=2)+
  theme(
    axis.title.x = element_text(size=Smallfont),
    axis.title.y = element_text(size=Smallfont),
    axis.line.x = element_line(colour="black",size=0.75),
    axis.line.y = element_line(colour="black",size=0.75),
    axis.ticks.x = element_line(size = 0.75),
    axis.ticks.y = element_line(size = 0.75),
    axis.text.x = element_text(size=Smallfont,colour="black"),
    axis.text.y = element_text(size=Smallfont,colour="black"),
    legend.position = "none",
    panel.background = element_blank())
Error in ggplot(tab_GWAS_gut_allometry_mean, aes(diet, mean_allometry, : objet 'tab_GWAS_gut_allometry_mean' introuvable
Plot_Fig1G
Error in eval(expr, envir, enclos): objet 'Plot_Fig1G' introuvable

##Export Figure 1

1.2 Figure 1 - figure supplement 1

1.2.1 Figure 1S1A

Canton S (Cs) flies fed HS diet have narrower midguts than those fed HY diet. Width was measured in three point along the gut (Region 2, 3 and 4, as visible in the yellow annotation in Figure 1C,D) and the sum of these three measurement was used as proxy for midgut width. Measurements are from the same guts as in Figure 1E

Length_HSHY = 
  d[["1E - 1S1A"]]%>%
  mutate_at(vars(starts_with("Total")),~./1000)%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  dplyr::rename(Total_Length_mm=Total.L,
         Total_width_mm=Total.W,
         Day_of_treatment=Day)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  Length_HSHY%>%
  group_by(Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet): objet 'Length_HSHY' introuvable
###Stats

mod.gen = fitme(log(Total_width_mm) ~  Diet + (1 | Repeat), data = Length_HSHY)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Length_HSHY' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_width_mm) ~ Diet + (1 / Repeat), data = Length_HSHY) 
Error in is.data.frame(data): objet 'Length_HSHY' introuvable
mod.gen1 = fitme(log(Total_width_mm) ~ 1 + (1 | Repeat), data = Length_HSHY) 
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Length_HSHY' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
#Now we make a tab with the results
tab_stat = data.frame(Variable = as.character(paste("HS vs HY")),
                               Rep = nlevels(Length_HSHY$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Length_HSHY' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%
  add_header_above(c("log(Total_width_mm) ~  Diet + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
### Plot
Limits = c("HS", "HY")
z = max(Length_HSHY$Total_width_mm)
Error in eval(expr, envir, enclos): objet 'Length_HSHY' introuvable
Plot_Fig1S1A=
ggplot(Length_HSHY, aes(x = Diet, y = Total_width_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.6) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/50) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 0.25, label = paste("(",Sample_size,")",sep="")),size=3)+
  geom_signif(annotation = formatC(paste("p=",tab_stat$Pvalue), digits = 2), textsize = 3, y_position = 0.93, xmin = 1, xmax = 2, tip_length = c(0.02, 0.02), vjust = -0.2)+
  scale_fill_manual(limits=Limits,
                    values=palette_diet_2)+
  scale_x_discrete("",
                   limits=c("HS", "HY"),
                   breaks=c("HS", "HY"))+
  scale_y_continuous("Midgut width (mm)",
                     limits=c(0.2,1),
                     breaks=seq(0.2,1,by=0.1))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18,colour = "black",aes(group=Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18,aes(group=Repeat, colour = Repeat)) +
  scale_color_manual(values=palette_mean)+
  theme(panel.background = element_blank(),
        panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
                axis.title.x = element_text(size=Smallfont,colour="black"),
                axis.title.y = element_text(size=Smallfont,colour="black"), 
                axis.line.x = element_line(colour="black",size=0.75),
                axis.line.y = element_line(colour="black",size=0.75),
                axis.ticks.x = element_line(size = 0.75),
                axis.ticks.y = element_line(size = 0.75),
                axis.text.x = element_text(size=Smallfont,colour="black"),
                axis.text.y = element_text(size=Smallfont,colour="black"),
                plot.margin = unit(Margin, "cm"),
                legend.direction = "vertical", 
                legend.box = "horizontal",
                legend.position = "none",
                legend.key.height = unit(0.4, "cm"),
                legend.key.width= unit(0.6, "cm"),
                legend.title = element_text(face="italic",size=Smallfont), 
                legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
                legend.text = element_text(size=SuperSmallfont),
                legend.background = element_rect(fill=NA))
Error in ggplot(Length_HSHY, aes(x = Diet, y = Total_width_mm)): objet 'Length_HSHY' introuvable
Plot_Fig1S1A
Error in eval(expr, envir, enclos): objet 'Plot_Fig1S1A' introuvable

1.2.2 Figure 1S1B

Length of midguts on HY diet is similar to standard diets used in the field (Bloomington [Bl] cornmeal and Bl molasses).

tab_stddiets_rev =
  d[["1 - S1B"]]%>%
  mutate(Total_Length_mm =Total.L/1000)%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  mutate(Sugar=fct_relevel(Diet,"HS","HY", "BL Cornmeal", "BL Molasses"))
Error in UseMethod("mutate"): pas de méthode pour 'mutate' applicable pour un objet de classe "NULL"
Sample_size=
  tab_stddiets_rev%>%
  group_by(Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet): objet 'tab_stddiets_rev' introuvable
###Stats

mod.gen = fitme((Total_Length_mm) ~  Diet + (1 | Repeat), data = tab_stddiets_rev)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_stddiets_rev' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest((Total_Length_mm) ~ Diet + (1 / Repeat), data = tab_stddiets_rev) 
Error in is.data.frame(data): objet 'tab_stddiets_rev' introuvable
mod.gen1 = fitme((Total_Length_mm) ~ 1 + (1 | Repeat), data = tab_stddiets_rev) 
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_stddiets_rev' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
#Now we make a tab with the results
tab_stat = data.frame(Variable = as.character(paste("Anova diets")),
                               Rep = nlevels(tab_stddiets_rev$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_stddiets_rev' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("(Total_Length_mm) ~  Diet + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
mod.gen = lmer(Total_Length_mm ~  Diet + (1 | Repeat), data = tab_stddiets_rev)
Error: bad 'data': objet 'tab_stddiets_rev' introuvable
multcomp = glht(mod.gen, linfct=mcp(Diet="Tukey"))
Error in model.matrix(model) : objet 'mod.gen' introuvable
Error in factor_contrasts(model): no 'model.matrix' method for 'model' found!
tmp = cld(multcomp)
Error in cld(multcomp): objet 'multcomp' introuvable
letter_position = aggregate(data=tab_stddiets_rev,Total_Length_mm ~ Diet, max)
Error in eval(m$data, parent.frame()): objet 'tab_stddiets_rev' introuvable
tab_letter =  as.data.frame(tmp$mcletters$Letters)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'tmp' introuvable
tab_letter$Diet=rownames(tab_letter)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'rownames' : objet 'tab_letter' introuvable
colnames(tab_letter)[1] = "Letter"
Error in colnames(tab_letter)[1] = "Letter": objet 'tab_letter' introuvable
tab_letter = left_join(tab_letter,letter_position)
Error in left_join(tab_letter, letter_position): objet 'tab_letter' introuvable
Limits =c("HS","HY", "BL Cornmeal", "BL Molasses")
Labels =c("HS","HY", "Bl cornmeal", "Bl molasses")
cbbPalette = c("#FFB4B4","#C3E6FC", "#f6efe5", "#f6efe5")

z = max(tab_stddiets_rev$Total_Length_mm, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'tab_stddiets_rev' introuvable
Plot_Fig1S1B=
  ggplot(tab_stddiets_rev, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8, alpha = 0.5) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/35) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 1.8, label = paste("(",Sample_size,")",sep="")),size=3)+
  geom_text(data = tab_stat, mapping = aes(x = 2.5, y = 7.5, label = paste("p=",format(Pvalue,digits=2))),size=3)+
  geom_text(data = tab_letter, mapping = aes(x = Diet, y = Total_Length_mm+0.6, label = Letter),size=3)+
  scale_fill_manual(limits=Limits,
                    values=cbbPalette)+
  scale_x_discrete("",
                   limits=Limits,
                   labels=Labels)+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(1.6,8),
                     breaks=seq(2,7,by=1))+
   stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
                     stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
                     scale_color_manual(values = palette_mean) +
  theme(panel.background = element_blank(),
        panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(c(0,0,0,0.5), "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA))
Error in ggplot(tab_stddiets_rev, aes(x = Diet, y = Total_Length_mm)): objet 'tab_stddiets_rev' introuvable
Plot_Fig1S1B
Error in eval(expr, envir, enclos): objet 'Plot_Fig1S1B' introuvable

1.2.3 Figure 1S1C

Un-mated females and mated males have lower response to diet compared to mated female flies. Statistics: comparison of the interaction between diet and mating status/sex. Full annotation on figure present in manuscript

tab_MUmM_rev = 
  d[["1 - S1C"]]%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  mutate(Total_Length_mm=Total.L/1000)%>%
  mutate(Treatment=fct_relevel(Treatment,c("Mated females","Un-mated females","Males")))
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  tab_MUmM_rev%>%
  group_by(Diet,Treatment)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet, Treatment): objet 'tab_MUmM_rev' introuvable
###Stats
#Un-mated
tmp = subset(tab_MUmM_rev, Treatment%in%c("Mated females","Un-mated females"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_MUmM_rev' introuvable
mod.gen = fitme((Total_Length_mm) ~  Diet * Treatment + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest((Total_Length_mm) ~  Diet + Treatment + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme((Total_Length_mm) ~  Diet + Treatment + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Treatment = as.character(paste("Mated vs Un-mated females")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=1,scientific=F)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_Un_mated=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Male
tmp = subset(tab_MUmM_rev, Treatment%in%c("Mated females","Males"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_MUmM_rev' introuvable
mod.gen = fitme(log(Total_Length_mm) ~  Diet * Treatment + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~  Diet + Treatment + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~  Diet + Treatment + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Treatment = as.character(paste("Mated vs Males")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=1,scientific=F)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_Male=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat=rbind(tab_stat_Male,tab_stat_Un_mated)
Error in eval(quote(list(...)), env): objet 'tab_stat_Male' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.009, "*", #changed to 0.009 because Un-mated is exactle 0.01
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.009, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Variable", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%
  add_header_above(c("log(Total_Length_mm) ~  Diet + Treatment + Diet : Treatment + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Variable", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
tab_stat$Treatment = as.factor(tab_stat$Treatment)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.factor' : objet 'tab_stat' introuvable
tab
Error in eval(expr, envir, enclos): objet 'tab' introuvable
### Plot
tab_stat_1S1C=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
Plot_Fig1S1C=
  ggplot(tab_MUmM_rev, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = 0.15) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 1.7, label = paste("(",Sample_size,")",sep="")),size=3)+
  facet_grid(.~ Treatment)+
  scale_fill_manual(values=palette_diet_2)+
  scale_x_discrete("",
                   limits=c("HS","HY"),
                   labels=c("HS","HY"))+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(1.5,8),
                     breaks=seq(2,6,by=1))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  stat_summary(fun = mean, colour = "black", geom = "line", aes(group = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_MUmM_rev, aes(x = Diet, y = Total_Length_mm)): objet 'tab_MUmM_rev' introuvable
Plot_Fig1S1C
Error in eval(expr, envir, enclos): objet 'Plot_Fig1S1C' introuvable

1.2.4 Figure 1S1D

Feeding assay shows higher dietary intake on HS than on HY diet. Absorbance measured after 1 day of assay, each day along a 5-day period from eclosion, for a total of 5 times per condition/repeat

Tab_absorbance = 
  d[["1 - S1D"]]%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  dplyr::rename(Diet=Food)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  Tab_absorbance%>%
  group_by(Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet): objet 'Tab_absorbance' introuvable
###Stats

mod.gen = fitme(Absorbance ~  Diet + (1 | Repeat), data = Tab_absorbance)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Tab_absorbance' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(Absorbance ~ Diet + (1 / Repeat), data = Tab_absorbance) 
Error in is.data.frame(data): objet 'Tab_absorbance' introuvable
mod.gen1 = fitme(Absorbance ~ 1 + (1 | Repeat), data = Tab_absorbance) 
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Tab_absorbance' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
#Now we make a tab with the results
tab_stat = data.frame(Variable = as.character(paste("HS vs HY")),
                               Rep = nlevels(Tab_absorbance$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Tab_absorbance' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("Absorbance ~  Diet + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
##Plot
Limits = c("HS", "HY")
z = max(Tab_absorbance$Absorbance)
Error in eval(expr, envir, enclos): objet 'Tab_absorbance' introuvable
Plot_Fig1S1D=
ggplot(Tab_absorbance, aes(x = Diet, y = Absorbance))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/40) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 0.02, label = paste("(",Sample_size,")",sep="")),size=3)+
  geom_signif(annotation = formatC(paste("p=",tab_stat$Pvalue), digits = 2), textsize = 3, y_position = 0.58, xmin = 1, xmax = 2, tip_length = c(0.02, 0.02), vjust = -0.2)+

  scale_fill_manual(limits=Limits,
                    values=palette_diet_2)+
  scale_x_discrete("",
                   limits=c("HS", "HY"),
                   breaks=c("HS", "HY"))+
  scale_y_continuous("Absorbance",
                     limits=c(0,0.6),
                     breaks=seq(0,0.5,by=0.1))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18,colour = "black",aes(group=Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18,aes(group=Repeat, colour = Repeat)) +
  scale_color_manual(values=palette_mean)+
  theme(panel.background = element_blank(),
        panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
                axis.title.x = element_text(size=Smallfont,colour="black"),
                axis.title.y = element_text(size=Smallfont,colour="black"), 
                axis.line.x = element_line(colour="black",size=0.75),
                axis.line.y = element_line(colour="black",size=0.75),
                axis.ticks.x = element_line(size = 0.75),
                axis.ticks.y = element_line(size = 0.75),
                axis.text.x = element_text(size=Smallfont,colour="black"),
                axis.text.y = element_text(size=Smallfont,colour="black"),
                plot.margin = unit(Margin, "cm"),
                legend.direction = "vertical", 
                legend.box = "horizontal",
                legend.position = "none",
                legend.key.height = unit(0.4, "cm"),
                legend.key.width= unit(0.6, "cm"),
                legend.title = element_text(face="italic",size=Smallfont), 
                legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
                legend.text = element_text(size=SuperSmallfont),
                legend.background = element_rect(fill=NA))
Error in ggplot(Tab_absorbance, aes(x = Diet, y = Absorbance)): objet 'Tab_absorbance' introuvable
Plot_Fig1S1D
Error in eval(expr, envir, enclos): objet 'Plot_Fig1S1D' introuvable

1.2.5 Figure 1S1E

Microbes are not required for the difference in size observed between HS and HY fed flies. Germ-free flies exhibit similar diet-induced increase in size as conventionally reared flies at both 7- and 14-days post eclosion (statistics: comparison of the interaction between diets and conv. reared/germ free treatment). Of note, at 7-days post eclosion we observed longer guts in germ free flies compared to conventionally reared flies (significant on HS diet). This difference was lost at 14-days post eclosion (Post hoc Tukey test from GLMM summarized by letter at the bottom of chart). Full statistical annotation on figure present in manuscript

Length_HSHY_germfree = 
  d[["1 - S1E"]]%>%
  mutate_at(vars(starts_with("Total")),~./1000)%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  dplyr::rename(Total_Length_mm=Total.L,
         Day_of_treatment=Day)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  Length_HSHY_germfree%>%
  group_by(Diet,Treatment, Day_of_treatment)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet, Treatment, Day_of_treatment): objet 'Length_HSHY_germfree' introuvable
Sample_size$Sample_size <- as.numeric(Sample_size$Sample_size)
Error in eval(expr, envir, enclos): objet 'Sample_size' introuvable
###Stats Day 7 interaction
Length_HSHY_germfree_Day7 = subset(Length_HSHY_germfree, Day_of_treatment == "7")
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_HSHY_germfree' introuvable
mod.gen = fitme(log(Total_Length_mm) ~  Diet + Treatment + Diet : Treatment + (1 | Repeat), data = Length_HSHY_germfree_Day7)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Length_HSHY_germfree_Day7' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet  + Treatment +  (1 / Repeat), data = Length_HSHY_germfree_Day7) 
Error in is.data.frame(data): objet 'Length_HSHY_germfree_Day7' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ Diet + Treatment + (1 | Repeat), data = Length_HSHY_germfree_Day7) 
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Length_HSHY_germfree_Day7' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
#Now we make a tab with the results
tab_stat7 = data.frame(Variable = as.character(paste("Response to diet Day7")),
                               Rep = as.numeric(nlevels(Length_HSHY_germfree_Day7$Repeat)),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[4],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Length_HSHY_germfree_Day7' introuvable
tab_stat7$sig = ifelse(tab_stat7$Pvalue < 0.05 & tab_stat7$Pvalue > 0.01, "*",
             ifelse(tab_stat7$Pvalue < 0.01 & tab_stat7$Pvalue > 0.001, "**",
              ifelse(tab_stat7$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat7$Pvalue < 0.05 & tab_stat7$Pvalue > 0.01, "*", : objet 'tab_stat7' introuvable
tab_stat7%>%
  kable(col.names = c("Response to diet Day7", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(Total_Length_mm) ~  Diet + Treatment + Diet : Treatment + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Response to diet Day7", "Replicates", : objet 'tab_stat7' introuvable
tab_stat_int_GF7=tab_stat7
Error in eval(expr, envir, enclos): objet 'tab_stat7' introuvable
###Stats Day 14 interaction
Length_HSHY_germfree_Day14 = subset(Length_HSHY_germfree, Day_of_treatment == "14")
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_HSHY_germfree' introuvable
mod.gen = fitme(log(Total_Length_mm) ~  Diet + Treatment + Diet : Treatment + (1 | Repeat), data = Length_HSHY_germfree_Day14)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Length_HSHY_germfree_Day14' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet  + Treatment +  (1 / Repeat), data = Length_HSHY_germfree_Day14) 
Error in is.data.frame(data): objet 'Length_HSHY_germfree_Day14' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ Diet + Treatment + (1 | Repeat), data = Length_HSHY_germfree_Day14) 
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Length_HSHY_germfree_Day14' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
#Now we make a tab with the results
tab_stat14 = data.frame(Variable = as.character(paste("Response to diet Day14")),
                               Rep = as.numeric(nlevels(Length_HSHY_germfree_Day14$Repeat)),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[4],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Length_HSHY_germfree_Day14' introuvable
tab_stat14$sig = ifelse(tab_stat14$Pvalue < 0.05 & tab_stat14$Pvalue > 0.01, "*",
             ifelse(tab_stat14$Pvalue < 0.01 & tab_stat14$Pvalue > 0.001, "**",
              ifelse(tab_stat14$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat14$Pvalue < 0.05 & tab_stat14$Pvalue > 0.01, "*", : objet 'tab_stat14' introuvable
tab_stat14%>%
  kable(col.names = c("Response to diet Day14", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(Total_Length_mm) ~  Diet + Treatment + Diet : Treatment + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Response to diet Day14", "Replicates", : objet 'tab_stat14' introuvable
tab_stat_int_GF14=tab_stat14
Error in eval(expr, envir, enclos): objet 'tab_stat14' introuvable
#Model including all samples and Post HOC test

Length_HSHY_germfree$Treat_Diet_Day = as.factor(paste(Length_HSHY_germfree$Treatment, Length_HSHY_germfree$Diet, Length_HSHY_germfree$Day_of_treatment, sep="_"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.factor' : objet 'Length_HSHY_germfree' introuvable
mod.gen = lmer(log(Total_Length_mm) ~ Treat_Diet_Day + (1 | Repeat), data = Length_HSHY_germfree)
Error: bad 'data': objet 'Length_HSHY_germfree' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Treat_Diet_Day + (1/ Repeat), data = Length_HSHY_germfree)
Error in is.data.frame(data): objet 'Length_HSHY_germfree' introuvable
multcomp = glht(mod.gen, linfct=mcp(Treat_Diet_Day="Tukey"))
Error in model.matrix(model) : objet 'mod.gen' introuvable
Error in factor_contrasts(model): no 'model.matrix' method for 'model' found!
tmp = cld(multcomp)
Error in cld(multcomp): objet 'multcomp' introuvable
letter_position = aggregate(data=Length_HSHY_germfree,Total_Length_mm ~ Treat_Diet_Day, min)
Error in eval(m$data, parent.frame()): objet 'Length_HSHY_germfree' introuvable
tab_letter =  as.data.frame(tmp$mcletters$Letters)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'tmp' introuvable
tab_letter$Treat_Diet_Day=rownames(tab_letter)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'rownames' : objet 'tab_letter' introuvable
colnames(tab_letter)[1] = "Letter"
Error in colnames(tab_letter)[1] = "Letter": objet 'tab_letter' introuvable
tab_letter = left_join(tab_letter,letter_position)
Error in left_join(tab_letter, letter_position): objet 'tab_letter' introuvable
tab_letter$Treat_Diet_Day= as.factor(tab_letter$Treat_Diet_Day)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.factor' : objet 'tab_letter' introuvable
tab_letter$Day_of_treatment = as.factor(mid(tab_letter$Treat_Diet_Day,7, 2))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.factor' : erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'substr' : objet 'tab_letter' introuvable
tab_letter$Diet = as.factor(mid(tab_letter$Treat_Diet_Day, 4,2))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.factor' : erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'substr' : objet 'tab_letter' introuvable
tab_letter$Treatment = as.factor(left(tab_letter$Treat_Diet_Day, 2))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.factor' : erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'substr' : objet 'tab_letter' introuvable
### Plot
Limits = c("HS", "HY")
z= max(Length_HSHY_germfree$Total_Length_mm)
Error in eval(expr, envir, enclos): objet 'Length_HSHY_germfree' introuvable
Treatment.status = c("Conv. reared", "Germ free")
names(Treatment.status) = c("CR", "GF")

Plot_Fig1S1E=
  ggplot(Length_HSHY_germfree, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/50) +
  geom_text(data = tab_letter, mapping = aes(x = Diet, y = Total_Length_mm-0.4, label = Letter),size=3)+
  facet_wrap(Day_of_treatment~Treatment,labeller=labeller(Treatment=Treatment.status), nrow = 1)+
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 1.35, label = paste("(",Sample_size,")",sep="")),size=3)+
  scale_fill_manual(limits=Limits,
                    values=palette_diet_2)+
  scale_x_discrete("",
                   limits=c("HS", "HY"),
                   breaks=c("HS", "HY"))+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(1,8),
                     breaks=seq(2,8,by=1))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18,colour = "black",aes(group=Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18,aes(group=Repeat, colour = Repeat)) +
  stat_summary(fun=mean, colour="black", geom="line",aes(group=Repeat))+
  scale_color_manual(values=palette_mean)+
  theme(panel.background = element_blank(),
        panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size =Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size =Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(Length_HSHY_germfree, aes(x = Diet, y = Total_Length_mm)): objet 'Length_HSHY_germfree' introuvable
Plot_Fig1S1E
Error in eval(expr, envir, enclos): objet 'Plot_Fig1S1E' introuvable

##Export Figure S1

1.3 Figure 1 - figure supplement 2

1.3.1 Figure 1S2A

Scheme depicting regional organization of the gut. The gut comprises three main anatomical regions: foregut (comprising the crop), midgut and hindgut. The midgut itself can be divided in anterior (blue), middle (green) and posterior (purple). Additional subregions have been described (Buchon et al., 2013; Marianes and Spradling, 2013).

 img1S2A = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/1- S2A.jpg") 
Error in transpose(y): object is NULL
 gob_imageFig1S2A = rasterGrob(img1S2A)
Error in rasterGrob(img1S2A): objet 'img1S2A' introuvable
 grid.draw(gob_imageFig1S2A)
Error in grid.draw(gob_imageFig1S2A): objet 'gob_imageFig1S2A' introuvable

1.3.2 Figure 1S2B

All regions of the midgut (x-axis) respond variably to diet composition, but the response of the posterior midgut length more closely reflects the response of the total midgut length. Red lines represent linear regression and black dashed lines are the lines of equivalence.

tab_GWAS_gut$dgrpDiet = factor(paste(tab_GWAS_gut$dgrp_id, tab_GWAS_gut$diet), ordered=T)

meansMat = aggregate(as.matrix(tab_GWAS_gut[,c("anteriorlength", "middlelength", "posteriorlength",  "totallength")]) ~ diet * dgrp_id, tab_GWAS_gut, mean)
rownames(meansMat) = paste(meansMat$dgrp_id, meansMat$diet, sep="_")
colnames(meansMat) <- c("diet","dgrp_id", "Anterior Length", "Middle Length", "Posterior Length", "Total Length")
meansMatX = subset(meansMat, diet=="x")
meansMatY = subset(meansMat, diet=="y")
all(meansMatX$dgrp_id == meansMatY$dgrp_id)
meansMatX = meansMatX[,!colnames(meansMatX) %in% c("dgrp_id", "diet")]
meansMatY = meansMatY[,!colnames(meansMatY) %in% c("dgrp_id", "diet")]

meansMatY=
meansMatY %>%
  setNames(str_to_sentence(names(.)))

meansMatX=
meansMatX %>%
  setNames(str_to_sentence(names(.)))

RIs <- meansMatY / meansMatX
RIs <- RIs[,!grepl("width", colnames(RIs))]
plotRegress <- function(x,y, datRange, textCex, ...){
    regn <- lm(y ~ x)
    plot(y ~ x, xlim=datRange, ylim=datRange, ...)
    abline(a=0,b=1, col=alpha(1, 0.5), lty=2)
    abline(a=coef(regn)[1], b=coef(regn)[2],col=2)
    
    val=round(summary(regn)$adj.r.squared, 1)
    text(y=max(datRange), x=min(datRange), 
    labels=bquote(R^2 ~"="~ .(val)), adj=0, cex=textCex)
    
    text(y=max(datRange) - (0.1 * diff(range(RIs))), x=min(datRange), 
    labels=paste("p =", signif(summary(regn)$coefficients[2,4], 2)), adj=0, cex=textCex)
    
    text(y=max(datRange) - (0.2 * diff(range(RIs))), x=min(datRange), 
    labels=paste("y = ", signif(coef(regn)[2], 2), "x", " + ", signif(coef(regn)[1], 2), sep=""), adj=0, cex=textCex)
}

jpeg(filename =  "Plot_Fig1S2B.jpeg",
      res = 300,
      width = 9, height = 3, units = 'in' )

 par(bty="n", mfrow=c(1,3), cex.main=1.4, cex.lab=1.4, cex.axis=1.4)

for(i in 1:3){
 plotRegress(x=RIs[,i], y=RIs[,4], xlab=paste(c("Anterior", "Middle", "Posterior")[i], "HY length / HS length"), ylab="Total HY length / HS length", bty="n", cex=0.75, pch=16, datRange=range(RIs), las=1, asp =1, textCex=1.4)
 } 
 
dev.off()
 img1S2B = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/Plot_Fig1S2B.jpeg") 
Error in transpose(y): object is NULL
 gob_imageFig1S2B = rasterGrob(img1S2B)
Error in rasterGrob(img1S2B): objet 'img1S2B' introuvable
 grid.draw(gob_imageFig1S2B)
Error in grid.draw(gob_imageFig1S2B): objet 'gob_imageFig1S2B' introuvable

##Export Figure 1S2

1.4 Figure 1 - figure supplement 3

1.4.1 Figure 1S3A

Variation in impact of diet on midgut length in the DGRP maps to genes with functions connected to epithelial turnover. The Manhattan plot summarizes the p-value per chromosomal locus (grey bars) associated with GWAS analysis. Highlighted genes have been selected based on their statistical significance, their function, and the effect of the genetic variation (e.g. non-synonymous mutation, etc.).

img1S3A = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/1 - S3.jpg") 
Error in transpose(y): object is NULL
gob_imageFig1S3A = rasterGrob(img1S3A)
Error in rasterGrob(img1S3A): objet 'img1S3A' introuvable
grid.draw(gob_imageFig1S3A)
Error in grid.draw(gob_imageFig1S3A): objet 'gob_imageFig1S3A' introuvable

##Export Figure

2 Figure 2. Sugar antagonizes yeast-induced increase of midgut length

2.1 Figure 2 - main

2.1.1 Figure 2A

Midgut length is maximized at specific points in diet space. Adult flies were maintained for 5 days from eclosion on one of 28 diets based on different caloric concentration and yeast to sucrose ratios (see figure 1-figure supplement 1A for scheme on diets used and sample size). The list of recipes can be found in Table1. The figure shows contours of a thin-plate spline (Generalized Additive Model) of length (mm, coded by colors) as a function of yeast and sucrose in diet. Colored dots represent mean of samples in a particular diet.

tab_nutri_geo = 
  d[["2A"]]%>%
    mutate(Total.Lmm = Total.L / 1000)

tab_nutri_geo$YSdiet <- with(tab_nutri_geo, (Yeast.in.Diet)/(Sucrose.in.Diet))
    tab_nutri_geo$YSingested <- with(tab_nutri_geo, (Yeast.ingested)/(Sucrose.ingested))

jpeg(filename =  "F:/Dropbox/Github/Bonfini_eLife_2021/data/Plot_Fig2A.jpeg",
     res = 600,
     width = 5, height = 4, units = 'in' )
par(cex=1, mar = c(4.5, 4.5, 1, 3))
with(tab_nutri_geo, geomPlotta(x = Sucrose.in.Diet, y = Yeast.in.Diet, z = Total.Lmm, alf = 1, xlim = c(-10, 300), ylim = c(-10, 300), xlab = "Sucrose in diet (g/L)", ylab = "Yeast in diet (g/L)", frame.plot= FALSE, cex.lab=1.2, cex.axis =1, las=1, labcex=1, asp=1))
img2A = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/Plot_Fig2A.jpeg")
Error in transpose(y): object is NULL
gob_imageFig2A = rasterGrob(img2A)
Error in rasterGrob(img2A): objet 'img2A' introuvable
grid.draw(gob_imageFig2A)
Error in grid.draw(gob_imageFig2A): objet 'gob_imageFig2A' introuvable

2.1.2 Figure 2B

Plot show an increase in midgut length with increased amount of yeast ingested.

tab_nutri_geo = 
  d[["2A"]]%>%
    mutate(Total.Lmm = Total.L / 1000)
Error in UseMethod("mutate"): pas de méthode pour 'mutate' applicable pour un objet de classe "NULL"
tab_nutri_geo$title1 <- "Midgut length vs yeast ingested"
Error in tab_nutri_geo$title1 <- "Midgut length vs yeast ingested": objet 'tab_nutri_geo' introuvable
graph2 <- ggplot(tab_nutri_geo, aes(x=Yeast.ingested, y=Total.Lmm))
Error in ggplot(tab_nutri_geo, aes(x = Yeast.ingested, y = Total.Lmm)): objet 'tab_nutri_geo' introuvable
Plot_Fig2B=
  graph2 + geom_point(size=2,shape=16) + geom_smooth(span=1, size=1, color = "blue") +
  scale_y_continuous("Midgut length (mm)") +
  scale_x_continuous("Yeast ingested (g/L x absorbance)") +
    theme(panel.background = element_blank(),
        panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"),
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"))
Error in eval(expr, envir, enclos): objet 'graph2' introuvable
Plot_Fig2B
Error in eval(expr, envir, enclos): objet 'Plot_Fig2B' introuvable

2.1.3 Figure 2C

Plots show a decrease in midgut length with increased amount of sucrose ingested.

tab_nutri_geo = 
  d[["2A"]]%>%
    mutate(Total.Lmm = Total.L / 1000)
Error in UseMethod("mutate"): pas de méthode pour 'mutate' applicable pour un objet de classe "NULL"
graph3 <- ggplot(tab_nutri_geo, aes(x=Sucrose.ingested, y=Total.Lmm))
Error in ggplot(tab_nutri_geo, aes(x = Sucrose.ingested, y = Total.Lmm)): objet 'tab_nutri_geo' introuvable
Plot_Fig2C=
  graph3 + geom_point(size=2,shape=16) + geom_smooth(span=1, size=1, color = "red")+
  scale_y_continuous("Midgut length (mm)") +
  scale_x_continuous("Sucrose ingested (g/L x absorbance)") +
  theme(panel.background = element_blank(),
        panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"),
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"))
Error in eval(expr, envir, enclos): objet 'graph3' introuvable
Plot_Fig2C
Error in eval(expr, envir, enclos): objet 'Plot_Fig2C' introuvable

2.1.4 Figure 2D

Plot show an increase in midgut length with ratio of yeast to sucrose ingested.

tab_nutri_geo = 
  d[["2A"]]%>%
    mutate(Total.Lmm = Total.L / 1000)
Error in UseMethod("mutate"): pas de méthode pour 'mutate' applicable pour un objet de classe "NULL"
graph4 <- ggplot(tab_nutri_geo, aes(x=(Yeast.ingested/Sucrose.ingested), y=Total.Lmm))
Error in ggplot(tab_nutri_geo, aes(x = (Yeast.ingested/Sucrose.ingested), : objet 'tab_nutri_geo' introuvable
Plot_Fig2D=
  
graph4 + geom_point(size=2,shape=16) + geom_smooth(span=1, size=1, color = "green")+
  scale_y_continuous("Midgut length (mm)") +
  scale_x_continuous("Y:S ingested") +
  theme(panel.background = element_blank(),
        panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"),
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"))
Error in eval(expr, envir, enclos): objet 'graph4' introuvable
Plot_Fig2D
Error in eval(expr, envir, enclos): objet 'Plot_Fig2D' introuvable

2.1.5 Figure 2E

Several nutrients from yeast (proteins, lipids, vitamins/minerals) are required to increase midgut length. Nutrients from yeast (proteins, amino acids, lipids, cholesterol, vitamins/minerals) were added against a base diet of only the amount of sucrose found in HY and devoid of yeast. Letters above violin plots represent grouping by statistical differences (Post hoc Tukey on GLMM). Bars beneath the main plot describe caloric content provided by the different components. Proper label annotation (in line with the chart) can be found in manuscript figures

tab_lenght_complement = 
  d[["2E"]]%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  dplyr::rename(Diet=Food,
        Total_Length_mm = Total.Lmm)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
tab_lenght_complement$Diet = factor(tab_lenght_complement$Diet, levels = c("HS",
"S74Y0 (A)",
"A+Cas2",
"A+Cas4",
"A+AA",
"A+AA2",
"A+L4",
"A+Ch0.4",
"A+L2+Ch0.2",
"A+L4+Ch0.4",
"A+V2",
"A+V4",
"A+C4+L4+Ch0.4",
"A+C4+L4+Ch0.4+V2",
"HY")) #Order Diets
Error in factor(tab_lenght_complement$Diet, levels = c("HS", "S74Y0 (A)", : objet 'tab_lenght_complement' introuvable
Sample_size=
  tab_lenght_complement%>%
  group_by(Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet): objet 'tab_lenght_complement' introuvable
###Stats

mod.gen = fitme(log(Total_Length_mm) ~  Diet + (1 | Repeat), data = tab_lenght_complement)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_lenght_complement' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = tab_lenght_complement) 
Error in is.data.frame(data): objet 'tab_lenght_complement' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tab_lenght_complement) 
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_lenght_complement' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
#Now we make a tab with the results
tab_stat = data.frame(Variable = as.character(paste("Anova diets")),
                               Rep = nlevels(tab_lenght_complement$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_lenght_complement' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(Total_Length_mm) ~  Diet + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
mod.gen = lmer(Total_Length_mm ~  Diet + (1 | Repeat), data = tab_lenght_complement)
Error: bad 'data': objet 'tab_lenght_complement' introuvable
multcomp = glht(mod.gen, linfct=mcp(Diet="Tukey"))
Error in model.matrix(model) : objet 'mod.gen' introuvable
Error in factor_contrasts(model): no 'model.matrix' method for 'model' found!
tmp = cld(multcomp)
Error in cld(multcomp): objet 'multcomp' introuvable
letter_position = aggregate(data=tab_lenght_complement,Total_Length_mm ~ Diet, max)
Error in eval(m$data, parent.frame()): objet 'tab_lenght_complement' introuvable
tab_letter =  as.data.frame(tmp$mcletters$Letters)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'tmp' introuvable
tab_letter$Diet=rownames(tab_letter)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'rownames' : objet 'tab_letter' introuvable
colnames(tab_letter)[1] = "Letter"
Error in colnames(tab_letter)[1] = "Letter": objet 'tab_letter' introuvable
tab_letter = left_join(tab_letter,letter_position)
Error in left_join(tab_letter, letter_position): objet 'tab_letter' introuvable
### Plot

Limits= c("HS", "S74Y0 (A)", "A+Cas2", "A+Cas4", "A+AA", "A+AA2", "A+L4", "A+Ch0.4", "A+L2+Ch0.2", "A+L4+Ch0.4", "A+V2", "A+V4", "A+C4+L4+Ch0.4","A+C4+L4+Ch0.4+V2", "HY")

cbbPalette = c("#FFB4B4", "#f6efe5", "#f6efe5", "#f6efe5", "#f6efe5", "#f6efe5", "#f6efe5", "#f6efe5", "#f6efe5", "#f6efe5", "#f6efe5", "#f6efe5", "#f6efe5", "#f6efe5", "#C3E6FC") 


z = max(tab_lenght_complement$Total_Length_mm, na.rm=TRUE)
Error in eval(expr, envir, enclos): objet 'tab_lenght_complement' introuvable
Plot_Fig2E=
  ggplot(tab_lenght_complement, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z / 60) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 2.2, label = paste("(",Sample_size,")",sep="")),size=3)+
  geom_text(data = tab_letter, mapping = aes(x = Diet, y = Total_Length_mm+0.4, label = Letter),size=3)+
  geom_text(data = tab_stat, mapping = aes(x = 2, y = 7.5, label = paste("p=",Pvalue)),size=3)+
  scale_fill_manual(limits=Limits,
                    values=cbbPalette)+
  scale_x_discrete("",
                   limits=Limits)+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(2,8),
                     breaks=seq(3,7,by=1))+
                     stat_summary(fun = mean, geom = "point", size = 2, shape = 18, colour = "black", aes(group = Repeat)) +
                     stat_summary(fun = mean, geom = "point", size = 1, shape = 18, aes(group = Repeat, colour = Repeat)) +
                     scale_color_manual(values = palette_mean) +
  theme(panel.background = element_blank(),
        panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        axis.title.x = element_blank(),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_blank(),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(c(0,0,0,0.5), "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.5, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA))
Error in ggplot(tab_lenght_complement, aes(x = Diet, y = Total_Length_mm)): objet 'tab_lenght_complement' introuvable
tab_component_calories= mutate_if(d[["2E - calories"]],is.character,as.factor)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
tab_component_calories$Component <- factor(tab_component_calories$Component, levels = c("Lipids", "Proteins", "Carbohydrates"))
Error in factor(tab_component_calories$Component, levels = c("Lipids", : objet 'tab_component_calories' introuvable
Limits_2 = c("Lipids","Proteins","Carbohydrates")
Labels = c("Lipids","Proteins","Carbohydrates")

Plot_Fig2E_bis=
ggplot(tab_component_calories,aes(x=Diet,y=Calories.contributed))+
geom_bar(stat="identity",aes(fill=Component),color="black",width=.90)+
  scale_fill_manual(limits=Limits_2,
                      values=palette_component_3,
                      labels=Labels)+
  scale_x_discrete("",
                     limits=Limits)+
  scale_y_reverse("Calories",
                     breaks=c(seq(0,1400,by=300)))+
  theme(axis.title.x = element_blank(),
        axis.title.y =  element_text(size=Smallfont,colour="black"),
        axis.line.x = element_line(colour="white"),
        axis.line.y = element_line(colour="black"),
        axis.ticks.x = element_line(colour="white"),
        axis.ticks.y = element_line(),
        axis.text.x = element_blank(),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        panel.grid = element_blank(),
        plot.margin = unit(c(0,0,0,0), "cm"),
        legend.direction = "horizontal", 
        legend.box = "horizontal",
        legend.position = "bottom",
        legend.margin=margin(t=0.1, r=0.2, b=0.1, l=0, unit="cm"),
        legend.title = element_blank(), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=Smallfont),
        legend.background = element_rect(fill="white", colour="black"),
        legend.key.size = unit(0.5,"cm"),
      
        strip.text.x = element_text(size =Mediumfont, colour = "black",face="italic"),
        strip.text.y = element_text(size =Mediumfont, colour = "black",face="italic"),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside",
        panel.background = element_rect(fill="transparent"))+
  guides(fill=guide_legend(ncol=3))
Error in ggplot(tab_component_calories, aes(x = Diet, y = Calories.contributed)): objet 'tab_component_calories' introuvable
plot_2E = grid.arrange(Plot_Fig2E,
                       Plot_Fig2E_bis+ theme(legend.position="none"),
                       grid.text("HS",x=0.15, y=0.2, just="left",gp = gpar(fontsize=Smallfont,fontface="bold")),
                       grid.text("HY",x=0.95, y=1, just="left",gp = gpar(fontsize=Smallfont,fontface="bold")),
                       grid.text("Sucrose in HY completed with:",x=0.21, y=0.9,just="left",gp = gpar(fontsize=Smallfont,fontface="bold")),
                       grid.text("Casein       x0  x2  x4                                            x4 x4", x=0.02, y=0.52,just="left",gp = gpar(fontsize=Smallfont,fontface="bold")),
                       grid.text("AAs            x0            x1 x2", x=0.02, y=0.51,just="left",gp = gpar(fontsize=Smallfont,fontface="bold")),
                       
                       grid.text("Lard           x0                       x4       x2 x4            x4  x4", x=0.02, y=0.50,just="left",gp = gpar(fontsize=Smallfont,fontface="bold")),
                       grid.text("Chol.          x0                            x1  x1 x1            x1  x1", x=0.02, y=0.49,just="left",gp = gpar(fontsize=Smallfont,fontface="bold")),
                       
                       grid.text("Vit.             x0                                            x2  x4       x2", x=0.02, y=0.48,just="left",gp = gpar(fontsize=Smallfont,fontface="bold")),
                     
                       ncol = 1, heights = c(2,1,0.2,0.15, 0.15,0.15,0.15,0.15,0.15,0.2))
Error in arrangeGrob(...): objet 'Plot_Fig2E' introuvable

2.1.6 Figure 2F

Midgut size is antagonized by sugar, but not other added calories. Diet with only lipids, isocaloric with HS and HY diets, results in midguts of lengths comparable to those on HS diet. Substitution of sucrose from HS diet with isocaloric lipids (Lipids HS) results in midguts as long as those on HY. Midguts of flies reared on a diet substituting sucrose in HY diet with lipids (Lipids HY) are also similar in length to those of flies fed HY. Letters above violin plots represent grouping by statistical differences (Post hoc Tukey on GLMM). Bottom part of the chart (bar graph) describes caloric content provided by the different components.

tab_lipids =
  d[["2F"]]%>%
  mutate(Total_Length_mm =Total.L/1000)%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  dplyr::rename(Diet=Food)
Error in UseMethod("mutate"): pas de méthode pour 'mutate' applicable pour un objet de classe "NULL"
Sample_size=
  tab_lipids%>%
  group_by(Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet): objet 'tab_lipids' introuvable
###Stats

mod.gen = fitme(log(Total_Length_mm) ~  Diet + (1 | Repeat), data = tab_lipids)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_lipids' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = tab_lipids) 
Error in is.data.frame(data): objet 'tab_lipids' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tab_lipids) 
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_lipids' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
#Now we make a tab with the results
tab_stat = data.frame(Variable = as.character(paste("Anova diets")),
                               Rep = nlevels(tab_lipids$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_lipids' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(Total_Length_mm) ~  Diet + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
mod.gen = lmer(Total_Length_mm ~  Diet + (1 | Repeat), data = tab_lipids)
Error: bad 'data': objet 'tab_lipids' introuvable
multcomp = glht(mod.gen, linfct=mcp(Diet="Tukey"))
Error in model.matrix(model) : objet 'mod.gen' introuvable
Error in factor_contrasts(model): no 'model.matrix' method for 'model' found!
tmp = cld(multcomp)
Error in cld(multcomp): objet 'multcomp' introuvable
letter_position = aggregate(data=tab_lipids,Total_Length_mm ~ Diet, max)
Error in eval(m$data, parent.frame()): objet 'tab_lipids' introuvable
tab_letter =  as.data.frame(tmp$mcletters$Letters)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'tmp' introuvable
tab_letter$Diet=rownames(tab_letter)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'rownames' : objet 'tab_letter' introuvable
colnames(tab_letter)[1] = "Letter"
Error in colnames(tab_letter)[1] = "Letter": objet 'tab_letter' introuvable
tab_letter = left_join(tab_letter,letter_position)
Error in left_join(tab_letter, letter_position): objet 'tab_letter' introuvable
Limits =c("Lard Only","HS","HS Lard sub","HY Lard sub","HY")
Labels =c("Yeast:Lipid 0:1","Yeast:Sugar 1:14 (HS)","Yeast:Lipid 1:14","Yeast:Lipid 1:0.7","Yeast:Sugar 1:0.7 (HY)")
cbbPalette = c("#f6efe5", "#FFB4B4", "#f6efe5", "#f6efe5", "#C3E6FC")

z = max(tab_lipids$Total_Length_mm, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'tab_lipids' introuvable
Plot_Fig2F=
  ggplot(tab_lipids, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8, alpha = 0.5) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/60) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 2.5, label = paste("(",Sample_size,")",sep="")),size=3)+
  geom_text(data = tab_stat, mapping = aes(x = 1.7, y = 7.5, label = paste("p=",format(Pvalue,digits=2))),size=3)+
  geom_text(data = tab_letter, mapping = aes(x = Diet, y = Total_Length_mm+0.4, label = Letter),size=3)+
  scale_fill_manual(limits=Limits,
                    values=cbbPalette)+
  scale_x_discrete("",
                   limits=Limits,
                   labels=Labels)+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(2,8.2),
                     breaks=seq(2,8,by=1))+
   stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
                     stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
                     scale_color_manual(values = palette_mean) +
  theme(panel.background = element_blank(),
        panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        axis.title.x = element_blank(),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_blank(),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(c(0,0,0,0.5), "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA))
Error in ggplot(tab_lipids, aes(x = Diet, y = Total_Length_mm)): objet 'tab_lipids' introuvable
tab_component_calories_2F= mutate_if(d[["2F - calories"]],is.character,as.factor)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Limits_1 =c("Lard Only","HS","HS Lard","HY Lard","HY")
Labels_1 =c("Yeast:Lipid 0:1","Yeast:Sugar 1:14 (HS)","Yeast:Lipid 1:14","Yeast:Lipid 1:0.7","Yeast:Sugar 1:0.7 (HY)")

tab_component_calories_2F$Component <- factor(tab_component_calories_2F$Component, levels = c("Lipids", "Proteins", "Carbohydrates"))
Error in factor(tab_component_calories_2F$Component, levels = c("Lipids", : objet 'tab_component_calories_2F' introuvable
Limits_2 = c("Lipids","Proteins","Carbohydrates")
Labels_2 = c("Lipids","Proteins","Carbohydrates")

Plot_Fig2F_bis=
ggplot(tab_component_calories_2F,aes(x=Diet,y=Calories.contributed))+
geom_bar(stat="identity",aes(fill=Component),color="black",width=.90)+
  scale_x_discrete("",
                     limits=Limits_1,
                   labels=Labels_1)+
  scale_y_reverse("Calories",
                     breaks=c(seq(0,600,by=200)))+
  scale_fill_manual(limits=Limits_2,
                      values=palette_component_3,
                      labels=Labels_2)+
  theme(axis.title.x = element_blank(),
        axis.title.y =  element_text(size=Smallfont,colour="black"),
        axis.line.x = element_line(colour="white"),
        axis.line.y = element_line(colour="black"),
        axis.ticks.x = element_line(colour="white"),
        axis.ticks.y = element_line(),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=45,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        panel.grid = element_blank(),
        plot.margin = unit(c(0,0,0,0), "cm"),
        legend.direction = "horizontal", 
        legend.box = "horizontal",
        legend.position = "bottom",
        legend.key.height = unit(0.3, "cm"),
        legend.key.width= unit(0.3, "cm"),
        legend.margin=margin(t=0, r=0, b=0, l=0, unit="cm"),
        legend.title = element_blank(), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=Smallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size =Mediumfont, colour = "black",face="italic"),
        strip.text.y = element_text(size =Mediumfont, colour = "black",face="italic"),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside",
        panel.background = element_rect(fill="transparent"))+
  guides(fill=guide_legend(ncol=3))
Error in ggplot(tab_component_calories_2F, aes(x = Diet, y = Calories.contributed)): objet 'tab_component_calories_2F' introuvable
g_legend=function(a.gplot){
  tmp = ggplot_gtable(ggplot_build(a.gplot))
  leg = which(sapply(tmp$grobs, function(x) x$name) == "guide-box")
  legend = tmp$grobs[[leg]]
  return(legend)}

mylegend=g_legend(Plot_Fig2F_bis)
Error in ggplot_build(a.gplot): objet 'Plot_Fig2F_bis' introuvable
plot_2F = grid.arrange(Plot_Fig2F,
                       Plot_Fig2F_bis+ theme(legend.position="none"),
                       ncol = 1, heights = c(2,2))
Error in arrangeGrob(...): objet 'Plot_Fig2F' introuvable

2.1.7 Figure 2G

Antagonism by sugar of yeast-induced growth is not specific to sucrose. Statistical comparisons were performed with HS vs HY for each sugar.

tab_sugars =
  d[["2G"]]%>%
  mutate(Total_Length_mm =Total.L/1000)%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  dplyr::rename(Day_of_Treatment=Day)
Error in UseMethod("mutate"): pas de méthode pour 'mutate' applicable pour un objet de classe "NULL"
tab_sugars$Sugar = factor(c("Sucrose","Fructose","Glucose","Maltose"), levels = c("Sucrose", "Glucose", "Fructose", "Maltose"))
Error in tab_sugars$Sugar = factor(c("Sucrose", "Fructose", "Glucose", : objet 'tab_sugars' introuvable
Sample_size=
  tab_sugars%>%
  group_by(Diet,Sugar)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet, Sugar): objet 'tab_sugars' introuvable
###Stats
# Sucrose:
mod.gen = fitme(log(Total_Length_mm) ~  Diet + (1 | Repeat), data = subset(tab_sugars,Sugar=="Sucrose"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_sugars' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = subset(tab_sugars,Sugar=="Sucrose")) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_sugars' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = subset(tab_sugars,Sugar=="Sucrose")) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_sugars' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("HS vs HY sucrose")),
                               Rep = nlevels(tab_lipids$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_lipids' introuvable
tab_stat_sucrose =tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
# Glucose:
mod.gen = fitme(log(Total_Length_mm) ~  Diet + (1 | Repeat), data = subset(tab_sugars,Sugar=="Glucose"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_sugars' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = subset(tab_sugars,Sugar=="Glucose")) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_sugars' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = subset(tab_sugars,Sugar=="Glucose")) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_sugars' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("HS vs HY glucose")),
                               Rep = nlevels(tab_lipids$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_lipids' introuvable
tab_stat_Glucose=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
# Fructose:
mod.gen = fitme(log(Total_Length_mm) ~  Diet + (1 | Repeat), data = subset(tab_sugars,Sugar=="Fructose"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_sugars' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = subset(tab_sugars,Sugar=="Fructose")) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_sugars' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = subset(tab_sugars,Sugar=="Fructose")) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_sugars' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("HS vs HY fructose")),
                               Rep = nlevels(tab_lipids$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_lipids' introuvable
tab_stat_Fructose = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
# Maltose:
mod.gen = fitme(log(Total_Length_mm) ~  Diet + (1 | Repeat), data = subset(tab_sugars,Sugar=="Maltose"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_sugars' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = subset(tab_sugars,Sugar=="Maltose")) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_sugars' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = subset(tab_sugars,Sugar=="Maltose")) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_sugars' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("HS vs HY maltose")),
                               Rep = nlevels(tab_lipids$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_lipids' introuvable
tab_stat_Maltose= tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat = rbind(tab_stat_sucrose,tab_stat_Glucose,tab_stat_Fructose,tab_stat_Maltose)
Error in eval(quote(list(...)), env): objet 'tab_stat_sucrose' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat$Sugar = c("Sucrose","Glucose","Fructose","Maltose")
Error in tab_stat$Sugar = c("Sucrose", "Glucose", "Fructose", "Maltose"): objet 'tab_stat' introuvable
tab_stat$Sugar =as.factor(tab_stat$Sugar)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.factor' : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif.","Sugar"),row.names = FALSE) %>%   add_header_above(c("log(Total_Length_mm) ~  Diet + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
Limits = c("HS","HY")
Labels= c("HS","HY")

z = max(tab_sugars$Total_Length_mm, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'tab_sugars' introuvable
Plot_Fig2G=
  ggplot(tab_sugars, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot(colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z / 60) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 2.5, label = paste("(",Sample_size,")",sep="")),size=3)+
  geom_signif(data = tab_stat,aes(xmin = 1, xmax = 2, annotations = formatC(paste("p=",Pvalue), digits = 2), y_position = 8.5), textsize = 3, vjust = -0.2, manual = TRUE)+
  facet_grid(.~Sugar)+
  scale_fill_manual(limits=Limits,
                    values=palette_diet_2)+
  scale_x_discrete("",
                   limits=Limits,
                   labels=Labels)+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(2,9),
                     breaks=seq(2,8,by=1))+
   stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
                     stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
                     scale_color_manual(values = palette_mean) +
  theme(panel.background = element_blank(),
        panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        axis.title.x = element_blank(),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"), 
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(c(0,0,0,0.5), "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_sugars, aes(x = Diet, y = Total_Length_mm)): objet 'tab_sugars' introuvable
Plot_Fig2G
Error in eval(expr, envir, enclos): objet 'Plot_Fig2G' introuvable

##Export Figure 2

2.2 Figure 2 - figure supplement 1

2.2.1 Figure 2S1A

Set of diets utilized for the nutritional geometry experiment. Numbers on dots denote sample sizes for figure 2A (pool of three independent biological replicates). We utilized 28 different diets, varying either caloric content or the yeast to sucrose ratio. The complete list of recipes can be found in Table 1. Complete numbers can be found in manuscript figure

tab_nutri_geo_design = 
  d[["2 - S1A"]]%>%
  dplyr::rename(Yeast.in.Diet=Yeast,
         Sucrose.in.Diet=Sugar)
Error in UseMethod("rename"): pas de méthode pour 'rename' applicable pour un objet de classe "NULL"
tab_raw_2A = 
  d[["2A"]]%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  mutate(Conc = paste(round(Sucrose.in.Diet,digits=2),"x",round(Yeast.in.Diet,digits=2),sep=""))%>%
  group_by(Yeast.in.Diet,Sucrose.in.Diet)%>%
  summarise(Sample_size=n())
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
tab_nutri_geo_design = left_join(tab_nutri_geo_design,tab_raw_2A)
Error in left_join(tab_nutri_geo_design, tab_raw_2A): objet 'tab_nutri_geo_design' introuvable
Plot_Fig2S1A=
  ggplot(tab_nutri_geo_design, aes(x = Sucrose.in.Diet, y = Yeast.in.Diet,label=Sample_size))+ 
  geom_point(aes(size=Calories), colour = "black") + 
  scale_x_continuous("Sucrose in diet (g/L)",
                     limits=c(-5,300),
                     breaks=seq(0,300,by=100))+
  scale_y_continuous("Yeast in diet (g/L)",
                     limits=c(-5,300),
                     breaks=seq(0,300,by=100))+
  geom_text(data=subset(tab_nutri_geo_design,Yeast.in.Diet>=30 | Sucrose.in.Diet>=30),color="white",size=3)+
  scale_size_continuous(range = c(1,13)) +
  theme(panel.background = element_blank(),
        panel.grid.major = element_line(colour = "black",linetype=3),
        axis.title.x = element_text(size=Smallfont,colour="black"), 
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"), 
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(c(0,0,0,0.5), "cm"),
        legend.direction = "horizontal", 
        legend.box = "horizontal",
        legend.position = "top",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size =Smallfont, colour = "black",face="italic"),
        strip.text.y = element_text(size =Smallfont, colour = "black",face="italic"),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")+
  guides(size=guide_legend(ncol=4))
Error in ggplot(tab_nutri_geo_design, aes(x = Sucrose.in.Diet, y = Yeast.in.Diet, : objet 'tab_nutri_geo_design' introuvable
Plot_Fig2S1A
Error in eval(expr, envir, enclos): objet 'Plot_Fig2S1A' introuvable

HS and HY diet compared to standard diets used for Drosophila

2.2.2 Figure 2S1B

FD&C1 blue transit assay (feeding assay) showing amount of food defecated, and by inference ingested, in the nutritional geometry experiment. The scale maps color to units. The graph indicates compensatory feeding at lower nutrient densities, especially low yeast. These data were used to calculate the total amount of yeast and sucrose ingested on each diet in Figure 2-supplemental figure 1C.

tab_geom_fecal = 
  d[["2 - S1B"]]

jpeg(filename = "F:/Dropbox/Github/Bonfini_eLife_2021/data/Plot_Fig2-S1B.jpeg",
     res = 600,
     width = 5, height = 4, units = 'in' )
par(cex=1, mar = c(4, 4, 1, 3))
with(tab_geom_fecal, geomPlotta(x = Sucrose.in.Diet, y = Yeast.in.Diet, z = (Absorbance*10), alf = 1, xlim = c(-10, 300), ylim = c(-10, 300), xlab = "Sucrose in diet (g/L)", ylab = "Yeast in diet (g/L)", frame.plot= FALSE, cex.lab=1, cex.axis =1, las=1, labcex=1, asp=1))
img2S1B = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/Plot_Fig2-S1B.jpeg") 
Error in transpose(y): object is NULL
gob_imageFig2S1B = rasterGrob(img2S1B)
Error in rasterGrob(img2S1B): objet 'img2S1B' introuvable
grid.draw(gob_imageFig2S1B)
Error in grid.draw(gob_imageFig2S1B): objet 'gob_imageFig2S1B' introuvable

2.2.3 Figure 2S1C

Yeast and sucrose have mutually antagonistic impacts on midgut length. Plots show midgut length as a function of sucrose or yeast ingested (g/L x Absorbance from Figure 2-supplemental figure 1B), or their ratio multiplied by ingestion per diet.

tab_nutri_geo = 
  d[["2A"]]%>%
    mutate(Total.Lmm = Total.L / 1000)
Error in UseMethod("mutate"): pas de méthode pour 'mutate' applicable pour un objet de classe "NULL"
tab_nutri_geo2 <- tab_nutri_geo %>%
    group_by(concatenate) %>%
    summarize(Calories.ingested = mean(Calories.ingested),
              Midgut.length = mean(Total.Lmm),
              Yeast.ingested = mean(Yeast.ingested),
              Sucrose.ingested = mean(Sucrose.ingested))
Error in group_by(., concatenate): objet 'tab_nutri_geo' introuvable
graph <- ggplot(tab_nutri_geo2, aes(x=Sucrose.ingested, y=Yeast.ingested))
Error in ggplot(tab_nutri_geo2, aes(x = Sucrose.ingested, y = Yeast.ingested)): objet 'tab_nutri_geo2' introuvable
Plot_Fig2S1C=
  graph + geom_point(aes(size=Calories.ingested, fill=Midgut.length), stroke=1.5, shape=21,  color="black") +
  scale_size(range = c(1,5)) +
  scale_fill_viridis_c() +
  theme(plot.title= element_text(hjust = 0.5))+
  scale_x_continuous("Sucrose ingested (g/L x Absorbance)",
                     limits=c(-5,160),
                     breaks=seq(0,160,by=25))+
  scale_y_continuous("Yeast ingested (g/L x Absorbance)",
                     limits=c(-5,50),
                     breaks=seq(0,50,by=10))+
  scale_size_continuous(range = c(1,10)) +
  theme(panel.background = element_blank(),
        panel.grid.major = element_line(colour = "black",linetype=3),
        axis.title.x = element_text(size=Smallfont,colour="black"), 
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"), 
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(c(0,0,0,0.5), "cm"),
        legend.direction = "horizontal", 
        legend.box = "vertical",
        legend.position = c(0.79,0.79),
        legend.key.height = unit(0.3, "cm"),
        legend.key.width= unit(0.4, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        strip.text.x = element_text(size =Smallfont, colour = "black",face="italic"),
        strip.text.y = element_text(size =Smallfont, colour = "black",face="italic"),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")+
  labs(fill = "Midgut length (mm)", size = "Calories ingested")
Error in eval(expr, envir, enclos): objet 'graph' introuvable
Plot_Fig2S1C
Error in eval(expr, envir, enclos): objet 'Plot_Fig2S1C' introuvable

##Export Figure 2S1

2.3 Figure 2 - figure supplement 2

2.3.1 Figure 2S2A

Food texture does not explain the differential effects of HS and HY diets on midgut length. Addition of inulin (inu), pectin (pect), cellulose (cell), and all previous fibers mixed (AF) or pectin + cellulose (PC) to HS does not increase midgut length. Addition of fibers to HY (HY + AF) and HY + pectin + cellulose (HY + PC2) does not affect midgut length.

tab_fiber = 
  d[["2 - S2A"]]%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  mutate(Total_Length_mm = Total.L/1000)%>%
  dplyr::rename(Diet=Food)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
tab_fiber$Diet = factor(tab_fiber$Diet, levels = c("HS", "HS + Inu", "HS + Pect", "HS + Pect2", "HS + Cell", "HS + Cell2", "HS + AF", "HS + PC2", "HY + AF", "HY + PC2", "HY")) 
Error in factor(tab_fiber$Diet, levels = c("HS", "HS + Inu", "HS + Pect", : objet 'tab_fiber' introuvable
Sample_size=
  tab_fiber%>%
  group_by(Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet): objet 'tab_fiber' introuvable
###Stats

mod.gen = fitme(log(Total_Length_mm) ~  Diet + (1 | Repeat), data = tab_fiber)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_fiber' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = tab_fiber) 
Error in is.data.frame(data): objet 'tab_fiber' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tab_fiber) 
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_fiber' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
#Now we make a tab with the results
tab_stat = data.frame(Variable = as.character(paste("Any difference")),
                               Rep = nlevels(tab_fiber$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_fiber' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(Total_Length_mm) ~  Diet + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
mod.gen = lmer(Total_Length_mm ~  Diet + (1 | Repeat), data = tab_fiber)
Error: bad 'data': objet 'tab_fiber' introuvable
multcomp = glht(mod.gen, linfct=mcp(Diet="Tukey"))
Error in model.matrix(model) : objet 'mod.gen' introuvable
Error in factor_contrasts(model): no 'model.matrix' method for 'model' found!
tmp = cld(multcomp)
Error in cld(multcomp): objet 'multcomp' introuvable
letter_position = aggregate(data=subset(tab_fiber,!is.na(Total_Length_mm)),Total_Length_mm ~ Diet, max)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_fiber' introuvable
tab_letter =  as.data.frame(tmp$mcletters$Letters)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'tmp' introuvable
tab_letter$Diet=rownames(tab_letter)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'rownames' : objet 'tab_letter' introuvable
colnames(tab_letter)[1] = "Letter"
Error in colnames(tab_letter)[1] = "Letter": objet 'tab_letter' introuvable
tab_letter = left_join(tab_letter,letter_position)
Error in left_join(tab_letter, letter_position): objet 'tab_letter' introuvable
### Plot

Limits= c("HS", "HS + Inu", "HS + Pect", "HS + Pect2", "HS + Cell", "HS + Cell2", "HS + AF", "HS + PC2", "HY + AF", "HY + PC2", "HY")

cbbPalette = c("#FFB4B4", "#f6efe5", "#f6efe5", "#f6efe5", "#f6efe5", "#f6efe5", "#f6efe5","#f6efe5", "#f6efe5", "#f6efe5", "#C3E6FC")
z = max(tab_fiber$Total_Length_mm, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'tab_fiber' introuvable
Plot_Fig2S2A=
  ggplot(tab_fiber, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/60) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 2.5, label = paste("(",Sample_size,")",sep="")),size=3)+
  geom_text(data = tab_letter, mapping = aes(x = Diet, y = Total_Length_mm+0.4, label = Letter),size=3)+
  geom_text(data = tab_stat, mapping = aes(x = 1.5, y = 7.5, label = paste("p=",format(Pvalue,digits=2))),size=3)+
  scale_fill_manual(limits=Limits,
                    values=cbbPalette)+
  scale_x_discrete("",
                   limits=Limits)+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(2,8),
                     breaks=seq(2,8,by=1))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.background = element_blank(),
        panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        axis.title.x = element_blank(),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=45,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(c(0,0,0,0.5), "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA))
Error in ggplot(tab_fiber, aes(x = Diet, y = Total_Length_mm)): objet 'tab_fiber' introuvable
Plot_Fig2S2A
Error in eval(expr, envir, enclos): objet 'Plot_Fig2S2A' introuvable

2.3.2 Figure 2S2B

Changes in food texture due to variation in agar concentration can affect midgut length but do not explain the effect of the diet treatment. Changes in agar concentration do not change midgut length on HS. Either increasing or decreasing agar concentration reduces midgut length on HY.

tab_agar =  
  d[["2 - S2B"]]%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  mutate(Total_Length_mm = Total.L/1000)%>%
  dplyr::rename(Diet=Food)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
levels(tab_agar$Diet)[levels(tab_agar$Diet)=="HS"] ="HS (original, 1.5%)"
Error in levels(tab_agar$Diet)[levels(tab_agar$Diet) == "HS"] = "HS (original, 1.5%)": objet 'tab_agar' introuvable
levels(tab_agar$Diet)[levels(tab_agar$Diet)=="HY"] ="HY (original, 1.5%)"
Error in levels(tab_agar$Diet)[levels(tab_agar$Diet) == "HY"] = "HY (original, 1.5%)": objet 'tab_agar' introuvable
Sample_size=
  tab_agar%>%
  group_by(Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet): objet 'tab_agar' introuvable
###Stats

mod.gen = fitme(log(Total_Length_mm) ~  Diet + (1 | Repeat), data = tab_agar)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_agar' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = tab_agar) 
Error in is.data.frame(data): objet 'tab_agar' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tab_agar) 
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_agar' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
#Now we make a tab with the results
tab_stat = data.frame(Variable = as.character(paste("Any difference")),
                               Rep = nlevels(tab_agar$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_agar' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(Total_Length_mm) ~  Diet + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
mod.gen = lmer(Total_Length_mm ~  Diet + (1 | Repeat), data = tab_agar)
Error: bad 'data': objet 'tab_agar' introuvable
multcomp = glht(mod.gen, linfct=mcp(Diet="Tukey"))
Error in model.matrix(model) : objet 'mod.gen' introuvable
Error in factor_contrasts(model): no 'model.matrix' method for 'model' found!
tmp = cld(multcomp)
Error in cld(multcomp): objet 'multcomp' introuvable
letter_position = aggregate(data=subset(tab_agar,!is.na(Total_Length_mm)),Total_Length_mm ~ Diet, max)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_agar' introuvable
tab_letter =  as.data.frame(tmp$mcletters$Letters)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'tmp' introuvable
tab_letter$Diet=rownames(tab_letter)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'rownames' : objet 'tab_letter' introuvable
colnames(tab_letter)[1] = "Letter"
Error in colnames(tab_letter)[1] = "Letter": objet 'tab_letter' introuvable
tab_letter = left_join(tab_letter,letter_position)
Error in left_join(tab_letter, letter_position): objet 'tab_letter' introuvable
### Plot

Limits= c("HS Agar 0.5%", "HS Agar 1%", "HS (original, 1.5%)", "HS Agar 3%", "HY Agar 0.5%", "HY Agar 1%", "HY (original, 1.5%)", "HY Agar 3%")

cbbPalette = c("#FFB4B4", "#FFB4B4", "#FFB4B4", "#FFB4B4", "#C3E6FC", "#C3E6FC", "#C3E6FC", "#C3E6FC")
z = max(tab_agar$Total_Length_mm, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'tab_agar' introuvable
Plot_Fig2S2B=
  ggplot(tab_agar, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/60) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 2.5, label = paste("(",Sample_size,")",sep="")),size=3)+
  geom_text(data = tab_letter, mapping = aes(x = Diet, y = Total_Length_mm+0.4, label = Letter),size=3)+
  geom_text(data = tab_stat, mapping = aes(x = 1.5, y = 7.5, label = paste("p=",Pvalue)),size=3)+
  scale_fill_manual(limits=Limits,
                    values=cbbPalette)+
  scale_x_discrete("",
                   limits=Limits)+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(2,8),
                     breaks=seq(2,8,by=1))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.background = element_blank(),
        panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        axis.title.x = element_blank(),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=34,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(c(0,0,0,0.5), "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA))
Error in ggplot(tab_agar, aes(x = Diet, y = Total_Length_mm)): objet 'tab_agar' introuvable
Plot_Fig2S2B
Error in eval(expr, envir, enclos): objet 'Plot_Fig2S2B' introuvable

2.3.3 Figure 2S2C

Sorbitol, a nutritious but not palatable sugar, has increased size on HY compared to HS, while Arabinose, a palatable but not nutritious sugar, results in death of flies before reaching dissection day on HS, and decreased size of midguts on HY diet. Statistical analysis is HS vs HY for each sugar.

tab_xtrsugars_rev =
  d[["2S2C"]]%>%
  mutate(Total_Length_mm =Total.L/1000)%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  dplyr::rename(Day_of_Treatment=Day)%>%
  mutate(Sugar=fct_relevel(Sugar,"Sucrose","Sorbitol", "Arabinose"))
Error in UseMethod("mutate"): pas de méthode pour 'mutate' applicable pour un objet de classe "NULL"
#tab_xtrsugars_rev$Sugar = factor(c("Sucrose","Sorbitol","Arabinose"), levels = c("Sucrose", "Sorbitol", "Arabinose"))

Sample_size=
  tab_xtrsugars_rev%>%
  group_by(Diet,Sugar)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet, Sugar): objet 'tab_xtrsugars_rev' introuvable
###Stats
# Sucrose:
mod.gen = fitme((Total_Length_mm) ~  Diet + (1 | Repeat), data = subset(tab_xtrsugars_rev,Sugar=="Sucrose"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_xtrsugars_rev' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest((Total_Length_mm) ~ Diet + (1 / Repeat), data = subset(tab_xtrsugars_rev,Sugar=="Sucrose")) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_xtrsugars_rev' introuvable
mod.gen1 = fitme((Total_Length_mm) ~ 1 + (1 | Repeat), data = subset(tab_xtrsugars_rev,Sugar=="Sucrose")) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_xtrsugars_rev' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("HS vs HY Sucrose")),
                               Rep = nlevels(tab_lipids$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_lipids' introuvable
tab_stat_sucrose =tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
# Sorbitol:
mod.gen = fitme((Total_Length_mm) ~  Diet + (1 | Repeat), data = subset(tab_xtrsugars_rev,Sugar=="Sorbitol"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_xtrsugars_rev' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest((Total_Length_mm) ~ Diet + (1 / Repeat), data = subset(tab_xtrsugars_rev,Sugar=="Sorbitol")) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_xtrsugars_rev' introuvable
mod.gen1 = fitme((Total_Length_mm) ~ 1 + (1 | Repeat), data = subset(tab_xtrsugars_rev,Sugar=="Sorbitol")) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_xtrsugars_rev' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("HS vs HY Sorbitol")),
                               Rep = nlevels(tab_lipids$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_lipids' introuvable
tab_stat_Sorbitol=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat = rbind(tab_stat_sucrose,tab_stat_Sorbitol)
Error in eval(quote(list(...)), env): objet 'tab_stat_sucrose' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat$Sugar = c("Sucrose","Sorbitol")
Error in tab_stat$Sugar = c("Sucrose", "Sorbitol"): objet 'tab_stat' introuvable
tab_stat$Sugar=as.factor(tab_stat$Sugar)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.factor' : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif.","Sugar"),row.names = FALSE) %>%   add_header_above(c("log(Total_Length_mm) ~  Diet + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
Limits = c("HS","HY")
Labels= c("HS","HY")

z = max(tab_xtrsugars_rev$Total_Length_mm, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'tab_xtrsugars_rev' introuvable
Plot_Fig2S2C=
  ggplot(tab_xtrsugars_rev, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z / 60) + 
  facet_grid(.~Sugar)+
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 1.8, label = paste("(",Sample_size,")",sep="")),size=3)+
    geom_signif(data = tab_stat,aes(xmin = 1, xmax = 2, annotations = formatC(paste("p=",Pvalue), digits = 2), y_position = 7.4), textsize = 3, vjust = -0.2, manual = TRUE)+
  scale_fill_manual(limits=Limits,
                    values=palette_diet_2)+
  scale_x_discrete("",
                   limits=Limits,
                   labels=Labels)+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(1.7,7.5),
                     breaks=seq(2,8,by=1))+
   stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
                     stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
                     scale_color_manual(values = palette_mean) +
  theme(panel.background = element_blank(),
        panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        axis.title.x = element_blank(),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"), 
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(c(0,0,0,0.5), "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_xtrsugars_rev, aes(x = Diet, y = Total_Length_mm)): objet 'tab_xtrsugars_rev' introuvable
Plot_Fig2S2C
Error in eval(expr, envir, enclos): objet 'Plot_Fig2S2C' introuvable

##Export Figure 2S2

3 Figure 3. Diet composition affects both cell number and enterocyte size in the midgut

3.1 Figure 3 - main

3.1.1 Figure 3A - B

Representative pictures of midguts from flies kept on HS (A) or HY (B) diet. Green arrows indicate intestinal stem cells (ISCs), marked only by GFP (green), red arrows mark enteroblasts (EBs), marked by GFP and GBE Su(H)-lacZ (red), and white arrow indicate enteroendocrine (EE) cells, marked with anti-Prospero antibody (white). All nuclei are stained with DAPI (blue). Complete graphical annotation can be found in manuscript figures

Error in transpose(y): object is NULL
Error in rasterGrob(img3A): objet 'img3A' introuvable
Error in grid.draw(gob_imageFig3A): objet 'gob_imageFig3A' introuvable
Error in transpose(y): object is NULL
Error in rasterGrob(img3B): objet 'img3B' introuvable
Error in grid.draw(gob_imageFig3B): objet 'gob_imageFig3B' introuvable

3.1.2 Figure 3C

Quantification of total cell numbers in the posterior midgut (R4) for HS and HY

Tab_cellnumber = 
  d[["3C"]]%>%
     mutate(across(c(Diet,Line,Day,Repeat,GutNumber,Region),as.factor))%>%
     mutate(across(c(ISC.AL,EB.AL,EE.AL,EC.AL),round,0))
Error in UseMethod("mutate"): pas de méthode pour 'mutate' applicable pour un objet de classe "NULL"
###Stats
#### ISC
mod.gen = fitme(log(ISC.AL) ~  Diet + (1 | Repeat), data = Tab_cellnumber)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Tab_cellnumber' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(ISC.AL) ~ Diet + (1 / Repeat), data = Tab_cellnumber) 
Error in is.data.frame(data): objet 'Tab_cellnumber' introuvable
mod.gen1 = fitme(log(ISC.AL) ~  1 + (1 | Repeat), data = Tab_cellnumber)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Tab_cellnumber' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("HS vs HY ISC")),
  Cell_type = as.character(paste("ISC.AL")),
                               Rep = nlevels(Tab_cellnumber$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Tab_cellnumber' introuvable
tab_stat_ISC=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#### EB
mod.gen = fitme(log(EB.AL) ~  Diet + (1 | Repeat),data = Tab_cellnumber)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Tab_cellnumber' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(EB.AL) ~ Diet + (1 / Repeat),data = Tab_cellnumber) 
Error in is.data.frame(data): objet 'Tab_cellnumber' introuvable
mod.gen1 = fitme(log(EB.AL) ~ 1 + (1 | Repeat), data = Tab_cellnumber) 
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Tab_cellnumber' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("HS vs HY EB")),
                      Cell_type = as.character(paste("EB.AL")),
                               Rep = nlevels(Tab_cellnumber$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Tab_cellnumber' introuvable
tab_stat_EB=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#### EC
mod.gen = fitme(log(EC.AL) ~  Diet + (1 | Repeat), data = Tab_cellnumber)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Tab_cellnumber' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(EC.AL) ~ Diet + (1 / Repeat), data = Tab_cellnumber) 
Error in is.data.frame(data): objet 'Tab_cellnumber' introuvable
mod.gen1 = fitme(log(EC.AL) ~ 1 + (1 | Repeat), data = Tab_cellnumber) 
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Tab_cellnumber' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
test
function (pkg = ".", filter = NULL, stop_on_failure = FALSE, 
    export_all = TRUE, ...) 
{
    save_all()
    pkg <- as.package(pkg)
    if (!uses_testthat(pkg) && interactive()) {
        cli::cli_alert_danger("No testing infrastructure found. Create it?")
        if (utils::menu(c("Yes", "No")) == 1) {
            usethis_use_testthat(pkg)
        }
        return(invisible())
    }
    load_all(pkg$path)
    cli::cli_alert_info("Testing {.pkg {pkg$package}}")
    withr::local_envvar(r_env_vars())
    testthat::test_local(pkg$path, filter = filter, stop_on_failure = stop_on_failure, 
        ...)
}
<bytecode: 0x000000009e53be20>
<environment: namespace:devtools>
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("HS vs HY EC")),
  Cell_type = as.character(paste("EC.AL")),
                               Rep = nlevels(Tab_cellnumber$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Tab_cellnumber' introuvable
tab_stat_EC=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#### EE
mod.gen = fitme(log(EE.AL) ~  Diet + (1 | Repeat), data = Tab_cellnumber)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Tab_cellnumber' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(EE.AL) ~ Diet + (1 / Repeat), data = Tab_cellnumber) 
Error in is.data.frame(data): objet 'Tab_cellnumber' introuvable
mod.gen1 = fitme(log(EE.AL) ~ 1 + (1 | Repeat), data = Tab_cellnumber) 
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Tab_cellnumber' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("HS vs HY EE")),
                      Cell_type = as.character(paste("EE.AL")),
                               Rep = nlevels(Tab_cellnumber$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Tab_cellnumber' introuvable
tab_stat_EE=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat=rbind(tab_stat_ISC,tab_stat_EB,tab_stat_EC,tab_stat_EE)
Error in eval(quote(list(...)), env): objet 'tab_stat_ISC' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Cell type", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(Cell number) ~  Diet + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Cell type", "Replicates", : objet 'tab_stat' introuvable
### Plot
Limits = c("HS", "HY")

Tab_cellnumber_gather=
  Tab_cellnumber %>%
  select(Diet,Line,Day,Repeat,GutNumber,Region,EB.AL,ISC.AL,EE.AL,EC.AL)%>%
  gather(key, value, -c(Diet,Line,Day,Repeat,GutNumber,Region)) %>%
  dplyr::rename(Cell_type = key,
         Cell_number = value) %>%
  mutate_if(is.character,as.factor)
Error in select(., Diet, Line, Day, Repeat, GutNumber, Region, EB.AL, : objet 'Tab_cellnumber' introuvable
Sample_size=
  subset(Tab_cellnumber_gather,!is.na(Day))%>%
  group_by(Diet,Cell_type)%>%
  summarise(Sample_size=n(),
            max=max(Cell_number,na.rm=T))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Tab_cellnumber_gather' introuvable
tmp=subset(Sample_size,Diet=="HY")
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Sample_size' introuvable
tab_stat = 
  left_join(tab_stat,tmp)
Error in left_join(tab_stat, tmp): objet 'tab_stat' introuvable
Treatment.status = c("ISC", "EB","EC","EE")
names(Treatment.status) = c("ISC.AL", "EB.AL","EC.AL","EE.AL")


Plot_Fig3C=
  ggplot(Tab_cellnumber_gather, aes(x = Diet, y = Cell_number/100*2))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center") + 
  facet_wrap(.~Cell_type,scale="free_y",labeller=labeller(Cell_type=Treatment.status))+
  geom_blank(data=tab_stat, aes(y = max/100*2.5))+
  geom_signif(data = tab_stat, aes(xmin = 1, xmax = 2, annotations = formatC(paste("p=",Pvalue), digits = 2), y_position = max/100*2.2,), textsize = 3, vjust = -0.2, manual = TRUE)+
  scale_fill_manual(limits=Limits,
                    values=palette_diet_2)+
  scale_x_discrete("",
                   limits=c("HS", "HY"),
                   labels=c("HS (n = 46)", "HY (n = 55)"))+
  scale_y_continuous(expression(paste("Cell number in posterior midgut (x",10^2,")",sep="")))+
  stat_summary(fun = mean, geom = "point", size = 2.5, shape = 18, colour = "black", aes(group = Repeat)) +
                     stat_summary(fun = mean, geom = "point", size = 1.5, shape = 18, aes(group = Repeat, colour = Repeat)) +
                     scale_color_manual(values = palette_mean) +
  theme(
    panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
    panel.background = element_blank(),
    axis.title.x = element_text(size=Smallfont,colour="black"),
    axis.title.y = element_text(size=Smallfont,colour="black"), 
    axis.line.x = element_line(colour="black",size=0.75),
    axis.line.y = element_line(colour="black",size=0.75),
    axis.ticks.x = element_line(size = 0.75),
    axis.ticks.y = element_line(size = 0.75),
    axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
    axis.text.y = element_text(size=Smallfont,colour="black"),
    plot.margin = unit(Margin, "cm"),
    legend.direction = "vertical", 
    legend.box = "horizontal",
    legend.position = "none",
    legend.key.height = unit(0.4, "cm"),
    legend.key.width= unit(0.6, "cm"),
    legend.title = element_text(face="italic",size=Smallfont), 
    legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
    legend.text = element_text(size=SuperSmallfont),
    legend.background = element_rect(fill=NA),
    strip.text.x = element_text(size = Smallfont, colour = "black", margin = margin(t = 1, r = 0, b = 1, l = 0)),
    strip.text.y = element_text(size = Smallfont, colour = "black", margin = margin(t = 1, r = 0, b = 1, l = 0)),
    strip.background = element_rect(fill=NA, colour="black"),
    strip.placement="outside")
Error in ggplot(Tab_cellnumber_gather, aes(x = Diet, y = Cell_number/100 * : objet 'Tab_cellnumber_gather' introuvable
Plot_Fig3C
Error in eval(expr, envir, enclos): objet 'Plot_Fig3C' introuvable

3.1.3 Figure 3D

HS and HY diets do not affect the relative proportion of cell types in the midgut (error is standard error of the mean).

tab_prop_cell_type = 
  d[["3C"]]%>%
  dplyr::select(Diet, Line, Day, Repeat, GutNumber, Region | ends_with(".AL") & !starts_with("ESG"))%>%
  mutate_if(is.character,as.factor)%>% 
  drop_na()%>%
  mutate(across(c(ISC.AL,EB.AL,EE.AL,EC.AL),round,0))%>%
  mutate(Total_cell=ISC.AL+EB.AL+EE.AL+EC.AL,
         proportion_ISC=ISC.AL/Total_cell*100,
         proportion_EB=EB.AL/Total_cell*100,
         proportion_EE=EE.AL/Total_cell*100,
         proportion_EC=EC.AL/Total_cell*100)%>%
  dplyr::select(Diet, Line, Day, Repeat, GutNumber, Region | starts_with("proportion"))%>%
  gather(key, value, -!starts_with("proportion") )%>%
  dplyr::rename(Cell_type = key,
         Cell_proportion = value) %>%
  mutate_if(is.character,as.factor) %>%
  group_by(Diet,Cell_type)%>%
  summarise(mean_proportion=mean(Cell_proportion, na.rm=T),
            se_proportion=se(Cell_proportion)) %>%
   as.data.frame()
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'select' applicable pour un objet de classe "NULL"
for (i in 1:length(tab_prop_cell_type$se_proportion)){
    tab_prop_cell_type$se_proportionGraphPlus[i] = tab_prop_cell_type$mean_proportion[i]+tab_prop_cell_type$se_proportion[i]
    tab_prop_cell_type$se_proportionGraphMinus[i] = tab_prop_cell_type$mean_proportion[i]-tab_prop_cell_type$se_proportion[i]
}
Error in eval(expr, envir, enclos): objet 'tab_prop_cell_type' introuvable
for (i in 1:length(tab_prop_cell_type$se_proportion)){
  if(tab_prop_cell_type$Cell_type[i]=="proportion_EB"){
    tab_prop_cell_type$se_proportionGraphPlus[i] = tab_prop_cell_type$mean_proportion[i]+tab_prop_cell_type$se_proportion[i]
    
    tab_prop_cell_type$se_proportionGraphMinus[i] = tab_prop_cell_type$mean_proportion[i]-tab_prop_cell_type$se_proportion[i]
    
  }else{
    if(tab_prop_cell_type$Cell_type[i]=="proportion_EC"){
      
      tab_prop_cell_type$se_proportionGraphPlus[i] = tab_prop_cell_type$mean_proportion[i-1]+tab_prop_cell_type$mean_proportion[i]+tab_prop_cell_type$se_proportion[i]
      
      tab_prop_cell_type$se_proportionGraphMinus[i] = tab_prop_cell_type$mean_proportion[i-1]+tab_prop_cell_type$mean_proportion[i]+-tab_prop_cell_type$se_proportion[i]
      
    }else{
      if(tab_prop_cell_type$Cell_type[i]=="proportion_EE"){
        
        tab_prop_cell_type$se_proportionGraphPlus[i] =tab_prop_cell_type$mean_proportion[i-1]+ tab_prop_cell_type$mean_proportion[i-2]+tab_prop_cell_type$mean_proportion[i]+tab_prop_cell_type$se_proportion[i]
        
        tab_prop_cell_type$se_proportionGraphMinus[i] =tab_prop_cell_type$mean_proportion[i-1]+ tab_prop_cell_type$mean_proportion[i-2]+tab_prop_cell_type$mean_proportion[i]-tab_prop_cell_type$se_proportion[i]
        
      }else{
        tab_prop_cell_type$se_proportionGraphPlus[i] =tab_prop_cell_type$mean_proportion[i-1]+tab_prop_cell_type$mean_proportion[i-2]+ tab_prop_cell_type$mean_proportion[i-3]+tab_prop_cell_type$mean_proportion[i]+tab_prop_cell_type$se_proportion[i]
        
        tab_prop_cell_type$se_proportionGraphMinus[i] =tab_prop_cell_type$mean_proportion[i-1]+tab_prop_cell_type$mean_proportion[i-2]+ tab_prop_cell_type$mean_proportion[i-3]+tab_prop_cell_type$mean_proportion[i]-tab_prop_cell_type$se_proportion[i]
      }
    }
  }
}
Error in eval(expr, envir, enclos): objet 'tab_prop_cell_type' introuvable
tab_prop_cell_type$Cell_type =factor(tab_prop_cell_type$Cell_type,levels = c("proportion_ISC","proportion_EE","proportion_EC","proportion_EB"))
Error in factor(tab_prop_cell_type$Cell_type, levels = c("proportion_ISC", : objet 'tab_prop_cell_type' introuvable
Plot_Fig3D =
ggplot(tab_prop_cell_type, aes(x=Diet, y=mean_proportion))+ 
  geom_bar(stat="identity",aes(fill=Cell_type),color="black",width=.90)+
  geom_errorbar(aes(ymin= se_proportionGraphMinus, ymax= se_proportionGraphPlus),width=0.25)+
  scale_fill_manual(name = "Cell types", 
                    values=c("#1fd511","#ffffff", "#5869d5","#fe0000"),
                    labels = c("ISC", "EE", "EC","EB"))+
   scale_y_continuous("Proportion of cells (% \u00B1se)",
                      limits=c(0,101),
                      breaks=seq(0,100,by=25))+
  theme(
    panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
    panel.background = element_blank(),
    axis.title.x = element_blank(),
    axis.title.y = element_text(size=Smallfont,colour="black", hjust = 0.1 ), 
    axis.line.x = element_line(colour="black",size=0.75),
    axis.line.y = element_line(colour="black",size=0.75),
    axis.ticks.x = element_line(size = 0.75),
    axis.ticks.y = element_line(size = 0.75),
    axis.text.x = element_text(size=Smallfont,colour="black"),
    axis.text.y = element_text(size=Smallfont,colour="black"),
    plot.margin = unit(Margin, "cm"),
    legend.direction = "vertical", 
    legend.box = "horizontal",
    legend.position = "bottom",
    legend.key.height = unit(0.4, "cm"),
    legend.key.width= unit(0.6, "cm"),
    legend.title = element_text(face="italic",size=Smallfont), 
    legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
    legend.text = element_text(size=Smallfont),
    legend.background = element_rect(fill=NA),
    strip.text.x = element_text(size =Smallfont, colour = "black",face="italic"),
    strip.text.y = element_text(size =Smallfont, colour = "black",face="italic"),
    strip.background = element_rect(fill=NA, colour="black"),
    strip.placement="outside")
Error in ggplot(tab_prop_cell_type, aes(x = Diet, y = mean_proportion)): objet 'tab_prop_cell_type' introuvable
Plot_Fig3D
Error in eval(expr, envir, enclos): objet 'Plot_Fig3D' introuvable

3.1.4 Figure 3E - F

Diet affects enterocyte size. Representative picture of midguts stained with anti-Mesh antibody on HS (D, left) vs HY (E, right) diet. Complete graphical annotation can be found in manuscript figures

Error in transpose(y): object is NULL
Error in rasterGrob(img3E): objet 'img3E' introuvable
Error in grid.draw(gob_imageFig3E): objet 'gob_imageFig3E' introuvable
Error in transpose(y): object is NULL
Error in rasterGrob(img3F): objet 'img3F' introuvable
Error in grid.draw(gob_imageFig3F): objet 'gob_imageFig3F' introuvable

3.1.5 Figure 3G

Quantification of EC size of individuals on HS or HY diet for 5 days confirms an increase in cell size on HY diet.

tab_cell_area = 
  d[["3G"]]%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  tab_cell_area%>%
  group_by(Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet): objet 'tab_cell_area' introuvable
###Stats

mod.gen = fitme(log(Area) ~  Diet + (1|Repeat),data =tab_cell_area)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_cell_area' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Area) ~  Diet + (1/Repeat),data =tab_cell_area)
Error in is.data.frame(data): objet 'tab_cell_area' introuvable
mod.gen1 = fitme(log(Area) ~  1 + (1|Repeat),data =tab_cell_area)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_cell_area' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("HS vs HY")),
                               Rep = nlevels(tab_cell_area$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_cell_area' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(Cell area) ~  Diet + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
### Plot

z = max(tab_cell_area$Area/1000, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'tab_cell_area' introuvable
Plot_Fig3G=
  ggplot(tab_cell_area, aes(x = Diet, y = Area/1000))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/140) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = -0.01, label = paste("(",Sample_size,")",sep="")),size=3)+
 # geom_text(data = tab_stat, mapping = aes(x = 1.5, y = 0.62, label = paste("p=",format(Pvalue,digits=3))),size=3)+
    geom_signif(annotation = formatC(paste("p=",tab_stat$Pvalue), digits = 2), textsize = 3, y_position = 0.86, xmin = 1, xmax = 2, tip_length = c(0.02, 0.02), vjust = -0.2)+

  scale_fill_manual(limits=c("HS", "HY"),
                    values= palette_diet_2 )+
  scale_x_discrete("",
                   limits=c("HS", "HY"),
                   labels=c("HS", "HY"))+
  scale_y_continuous(expression(paste("EC area (10"^3, "mm"^2,")",sep="")),
                     limits=c(-0.01,0.9),
                     breaks=seq(0,0.8,by=0.1))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
                     stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
                     scale_color_manual(values = palette_mean) +
  theme(
    panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
    panel.background = element_blank(),
    axis.title.x = element_text(size=Smallfont,colour="black"),
    axis.title.y = element_text(size=Smallfont,colour="black"), 
    axis.line.x = element_line(colour="black",size=0.75),
    axis.line.y = element_line(colour="black",size=0.75),
    axis.ticks.x = element_line(size = 0.75),
    axis.ticks.y = element_line(size = 0.75),
    axis.text.x = element_text(size=Smallfont,colour="black"),
    axis.text.y = element_text(size=Smallfont,colour="black"),
    plot.margin = unit(Margin, "cm"),
    legend.direction = "vertical", 
    legend.box = "horizontal",
    legend.position = "none",
    legend.key.height = unit(0.4, "cm"),
    legend.key.width= unit(0.6, "cm"),
    legend.title = element_text(face="italic",size=Smallfont), 
    legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
    legend.text = element_text(size=SuperSmallfont),
    legend.background = element_rect(fill=NA))
Error in ggplot(tab_cell_area, aes(x = Diet, y = Area/1000)): objet 'tab_cell_area' introuvable
Plot_Fig3G
Error in eval(expr, envir, enclos): objet 'Plot_Fig3G' introuvable

##Export Figure 3

3.2 Figure 3 - figure supplement 1

3.2.1 Figure 3S1A

ECs are more densely packed on HS diet than on HY diet.

tab_ECarea = 
  d[["3C"]]%>%
  select(Diet, Line, Day, Repeat, GutNumber, Region,EC.A)%>%
  mutate_if(is.character,as.factor)%>% 
  mutate_if(is.integer,as.factor)%>% 
  dplyr::rename(EC_density=EC.A)%>% 
  mutate(EC_density_mm=EC_density*1000)%>% 
  drop_na()
Error in UseMethod("select"): pas de méthode pour 'select' applicable pour un objet de classe "NULL"
Sample_size=
  tab_ECarea%>%
  group_by(Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet): objet 'tab_ECarea' introuvable
###Stats

mod.gen = fitme(EC_density_mm ~  Diet + (1 | Repeat), data = tab_ECarea)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_ECarea' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(EC_density_mm ~ Diet + (1 / Repeat), data = tab_ECarea) 
Error in is.data.frame(data): objet 'tab_ECarea' introuvable
mod.gen1 = fitme(EC_density_mm ~ 1 + (1 | Repeat), data = tab_ECarea) 
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_ECarea' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
#Now we make a tab with the results
tab_stat = data.frame(Variable = as.character(paste("HS vs HY")),
                               Rep = nlevels(tab_ECarea$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_ECarea' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("EC density ~  Diet + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
Limits= c("HS","HY")

z=max(tab_ECarea$EC_density_mm, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'tab_ECarea' introuvable
Plot_Fig3S1A =
ggplot(tab_ECarea, aes(x=Diet, y=EC_density_mm))+ 
 geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/60) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 1.8, label = paste("(",Sample_size,")",sep="")),size=3)+
    geom_signif(annotation = formatC(paste("p=",tab_stat$Pvalue), digits = 2), textsize = 3, y_position = 9, xmin = 1, xmax = 2, tip_length = c(0.02, 0.02), vjust = -0.2)+

  scale_fill_manual(limits=Limits,
                    values=palette_diet_2)+
  scale_x_discrete("",
                   limits=c("HS", "HY"),
                   labels=c("HS", "HY"))+
  scale_y_continuous(expression(paste("EC density (per ",mm^2,")")),
                     limits=c(1.5,9.5),
                     breaks=seq(2,8,by=1))+
      stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
                     stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
                     scale_color_manual(values = palette_mean) +
  theme(
    panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
    panel.background = element_blank(),
    axis.title.x = element_text(size=Smallfont,colour="black"),
    axis.title.y = element_text(size=Smallfont,colour="black"), 
    axis.line.x = element_line(colour="black",size=0.75),
    axis.line.y = element_line(colour="black",size=0.75),
    axis.ticks.x = element_line(size = 0.75),
    axis.ticks.y = element_line(size = 0.75),
    axis.text.x = element_text(size=Smallfont,colour="black"),
    axis.text.y = element_text(size=Smallfont,colour="black"),
    plot.margin = unit(Margin, "cm"),
    legend.direction = "vertical", 
    legend.box = "horizontal",
    legend.position = "none",
    legend.key.height = unit(0.4, "cm"),
    legend.key.width= unit(0.6, "cm"),
    legend.title = element_text(face="italic",size=Smallfont), 
    legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
    legend.text = element_text(size=SuperSmallfont),
    legend.background = element_rect(fill=NA))
Error in ggplot(tab_ECarea, aes(x = Diet, y = EC_density_mm)): objet 'tab_ECarea' introuvable
Plot_Fig3S1A
Error in eval(expr, envir, enclos): objet 'Plot_Fig3S1A' introuvable

3.2.2 Figure 3S1B

Scheme illustrating area measurements. Top view in this scheme is as in pictures shown in figure 3 D, E. 3D side view show side view with Mesh showing measured surface.

Error in transpose(y): object is NULL
Error in rasterGrob(img3S1B): objet 'img3S1B' introuvable
Error in grid.draw(gob_imageFig3S1B): objet 'gob_imageFig3S1B' introuvable

3.2.3 Figure 3S1C

Diet affects enterocyte size. Quantification of EC height of MyoTS>GFP on HS or HY diet demonstrates an increase in cell height on HY diet.

tab_ECheight = 
  d[["3 - S1C"]]%>%
 select(Diet, Repeat, GutNumber, Region, Height)%>%
  mutate_if(is.character,as.factor)%>% 
  mutate_if(is.integer,as.factor)%>% 
  dplyr::rename(EC_height=Height)%>% 
  drop_na()
Error in UseMethod("select"): pas de méthode pour 'select' applicable pour un objet de classe "NULL"
tab_ECheight$EC_height <- as.numeric(tab_ECheight$EC_height)
Error in eval(expr, envir, enclos): objet 'tab_ECheight' introuvable
Sample_size=
  tab_ECheight%>%
  group_by(Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet): objet 'tab_ECheight' introuvable
###Stats

mod.gen = fitme((EC_height) ~  Diet + (1 | Repeat), data = tab_ECheight)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_ECheight' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(EC_height ~ Diet + (1 / Repeat), data = tab_ECheight) 
Error in is.data.frame(data): objet 'tab_ECheight' introuvable
mod.gen1 = fitme(EC_height ~ 1 + (1 | Repeat), data = tab_ECheight) 
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_ECheight' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
#Now we make a tab with the results
tab_stat = data.frame(Variable = as.character(paste("HS vs HY")),
                               Rep = nlevels(tab_ECheight$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_ECheight' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("EC height ~  Diet + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
Limits= c("HS","HY")

z=max(tab_ECheight$EC_height, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'tab_ECheight' introuvable
Plot_Fig3S1C =
  ggplot(tab_ECheight, aes(x=Diet, y=EC_height))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/150) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = -1, label = paste("(",Sample_size,")",sep="")),size=3)+
    geom_signif(annotation = formatC(paste("p=",tab_stat$Pvalue), digits = 2), textsize = 3, y_position = 23, xmin = 1, xmax = 2, tip_length = c(0.02, 0.02), vjust = -0.2)+

  scale_fill_manual(limits=Limits,
                    values=palette_diet_2)+
  scale_x_discrete("",
                   limits=c("HS", "HY"),
                   labels=c("HS", "HY"))+
  scale_y_continuous(expression(paste("EC height (", mu, "m)")),
                     limits=c(-2,25),
                     breaks=seq(2,25,by=5))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(
    panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
    panel.background = element_blank(),
    axis.title.x = element_text(size=Smallfont,colour="black"),
    axis.title.y = element_text(size=Smallfont,colour="black"), 
    axis.line.x = element_line(colour="black",size=0.75),
    axis.line.y = element_line(colour="black",size=0.75),
    axis.ticks.x = element_line(size = 0.75),
    axis.ticks.y = element_line(size = 0.75),
    axis.text.x = element_text(size=Smallfont,colour="black"),
    axis.text.y = element_text(size=Smallfont,colour="black"),
    plot.margin = unit(Margin, "cm"),
    legend.direction = "vertical", 
    legend.box = "horizontal",
    legend.position = "none",
    legend.key.height = unit(0.4, "cm"),
    legend.key.width= unit(0.6, "cm"),
    legend.title = element_text(face="italic",size=Smallfont), 
    legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
    legend.text = element_text(size=SuperSmallfont),
    legend.background = element_rect(fill=NA))
Error in ggplot(tab_ECheight, aes(x = Diet, y = EC_height)): objet 'tab_ECheight' introuvable
Plot_Fig3S1C
Error in eval(expr, envir, enclos): objet 'Plot_Fig3S1C' introuvable

3.2.4 Figure 3S1D

Representative density plot from FACS for HS diet Complete annotation found in manuscript’s figures

Error in transpose(y): object is NULL
Error in rasterGrob(img3S1D): objet 'img3S1D' introuvable
Error in grid.draw(gob_imageFig3S1D): objet 'gob_imageFig3S1D' introuvable

3.2.5 Figure 3S1E

Representative density plot from FACS for HY diet Complete annotation found in manuscript’s figures

Error in transpose(y): object is NULL
Error in rasterGrob(img3S1E): objet 'img3S1E' introuvable
Error in grid.draw(gob_imageFig3S1E): objet 'gob_imageFig3S1E' introuvable

3.2.6 Figure 3S1F

Representative frequency plot from FACS for HS diet. Complete annotation found in manuscript’s figures

Error in transpose(y): object is NULL
Error in rasterGrob(img3S1F): objet 'img3S1F' introuvable
Error in grid.draw(gob_imageFig3S1F): objet 'gob_imageFig3S1F' introuvable

3.2.7 Figure 3S1G

Representative frequency plot from FACS for HY dietComplete annotation found in manuscript’s figures

Error in transpose(y): object is NULL
Error in rasterGrob(img3S1G): objet 'img3S1G' introuvable
Error in grid.draw(gob_imageFig3S1G): objet 'gob_imageFig3S1G' introuvable

3.2.8 Figure 3S1H

Ploidy of midguts on either HS or HY diets is largely unchanged. Stacked bar plot from 7 repeats, each of 25 midguts

tab_ploidy_rev = 
  d[["3 - S1H"]]%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  group_by(Diet, Ploidy)%>%
  summarise(mean_Percentage=mean(Percentage,na.rm=T),
            sd_Percentage=sd(Percentage))%>%
  mutate(group=paste(Diet, Ploidy,sep="_"))%>%
  mutate(Ploidy=fct_relevel(Ploidy,"2","4", "8", "16", "32", "64", "64+"))%>%
  as.data.frame()
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
    tab_ploidy_rev%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  group_by(Diet)%>%
  summarise(Sample_size=n())
Error in is_grouped_df(tbl): objet 'tab_ploidy_rev' introuvable
# Creation of dataset with right position for error bar
##HS
tmp = subset(tab_ploidy_rev , Diet%in%c("HS"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_ploidy_rev' introuvable
tmp1 <- subset(tmp, select = -c(group , sd_Percentage, Diet))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tmp' introuvable
tmpw1 <-spread(tmp1, Ploidy, mean_Percentage)
Error in spread(tmp1, Ploidy, mean_Percentage): objet 'tmp1' introuvable
tmpw1$`2.p` = tmpw1$`2`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`4.p` = tmpw1$`2` + tmpw1$`4`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`8.p` = tmpw1$`4.p` + tmpw1$`8`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`16.p` = tmpw1$`8.p` + tmpw1$`16`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`32.p` = tmpw1$`16.p` + tmpw1$`32`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`64.p` = tmpw1$`32.p` + tmpw1$`64`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`64+.p` = tmpw1$`64.p` + tmpw1$`64+`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmp2 <- subset(tmp, select = -c(group , mean_Percentage, Diet))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tmp' introuvable
tmpw2 <-spread(tmp2, Ploidy, sd_Percentage)
Error in spread(tmp2, Ploidy, sd_Percentage): objet 'tmp2' introuvable
tmpw1$`2.se` = tmpw2$`2`
Error in eval(expr, envir, enclos): objet 'tmpw2' introuvable
tmpw1$`4.se` = tmpw2$`4`
Error in eval(expr, envir, enclos): objet 'tmpw2' introuvable
tmpw1$`8.se` = tmpw2$`8`
Error in eval(expr, envir, enclos): objet 'tmpw2' introuvable
tmpw1$`16.se` = tmpw2$`16`
Error in eval(expr, envir, enclos): objet 'tmpw2' introuvable
tmpw1$`32.se` = tmpw2$`32`
Error in eval(expr, envir, enclos): objet 'tmpw2' introuvable
tmpw1$`64.se` = tmpw2$`64`
Error in eval(expr, envir, enclos): objet 'tmpw2' introuvable
tmpw1$`64+.se` = tmpw2$`64+`
Error in eval(expr, envir, enclos): objet 'tmpw2' introuvable
tmpw1$`2.se+` = tmpw1$`2` + tmpw1$`2.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`4.se+` = tmpw1$`4.p` + tmpw1$`4.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`8.se+` = tmpw1$`8.p` + tmpw1$`8.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`16.se+` = tmpw1$`16.p` + tmpw1$`16.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`32.se+` = tmpw1$`32.p` + tmpw1$`32.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`64.se+` = tmpw1$`64.p` + tmpw1$`64.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`64+.se+` = tmpw1$`64+.p` + tmpw1$`64+.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`2.se-` = tmpw1$`2` - tmpw1$`2.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`4.se-` = tmpw1$`4.p` - tmpw1$`4.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`8.se-` = tmpw1$`8.p` - tmpw1$`8.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`16.se-` = tmpw1$`16.p` - tmpw1$`16.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`32.se-` = tmpw1$`32.p` - tmpw1$`32.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`64.se-` = tmpw1$`64.p` - tmpw1$`64.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`64+.se-` = tmpw1$`64+.p` - tmpw1$`64+.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpl <- reshape(data=tmpw1, 
    varying = list(Ploidy = c(1:7), Position = c(8:14), se = c(15:21), seplus = c(22:28), seminus = c(29:35)),
    direction = 'long',
    v.names = c("Percentage", "Position", "se", "seplus", "seminus"),
    sep = ".")
Error in FUN(X[[i]], ...): objet 'tmpw1' introuvable
tmpl$Ploidy = c("2","4", "8", "16", "32", "64", "64+")
Error in tmpl$Ploidy = c("2", "4", "8", "16", "32", "64", "64+"): objet 'tmpl' introuvable
tmpl$Diet = "HS"
Error in tmpl$Diet = "HS": objet 'tmpl' introuvable
tmpl <- subset(tmpl, select = -c(time , id))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tmpl' introuvable
tmpl_HS <- tmpl
Error in eval(expr, envir, enclos): objet 'tmpl' introuvable
##HY
tmp = subset(tab_ploidy_rev , Diet%in%c("HY"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_ploidy_rev' introuvable
tmp1 <- subset(tmp, select = -c(group , sd_Percentage, Diet))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tmp' introuvable
tmpw1 <-spread(tmp1, Ploidy, mean_Percentage)
Error in spread(tmp1, Ploidy, mean_Percentage): objet 'tmp1' introuvable
tmpw1$`2.p` = tmpw1$`2`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`4.p` = tmpw1$`2` + tmpw1$`4`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`8.p` = tmpw1$`4.p` + tmpw1$`8`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`16.p` = tmpw1$`8.p` + tmpw1$`16`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`32.p` = tmpw1$`16.p` + tmpw1$`32`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`64.p` = tmpw1$`32.p` + tmpw1$`64`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`64+.p` = tmpw1$`64.p` + tmpw1$`64+`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmp2 <- subset(tmp, select = -c(group , mean_Percentage, Diet))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tmp' introuvable
tmpw2 <-spread(tmp2, Ploidy, sd_Percentage)
Error in spread(tmp2, Ploidy, sd_Percentage): objet 'tmp2' introuvable
tmpw1$`2.se` = tmpw2$`2`
Error in eval(expr, envir, enclos): objet 'tmpw2' introuvable
tmpw1$`4.se` = tmpw2$`4`
Error in eval(expr, envir, enclos): objet 'tmpw2' introuvable
tmpw1$`8.se` = tmpw2$`8`
Error in eval(expr, envir, enclos): objet 'tmpw2' introuvable
tmpw1$`16.se` = tmpw2$`16`
Error in eval(expr, envir, enclos): objet 'tmpw2' introuvable
tmpw1$`32.se` = tmpw2$`32`
Error in eval(expr, envir, enclos): objet 'tmpw2' introuvable
tmpw1$`64.se` = tmpw2$`64`
Error in eval(expr, envir, enclos): objet 'tmpw2' introuvable
tmpw1$`64+.se` = tmpw2$`64+`
Error in eval(expr, envir, enclos): objet 'tmpw2' introuvable
tmpw1$`2.se+` = tmpw1$`2` + tmpw1$`2.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`4.se+` = tmpw1$`4.p` + tmpw1$`4.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`8.se+` = tmpw1$`8.p` + tmpw1$`8.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`16.se+` = tmpw1$`16.p` + tmpw1$`16.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`32.se+` = tmpw1$`32.p` + tmpw1$`32.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`64.se+` = tmpw1$`64.p` + tmpw1$`64.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`64+.se+` = tmpw1$`64+.p` + tmpw1$`64+.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`2.se-` = tmpw1$`2` - tmpw1$`2.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`4.se-` = tmpw1$`4.p` - tmpw1$`4.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`8.se-` = tmpw1$`8.p` - tmpw1$`8.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`16.se-` = tmpw1$`16.p` - tmpw1$`16.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`32.se-` = tmpw1$`32.p` - tmpw1$`32.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`64.se-` = tmpw1$`64.p` - tmpw1$`64.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpw1$`64+.se-` = tmpw1$`64+.p` - tmpw1$`64+.se`
Error in eval(expr, envir, enclos): objet 'tmpw1' introuvable
tmpl <- reshape(data=tmpw1, 
    varying = list(Ploidy = c(1:7), Position = c(8:14), se = c(15:21), seplus = c(22:28), seminus = c(29:35)),
    direction = 'long',
    v.names = c("Percentage", "Position", "se", "seplus", "seminus"),
    sep = ".")
Error in FUN(X[[i]], ...): objet 'tmpw1' introuvable
tmpl$Ploidy = c("2","4", "8", "16", "32", "64", "64+")
Error in tmpl$Ploidy = c("2", "4", "8", "16", "32", "64", "64+"): objet 'tmpl' introuvable
tmpl$Diet = "HY"
Error in tmpl$Diet = "HY": objet 'tmpl' introuvable
tmpl <- subset(tmpl, select = -c(time , id))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tmpl' introuvable
tmpl_HY <- tmpl
Error in eval(expr, envir, enclos): objet 'tmpl' introuvable
#Bind, rename and reorcer
tab_ploidy <- rbind(tmpl_HS, tmpl_HY)
Error in eval(quote(list(...)), env): objet 'tmpl_HS' introuvable
tab_ploidy$Ploidy <- as.factor(tab_ploidy$Ploidy)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.factor' : objet 'tab_ploidy' introuvable
tab_ploidy$Ploidy <-factor(tab_ploidy$Ploidy, levels =c("64+","64", "32", "16", "8", "4", "2"))
Error in factor(tab_ploidy$Ploidy, levels = c("64+", "64", "32", "16", : objet 'tab_ploidy' introuvable
#Plot

                                  
Plot_Fig3S1H =
  ggplot(tab_ploidy, aes(x=Diet, y=Percentage))+ 
  geom_bar(stat="identity",aes(fill=Ploidy),color="black",width=.90)+
  geom_errorbar(aes(ymin= seminus, ymax= seplus),width=0.25, color = "black")+
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = -5, label = paste("(",Sample_size,")",sep="")),size=3)+
  scale_fill_manual(name = "Ploidy", 
                    values=c("#0052A2","#1A63AB", "#3375B5", "#6697C7", "#99BADA", "#CCDCEC", "#E6EEF6"),
                    labels = c("64+n", "64n", "32n", "16n", "8n", "4n", "2n"))+
  scale_y_continuous("Percentage of ploidy (mean \u00B1sd)",
                     limits=c(-5,90),
                     breaks=seq(0,80,by=20))+
  theme(
    panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
    panel.background = element_blank(),
    axis.title.x = element_blank(),
    axis.title.y = element_text(size=Smallfont,colour="black"), 
    axis.line.x = element_line(colour="black",size=0.75),
    axis.line.y = element_line(colour="black",size=0.75),
    axis.ticks.x = element_line(size = 0.75),
    axis.ticks.y = element_line(size = 0.75),
    axis.text.x = element_text(size=Smallfont,colour="black"),
    axis.text.y = element_text(size=Smallfont,colour="black"),
    plot.margin = unit(Margin, "cm"),
    legend.direction = "horizontal", 
    legend.box = "horizontal",
    legend.position = "bottom",
    #legend.key.height = unit(0.6, "cm"),
    #legend.key.width= unit(0.4, "cm"),
    legend.title = element_blank(), 
    legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
    legend.text = element_text(size=Smallfont),
    legend.background = element_rect(fill=NA),
    strip.text = element_blank())+
    guides(fill=guide_legend(nrow=4,byrow=TRUE))
Error in ggplot(tab_ploidy, aes(x = Diet, y = Percentage)): objet 'tab_ploidy' introuvable
    #strip.background = element_rect(fill=NA, colour="black"),
    #strip.placement="outside")

Plot_Fig3S1H
Error in eval(expr, envir, enclos): objet 'Plot_Fig3S1H' introuvable

##Export Figure 3S1

4 Figure 4. Shifts in diet composition lead to plastic midgut resizing and changes in absolute and relative cell loss and gain

4.1 Figure 4 - main

4.1.1 Figure 4A

Midguts can respond plastically to changes in isocaloric diets. Midgut length increases from eclosion on HY for 7 days, then decreases when switched to HS for additional 7 days but can re-increase size upon a further 7 days HY feeding. Letters above violin plots represent grouping by statistical differences (Post hoc Tukey on GLMM).

Length_plasticity_time = 
  d[["4A"]]%>%
  mutate_at(vars(starts_with("Total")),~./1000)%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  dplyr::rename(Total_Length_mm=Total.L,
         Day_of_treatment=Day)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  Length_plasticity_time%>%
  group_by(Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet): objet 'Length_plasticity_time' introuvable
###Stats

mod.gen = fitme(log(Total_Length_mm) ~  Diet + (1 | Repeat), data = Length_plasticity_time)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Length_plasticity_time' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = Length_plasticity_time) 
Error in is.data.frame(data): objet 'Length_plasticity_time' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = Length_plasticity_time) 
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Length_plasticity_time' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("Anova diets")),
                               Rep = nlevels(Length_plasticity_time$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Length_plasticity_time' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(Total_Length_mm) ~  Diet + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
mod.gen = lmer(log(Total_Length_mm) ~  Diet + (1 | Repeat), data = Length_plasticity_time)
Error: bad 'data': objet 'Length_plasticity_time' introuvable
multcomp = glht(mod.gen, linfct=mcp(Diet="Tukey"))
Error in model.matrix(model) : objet 'mod.gen' introuvable
Error in factor_contrasts(model): no 'model.matrix' method for 'model' found!
tmp = cld(multcomp)
Error in cld(multcomp): objet 'multcomp' introuvable
letter_position = aggregate(data=Length_plasticity_time,Total_Length_mm ~  Diet, max)
Error in eval(m$data, parent.frame()): objet 'Length_plasticity_time' introuvable
tab_letter =  as.data.frame(tmp$mcletters$Letters)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'tmp' introuvable
tab_letter$Diet=rownames(tab_letter)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'rownames' : objet 'tab_letter' introuvable
colnames(tab_letter)[1] = "Letter"
Error in colnames(tab_letter)[1] = "Letter": objet 'tab_letter' introuvable
tab_letter = left_join(tab_letter,letter_position)
Error in left_join(tab_letter, letter_position): objet 'tab_letter' introuvable
### Plot
Limits = c("Eclosion","HY","HYtoHS", "HYtoHStoHY")
z = max(Length_plasticity_time$Total_Length_mm, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'Length_plasticity_time' introuvable
Plot_Fig4A=
  ggplot(Length_plasticity_time, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/60) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 1.5, label = paste("(",Sample_size,")",sep="")),size=3)+
geom_text(data = tab_letter, mapping = aes(x = Diet, y = Total_Length_mm+0.4, label = Letter),size=3)+
  geom_text(data = tab_stat, mapping = aes(x = 1.2, y = 7.5, label = paste("p=",format(Pvalue,digits=2))),size=3)+
  scale_fill_manual(limits=Limits,
                    values=cbbPalette_4)+
  scale_x_discrete("",
                   limits=Limits,
                   labels=c("Eclosion","HY","HY to HS", "HY to HS to HY"))+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(1.3,8.2),
                     breaks=seq(2,8,by=1),
                     minor_breaks = seq(3, 7,by= 1))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
                     stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
                     scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size =Smallfont, colour = "black",face="italic"),
        strip.text.y = element_text(size =Smallfont, colour = "black",face="italic"),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(Length_plasticity_time, aes(x = Diet, y = Total_Length_mm)): objet 'Length_plasticity_time' introuvable
Plot_Fig4A
Error in eval(expr, envir, enclos): objet 'Plot_Fig4A' introuvable

4.1.2 Figure 4B

Mitotically active cells visualized by phospho-Histone H3 (pH3) immunostaining are more numerous on HY diet than on HS diet. pH3+ cells gradually increase over time on HY, but not HS diet. Letters above violin plots represent grouping by statistical differences (Post hoc Tukey on GLMM).

Length_Diet_time = 
  d[["4B, 4S1C"]]%>%
  mutate_at(vars(ends_with(".L")),~./1000)%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  mutate(group=paste(Diet, Day,sep="_"))%>%
 dplyr::rename(Total_Length_mm=Total.L,
         PH3_positive_cell=Total.PH3,
         Day_of_treatment=Day)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  Length_Diet_time%>%
  group_by(Diet,Day_of_treatment)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet, Day_of_treatment): objet 'Length_Diet_time' introuvable
###Stats

mod.gen = fitme(PH3_positive_cell ~  group + (1 | Repeat),data = subset(Length_Diet_time,!is.na(PH3_positive_cell)))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_Diet_time' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(PH3_positive_cell ~  group + (1 / Repeat),data = subset(Length_Diet_time,!is.na(PH3_positive_cell)))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_Diet_time' introuvable
mod.gen1 = fitme(PH3_positive_cell ~  1 + (1 | Repeat),data = subset(Length_Diet_time,!is.na(PH3_positive_cell)))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_Diet_time' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("Any difference")),
                               Rep = nlevels(Length_Diet_time$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Length_Diet_time' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("PH3_positive_cell ~  group + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
tab_stat$Diet="HS"
Error in tab_stat$Diet = "HS": objet 'tab_stat' introuvable
mod.gen = lmer(PH3_positive_cell ~  group + (1 | Repeat),data =subset(Length_Diet_time,!is.na(PH3_positive_cell)))
Error: bad 'data': erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_Diet_time' introuvable
multcomp = glht(mod.gen, linfct=mcp(group="Tukey"))
Error in model.matrix(model) : objet 'mod.gen' introuvable
Error in factor_contrasts(model): no 'model.matrix' method for 'model' found!
tmp = cld(multcomp)
Error in cld(multcomp): objet 'multcomp' introuvable
letter_position = aggregate(data=subset(Length_Diet_time,!is.na(PH3_positive_cell)),PH3_positive_cell ~  group, max)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_Diet_time' introuvable
tab_letter =  as.data.frame(tmp$mcletters$Letters)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'tmp' introuvable
tab_letter$group=rownames(tab_letter)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'rownames' : objet 'tab_letter' introuvable
colnames(tab_letter)[1] = "Letter"
Error in colnames(tab_letter)[1] = "Letter": objet 'tab_letter' introuvable
tab_letter = left_join(tab_letter,letter_position)
Error in left_join(tab_letter, letter_position): objet 'tab_letter' introuvable
tab_letter = separate(tab_letter,group, c("Diet", "Day_of_treatment"), sep = "_", remove=FALSE)
Error in separate(tab_letter, group, c("Diet", "Day_of_treatment"), sep = "_", : objet 'tab_letter' introuvable
### Plot
Limits = c("7","14","21", "28")
z = max(Length_Diet_time$PH3_positive_cell, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'Length_Diet_time' introuvable
Plot_Fig4B=
  ggplot(Length_Diet_time, aes(x = Day_of_treatment, y = PH3_positive_cell))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/40) + 
  facet_grid(. ~ Diet)+
  geom_text(data = Sample_size, mapping = aes(x = Day_of_treatment, y = -8, label = paste("(",Sample_size,")",sep="")),size=3)+
  geom_text(data = tab_letter, mapping = aes(x = Day_of_treatment, y = PH3_positive_cell+10, label = Letter),size=3)+
  geom_text(data = tab_stat, mapping = aes(x = 2, y = 130, label = paste("p=",format(Pvalue,digits=2))),size=3)+
   scale_fill_manual(limits=c("HS","HY"),
                     values=palette_diet_2)+
  scale_x_discrete("",
                   limits=Limits,
                   labels=c("7 days","14 days", "21 days", "28 days"))+
  scale_y_continuous(expression(paste("pH3" ^ "+", " cells")),
                     limits=c(-10,140),
                     breaks=seq(0,140,by=20))+
     stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
                     stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
                     scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(Length_Diet_time, aes(x = Day_of_treatment, y = PH3_positive_cell)): objet 'Length_Diet_time' introuvable
Plot_Fig4B
Error in eval(expr, envir, enclos): objet 'Plot_Fig4B' introuvable

4.1.3 Figure 4C

Shifting between diets impacts pH3+ cell number in growth (HS to HY) experiments. Statistical comparisons are vs pre-shift measurement.

Length_Growth_PH3 = 
  d[["4C, 4S1D"]]%>%
  mutate_at(vars(ends_with(".L")),~./1000)%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  dplyr::rename(Total_Length_mm=Total.L,
         PH3_positive_cell=Total.PH3,
         Day_of_treatment=Day)%>%
  as.data.frame()%>%
  mutate(Dday=fct_relevel(Dday,"Shift Day 7","Shift Day 14","Shift Day 21"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  Length_Growth_PH3%>%
  group_by(Diet,Dday)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet, Dday): objet 'Length_Growth_PH3' introuvable
###Stats
###Day 7
mod.gen = fitme(log(PH3_positive_cell) ~  Diet + (1 | Repeat),data = subset(Length_Growth_PH3,Dday=="Shift Day 7"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_Growth_PH3' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell) ~  Diet + (1 / Repeat),data = subset(Length_Growth_PH3,Dday=="Shift Day 7"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_Growth_PH3' introuvable
mod.gen1 = fitme(log(PH3_positive_cell) ~  1 + (1 | Repeat),data = subset(Length_Growth_PH3,Dday=="Shift Day 7"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_Growth_PH3' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("HS Day 7 vs HS to HY Day 14")),
                      Variable = as.character(paste("Shift Day 7")),
                               Rep = nlevels(Length_Growth_PH3$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Length_Growth_PH3' introuvable
tab_stat_7=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Day 14
mod.gen = fitme(log(PH3_positive_cell) ~  Diet + (1 | Repeat),data = subset(Length_Growth_PH3,Dday=="Shift Day 14"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_Growth_PH3' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell) ~  Diet + (1 / Repeat),data = subset(Length_Growth_PH3,Dday=="Shift Day 14"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_Growth_PH3' introuvable
mod.gen1 = fitme(log(PH3_positive_cell) ~  1 + (1 | Repeat),data = subset(Length_Growth_PH3,Dday=="Shift Day 14"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_Growth_PH3' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("HS Day 14 vs HS to HY Day 21")),
                      Variable = as.character(paste("Shift Day 14")),
                               Rep = nlevels(Length_Growth_PH3$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Length_Growth_PH3' introuvable
tab_stat_14=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Day 21
mod.gen = fitme(log(PH3_positive_cell) ~  Diet + (1 | Repeat),data = subset(Length_Growth_PH3,Dday=="Shift Day 21"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_Growth_PH3' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell) ~  Diet + (1 / Repeat),data = subset(Length_Growth_PH3,Dday=="Shift Day 21"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_Growth_PH3' introuvable
mod.gen1 = fitme(log(PH3_positive_cell) ~  1 + (1 | Repeat),data = subset(Length_Growth_PH3,Dday=="Shift Day 21"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_Growth_PH3' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("HS Day 21 vs HS to HY Day 28")),
                      Variable = as.character(paste("Shift Day 21")),
                               Rep = nlevels(Length_Growth_PH3$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Length_Growth_PH3' introuvable
tab_stat_21 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat=rbind(tab_stat_7,tab_stat_14,tab_stat_21)
Error in eval(quote(list(...)), env): objet 'tab_stat_7' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Variable", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(PH3_positive_cell) ~  Diet + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Variable", "Replicates", : objet 'tab_stat' introuvable
tab_stat=
  tab_stat %>%
  dplyr::rename(Dday=Variable)%>%
  as.data.frame()%>%
  mutate(Dday=fct_relevel(Dday,"Shift Day 7","Shift Day 14","Shift Day 21"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'tab_stat' introuvable
### Plot
Limits = c("HS","HStoHY")
z=max(Length_Growth_PH3$PH3_positive_cell, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'Length_Growth_PH3' introuvable
Plot_Fig4C=
  ggplot(Length_Growth_PH3, aes(x = Diet, y = PH3_positive_cell))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/40) + 
  facet_grid(. ~ Dday)+
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = -5, label = paste("(",Sample_size,")",sep="")),size=3)+
    geom_signif(data = tab_stat, aes(xmin = 1, xmax = 2, annotations = formatC(paste("p=",Pvalue), digits = 2), y_position = 132,), textsize = 3, vjust = -0.2, manual = TRUE)+

  scale_fill_manual(limits=c("HS","HStoHY"),
                    values=cbbHS_HStoHY)+
  scale_x_discrete("",
                   limits=Limits,
                   labels=c("HS","HS to HY"))+
  scale_y_continuous(expression(paste("pH3" ^ "+", " cells")),
                     limits=c(-8,136),
                     breaks=seq(0,120,by=20))+
stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
                     stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
                     scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
            strip.text.x = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(Length_Growth_PH3, aes(x = Diet, y = PH3_positive_cell)): objet 'Length_Growth_PH3' introuvable
Plot_Fig4C
Error in eval(expr, envir, enclos): objet 'Plot_Fig4C' introuvable

4.1.4 Figure 4D

Shifting between diets impacts pH3+ cell number in shrinkage (HY to HS) experiments. Statistical comparisons are vs pre-shift measurement.

Length_shrinkage_PH3 = 
  d[["4C', 4S1D'"]]%>%
  mutate_at(vars(ends_with(".L")),~./1000)%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  dplyr::rename(Total_Length_mm=Total.L,
         PH3_positive_cell=Total.PH3,
         Day_of_treatment=Day)%>%
  as.data.frame()%>%
  mutate(Dday=fct_relevel(Dday,"Shift Day 7","Shift Day 14","Shift Day 21"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  Length_shrinkage_PH3%>%
  group_by(Diet,Dday)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet, Dday): objet 'Length_shrinkage_PH3' introuvable
###Stats
###Day 7
mod.gen = fitme(log(PH3_positive_cell) ~  Diet + (1 | Repeat),data = subset(Length_shrinkage_PH3,Dday=="Shift Day 7"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_shrinkage_PH3' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell) ~  Diet + (1 / Repeat),data = subset(Length_shrinkage_PH3,Dday=="Shift Day 7"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_shrinkage_PH3' introuvable
mod.gen1 = fitme(log(PH3_positive_cell) ~  1 + (1 | Repeat),data = subset(Length_shrinkage_PH3,Dday=="Shift Day 7"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_shrinkage_PH3' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_shrinkage = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("HS Day 7 vs HS to HY Day 14")),
                      Variable = as.character(paste("Shift Day 7")),
                               Rep = nlevels(Length_shrinkage_PH3$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_shrinkage,df=1,lower.tail = F),digits=1,scientific=F)))
Error in levels(x): objet 'Length_shrinkage_PH3' introuvable
tab_stat_7=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Day 14
mod.gen = fitme(log(PH3_positive_cell) ~  Diet + (1 | Repeat),data = subset(Length_shrinkage_PH3,Dday=="Shift Day 14"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_shrinkage_PH3' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell) ~  Diet + (1 / Repeat),data = subset(Length_shrinkage_PH3,Dday=="Shift Day 14"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_shrinkage_PH3' introuvable
mod.gen1 = fitme(log(PH3_positive_cell) ~  1 + (1 | Repeat),data = subset(Length_shrinkage_PH3,Dday=="Shift Day 14"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_shrinkage_PH3' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_shrinkage = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("HS Day 14 vs HS to HY Day 21")),
                      Variable = as.character(paste("Shift Day 14")),
                               Rep = nlevels(Length_shrinkage_PH3$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_shrinkage,df=1,lower.tail = F),digits=1)))
Error in levels(x): objet 'Length_shrinkage_PH3' introuvable
tab_stat_14=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Day 21
mod.gen = fitme(log(PH3_positive_cell) ~  Diet + (1 | Repeat),data = subset(Length_shrinkage_PH3,Dday=="Shift Day 21"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_shrinkage_PH3' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell) ~  Diet + (1 / Repeat),data = subset(Length_shrinkage_PH3,Dday=="Shift Day 21"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_shrinkage_PH3' introuvable
mod.gen1 = fitme(log(PH3_positive_cell) ~  1 + (1 | Repeat),data = subset(Length_shrinkage_PH3,Dday=="Shift Day 21"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_shrinkage_PH3' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_shrinkage = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("HS Day 21 vs HS to HY Day 28")),
                      Variable = as.character(paste("Shift Day 21")),
                               Rep = nlevels(Length_shrinkage_PH3$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_shrinkage,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Length_shrinkage_PH3' introuvable
tab_stat_21 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat=rbind(tab_stat_7,tab_stat_14,tab_stat_21)
Error in eval(quote(list(...)), env): objet 'tab_stat_7' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Variable", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(PH3_positive_cell) ~  Diet + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Variable", "Replicates", : objet 'tab_stat' introuvable
tab_stat=
  tab_stat %>%
  dplyr::rename(Dday=Variable)%>%
  as.data.frame()%>%
  mutate(Dday=fct_relevel(Dday,"Shift Day 7","Shift Day 14","Shift Day 21"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'tab_stat' introuvable
### Plot
Limits = c("HY","HYtoHS")
z = max(Length_shrinkage_PH3$PH3_positive_cell, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'Length_shrinkage_PH3' introuvable
Plot_Fig4D=
  ggplot(Length_shrinkage_PH3, aes(x = Diet, y = PH3_positive_cell))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/40) + 
  facet_grid(. ~ Dday)+
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = -5, label = paste("(",Sample_size,")",sep="")),size=3)+
      geom_signif(data = tab_stat, aes(xmin = 1, xmax = 2, annotations = formatC(paste("p=",Pvalue), digits = 2), y_position = 132,), textsize = 3, vjust = -0.2, manual = TRUE)+

  scale_fill_manual(limits=c("HY","HYtoHS"),
                    values=cbbHY_HYtoHS)+
  scale_x_discrete("",
                   limits=Limits,
                   labels=c("HY","HY to HS"))+
  scale_y_continuous(expression(paste("pH3" ^ "+", " cells")),
                     limits=c(-8,136),
                     breaks=seq(0,120,by=20))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
                     stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
                     scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(Length_shrinkage_PH3, aes(x = Diet, y = PH3_positive_cell)): objet 'Length_shrinkage_PH3' introuvable
Plot_Fig4D
Error in eval(expr, envir, enclos): objet 'Plot_Fig4D' introuvable

4.1.5 Figure 4E-F

Clonal assay with EsgF/O system illustrates increased number of marked cells on HY (F) vs HS (E) diets 5 days post-eclosion in region 4 of the midgut. GFP, in green, marks all cells made since the EsgF/O system was activated. Complete graphical annotation can be found in manuscript figures

Error in transpose(y): object is NULL
Error in rasterGrob(img4E): objet 'img4E' introuvable
Error in grid.draw(gob_imageFig4E): objet 'gob_imageFig4E' introuvable
Error in transpose(y): object is NULL
Error in rasterGrob(img4F): objet 'img4F' introuvable
Error in grid.draw(gob_imageFig4F): objet 'gob_imageFig4F' introuvable

4.1.6 Figure 4G-H-I-J

Cell loss assay enables analysis of the impact of diet composition on replacement ratio and rate. Description of experimental design is found in materials and methods and illustrated in figure 4–figure supplement 1H. In brief, this assay allows us to mark ECs and EBs at the start of the experiment and to count their numbers 14 days after shifting dietary conditions recapitulating growth and shrinkage of the midgut, thus estimating cell gain and cell loss in these conditions. Representative pictures for the cell loss assay in growing conditions (G, H, top row) and shrinkage conditions (I, J, bottom row). Complete graphical annotation can be found in manuscript figures

Error in transpose(y): object is NULL
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
Error in grid.draw(gob_imageFig4G): objet 'gob_imageFig4G' introuvable
Error in transpose(y): object is NULL
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
Error in grid.draw(gob_imageFig4H): objet 'gob_imageFig4H' introuvable
Error in transpose(y): object is NULL
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
Error in grid.draw(gob_imageFig4I): objet 'gob_imageFig4I' introuvable
Error in transpose(y): object is NULL
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
Error in grid.draw(gob_imageFig4J): objet 'gob_imageFig4J' introuvable

4.1.7 Figure 4K

In red 5966GS> His-RFP, marking EB and EC. Number of ECs in the posterior midgut, both marked (Red, old ECs) and unmarked (Blue, new ECs) by RFP, error bars are SE from 3 repeats.

tab_prop_cell_RFP = 
  d[["4K"]]%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  mutate(Post.Dapi.Number = (Post.Dapi.Number)*2)%>%
  mutate(Post.RFP.Number = (Post.RFP.Number)*2)%>%
  mutate(Post.NonRFP.Number = (Post.Dapi.Number - Post.RFP.Number))%>%
  group_by(Day, Diet, Diet1, Experiment)%>%
  summarise(mean_RFP_positive=mean(Post.RFP.Number,na.rm=T),
            se_RFP_positive=se(Post.RFP.Number),
            mean_RFP_negative=mean(Post.NonRFP.Number,na.rm=T),
            se_RFP_negative=se(Post.NonRFP.Number))%>%
  mutate(group=paste(Diet1,Experiment,sep="_"))%>%
  as.data.frame()
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
attach(tab_prop_cell_RFP)
Error in attach(tab_prop_cell_RFP): objet 'tab_prop_cell_RFP' introuvable
for (i in 1:length(Experiment)){
    tab_prop_cell_RFP$se_proportionGraphPlus_pos[i] = mean_RFP_positive[i]+se_RFP_positive[i]
    tab_prop_cell_RFP$se_proportionGraphMinus_pos[i] = mean_RFP_positive[i]-se_RFP_positive[i]
    tab_prop_cell_RFP$se_proportionGraphPlus_neg[i] = mean_RFP_positive[i]+mean_RFP_negative[i]+se_RFP_negative[i]
    tab_prop_cell_RFP$se_proportionGraphMinus_neg[i] = mean_RFP_positive[i]+mean_RFP_negative[i]-se_RFP_negative[i]
}
Error in eval(expr, envir, enclos): objet 'Experiment' introuvable
tmp1 = tab_prop_cell_RFP[,c("Day", "Diet", "Diet1", "Experiment","mean_RFP_positive", "se_RFP_positive","se_proportionGraphPlus_pos", "se_proportionGraphMinus_pos")]
Error in eval(expr, envir, enclos): objet 'tab_prop_cell_RFP' introuvable
tmp1$RFP="Positive"
Error in tmp1$RFP = "Positive": objet 'tmp1' introuvable
tmp1=dplyr::rename(tmp1,mean_RFP = mean_RFP_positive,
            se_RFP = se_RFP_positive,
            se_proportionGraphPlus =se_proportionGraphPlus_pos,
            se_proportionGraphMinus= se_proportionGraphMinus_pos)
Error in dplyr::rename(tmp1, mean_RFP = mean_RFP_positive, se_RFP = se_RFP_positive, : objet 'tmp1' introuvable
tmp2 = tab_prop_cell_RFP[,c("Day", "Diet", "Diet1", "Experiment","mean_RFP_negative", "se_RFP_negative", "se_proportionGraphMinus_neg" ,"se_proportionGraphPlus_neg")]
Error in eval(expr, envir, enclos): objet 'tab_prop_cell_RFP' introuvable
tmp2$RFP="Negative"
Error in tmp2$RFP = "Negative": objet 'tmp2' introuvable
tmp2=dplyr::rename(tmp2,mean_RFP = mean_RFP_negative, 
            se_RFP = se_RFP_negative,
            se_proportionGraphPlus =se_proportionGraphPlus_neg,
            se_proportionGraphMinus= se_proportionGraphMinus_neg)
Error in dplyr::rename(tmp2, mean_RFP = mean_RFP_negative, se_RFP = se_RFP_negative, : objet 'tmp2' introuvable
tab_prop_cell_RFP = rbind(tmp1,tmp2)
Error in eval(quote(list(...)), env): objet 'tmp1' introuvable
tab_prop_cell_RFP = 
  tab_prop_cell_RFP%>%
  mutate_if(is.numeric,round,0)%>%
  mutate_if(is.character,as.factor)
Error in is_grouped_df(tbl): objet 'tab_prop_cell_RFP' introuvable
#tab_prop_cell_RFP$Experiment = as.factor(ifelse(tab_prop_cell_RFP$Day=="0" & tab_prop_cell_RFP$Diet1=="HS","HS",
                                      #ifelse(tab_prop_cell_RFP$Day=="0" & tab_prop_cell_RFP$Diet1=="HY","HY", 
                                            # as.character(tab_prop_cell_RFP$Experiment))))

#tab_prop_cell_RFP=
  #tab_prop_cell_RFP%>%
  #as.data.frame()%>%
  #mutate(Diet1=fct_relevel(Diet1,"HS", "HStoHS" , "HStoHY", "HY", "HYtoHS", "HYtoHY"),
         #Experiment=fct_relevel(Experiment, "HS", "Growth", "HY", "Shrinkage"))

levels(tab_prop_cell_RFP$Diet1) <- c("HS", "HS to HS" , "HS to HY", "HY", "HY to HS", "HY to HY")
Error in levels(tab_prop_cell_RFP$Diet1) <- c("HS", "HS to HS", "HS to HY", : objet 'tab_prop_cell_RFP' introuvable
Sample_size=
    d[["4K"]]%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  group_by(Diet1)%>%
  summarise(Sample_size=n())
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size$Experiment = c("G", "G", "G", "S", "S", "S")
Error in Sample_size$Experiment = c("G", "G", "G", "S", "S", "S"): objet 'Sample_size' introuvable
levels(Sample_size$Diet1) <- c("HS", "HS to HS" , "HS to HY", "HY", "HY to HS", "HY to HY")
Error in levels(Sample_size$Diet1) <- c("HS", "HS to HS", "HS to HY", : objet 'Sample_size' introuvable
Plot_Fig4K =
  ggplot(tab_prop_cell_RFP, aes(x=Diet1, y=mean_RFP))+ 
  geom_bar(stat="identity",aes(fill=RFP),color="black",width=.90)+
  geom_errorbar(aes(ymin= se_proportionGraphMinus, ymax= se_proportionGraphPlus),width=0.25)+
   geom_text(data = Sample_size, mapping = aes(x = Diet1, y = 200, label = paste("(",Sample_size,")",sep="")),size=3)+
  facet_wrap(.~Experiment,scales="free_x")+
  scale_fill_manual(name = "RFP labelling", 
                    values=c("#3a5ecc","#cc0000"),
                    labels = c("Negative", "Positive"))+
  scale_y_continuous("Number of cells (mean \u00B1se)",
                     limits=c(0,5800),
                     breaks=seq(0,5000,by=500))+
  theme(
    panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
    panel.background = element_blank(),
    axis.title.x = element_blank(),
    axis.title.y = element_text(size=Smallfont,colour="black"), 
    axis.line.x = element_line(colour="black",size=0.75),
    axis.line.y = element_line(colour="black",size=0.75),
    axis.ticks.x = element_line(size = 0.75),
    axis.ticks.y = element_line(size = 0.75),
    axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
    axis.text.y = element_text(size=Smallfont,colour="black"),
    plot.margin = unit(Margin, "cm"),
    legend.direction = "vertical", 
    legend.box = "horizontal",
    legend.position = c(0.2,0.87),
    legend.key.height = unit(0.4, "cm"),
    legend.key.width= unit(0.6, "cm"),
    legend.title = element_text(face="italic",size=Smallfont), 
    legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
    legend.text = element_text(size=Smallfont),
    legend.background = element_rect(fill=NA),
    strip.text = element_blank())
Error in ggplot(tab_prop_cell_RFP, aes(x = Diet1, y = mean_RFP)): objet 'tab_prop_cell_RFP' introuvable
    #strip.background = element_rect(fill=NA, colour="black"),
    #strip.placement="outside")

Plot_Fig4K
Error in eval(expr, envir, enclos): objet 'Plot_Fig4K' introuvable

4.1.8 Figure 4L

Data shown as rate relative to experiment start (cell /initial EC/ day). Number on bar in red is ratio of EC gained/EC lost (see materials and methods for formula).

tab_relative_cell_rate = 
  d[["4L, 4S2D"]]%>%
  select(-starts_with("X"))%>%
  drop_na()%>%
  mutate_if(is.character,as.factor)%>%
  group_by(Diet1, Experiment, Experiment2, GL)%>%
  summarise(mean_RelativeRate=mean(RelativeRate,na.rm=T),
            se_RelativeRate=se(RelativeRate))%>%
            mutate(group=paste(Diet1,Experiment,sep="_"))%>%
  as.data.frame()
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'select' applicable pour un objet de classe "NULL"
tab_relative_cell_rate_ratio = 
  tab_relative_cell_rate%>%
  group_by(Diet1,Experiment2)%>%
  summarize(Ratio = round(mean_RelativeRate[GL == "Gain"] / (-mean_RelativeRate[GL == "Loss"]),2))%>%
  mutate(GL="Loss")
Error in group_by(., Diet1, Experiment2): objet 'tab_relative_cell_rate' introuvable
levels(tab_relative_cell_rate$Diet1) <- c("HS to HS" , "HS to HY", "HY to HS", "HY to HY")
Error in levels(tab_relative_cell_rate$Diet1) <- c("HS to HS", "HS to HY", : objet 'tab_relative_cell_rate' introuvable
levels(tab_relative_cell_rate_ratio$Diet1) <- c("HS to HS" , "HS to HY", "HY to HS", "HY to HY")
Error in levels(tab_relative_cell_rate_ratio$Diet1) <- c("HS to HS", "HS to HY", : objet 'tab_relative_cell_rate_ratio' introuvable
Plot_Fig4L =
  ggplot(tab_relative_cell_rate, aes(x = Diet1, y = mean_RelativeRate, fill = GL))+ 
  geom_bar(stat="identity",aes(fill=GL),color="black",width=.90)+
  geom_hline(yintercept = 0)+
  geom_text(data=tab_relative_cell_rate_ratio,mapping=aes(x=Diet1,y=-0.01,label=Ratio), color = "red")+
  facet_grid(.~Experiment2,scales="free_x")+

  scale_fill_manual(name = "Enterocyte", 
                    values=c("palegreen", "moccasin"),
                    labels = c("Gain", "Loss"))+
  scale_y_continuous("Cell rate (cell/ initialEC/ day)",
                     limits=c(-0.11,0.11),
                     breaks=seq(-0.2,0.2,by=0.05))+
  theme(
    panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
    panel.background = element_blank(),
    axis.title.x = element_blank(),
    axis.title.y = element_text(size=Smallfont,colour="black"), 
    axis.line.x = element_line(colour="black",size=0.75),
    axis.line.y = element_line(colour="black",size=0.75),
    axis.ticks.x = element_line(size = 0.75),
    axis.ticks.y = element_line(size = 0.75),
    axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
    axis.text.y = element_text(size=Smallfont,colour="black"),
    plot.margin = unit(Margin, "cm"),
    legend.direction = "vertical", 
    legend.box = "horizontal",
    legend.position = c(0.18,0.83),
    legend.key.height = unit(0.4, "cm"),
    legend.key.width= unit(0.6, "cm"),
    legend.title = element_text(face="italic",size=Smallfont), 
    legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
    legend.text = element_text(size=Smallfont),
    legend.background = element_rect(fill=NA),
    strip.text.x = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
    strip.text.y = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
    strip.background = element_rect(fill=NA, colour="black"),
    strip.placement="outside")
Error in ggplot(tab_relative_cell_rate, aes(x = Diet1, y = mean_RelativeRate, : objet 'tab_relative_cell_rate' introuvable
Plot_Fig4L
Error in eval(expr, envir, enclos): objet 'Plot_Fig4L' introuvable

##Export Figure 4

4.2 Figure 4 - supplementary 1

4.2.1 Figure 4S1A

Midgut length increases progressively on HY, but not on HS. Statistics compare HS vs HY for each day, *** = p<0.01.

Length_dayseclosion = 
  d[["4 - S1A"]]%>%
  select(-starts_with("X"))%>%
  mutate_at(vars(starts_with("Total")),~./1000)%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  dplyr::rename(Total_Length_mm=Total.Length)%>%
  mutate(group=paste(TreatCol,Day,sep="_"))
Error in UseMethod("select"): pas de méthode pour 'select' applicable pour un objet de classe "NULL"
Sample_size=
  Length_dayseclosion%>%
  group_by(Day,TreatCol)%>%
  summarise(Sample_size=n())%>%
  dplyr::rename(Diet=TreatCol)
Error in group_by(., Day, TreatCol): objet 'Length_dayseclosion' introuvable
#Stats4S1A
###Stats

#Day 1
tmp = subset(Length_dayseclosion, Day == "1") %>%
    mutate(Day = as.factor(Day))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_dayseclosion' introuvable
mod.gen = fitme(log(Total_Length_mm) ~ Diet + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2 * (mod.gen$APHLs[["p_v"]] - mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character("1"),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_day_1 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Day 2
tmp = subset(Length_dayseclosion, Day == "2") %>%
    mutate(Day = as.factor(Day))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_dayseclosion' introuvable
mod.gen = fitme(log(Total_Length_mm) ~ Diet + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2 * (mod.gen$APHLs[["p_v"]] - mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character("2"),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_day_2 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Day 3
tmp = subset(Length_dayseclosion, Day == "3") %>%
    mutate(Day = as.factor(Day))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_dayseclosion' introuvable
mod.gen = fitme(log(Total_Length_mm) ~ Diet + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2 * (mod.gen$APHLs[["p_v"]] - mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character("3"),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_day_3 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Day 4
tmp = subset(Length_dayseclosion, Day == "4") %>%
  mutate(Day = as.factor(Day))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_dayseclosion' introuvable
mod.gen = fitme(log(Total_Length_mm) ~ Diet + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2 * (mod.gen$APHLs[["p_v"]] - mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("4")),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_day_4 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Day 5
tmp = subset(Length_dayseclosion, Day == "5") %>%
    mutate(Day = as.factor(Day))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_dayseclosion' introuvable
mod.gen = fitme(log(Total_Length_mm) ~ Diet + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2 * (mod.gen$APHLs[["p_v"]] - mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character("5"),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_day_5 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat = rbind(tab_stat_day_1, tab_stat_day_2, tab_stat_day_3, tab_stat_day_4, tab_stat_day_5)
Error in eval(quote(list(...)), env): objet 'tab_stat_day_1' introuvable
tab_stat$padj = p.adjust(tab_stat$Pvalue, method = "BH")
Error in p.adjust(tab_stat$Pvalue, method = "BH"): objet 'tab_stat' introuvable
tab_stat$sig = ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*",
                      ifelse(tab_stat$padj < 0.01 & tab_stat$padj > 0.001, "**",
                             ifelse(tab_stat$padj < 0.001, "***", "")))
Error in ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*", ifelse(tab_stat$padj < : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparisons diet within days", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","p-value adjusted","Signif."),row.names = FALSE) %>%
  add_header_above(c("log(Total_Length_mm) ~  Diet + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparisons diet within days", "Replicates", : objet 'tab_stat' introuvable
tab_stat =
    tab_stat %>%
    dplyr::rename(Day = Variable) %>%
    mutate(Day = as.factor(Day))
Error in dplyr::rename(., Day = Variable): objet 'tab_stat' introuvable
tab_stat$Diet = "HY"
Error in tab_stat$Diet = "HY": objet 'tab_stat' introuvable
letter_position = aggregate(data = Length_dayseclosion, Total_Length_mm ~ Day, max)
Error in eval(m$data, parent.frame()): objet 'Length_dayseclosion' introuvable
tab_stat1 = left_join(tab_stat, letter_position)
Error in left_join(tab_stat, letter_position): objet 'tab_stat' introuvable
#Stats vs eclosion for HS

Length_dayseclosionHS = subset(Length_dayseclosion, Diet == "0" | Diet == "HS")
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_dayseclosion' introuvable
#Day 1
tmp = subset(Length_dayseclosionHS, Day == "0" | Day == "1") %>%
    mutate(Day = as.factor(Day))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_dayseclosionHS' introuvable
mod.gen = fitme(log(Total_Length_mm) ~ Day + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Day + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2 * (mod.gen$APHLs[["p_v"]] - mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("1")),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_day_0vs1 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Day 2
tmp = subset(Length_dayseclosionHS, Day == "0" | Day == "2") %>%
    mutate(Day = as.factor(Day))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_dayseclosionHS' introuvable
mod.gen = fitme(log(Total_Length_mm) ~ Day + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Day + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2 * (mod.gen$APHLs[["p_v"]] - mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("2")),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_day_0vs2 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Day 3
tmp = subset(Length_dayseclosionHS, Day == "0" | Day == "3") %>%
    mutate(Day = as.factor(Day))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_dayseclosionHS' introuvable
mod.gen = fitme(log(Total_Length_mm) ~ Day + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Day + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2 * (mod.gen$APHLs[["p_v"]] - mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("3")),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_day_0vs3 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Day 4
tmp = subset(Length_dayseclosionHS, Day == "0" | Day == "4") %>%
    mutate(Day = as.factor(Day))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_dayseclosionHS' introuvable
mod.gen = fitme(log(Total_Length_mm) ~ Day + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Day + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2 * (mod.gen$APHLs[["p_v"]] - mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("4")),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_day_0vs4 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Day 5
tmp = subset(Length_dayseclosionHS, Day == "0" | Day == "5") %>%
    mutate(Day = as.factor(Day))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_dayseclosionHS' introuvable
mod.gen = fitme(log(Total_Length_mm) ~ Day + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Day + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2 * (mod.gen$APHLs[["p_v"]] - mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("5")),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_day_0vs5 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_statHSeclosion = rbind(tab_stat_day_0vs1, tab_stat_day_0vs2, tab_stat_day_0vs3, tab_stat_day_0vs4, tab_stat_day_0vs5)
Error in eval(quote(list(...)), env): objet 'tab_stat_day_0vs1' introuvable
tab_statHSeclosion$padj = p.adjust(tab_statHSeclosion$Pvalue, method = "BH")
Error in p.adjust(tab_statHSeclosion$Pvalue, method = "BH"): objet 'tab_statHSeclosion' introuvable
tab_statHSeclosion$sig = ifelse(tab_statHSeclosion$padj > 0.05, "ns",
  ifelse(tab_statHSeclosion$padj < 0.05 & tab_statHSeclosion$padj > 0.01, "*",
                      ifelse(tab_statHSeclosion$padj < 0.01 & tab_statHSeclosion$padj > 0.001, "**",
                             ifelse(tab_statHSeclosion$padj < 0.001, "***", ""))))
Error in ifelse(tab_statHSeclosion$padj > 0.05, "ns", ifelse(tab_statHSeclosion$padj < : objet 'tab_statHSeclosion' introuvable
tab_statHSeclosion%>%
  kable(col.names = c("Comparison to eclosion on HS", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","p-value adjusted","Signif."),row.names = FALSE) %>%
  add_header_above(c("log(Total_Length_mm) ~  Day + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison to eclosion on HS", "Replicates", : objet 'tab_statHSeclosion' introuvable
tab_statHSeclosion =
    tab_statHSeclosion %>%
    dplyr::rename(Day = Variable) %>%
    mutate(Day = as.factor(Day))
Error in dplyr::rename(., Day = Variable): objet 'tab_statHSeclosion' introuvable
tab_statHSeclosion$Diet = "HS"
Error in tab_statHSeclosion$Diet = "HS": objet 'tab_statHSeclosion' introuvable
letter_position = aggregate(data = Length_dayseclosion, Total_Length_mm ~ Day, max)
Error in eval(m$data, parent.frame()): objet 'Length_dayseclosion' introuvable
tab_statHSeclosion = left_join(tab_statHSeclosion, letter_position)
Error in left_join(tab_statHSeclosion, letter_position): objet 'tab_statHSeclosion' introuvable
#Stats vs eclosion for HY

Length_dayseclosionHS = subset(Length_dayseclosion, Diet == "0" | Diet == "HY")
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_dayseclosion' introuvable
#Day 1
tmp = subset(Length_dayseclosionHS, Day == "0" | Day == "1") %>%
    mutate(Day = as.factor(Day))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_dayseclosionHS' introuvable
mod.gen = fitme(log(Total_Length_mm) ~ Day + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Day + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2 * (mod.gen$APHLs[["p_v"]] - mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("1")),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_day_0vs1 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Day 2
tmp = subset(Length_dayseclosionHS, Day == "0" | Day == "2") %>%
    mutate(Day = as.factor(Day))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_dayseclosionHS' introuvable
mod.gen = fitme(log(Total_Length_mm) ~ Day + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Day + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2 * (mod.gen$APHLs[["p_v"]] - mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("2")),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_day_0vs2 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Day 3
tmp = subset(Length_dayseclosionHS, Day == "0" | Day == "3") %>%
    mutate(Day = as.factor(Day))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_dayseclosionHS' introuvable
mod.gen = fitme(log(Total_Length_mm) ~ Day + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Day + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2 * (mod.gen$APHLs[["p_v"]] - mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("3")),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_day_0vs3 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Day 4
tmp = subset(Length_dayseclosionHS, Day == "0" | Day == "4") %>%
    mutate(Day = as.factor(Day))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_dayseclosionHS' introuvable
mod.gen = fitme(log(Total_Length_mm) ~ Day + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Day + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2 * (mod.gen$APHLs[["p_v"]] - mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("4")),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_day_0vs4 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Day 5
tmp = subset(Length_dayseclosionHS, Day == "0" | Day == "5") %>%
    mutate(Day = as.factor(Day))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_dayseclosionHS' introuvable
mod.gen = fitme(log(Total_Length_mm) ~ Day + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Day + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2 * (mod.gen$APHLs[["p_v"]] - mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("5")),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_day_0vs5 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_statHYeclosion = rbind(tab_stat_day_0vs1, tab_stat_day_0vs2, tab_stat_day_0vs3, tab_stat_day_0vs4, tab_stat_day_0vs5)
Error in eval(quote(list(...)), env): objet 'tab_stat_day_0vs1' introuvable
tab_statHYeclosion$padj = as.numeric(p.adjust(tab_statHYeclosion$Pvalue, method = "BH"))
Error in p.adjust(tab_statHYeclosion$Pvalue, method = "BH"): objet 'tab_statHYeclosion' introuvable
tab_statHYeclosion$sig = ifelse(tab_statHYeclosion$padj > 0.05, "ns",
  ifelse(tab_statHYeclosion$padj < 0.05 & tab_statHYeclosion$padj > 0.01, "*",
                      ifelse(tab_statHYeclosion$padj < 0.01 & tab_statHYeclosion$padj > 0.001, "**",
                             ifelse(tab_statHYeclosion$padj < 0.001, "***", ""))))
Error in ifelse(tab_statHYeclosion$padj > 0.05, "ns", ifelse(tab_statHYeclosion$padj < : objet 'tab_statHYeclosion' introuvable
tab_statHYeclosion%>%
  kable(col.names = c("Comparison to eclosion on HY", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","p-value adjusted","Signif."),row.names = FALSE) %>%
  add_header_above(c("log(Total_Length_mm) ~  Day + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison to eclosion on HY", "Replicates", : objet 'tab_statHYeclosion' introuvable
tab_statHYeclosion =
    tab_statHYeclosion %>%
    dplyr::rename(Day = Variable) %>%
    mutate(Day = as.factor(Day))
Error in dplyr::rename(., Day = Variable): objet 'tab_statHYeclosion' introuvable
tab_statHYeclosion$Diet = "HY"
Error in tab_statHYeclosion$Diet = "HY": objet 'tab_statHYeclosion' introuvable
letter_position = aggregate(data = Length_dayseclosion, Total_Length_mm ~ Day, max)
Error in eval(m$data, parent.frame()): objet 'Length_dayseclosion' introuvable
tab_statHYeclosion = left_join(tab_statHYeclosion, letter_position)
Error in left_join(tab_statHYeclosion, letter_position): objet 'tab_statHYeclosion' introuvable
### Plot
z = max(Length_dayseclosion$Total_Length_mm, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'Length_dayseclosion' introuvable
Plot_Fig4S1A=
  ggplot(Length_dayseclosion, aes(x = Day, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/60) + 
  facet_grid(.~Diet,scales="free_x",space="free")+
  geom_text(data = Sample_size, mapping = aes(x = Day, y = 2.3, label = paste("(",Sample_size,")",sep="")),size=3)+
  geom_text(data = tab_stat1, mapping = aes(x =Day, y = 7.5, label = sig),size=3)+
  geom_text(data = tab_statHSeclosion, mapping = aes(x =Day, y = 3.5, label = sig),size=3)+
  geom_text(data = tab_statHYeclosion, mapping = aes(x =Day, y = 3.5, label = sig),size=3)+
  
  
  scale_fill_manual(limits=c("0","HS","HY"),
                    values= c("#cfe7cf","#FFB4B4", "#C3E6FC"))+
  scale_x_discrete("Days post eclosion")+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(2,8.2),
                     breaks=seq(2,8,by=1))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(Length_dayseclosion, aes(x = Day, y = Total_Length_mm)): objet 'Length_dayseclosion' introuvable
Plot_Fig4S1A
Error in eval(expr, envir, enclos): objet 'Plot_Fig4S1A' introuvable

4.2.2 Figure 4S1B

Scheme for Figure 4 B, C, D and Figure 4 supplement 1C, D, E. At eclosion, flies were allocated to either HS or HY diet. 7-, 14- and 21-days post eclosion flies were either kept on the same diet or shifted on the opposite diet for 7 days (HS to HY or HY to HS). Flies were dissected every 7 days, up until day 28.

img4S1B = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/4 - S1B.jpg") 
Error in transpose(y): object is NULL
gob_imageFig4S1B = rasterGrob(img4S1B)
Error in rasterGrob(img4S1B): objet 'img4S1B' introuvable
grid.draw(gob_imageFig4S1B)
Error in grid.draw(gob_imageFig4S1B): objet 'gob_imageFig4S1B' introuvable

4.2.3 Figure 4S1C

HS diet does not postpone post-eclosion development, but rather induces continual midgut shrinkage over 28 days of feeding. Letters above violin plots represent grouping by statistical differences (Post hoc Tukey on GLMM).

Length_longshift = 
  d[["4B, 4S1C"]]%>%
  select(-Total.PH3)%>%
  mutate(Total_Length_mm = Total.L/1000)%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  dplyr::rename(Day_of_treatment=Day)
Error in UseMethod("select"): pas de méthode pour 'select' applicable pour un objet de classe "NULL"
Sample_size=
  Length_longshift%>%
  group_by(Day_of_treatment,Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Day_of_treatment, Diet): objet 'Length_longshift' introuvable
###Stats

#HS
tmp= subset(Length_longshift, Diet=="HS")
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_longshift' introuvable
mod.gen = fitme(log(Total_Length_mm) ~  Day_of_treatment + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Day_of_treatment + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Diet = as.character(paste("HS")),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_HS= tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
mod.gen = lmer(log(Total_Length_mm) ~  Day_of_treatment + (1 | Repeat), data = tmp)
Error: bad 'data': objet 'tmp' introuvable
multcomp = glht(mod.gen, linfct=mcp(Day_of_treatment="Tukey"))
Error in model.matrix(model) : objet 'mod.gen' introuvable
Error in factor_contrasts(model): no 'model.matrix' method for 'model' found!
Comp_HS = cld(multcomp)
Error in cld(multcomp): objet 'multcomp' introuvable
letter_position_HS = aggregate(data=tmp,Total_Length_mm ~  Day_of_treatment, max)
Error in eval(m$data, parent.frame()): objet 'tmp' introuvable
letter_position_HS$Diet="HS"
Error in letter_position_HS$Diet = "HS": objet 'letter_position_HS' introuvable
#HY
tmp= subset(Length_longshift, Diet=="HY")
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_longshift' introuvable
mod.gen = fitme(log(Total_Length_mm) ~  Day_of_treatment + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Day_of_treatment + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Diet = as.character(paste("HY")),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_HY =tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
mod.gen = lmer(log(Total_Length_mm) ~  Day_of_treatment + (1 | Repeat), data = tmp)
Error: bad 'data': objet 'tmp' introuvable
multcomp = glht(mod.gen, linfct=mcp(Day_of_treatment="Tukey"))
Error in model.matrix(model) : objet 'mod.gen' introuvable
Error in factor_contrasts(model): no 'model.matrix' method for 'model' found!
Comp_HY = cld(multcomp)
Error in cld(multcomp): objet 'multcomp' introuvable
letter_position_HY = aggregate(data=tmp,Total_Length_mm ~  Day_of_treatment, max)
Error in eval(m$data, parent.frame()): objet 'tmp' introuvable
letter_position_HY$Diet="HY"
Error in letter_position_HY$Diet = "HY": objet 'letter_position_HY' introuvable
tab_stat = rbind(tab_stat_HS,tab_stat_HY)
Error in eval(quote(list(...)), env): objet 'tab_stat_HS' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Any difference", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%
  add_header_above(c("log(Total_Length_mm) ~  Day + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Any difference", "Replicates", "Chi2", : objet 'tab_stat' introuvable
letter_position = rbind(letter_position_HS,letter_position_HY)
Error in eval(quote(list(...)), env): objet 'letter_position_HS' introuvable
tab_letter_HS =  as.data.frame(Comp_HS$mcletters$Letters)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'Comp_HS' introuvable
tab_letter_HS$Diet = "HS"
Error in tab_letter_HS$Diet = "HS": objet 'tab_letter_HS' introuvable
tab_letter_HS$Day_of_treatment=rownames(tab_letter_HS)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'rownames' : objet 'tab_letter_HS' introuvable
colnames(tab_letter_HS)[1] = "Letter"
Error in colnames(tab_letter_HS)[1] = "Letter": objet 'tab_letter_HS' introuvable
tab_letter_HY =  as.data.frame(Comp_HY$mcletters$Letters)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'Comp_HY' introuvable
tab_letter_HY$Day_of_treatment=rownames(tab_letter_HY)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'rownames' : objet 'tab_letter_HY' introuvable
tab_letter_HY$Diet = "HY"
Error in tab_letter_HY$Diet = "HY": objet 'tab_letter_HY' introuvable
colnames(tab_letter_HY)[1] = "Letter"
Error in colnames(tab_letter_HY)[1] = "Letter": objet 'tab_letter_HY' introuvable
tab_letter = rbind(tab_letter_HS,tab_letter_HY)
Error in eval(quote(list(...)), env): objet 'tab_letter_HS' introuvable
tab_letter = left_join(tab_letter,letter_position)
Error in left_join(tab_letter, letter_position): objet 'tab_letter' introuvable
### Plot
z=max(Length_longshift$Total_Length_mm, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'Length_longshift' introuvable
Plot_Fig4S1C=
  ggplot(Length_longshift, aes(x = Day_of_treatment, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = 0.15) + 
  facet_grid(.~Diet,scales="free_x",space="free")+
  geom_text(data = Sample_size, mapping = aes(x = Day_of_treatment, y = 1.5, label = paste("(",Sample_size,")",sep="")),size=3)+
  geom_text(data = tab_letter, mapping = aes(x = Day_of_treatment, y = Total_Length_mm+0.4, label = Letter),size=3)+
  geom_text(data = tab_stat, mapping = aes(x = 1.5, y = 9.5, label = paste("p=",format(Pvalue,digits=2))),size=3)+
  scale_fill_manual(limits=c("0","HS","HY"),
                    values= c("#cfe7cf","#FFB4B4", "#C3E6FC"))+
  scale_x_discrete("Days post eclosion")+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(1.5,9.5),
                     breaks=seq(3,9,by=1))+
     stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
                     stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
                     scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(Length_longshift, aes(x = Day_of_treatment, y = Total_Length_mm)): objet 'Length_longshift' introuvable
Plot_Fig4S1C
Error in eval(expr, envir, enclos): objet 'Plot_Fig4S1C' introuvable

4.2.4 Figure 4S1D

Midgut size is a plastic, diet-dependent trait. Midguts of flies shifted between HS or HY can reversibly grow throughout 21 days. Statistical comparison is vs pre-shift measurement.

Length_shift_growth = 
  d[["4C, 4S1D"]]%>%
  select(-Total.PH3)%>%
  mutate(Total_Length_mm = Total.L/1000)%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  dplyr::rename(Day_of_treatment=Day)%>%
  as.data.frame()%>%
  mutate(Dday=fct_relevel(Dday,"Shift Day 7","Shift Day 14","Shift Day 21"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'select' applicable pour un objet de classe "NULL"
Sample_size=
  Length_shift_growth%>%
  group_by(Dday,Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Dday, Diet): objet 'Length_shift_growth' introuvable
###Stats
# Day 7
tmp= subset(Length_shift_growth,Dday=="Shift Day 7")
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_shift_growth' introuvable
mod.gen = fitme(log(Total_Length_mm) ~  Diet + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste(("HS Day 7 vs HS to HY Day 14"))),
                      Dday = as.character(paste("Shift Day 7")),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_7 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
# Day 14
tmp= subset(Length_shift_growth,Dday=="Shift Day 14")
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_shift_growth' introuvable
mod.gen = fitme(log(Total_Length_mm) ~  Diet + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste(("HS Day 14 vs HS to HY Day 21"))),
                      Dday = as.character(paste("Shift Day 14")),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_14 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
# Day 21
tmp= subset(Length_shift_growth,Dday=="Shift Day 21")
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_shift_growth' introuvable
mod.gen = fitme(log(Total_Length_mm) ~  Diet + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste(("HS Day 21 vs HS to HY Day 28"))),
                      Dday = as.character(paste("Shift Day 21")),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_21 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat=rbind(tab_stat_7,tab_stat_14,tab_stat_21)
Error in eval(quote(list(...)), env): objet 'tab_stat_7' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Shift day", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(Total_Length_mm) ~  Diet + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Shift day", "Replicates", : objet 'tab_stat' introuvable
tab_stat=
  tab_stat%>%
  mutate_if(is.character,as.factor)%>%
  as.data.frame()%>%
  mutate(Dday=fct_relevel(Dday,"Shift Day 7","Shift Day 14","Shift Day 21"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'tab_stat' introuvable
### Plot

Treatment.status = c("Shift\nDay 7","Shift\nDay 14","Shift\nDay 21")
names(Treatment.status) = c("Shift Day 7", "Shift Day 14","Shift Day 21")
z=max(Length_shift_growth$Total_Length_mm, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'Length_shift_growth' introuvable
Plot_Fig4S1D=
  ggplot(Length_shift_growth, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/60) + 
  facet_grid(. ~ Dday,labeller=labeller(Dday=Treatment.status) )+
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 1.6, label = paste("(",Sample_size,")",sep="")),size=3)+
      geom_signif(data = tab_stat, aes(xmin = 1, xmax = 2, annotations = formatC(paste("p=",Pvalue), digits = 2), y_position = 9), textsize = 2.5, vjust = -0.2, manual = TRUE)+

  scale_fill_manual(limits=c("HS","HStoHY"),
                    values=cbbHS_HStoHY)+
  scale_x_discrete("",
                   limits=c("HS","HStoHY"),
                   labels=c("HS","HS to HY"))+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(1.5,9.5),
                     breaks=seq(2,8,by=1))+
  stat_summary(fun = mean, geom = "point", size = 2.5, shape = 18,aes(group=Repeat, colour = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(Length_shift_growth, aes(x = Diet, y = Total_Length_mm)): objet 'Length_shift_growth' introuvable
Plot_Fig4S1D
Error in eval(expr, envir, enclos): objet 'Plot_Fig4S1D' introuvable

4.2.5 Figure 4S1E

Midgut size is a plastic, diet-dependent trait. Midguts of flies shifted between HS or HY can reversibly shrink throughout 21 days. Statistical comparison is vs pre-shift measurement.

Length_shift_Shrink = 
  d[["4C', 4S1D'"]]%>%
  select(-Total.PH3)%>%
  mutate(Total_Length_mm = Total.L/1000)%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  dplyr::rename(Day_of_treatment=Day)%>%
  as.data.frame()%>%
  mutate(Dday=fct_relevel(Dday,"Shift Day 7","Shift Day 14","Shift Day 21"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'select' applicable pour un objet de classe "NULL"
Sample_size=
  Length_shift_Shrink%>%
  group_by(Dday,Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Dday, Diet): objet 'Length_shift_Shrink' introuvable
###Stats
# Day 7
tmp= subset(Length_shift_Shrink,Dday=="Shift Day 7")
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_shift_Shrink' introuvable
mod.gen = fitme(log(Total_Length_mm) ~  Diet + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste(("HS Day 7 vs HS to HY Day 14"))),
  Dday = as.character(paste("Shift Day 7")),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_7 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
# Day 14
tmp= subset(Length_shift_Shrink,Dday=="Shift Day 14")
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_shift_Shrink' introuvable
mod.gen = fitme(log(Total_Length_mm) ~  Diet + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste(("HS Day 14 vs HS to HY Day 21"))),
                      Dday = as.character(paste("Shift Day 14")),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_14 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
# Day 21
tmp= subset(Length_shift_Shrink,Dday=="Shift Day 21")
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Length_shift_Shrink' introuvable
mod.gen = fitme(log(Total_Length_mm) ~  Diet + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~ Diet + (1 / Repeat), data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~ 1 + (1 | Repeat), data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste(("HS Day 21 vs HS to HY Day 28"))),
                      Dday = as.character(paste("Shift Day 21")),
                      Rep = nlevels(tmp$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_21 = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat=rbind(tab_stat_7,tab_stat_14,tab_stat_21)
Error in eval(quote(list(...)), env): objet 'tab_stat_7' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison","Shift day", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(Total length) ~ Day + Diet + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Shift day", "Replicates", : objet 'tab_stat' introuvable
tab_stat=
  tab_stat%>%
  mutate_if(is.character,as.factor)%>%
  as.data.frame()%>%
  mutate(Dday=fct_relevel(Dday,"Shift Day 7","Shift Day 14","Shift Day 21"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'tab_stat' introuvable
### Plot

Treatment.status = c("Shift\nDay 7","Shift\nDay 14","Shift\nDay 21")
names(Treatment.status) = c("Shift Day 7", "Shift Day 14","Shift Day 21")

z=max(Length_shift_Shrink$Total_Length_mm, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'Length_shift_Shrink' introuvable
Plot_Fig4S1E=
  ggplot(Length_shift_Shrink, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = 0.15) + 
  facet_grid(. ~ Dday,labeller=labeller(Dday=Treatment.status) )+
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 1.6, label = paste("(",Sample_size,")",sep="")),size=3)+
      geom_signif(data = tab_stat, aes(xmin = 1, xmax = 2, annotations = formatC(paste("p=",Pvalue), digits = 2), y_position = 9), textsize = 2.5, vjust = -0.2, manual = TRUE)+

  scale_fill_manual(limits=c("HY","HYtoHS"),
                    values=cbbHY_HYtoHS)+
  scale_x_discrete("",
                   limits=c("HY","HYtoHS"),
                   labels=c("HY","HY to HS"))+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(1.5,9.5),
                     breaks=seq(2,8,by=1))+
  stat_summary(fun = mean, geom = "point", size = 2.5, shape = 18,aes(group=Repeat, colour = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(Length_shift_Shrink, aes(x = Diet, y = Total_Length_mm)): objet 'Length_shift_Shrink' introuvable
Plot_Fig4S1E
Error in eval(expr, envir, enclos): objet 'Plot_Fig4S1E' introuvable

4.2.6 Figure 4S1F

ISC proliferation is promoted by yeast and antagonized by sugar. Cell proliferation (pH3 stain) is impeded by dietary sucrose, and increased by yeast, similar to total midgut length (Figure 2A). Plots showing counts of pH3+ cells as a function of ingested yeast and sucrose.

tab_nutri_geo_PH3 = 
  d[["4 - S1F"]]

jpeg(filename =  "Plot_Fig4-S1F.jpeg",
     res = 600,
     width = 5, height = 4, units = 'in' )
par(cex=1, mar = c(4.5, 4.5, 1, 3))
with(tab_nutri_geo_PH3, geomPlotta(x = Sucrose.in.Diet, y = Yeast.in.Diet, z = Ph3.Total, alf = 1, xlim = c(-10, 300), ylim = c(-10, 300), xlab = "Sucrose in diet (g/L)", ylab = "Yeast in diet (g/L)", frame.plot= FALSE, cex.lab=1.2, cex.axis =1, las=1, labcex=1, asp=1))
img4S1F = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/Plot_Fig4-S1F.jpeg") 
Error in transpose(y): object is NULL
gob_imageFig4S1F = rasterGrob(img4S1F)
Error in rasterGrob(img4S1F): objet 'img4S1F' introuvable
grid.draw(gob_imageFig4S1F)
Error in grid.draw(gob_imageFig4S1F): objet 'gob_imageFig4S1F' introuvable

4.2.7 Figure 4S1G

Plots showing pH3+ cell counts increase with dietary yeast, with an optimum around HY diet. Increasing sucrose reduces counts of pH3+ cells.

tab_nutri_geo_PH3 = 
  d[["4 - S1F"]]

tab_nutri_geo_PH32 <- tab_nutri_geo_PH3 %>%
    group_by(concatenate) %>%
    summarize(Calories.ingested = mean(Calories.ingested),
              Ph3.Total = mean(Ph3.Total),
              Yeast.ingested = mean(Yeast.ingested),
              Sucrose.ingested = mean(Sucrose.ingested))
Error in UseMethod("group_by"): pas de méthode pour 'group_by' applicable pour un objet de classe "NULL"
graph <- ggplot(tab_nutri_geo_PH32, aes(x=Sucrose.ingested, y=Yeast.ingested))
Error in ggplot(tab_nutri_geo_PH32, aes(x = Sucrose.ingested, y = Yeast.ingested)): objet 'tab_nutri_geo_PH32' introuvable
Plot_Fig4S1G=
 graph + geom_point(aes(size=Calories.ingested, fill=Ph3.Total), stroke=1, shape=21,  color="black") +
  scale_size(range = c(1,5)) +
  scale_fill_viridis_c() +
  theme(plot.title= element_text(hjust = 0.5))+
scale_x_continuous("Sucrose ingested (g/L x Absorbance)",
                     limits=c(-5,160),
                     breaks=seq(0,160,by=25))+
  scale_y_continuous("Yeast ingested (g/L x Absorbance)",
                     limits=c(-5,50),
                     breaks=seq(0,50,by=10))+
    scale_size_continuous(range = c(1,5)) +
    theme(panel.background = element_blank(),
        panel.grid.major = element_line(colour = "black",linetype=3),
        axis.title.x = element_text(size=Smallfont,colour="black"), 
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"), 
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(c(0,0,0,0.5), "cm"),
        legend.direction = "horizontal", 
        legend.box = "vertical",
        legend.position = c(0.75,0.79),
       legend.key.height = unit(0.3, "cm"),
        legend.key.width= unit(0.3, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.box.background = element_rect(fill="white", colour ="black"),
        legend.spacing.y = unit(0, "cm"))+
  labs(fill = expression(paste("pH3" ^ "+", " cells")), size = "Calories
ingested", vjust="center" )
Error in eval(expr, envir, enclos): objet 'graph' introuvable
Plot_Fig4S1G
Error in eval(expr, envir, enclos): objet 'Plot_Fig4S1G' introuvable

##Export Figure 4S1

4.3 Figure 4 - supplementary 2

4.3.1 Figure 4S2A

Illustration of the cell loss assay (Figure 4G - L). A pulse of RU486 for 3 days marks all ECs and EBs through 5966GS>His-2BRFP. Flies were dissected at 2 and 16-days after cessation of hormone pulse.

img4S2A = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/4 - S2A.jpg") 
Error in transpose(y): object is NULL
gob_imageFig4S2A = rasterGrob(img4S2A)
Error in rasterGrob(img4S2A): objet 'img4S2A' introuvable
grid.draw(gob_imageFig4S2A)
Error in grid.draw(gob_imageFig4S2A): objet 'gob_imageFig4S2A' introuvable

4.3.2 Figure 4S2B

His2B-RFP is highly stable on both HS and HY diets on tissues not undergoing turnover in a manner similar to the midgut. We assayed the stability of the His2B-RFP by driving it through an ActGS driver, in the crop and hindgut in the same timeline as the experiment presented in Figure 4K. In both organs, we found a high degree of cells marked by His2B-RFP, and on both diets, at both the initial timepoint and after 14 days from the start of the chase. Day of dissection at the bottom of the chart are relative to start of pulse chase.

tab_Hisstab_rev = 
  d[["4S2B"]]%>%
  mutate_at(vars(!starts_with("RFP")),as.factor)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
###Stats

#Crop
tmp = subset(tab_Hisstab_rev , Tissue%in%c("Crop"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_Hisstab_rev' introuvable
mod.gen = fitme((RFP.Dapi) ~  Day * Diet + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest((RFP.Dapi) ~  Day * Diet + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme((RFP.Dapi) ~  Day + Diet + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
test
function (pkg = ".", filter = NULL, stop_on_failure = FALSE, 
    export_all = TRUE, ...) 
{
    save_all()
    pkg <- as.package(pkg)
    if (!uses_testthat(pkg) && interactive()) {
        cli::cli_alert_danger("No testing infrastructure found. Create it?")
        if (utils::menu(c("Yes", "No")) == 1) {
            usethis_use_testthat(pkg)
        }
        return(invisible())
    }
    load_all(pkg$path)
    cli::cli_alert_info("Testing {.pkg {pkg$package}}")
    withr::local_envvar(r_env_vars())
    testthat::test_local(pkg$path, filter = filter, stop_on_failure = stop_on_failure, 
        ...)
}
<bytecode: 0x000000009e53be20>
<environment: namespace:devtools>
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Tissue = as.character(paste("Crop")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=1,scientific=F)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_Crop=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Hindgut
tmp = subset(tab_Hisstab_rev , Tissue%in%c("Hindgut"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_Hisstab_rev' introuvable
mod.gen = fitme((RFP.Dapi) ~  Day * Diet + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest((RFP.Dapi) ~  Day * Diet + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme((RFP.Dapi) ~  Day + Diet + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
test
function (pkg = ".", filter = NULL, stop_on_failure = FALSE, 
    export_all = TRUE, ...) 
{
    save_all()
    pkg <- as.package(pkg)
    if (!uses_testthat(pkg) && interactive()) {
        cli::cli_alert_danger("No testing infrastructure found. Create it?")
        if (utils::menu(c("Yes", "No")) == 1) {
            usethis_use_testthat(pkg)
        }
        return(invisible())
    }
    load_all(pkg$path)
    cli::cli_alert_info("Testing {.pkg {pkg$package}}")
    withr::local_envvar(r_env_vars())
    testthat::test_local(pkg$path, filter = filter, stop_on_failure = stop_on_failure, 
        ...)
}
<bytecode: 0x000000009e53be20>
<environment: namespace:devtools>
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Tissue = as.character(paste("Hindgut")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=1,scientific=F)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_Hindgut=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Table
tab_stat=rbind(tab_stat_Crop,tab_stat_Hindgut)
Error in eval(quote(list(...)), env): objet 'tab_stat_Crop' introuvable
tab_stat$padj = as.numeric(format(p.adjust(tab_stat$Pvalue, method = "BH"),digits=2,scientific =F))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'format' : objet 'tab_stat' introuvable
tab_stat$sig = ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*",
             ifelse(tab_stat$padj < 0.01 & tab_stat$padj > 0.001, "**",
              ifelse(tab_stat$padj < 0.001, "***", "")))
Error in ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*", ifelse(tab_stat$padj < : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Variable", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","p-value adjusted","Signif."),row.names = FALSE) %>%
  add_header_above(c("(RFP/Dapi) ~  Diet + Genotype + Diet : Genotype + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Variable", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
tab_stat_rev_Hisstab=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat_rev_Hisstab$Diet = "HY"
Error in tab_stat_rev_Hisstab$Diet = "HY": objet 'tab_stat_rev_Hisstab' introuvable
Sample_size=
  tab_Hisstab_rev%>%
  group_by(Diet, Day, Tissue)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet, Day, Tissue): objet 'tab_Hisstab_rev' introuvable
### Plot
Limits = c("0","14")

Plot_Fig4S2B=
  ggplot(tab_Hisstab_rev, aes(x = Day, y = RFP.Dapi))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = 4) + 
  facet_grid(Tissue ~ Diet,labeller=label_parsed)+
  geom_text(data = Sample_size, mapping = aes(x = Day, y = 10, label = paste("(",Sample_size,")",sep="")),size=3)+
  scale_fill_manual(limits=c("HS","HY"),
                    values=c("#FFB4B4","#C3E6FC"))+
  scale_x_discrete("Day of dissection post RU486 pulse",
                   limits=Limits,
                   labels=c("0","14"))+
  scale_y_continuous(expression(paste("RFP pos. cells / Total cells %")),
                     limits=c(0,110),
                     breaks=seq(0,100,by=20))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  stat_summary(fun = mean, colour = "black", geom = "line", aes(group = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black", margin = margin(t = 0, r = 0, b = 0, l = 0) ), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text = element_text(size =Smallfont-2, colour = "black",face="italic", margin = margin(t = 2, r = 1, b = 2, l = 1)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_Hisstab_rev, aes(x = Day, y = RFP.Dapi)): objet 'tab_Hisstab_rev' introuvable
Plot_Fig4S2B
Error in eval(expr, envir, enclos): objet 'Plot_Fig4S2B' introuvable

4.3.3 Figure 4S2C

Cell loss assay performed at 5 days post start of chase shows limited cell loss in HY to HY condition. Number of ECs in the posterior midgut, both marked (Red, old ECs) and unmarked (Blue, new ECs) by RFP, error bars are SE from 3 repeats.

tab_prop_cell_RFP_kin = 
  d[["4S2C"]]%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  mutate(Post.Dapi.Number = (Post.Dapi.Number)*2)%>%
  mutate(Post.RFP.Number = (Post.RFP.Number)*2)%>%
  mutate(Post.NonRFP.Number = (Post.Dapi.Number - Post.RFP.Number))%>%
  group_by(Day, Diet, CG, Experiment)%>%
  summarise(mean_RFP_positive=mean(Post.RFP.Number,na.rm=T),
            se_RFP_positive=se(Post.RFP.Number),
            mean_RFP_negative=mean(Post.NonRFP.Number,na.rm=T),
            se_RFP_negative=se(Post.NonRFP.Number))%>%
  mutate(group=paste(Diet,Experiment,sep="_"))%>%
  as.data.frame()
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
attach(tab_prop_cell_RFP_kin)
Error in attach(tab_prop_cell_RFP_kin): objet 'tab_prop_cell_RFP_kin' introuvable
for (i in 1:length(Experiment)){
    tab_prop_cell_RFP_kin$se_proportionGraphPlus_pos[i] = mean_RFP_positive[i]+se_RFP_positive[i]
    tab_prop_cell_RFP_kin$se_proportionGraphMinus_pos[i] = mean_RFP_positive[i]-se_RFP_positive[i]
    tab_prop_cell_RFP_kin$se_proportionGraphPlus_neg[i] = mean_RFP_positive[i]+mean_RFP_negative[i]+se_RFP_negative[i]
    tab_prop_cell_RFP_kin$se_proportionGraphMinus_neg[i] = mean_RFP_positive[i]+mean_RFP_negative[i]-se_RFP_negative[i]
}
Error in eval(expr, envir, enclos): objet 'Experiment' introuvable
tmp1 = tab_prop_cell_RFP_kin[,c("Day", "Diet", "CG", "Experiment","mean_RFP_positive", "se_RFP_positive","se_proportionGraphPlus_pos", "se_proportionGraphMinus_pos")]
Error in eval(expr, envir, enclos): objet 'tab_prop_cell_RFP_kin' introuvable
tmp1$RFP="Positive"
Error in tmp1$RFP = "Positive": objet 'tmp1' introuvable
tmp1=dplyr::rename(tmp1,mean_RFP = mean_RFP_positive,
            se_RFP = se_RFP_positive,
            se_proportionGraphPlus =se_proportionGraphPlus_pos,
            se_proportionGraphMinus= se_proportionGraphMinus_pos)
Error in dplyr::rename(tmp1, mean_RFP = mean_RFP_positive, se_RFP = se_RFP_positive, : objet 'tmp1' introuvable
tmp2 = tab_prop_cell_RFP_kin[,c("Day", "Diet", "CG", "Experiment","mean_RFP_negative", "se_RFP_negative", "se_proportionGraphMinus_neg" ,"se_proportionGraphPlus_neg")]
Error in eval(expr, envir, enclos): objet 'tab_prop_cell_RFP_kin' introuvable
tmp2$RFP="Negative"
Error in tmp2$RFP = "Negative": objet 'tmp2' introuvable
tmp2=dplyr::rename(tmp2,mean_RFP = mean_RFP_negative, 
            se_RFP = se_RFP_negative,
            se_proportionGraphPlus =se_proportionGraphPlus_neg,
            se_proportionGraphMinus= se_proportionGraphMinus_neg)
Error in dplyr::rename(tmp2, mean_RFP = mean_RFP_negative, se_RFP = se_RFP_negative, : objet 'tmp2' introuvable
tab_prop_cell_RFP_kin = rbind(tmp1,tmp2)
Error in eval(quote(list(...)), env): objet 'tmp1' introuvable
tab_prop_cell_RFP_kin = 
  tab_prop_cell_RFP_kin%>%
  mutate_if(is.numeric,round,0)%>%
  mutate_if(is.character,as.factor)
Error in is_grouped_df(tbl): objet 'tab_prop_cell_RFP_kin' introuvable
levels(tab_prop_cell_RFP_kin$Diet) <- c("HS", "HS to HS" , "HS to HY", "HY", "HY to HS", "HY to HY")
Error in levels(tab_prop_cell_RFP_kin$Diet) <- c("HS", "HS to HS", "HS to HY", : objet 'tab_prop_cell_RFP_kin' introuvable
Sample_size=
    d[["4S2C"]]%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  group_by(Diet)%>%
  summarise(Sample_size=n())
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size$Experiment = c("G", "G", "G", "S", "S", "S")
Error in Sample_size$Experiment = c("G", "G", "G", "S", "S", "S"): objet 'Sample_size' introuvable
levels(Sample_size$Diet) <- c("HS", "HS to HS" , "HS to HY", "HY", "HY to HS", "HY to HY")
Error in levels(Sample_size$Diet) <- c("HS", "HS to HS", "HS to HY", "HY", : objet 'Sample_size' introuvable
Plot_Fig4S2C =
  ggplot(tab_prop_cell_RFP_kin, aes(x=Diet, y=mean_RFP))+ 
  geom_bar(stat="identity",aes(fill=RFP),color="black",width=.90)+
  geom_errorbar(aes(ymin= se_proportionGraphMinus, ymax= se_proportionGraphPlus),width=0.25)+
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 200, label = paste("(",Sample_size,")",sep="")),size=3)+
  #facet_wrap(.~Experiment,scales="free_x")+
  scale_fill_manual(name = "RFP labelling", 
                    values=c("#3a5ecc","#cc0000"),
                    labels = c("Negative", "Positive"))+
  scale_y_continuous("Number of cells (mean \u00B1se)",
                     limits=c(0,5800),
                     breaks=seq(0,5000,by=500))+
  theme(
    panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
    panel.background = element_blank(),
    axis.title.x = element_blank(),
    axis.title.y = element_text(size=Smallfont,colour="black"), 
    axis.line.x = element_line(colour="black",size=0.75),
    axis.line.y = element_line(colour="black",size=0.75),
    axis.ticks.x = element_line(size = 0.75),
    axis.ticks.y = element_line(size = 0.75),
    axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
    axis.text.y = element_text(size=Smallfont,colour="black"),
    plot.margin = unit(Margin, "cm"),
    legend.direction = "vertical", 
    legend.box = "horizontal",
    legend.position = c(0.2,0.87),
    legend.key.height = unit(0.4, "cm"),
    legend.key.width= unit(0.6, "cm"),
    legend.title = element_text(face="italic",size=Smallfont), 
    legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
    legend.text = element_text(size=Smallfont),
    legend.background = element_rect(fill=NA),
    strip.text = element_blank())
Error in ggplot(tab_prop_cell_RFP_kin, aes(x = Diet, y = mean_RFP)): objet 'tab_prop_cell_RFP_kin' introuvable
    #strip.background = element_rect(fill=NA, colour="black"),
    #strip.placement="outside")

Plot_Fig4S2C
Error in eval(expr, envir, enclos): objet 'Plot_Fig4S2C' introuvable

4.3.4 Figure 4S2D

Diet composition modulates cell replacement rate (cell/day). Bar chart was made using the same data as in Figure 4 K, L.

tab_relative_cell_rate_supp = 
  d[["4L, 4S2D"]]%>%
  select(-starts_with("X"))%>%
  drop_na()%>%
mutate_if(is.character,as.factor)%>%
  group_by(Diet1, Experiment, Experiment2, GL)%>%
  summarise(mean_Daily=mean(Daily,na.rm=T))%>%
            mutate(group=paste(Diet1,Experiment,sep="_"))%>%
  as.data.frame()
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'select' applicable pour un objet de classe "NULL"
tab_relative_cell_rate_ratio = 
  tab_relative_cell_rate_supp%>%
  group_by(Diet1,Experiment2)%>%
  summarize(Ratio = round(mean_Daily[GL == "Gain"] / (-mean_Daily[GL == "Loss"]),2))%>%
  mutate(GL="Loss")
Error in group_by(., Diet1, Experiment2): objet 'tab_relative_cell_rate_supp' introuvable
levels(tab_relative_cell_rate_supp$Diet1) <- c("HS to HS" , "HS to HY", "HY to HS", "HY to HY")
Error in levels(tab_relative_cell_rate_supp$Diet1) <- c("HS to HS", "HS to HY", : objet 'tab_relative_cell_rate_supp' introuvable
levels(tab_relative_cell_rate_ratio$Diet1) <- c("HS to HS" , "HS to HY", "HY to HS", "HY to HY")
Error in levels(tab_relative_cell_rate_ratio$Diet1) <- c("HS to HS", "HS to HY", : objet 'tab_relative_cell_rate_ratio' introuvable
Plot_Fig4S2D =
  ggplot(tab_relative_cell_rate_supp, aes(x = Diet1, y = mean_Daily, fill = GL))+ 
  geom_bar(stat="identity",aes(fill=GL),color="black",width=.90)+
  geom_hline(yintercept = 0)+
  geom_text(data=tab_relative_cell_rate_ratio,mapping=aes(x=Diet1,y=-20,label=Ratio), color = "red")+
  facet_grid(.~Experiment2,scales="free_x")+

  scale_fill_manual(name = "Enterocyte", 
                    values=c("palegreen", "moccasin"),
                    labels = c("Gain", "Loss"))+
  scale_y_continuous("Cell rate (cell/ day)",
                     limits=c(-220,220),
                     breaks=seq(-200,200,by=50))+
  theme(
    panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
    panel.background = element_blank(),
    axis.title.x = element_blank(),
    axis.title.y = element_text(size=Smallfont,colour="black"), 
    axis.line.x = element_line(colour="black",size=0.75),
    axis.line.y = element_line(colour="black",size=0.75),
    axis.ticks.x = element_line(size = 0.75),
    axis.ticks.y = element_line(size = 0.75),
    axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
    axis.text.y = element_text(size=Smallfont,colour="black"),
    plot.margin = unit(Margin, "cm"),
    legend.direction = "vertical", 
    legend.box = "horizontal",
    legend.position = c(0.18,0.88),
    legend.key.height = unit(0.4, "cm"),
    legend.key.width= unit(0.6, "cm"),
    legend.title = element_text(face="italic",size=Smallfont), 
    legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
    legend.text = element_text(size=Smallfont),
    legend.background = element_rect(fill=NA),
    strip.text.x = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
    strip.text.y = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
    strip.background = element_rect(fill=NA, colour="black"),
    strip.placement="outside")
Error in ggplot(tab_relative_cell_rate_supp, aes(x = Diet1, y = mean_Daily, : objet 'tab_relative_cell_rate_supp' introuvable
Plot_Fig4S2D
Error in eval(expr, envir, enclos): objet 'Plot_Fig4S2D' introuvable

##Export Figure 4S2

5 Figure 5. Sugar uncouples ISC proliferation from niche signal expression by inducing translational stress

5.1 Figure 5 - main

5.1.1 Figure 5A

Diet influences midgut transcriptomes after an initial programmed developmental transition. The plot shows a PCA of the whole transcriptome, with means per diet per day ± standard error (3 repeats). Numbers on the plot represent the day of dissection from eclosion. Lines connect the datapoints sequentially (Day 0 to day 1, day 1 to day 2, and so on), and show the divergent transcriptomic trajectory followed by midguts on the two different diets from eclosion.

dataInd =
  d[["gutGrowthDataIndex"]]%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
    #add string to direct to enumerated reads
dataInd$countFile = gsub(".fastq", "_sn.sam.count", dataInd$library)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'gsub' : objet 'dataInd' introuvable
dataInd$samp = paste("day",dataInd$day,"_diet",dataInd$diet,"_rep",dataInd$rep,sep="")
Error in eval(quote(list(...)), env): objet 'dataInd' introuvable
dataInd$expCond = factor(paste(dataInd$day, dataInd$diet, sep=""))
Error in eval(quote(list(...)), env): objet 'dataInd' introuvable
dataInd$dietCol = with( dataInd, ifelse(diet=="x", "#ff9595", ifelse(diet=="y", "#abefff", "#67ff67"))  )
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'data' lors de la s�lection d'une m�thode pour la fonction 'with' : objet 'dataInd' introuvable
tab_read_RNAseq = d[["readTable"]]
geneID = rownames(tab_read_RNAseq) = tab_read_RNAseq$FBid
tab_read_RNAseq = tab_read_RNAseq[,2:ncol(tab_read_RNAseq)]
Error in 2:ncol(tab_read_RNAseq): l'argument est de longueur nulle
normCounts = d[["normCounts"]]
rownames(normCounts) = geneID
normCounts = normCounts[,2:ncol(normCounts)]
Error in 2:ncol(normCounts): l'argument est de longueur nulle
    #pca without day 4
dataInd2 = droplevels(subset(dataInd, day!=4))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'droplevels' : erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'dataInd' introuvable
normCounts2 = normCounts[,dataInd$day!=4]
Error in eval(expr, envir, enclos): objet 'dataInd' introuvable
pca2 = prcomp(t(normCounts2))   
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 't' : objet 'normCounts2' introuvable
summary(pca2)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'summary' : objet 'pca2' introuvable
    #calculate means and SEs of the PCs
        #without day 4
pcMns = aggregate(pca2$x ~ day * diet + dietCol, data=dataInd2, mean)
Error in eval(m$data, parent.frame()): objet 'dataInd2' introuvable
pcSEs = aggregate(pca2$x ~ day * diet + dietCol, data=dataInd2, function(x){sd(x)/sqrt(length(x))})
Error in eval(m$data, parent.frame()): objet 'dataInd2' introuvable
pcMns = droplevels(subset(pcMns, day!=4))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'droplevels' : erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'pcMns' introuvable
pcSEs = droplevels(subset(pcSEs, day!=4))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'droplevels' : erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'pcSEs' introuvable
pcMns = pcMns[order(pcMns$day),]
Error in eval(expr, envir, enclos): objet 'pcMns' introuvable
pcSEs = pcSEs[order(pcSEs$day),]
Error in eval(expr, envir, enclos): objet 'pcSEs' introuvable
pcMns = pcMns%>%
  mutate_if(is.character,as.factor)%>%
  select(day,diet,dietCol,PC1,PC2)%>%
  as.data.frame()%>%
  dplyr::rename(PC1_mean=PC1,
         PC2_mean=PC2)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'pcMns' introuvable
pcSEs = pcSEs%>%
  mutate_if(is.character,as.factor)%>%
  select(day,diet,dietCol,PC1,PC2)%>%
  dplyr::rename(PC1_se=PC1,
         PC2_se=PC2)
Error in is_grouped_df(tbl): objet 'pcSEs' introuvable
tab_PCA = left_join(pcMns,pcSEs)
Error in left_join(pcMns, pcSEs): objet 'pcMns' introuvable
tab_PCA$diet1 =ifelse(tab_PCA$diet=="x","#ff9595","#abefff")
Error in ifelse(tab_PCA$diet == "x", "#ff9595", "#abefff"): objet 'tab_PCA' introuvable
tab_PCA$diet1[1]="#ff9595"
Error in tab_PCA$diet1[1] = "#ff9595": objet 'tab_PCA' introuvable
tab_PCA$diet2=ifelse(tab_PCA$diet=="y","#abefff","#ff9595")
Error in ifelse(tab_PCA$diet == "y", "#abefff", "#ff9595"): objet 'tab_PCA' introuvable
tab_PCA$diet2[1]="#abefff"
Error in tab_PCA$diet2[1] = "#abefff": objet 'tab_PCA' introuvable
tab_PCA=mutate_if(tab_PCA,is.character,as.factor)
Error in is_grouped_df(tbl): objet 'tab_PCA' introuvable
tab_PCA$diet1= factor(tab_PCA$diet1,levels=c("#67ff67","#abefff","#ff9595"))
Error in factor(tab_PCA$diet1, levels = c("#67ff67", "#abefff", "#ff9595")): objet 'tab_PCA' introuvable
tab_PCA$diet2= factor(tab_PCA$diet2,levels=c("#67ff67","#abefff","#ff9595"))
Error in factor(tab_PCA$diet2, levels = c("#67ff67", "#abefff", "#ff9595")): objet 'tab_PCA' introuvable
Plot_Fig5A=
 ggplot(tab_PCA,aes(x=PC1_mean, y=PC2_mean))+
  geom_point(aes(color=dietCol),size=2 ,shape=19)+
  geom_errorbarh(aes(xmax = PC1_mean+PC1_se, xmin =PC1_mean-PC1_se,color=dietCol ),height=0.1)+
  geom_errorbar(aes(ymax = PC2_mean+PC2_se, ymin =PC2_mean-PC2_se,color=dietCol ),width =0.1)+
  geom_path(size=0.8,aes(group=diet1,color=diet1))+
  geom_path(size=0.8,aes(group=diet2,color=diet2))+
  geom_text(aes(label=day),size=4,vjust = 0, nudge_y = -2.5)+
  scale_color_manual(values=c("#67ff67","#abefff","#ff9595"))+
  scale_x_continuous(paste("PC1 (", round(summary(pca2)$importance[2,1]*100), "%)", sep=""),
                   limits=c(-50,60),
                   breaks=seq(-50,60,by=20))+
  scale_y_continuous(paste("PC2 (", round(summary(pca2)$importance[2,2]*100), "%)", sep=""),
                     limits=c(-30,45),
                     breaks=seq(-30,40,by=10))+
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"),
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical",
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont),
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size =Smallfont, colour = "black",face="italic"),
        strip.text.y = element_text(size =Smallfont, colour = "black",face="italic"),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_PCA, aes(x = PC1_mean, y = PC2_mean)): objet 'tab_PCA' introuvable
Plot_Fig5A
Error in eval(expr, envir, enclos): objet 'Plot_Fig5A' introuvable

5.1.2 Figure 5B

Diet modulates expression of functionally distinct gene classes. Midguts of flies fed HY diet show higher expression of genes with digestive functions, while HS diet involves mainly genes attributed to stress response and growth. X-axis represents the statistical significance of the gene ontology (GO) categories (y-axis) after adjustment for multiple testing. Size of the dot is proportional to number of genes in the given GO category

tab_GO_results = 
  d[["5B"]]%>%
  mutate_if(is.character,as.factor)%>%
  mutate(Padj=-log(p.value,10),
         Term = str_to_sentence(Term))%>%
  as.data.frame()
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
tab_GO_results$Term <- factor(tab_GO_results$Term, levels = tab_GO_results$Term[order(tab_GO_results$Diet, tab_GO_results$Padj, tab_GO_results$Significant)])
Error in factor(tab_GO_results$Term, levels = tab_GO_results$Term[order(tab_GO_results$Diet, : objet 'tab_GO_results' introuvable
#order GO categories based on size of Padj

tab_GO_results$Diet <- factor(tab_GO_results$Diet, levels = c("HY", "HS"))
Error in factor(tab_GO_results$Diet, levels = c("HY", "HS")): objet 'tab_GO_results' introuvable
### Plot

Plot_Fig5B=
  ggplot(tab_GO_results, aes(x = Padj, y = Term))+ 
  geom_point(aes(size=Significant,fill=Diet),shape=21) +
  facet_grid(Diet~.,scales="free_y",space="free")+
  scale_fill_manual(limits=c("HS","HY"),
                    values=c("#FFB4B4","#C3E6FC"))+
  geom_vline(xintercept = 1.3,linetype=3)+
  scale_y_discrete("GO categories")+
  scale_x_continuous(expression(paste("-P-value adjusted (", log[10],")")),
                     limits=c(0,31),
                     breaks=c(0,seq(10,30,by=10)))+
  scale_size_continuous("Nbr genes", range =c(1,5) )+
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont-2,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "horizontal", 
        legend.box = "horizontal",
        legend.position = "top",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.margin=margin(b=0, unit='cm'),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=Smallfont-2),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size =Smallfont, colour = "black",face="italic"),
        strip.text.y = element_text(size = Smallfont, colour = "black", margin = margin(t = 3, r = 1, b = 3, l = 1)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")+
  guides(fill=F)
Error in ggplot(tab_GO_results, aes(x = Padj, y = Term)): objet 'tab_GO_results' introuvable
Plot_Fig5B
Error in eval(expr, envir, enclos): objet 'Plot_Fig5B' introuvable

5.1.3 Figure 5C

Table of genes significantly differently expressed, between HS and HY, as a ratio of HS/HY, representing midgut response to HS and HY diets; additional information on the statistics is found in material and methods; asterisks denote genes significantly different for p-value but not for adjusted p-value

img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/5C.jpg") 
Error in transpose(y): object is NULL
gob_imageFig5C = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig5C)
Error in grid.draw(gob_imageFig5C): objet 'gob_imageFig5C' introuvable

5.1.4 Figure 5D

Cell proliferation is possible on HS diet when genetically induced. Progenitor-specific (EsgTS) overexpression of a constitutively active form of Ras (UAS-RasV12) and of UAS-Tor-DER (EGFR Active), both known proliferative inducers, allows for increased proliferation on HS diet. P-values on top of the chart refer to comparison vs control, P-values at the bottom refer to comparison between HS and HY for each sample. Complete statistical annotation on image can be fund in the manuscript’s figures.

Tab_Ras_PH3_Rev = 
  d[["5D"]]%>%
  mutate_at(vars(ends_with(".L")),~./1000)%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  dplyr::rename(PH3_positive_cell=Total.PH3,
                Diet=Treatment,
                Male_Line=Male.Line)%>%
  mutate(Cross=fct_relevel(Cross,"EsgTsXControl","EsgTsX64195", "EsgTsXTorDER" ))
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
###Stats

##Control
tmp = subset(Tab_Ras_PH3_Rev , Male_Line%in%c("Control"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Tab_Ras_PH3_Rev' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Diet + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Diet + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("HS vs HY Control")),
                               Rep = nlevels(Tab_Ras_PH3_Rev$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Tab_Ras_PH3_Rev' introuvable
tab_stat_Control=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
##Ras85DV12 (64195)

tmp = subset(Tab_Ras_PH3_Rev , Male_Line%in%c("Ras85DV12"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Tab_Ras_PH3_Rev' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Diet + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Diet + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("HS vs HY Ras85DV12")),
                               Rep = nlevels(Tab_Ras_PH3_Rev$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Tab_Ras_PH3_Rev' introuvable
tab_stat_Ras85DV12=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
##Ras85DV12_2 (TorDER)

tmp = subset(Tab_Ras_PH3_Rev , Male_Line%in%c("TorDER"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Tab_Ras_PH3_Rev' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Diet + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Diet + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("HS vs HY TorDER")),
                               Rep = nlevels(Tab_Ras_PH3_Rev$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Tab_Ras_PH3_Rev' introuvable
tab_stat_TorDER=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat=rbind(tab_stat_Control, tab_stat_Ras85DV12, tab_stat_TorDER)
Error in eval(quote(list(...)), env): objet 'tab_stat_Control' introuvable
tab_stat$padj = as.numeric(format(p.adjust(tab_stat$Pvalue, method = "BH"),digits=2,scientific =F))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'format' : objet 'tab_stat' introuvable
tab_stat$sig = ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*",
             ifelse(tab_stat$padj < 0.01 & tab_stat$padj > 0.001, "**",
              ifelse(tab_stat$padj < 0.001, "***", "")))
Error in ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*", ifelse(tab_stat$padj < : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","p-value adjusted","Signif."),row.names = FALSE) %>%
  add_header_above(c("log(PH3_positive_cell+1) ~  Diet + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
tab_stat_rev_RasPH3=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat_rev_RasPH3$Male_Line= tab_stat_rev_RasPH3$Variable
Error in eval(expr, envir, enclos): objet 'tab_stat_rev_RasPH3' introuvable
###Stats HS vs control

tmpd = subset(Tab_Ras_PH3_Rev , Diet%in%c("HS"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Tab_Ras_PH3_Rev' introuvable
##Ras85DV12

tmp = subset(tmpd , Male_Line%in%c("Control", "Ras85DV12"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tmpd' introuvable
mod.gen = fitme((PH3_positive_cell+1) ~  Male_Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest((PH3_positive_cell+1) ~  Male_Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme((PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("HS Ras85DV12 vs HS Control")),
                               Rep = nlevels(Tab_Ras_PH3_Rev$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Tab_Ras_PH3_Rev' introuvable
tab_stat_HS_Ras85DV12=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
##TorDER
tmp = subset(tmpd , Male_Line%in%c("Control", "TorDER"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tmpd' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Male_Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Male_Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("HS TorDER vs HS Control")),
                               Rep = nlevels(Tab_Ras_PH3_Rev$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Tab_Ras_PH3_Rev' introuvable
tab_stat_HS_TorDER=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Table


tab_stat=rbind(tab_stat_HS_Ras85DV12, tab_stat_HS_TorDER)
Error in eval(quote(list(...)), env): objet 'tab_stat_HS_Ras85DV12' introuvable
tab_stat$padj = as.numeric(format(p.adjust(tab_stat$Pvalue, method = "BH"),digits=2,scientific =F))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'format' : objet 'tab_stat' introuvable
tab_stat$sig = ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*",
             ifelse(tab_stat$padj < 0.01 & tab_stat$padj > 0.001, "**",
              ifelse(tab_stat$padj < 0.001, "***", "")))
Error in ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*", ifelse(tab_stat$padj < : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","p-value adjusted","Signif."),row.names = FALSE) %>%
  add_header_above(c("log(PH3_positive_cell+1) ~  Genotype + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
tab_stat_rev_RasPH3_HS=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat_rev_RasPH3_HS$Male_Line= tab_stat_rev_RasPH3_HS$Variable
Error in eval(expr, envir, enclos): objet 'tab_stat_rev_RasPH3_HS' introuvable
###Stats HY vs control

tmpd = subset(Tab_Ras_PH3_Rev , Diet%in%c("HY"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'Tab_Ras_PH3_Rev' introuvable
##Ras85DV12

tmp = subset(tmpd , Male_Line%in%c("Control", "Ras85DV12"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tmpd' introuvable
mod.gen = fitme((PH3_positive_cell+1) ~  Male_Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest((PH3_positive_cell+1) ~  Male_Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme((PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("HY Ras85DV12 vs HY Control")),
                               Rep = nlevels(Tab_Ras_PH3_Rev$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Tab_Ras_PH3_Rev' introuvable
tab_stat_HY_Ras85DV12=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
##TorDER
tmp = subset(tmpd , Male_Line%in%c("Control", "TorDER"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tmpd' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Male_Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Male_Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("HY TorDER vs HY Control")),
                               Rep = nlevels(Tab_Ras_PH3_Rev$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Tab_Ras_PH3_Rev' introuvable
tab_stat_HY_TorDER=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Table


tab_stat=rbind(tab_stat_HY_Ras85DV12, tab_stat_HY_TorDER)
Error in eval(quote(list(...)), env): objet 'tab_stat_HY_Ras85DV12' introuvable
tab_stat$padj = as.numeric(format(p.adjust(tab_stat$Pvalue, method = "BH"),digits=2,scientific =F))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'format' : objet 'tab_stat' introuvable
tab_stat$sig = ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*",
             ifelse(tab_stat$padj < 0.01 & tab_stat$padj > 0.001, "**",
              ifelse(tab_stat$padj < 0.001, "***", "")))
Error in ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*", ifelse(tab_stat$padj < : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","p-value adjusted","Signif."),row.names = FALSE) %>%
  add_header_above(c("log(PH3_positive_cell+1) ~  Genotype + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
tab_stat_rev_RasPH3_HY=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat_rev_RasPH3_HY$Male_Line= tab_stat_rev_RasPH3_HY$Variable
Error in eval(expr, envir, enclos): objet 'tab_stat_rev_RasPH3_HY' introuvable
#Samplesize

Sample_size=
 Tab_Ras_PH3_Rev%>%
  group_by(Male_Line,Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Male_Line, Diet): objet 'Tab_Ras_PH3_Rev' introuvable
### Plot
Tab_Ras_PH3_Rev$Male_Line = factor(Tab_Ras_PH3_Rev$Male_Line, labels = c(expression(italic(paste("Control"))), expression(italic(paste("Ra",s^{V12},sep=""))), expression(italic(paste("Tor-DER")))))
Error in factor(Tab_Ras_PH3_Rev$Male_Line, labels = c(expression(italic(paste("Control"))), : objet 'Tab_Ras_PH3_Rev' introuvable
Sample_size$Male_Line = factor(Sample_size$Male_Line, labels = c(expression(italic(paste("Control"))), expression(italic(paste("Ra",s^{V12},sep=""))), expression(italic(paste("Tor-DER")))))
Error in factor(Sample_size$Male_Line, labels = c(expression(italic(paste("Control"))), : objet 'Sample_size' introuvable
tab_stat_rev_RasPH3$Male_Line = factor(tab_stat_rev_RasPH3$Male_Line, labels = c(expression(italic(paste("Control"))), expression(italic(paste("Ra",s^{V12},sep=""))), expression(italic(paste("Tor-DER")))))
Error in factor(tab_stat_rev_RasPH3$Male_Line, labels = c(expression(italic(paste("Control"))), : objet 'tab_stat_rev_RasPH3' introuvable
tab_stat_rev_RasPH3_HS$Male_Line = factor(tab_stat_rev_RasPH3_HS$Male_Line, labels = c(expression(italic(paste("Ra",s^{V12},sep=""))), expression(italic(paste("Tor-DER")))))
Error in factor(tab_stat_rev_RasPH3_HS$Male_Line, labels = c(expression(italic(paste("Ra", : objet 'tab_stat_rev_RasPH3_HS' introuvable
tab_stat_rev_RasPH3_HY$Male_Line = factor(tab_stat_rev_RasPH3_HY$Male_Line, labels = c(expression(italic(paste("Ra",s^{V12},sep=""))), expression(italic(paste("Tor-DER")))))
Error in factor(tab_stat_rev_RasPH3_HY$Male_Line, labels = c(expression(italic(paste("Ra", : objet 'tab_stat_rev_RasPH3_HY' introuvable
#Annotation in the plot


ann_textHS <-data.frame(Male_Line = "Control", anot = "Vs Ctrl HS")
ann_textHS$Male_Line = factor(ann_textHS$Male_Line, labels = c(expression(italic(paste("Control")))))

ann_textHY <-data.frame(Male_Line = "Control", anot = "Vs Ctrl HY")
ann_textHY$Male_Line = factor(ann_textHY$Male_Line, labels = c(expression(italic(paste("Control")))))

ann_text <-data.frame(Male_Line = "Ras85DV12", anot = "HS vs HY")
ann_text$Male_Line = factor(ann_text$Male_Line, labels = c(expression(italic(paste("Ra",s^{V12},sep="")))))


#Plot
Limits = c("HS","HY")

Plot_Fig5D=
  ggplot(Tab_Ras_PH3_Rev, aes(x = Diet, y = PH3_positive_cell))+ 
    geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = 3) + 
  facet_grid(. ~ Male_Line,labeller=label_parsed)+
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = -10, label = paste("(",Sample_size,")",sep="")),size=3)+
  geom_signif(data = tab_stat_rev_RasPH3, aes(xmin = 1, xmax = 2, annotations = formatC(paste("p=",Pvalue), digits = 2), y_position = 105), textsize = 2.5, vjust = -0.2, manual = TRUE)+
  scale_fill_manual(limits=c("HS","HY"),
                    values=c("#FFB4B4","#C3E6FC"))+
  scale_x_discrete("",
                   limits=Limits,
                   labels=c("HS","HY"))+
  scale_y_continuous(expression(paste("pH3" ^ "+", " cells")),
                     limits=c(-15,175),
                     breaks=seq(0,110,by=20))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black", margin = margin(t = 0, r = 0, b = 0, l = 0) ), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text = element_text(size =Smallfont-2, colour = "black",face="italic", margin = margin(t = 2, r = 1, b = 2, l = 1)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(Tab_Ras_PH3_Rev, aes(x = Diet, y = PH3_positive_cell)): objet 'Tab_Ras_PH3_Rev' introuvable
Plot_Fig5D
Error in eval(expr, envir, enclos): objet 'Plot_Fig5D' introuvable

5.1.5 Figure 5E

Enterocyte specific over expression (MyoTS) of UAS-upd3-OE and UAS-spi-SEC elicit increased proliferation, strongly only on HY diet, and weakly on HS with UAS-upd3-OE. P-values on top of the chart refer to comparisons with the control, p-values at the bottom refer to comparison between HS and HY for each sample. Flies were 9 days old when dissected. Complete statistical annotation on image can be fund in the manuscript’s figures.

tab_Myo_PH3_Rev = 
  d[["5E"]]%>%
  mutate_at(vars(ends_with(".L")),~./1000)%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  dplyr::rename(PH3_positive_cell=Total.PH3,
                Diet=Treatment,
                Male_Line=Male.Line)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
###Stats HS vs HY



##Control
tmp = subset(tab_Myo_PH3_Rev, Male_Line%in%c("Control"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_Myo_PH3_Rev' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Diet + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Diet + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("Control HS vs HY")),
                      
                               Rep = nlevels(tab_Myo_PH3_Rev$Repeat),
                      
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      
                               intercept = format(mod.gen$fixef[1],digits=3),
                      
                               estimate = format(mod.gen$fixef[2],digits=3),
                      
                               df = as.numeric(test$basicLRT$df),
                      
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_Myo_PH3_Rev' introuvable
tab_stat_Control=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat_Control$Male_Line = "Control"
Error in tab_stat_Control$Male_Line = "Control": objet 'tab_stat_Control' introuvable
##spi-sec


tmp = subset(tab_Myo_PH3_Rev , Male_Line%in%c("spi-SEC"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_Myo_PH3_Rev' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Diet + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Diet + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("spi-SEC HS vs HY")),
                      
                               Rep = nlevels(tmp$Repeat),
                      
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      
                               intercept = format(mod.gen$fixef[1],digits=3),
                      
                               estimate = format(mod.gen$fixef[2],digits=3),
                      
                               df = as.numeric(test$basicLRT$df),
                      
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_spi_sec=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat_spi_sec$Male_Line = "spi-SEC"
Error in tab_stat_spi_sec$Male_Line = "spi-SEC": objet 'tab_stat_spi_sec' introuvable
##upd3-OE

tmp = subset(tab_Myo_PH3_Rev , Male_Line%in%c("upd3-OE"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_Myo_PH3_Rev' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Diet + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Diet + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("upd3-OE HS vs HY")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_upd3_OE=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat_upd3_OE$Male_Line = "upd3-OE"
Error in tab_stat_upd3_OE$Male_Line = "upd3-OE": objet 'tab_stat_upd3_OE' introuvable
tab_stat=rbind(tab_stat_Control,tab_stat_spi_sec, tab_stat_upd3_OE)
Error in eval(quote(list(...)), env): objet 'tab_stat_Control' introuvable
tab_stat$padj = as.numeric(format(p.adjust(tab_stat$Pvalue, method = "BH"),digits=2,scientific =F))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'format' : objet 'tab_stat' introuvable
tab_stat$sig = ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*",
             ifelse(tab_stat$padj < 0.01 & tab_stat$padj > 0.001, "**",
              ifelse(tab_stat$padj < 0.001, "***", "")))
Error in ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*", ifelse(tab_stat$padj < : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value", "Genotype Male_line" ,"p-value adjusted","Signif."),row.names = FALSE) %>%
  add_header_above(c("log(PH3_positive_cell+1) ~  Diet + (1 | Repeat)" = 10))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
tab_stat_rev_MyoPH3=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
###Stats HS vs control

tmpd = subset(tab_Myo_PH3_Rev , Diet%in%c("HS"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_Myo_PH3_Rev' introuvable
##spi-sec

tmp = subset(tmpd , Male_Line%in%c("Control", "spi-SEC"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tmpd' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Male_Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Male_Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("Control vs spi-SEC (HS)")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_HS_spi_sec=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat_HS_spi_sec$Male_Line = "spi-SEC"
Error in tab_stat_HS_spi_sec$Male_Line = "spi-SEC": objet 'tab_stat_HS_spi_sec' introuvable
##upd3-OE
tmp = subset(tmpd , Male_Line%in%c("Control", "upd3-OE"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tmpd' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Male_Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Male_Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("Control vs upd3-OE (HS)")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_HS_upd3_OE=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat_HS_upd3_OE$Male_Line = "upd3-OE"
Error in tab_stat_HS_upd3_OE$Male_Line = "upd3-OE": objet 'tab_stat_HS_upd3_OE' introuvable
#Table


tab_stat=rbind(tab_stat_HS_spi_sec, tab_stat_HS_upd3_OE)
Error in eval(quote(list(...)), env): objet 'tab_stat_HS_spi_sec' introuvable
tab_stat$padj = as.numeric(format(p.adjust(tab_stat$Pvalue, method = "BH"),digits=2,scientific =F))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'format' : objet 'tab_stat' introuvable
tab_stat$sig = ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*",
             ifelse(tab_stat$padj < 0.01 & tab_stat$padj > 0.001, "**",
              ifelse(tab_stat$padj < 0.001, "***", "")))
Error in ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*", ifelse(tab_stat$padj < : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Genotype Male_Line" ,"p-value adjusted","Signif."),row.names = FALSE) %>%
  add_header_above(c("log(PH3_positive_cell+1) ~  Genotype + (1 | Repeat)" = 10))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
tab_stat_rev_MyoPH3_HS=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
###Stats HY vs control

tmpd = subset(tab_Myo_PH3_Rev , Diet%in%c("HY"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_Myo_PH3_Rev' introuvable
##spi-sec

tmp = subset(tmpd , Male_Line%in%c("Control", "spi-SEC"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tmpd' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Male_Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Male_Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("Control vs spi-SEC (HY)")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_HY_spi_sec=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat_HY_spi_sec$Male_Line = "spi-SEC"
Error in tab_stat_HY_spi_sec$Male_Line = "spi-SEC": objet 'tab_stat_HY_spi_sec' introuvable
##upd3-OE
tmp = subset(tmpd , Male_Line%in%c("Control", "upd3-OE"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tmpd' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Male_Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Male_Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("Control vs upd3-OE (HY)")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_HY_upd3_OE=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat_HY_upd3_OE$Male_Line = "upd3-OE"
Error in tab_stat_HY_upd3_OE$Male_Line = "upd3-OE": objet 'tab_stat_HY_upd3_OE' introuvable
#Table


tab_stat=rbind(tab_stat_HY_spi_sec, tab_stat_HY_upd3_OE)
Error in eval(quote(list(...)), env): objet 'tab_stat_HY_spi_sec' introuvable
tab_stat$padj = as.numeric(format(p.adjust(tab_stat$Pvalue, method = "BH"),digits=2,scientific =F))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'format' : objet 'tab_stat' introuvable
tab_stat$sig = ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*",
             ifelse(tab_stat$padj < 0.01 & tab_stat$padj > 0.001, "**",
              ifelse(tab_stat$padj < 0.001, "***", "")))
Error in ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*", ifelse(tab_stat$padj < : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value", "Genotype Male_Line" ,"p-value adjusted","Signif."),row.names = FALSE) %>%
  add_header_above(c("log(PH3_positive_cell+1) ~  Genotype + (1 | Repeat)" = 10))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
tab_stat_rev_MyoPH3_HY=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
Sample_size=
 tab_Myo_PH3_Rev%>%
  group_by(Male_Line,Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Male_Line, Diet): objet 'tab_Myo_PH3_Rev' introuvable
#Annotation in the plot


ann_textHS <-data.frame(Male_Line = "Control", anot = "Vs Ctrl HS")

ann_textHY <-data.frame(Male_Line = "Control", anot = "Vs Ctrl HY")

ann_text <-data.frame(Male_Line = "spi-SEC", anot = "HS vs HY")






### Plot
Limits = c("HS","HY")

Plot_Fig5E=
  ggplot(tab_Myo_PH3_Rev, aes(x = Diet, y = PH3_positive_cell))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = 3) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = -10, label = paste("(",Sample_size,")",sep="")),size=3)+
 geom_signif(data = tab_stat_rev_MyoPH3, aes(xmin = 1, xmax = 2, annotations = formatC(paste("p=",Pvalue), digits = 2), y_position = 135), textsize = 2.5, vjust = -0.2, manual = TRUE)+
  facet_grid(. ~ Male_Line)+
  scale_fill_manual(limits=c("HS","HY"),
                    values=c("#FFB4B4","#C3E6FC"))+
  scale_x_discrete("",
                   limits=Limits,
                   labels=c("HS","HY"))+
  scale_y_continuous(expression(paste("pH3" ^ "+", " cells")),
                     limits=c(-15,225),
                     breaks=seq(0,130,by=20))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black", margin = margin(t = 0, r = 0, b = 0, l = 0) ), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
         strip.text.x = element_text(size = xSmallfont, colour = "black", angle=0, face = "italic", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = xSmallfont, colour = "black", angle=0, face = "italic", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_Myo_PH3_Rev, aes(x = Diet, y = PH3_positive_cell)): objet 'tab_Myo_PH3_Rev' introuvable
Plot_Fig5E
Error in eval(expr, envir, enclos): objet 'Plot_Fig5E' introuvable

5.1.6 Figure 5F-G

General translation is lower on HS than HY, shown by puromycin incorporation assay. Images show lower incorporation on HS (F, F’, top row) than HY (G, G’, bottom row) in region 4 of the midgut.Complete graphical annotation can be found in manuscript figures

img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/5F.jpg") 
Error in transpose(y): object is NULL
gob_imageFig5F = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig5F)
Error in grid.draw(gob_imageFig5F): objet 'gob_imageFig5F' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/5F'.jpg") 
Error in transpose(y): object is NULL
gob_imageFig5F2 = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig5F2)
Error in grid.draw(gob_imageFig5F2): objet 'gob_imageFig5F2' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/5G.jpg") 
Error in transpose(y): object is NULL
gob_imageFig5G = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig5G)
Error in grid.draw(gob_imageFig5G): objet 'gob_imageFig5G' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/5G'.jpg") 
Error in transpose(y): object is NULL
gob_imageFig5G2 = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig5G2)
Error in grid.draw(gob_imageFig5G2): objet 'gob_imageFig5G2' introuvable

5.1.7 Figure 5H

Quantification of mean pixel intensity of puromycin stain.

Length_Puromycin = 
  d[["5H"]]%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  dplyr::rename(Puromycin_int=Mean)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  Length_Puromycin%>%
  group_by(Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet): objet 'Length_Puromycin' introuvable
###Stats
mod.gen = fitme(log(Puromycin_int) ~  Diet + (1 | Repeat),data = Length_Puromycin)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Length_Puromycin' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Puromycin_int) ~  Diet + (1 / Repeat),data = Length_Puromycin)
Error in is.data.frame(data): objet 'Length_Puromycin' introuvable
mod.gen1 = fitme(log(Puromycin_int) ~  1 + (1 | Repeat),data = Length_Puromycin)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Length_Puromycin' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("HS vs HY")),
                      Rep = nlevels(Length_Puromycin$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Length_Puromycin' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(Puromycin intensity) ~  Diet + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
### Plot

Plot_Fig5H=
  ggplot(Length_Puromycin, aes(x = Diet, y = Puromycin_int))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = 1) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 1, label = paste("(",Sample_size,")",sep="")),size=3)+
      geom_signif(annotation = formatC(paste("p=",tab_stat$Pvalue), digits = 2), textsize = 3, y_position = 47, xmin = 1, xmax = 2, tip_length = c(0.02, 0.02), vjust = -0.2)+

  scale_fill_manual(limits=c("HS","HY"),
                    values=c("#FFB4B4","#C3E6FC"))+
  scale_x_discrete("",
                   limits=c("HS","HY"),
                   labels=c("HS","HY"))+
  scale_y_continuous("Mean pixel intensity
puromycin (a.u.)",
                     limits=c(0,50),
                     breaks=seq(0,40,by=10))+ 
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text = element_text(size =Smallfont-2, colour = "black",face="italic", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(Length_Puromycin, aes(x = Diet, y = Puromycin_int)): objet 'Length_Puromycin' introuvable
Plot_Fig5H
Error in eval(expr, envir, enclos): objet 'Plot_Fig5H' introuvable

5.1.8 Figure 5I-J

p-eIF2α stain is elevated on HS (I, I’, top row) compared to HY (J, J’, bottom row). Complete graphical annotation can be found in manuscript figures

img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/5I.jpg") 
Error in transpose(y): object is NULL
gob_imageFig5I = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig5I)
Error in grid.draw(gob_imageFig5I): objet 'gob_imageFig5I' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/5I'.jpg") 
Error in transpose(y): object is NULL
gob_imageFig5I2 = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig5I2)
Error in grid.draw(gob_imageFig5I2): objet 'gob_imageFig5I2' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/5J.jpg") 
Error in transpose(y): object is NULL
gob_imageFig5J = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig5J)
Error in grid.draw(gob_imageFig5J): objet 'gob_imageFig5J' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/5J'.jpg") 
Error in transpose(y): object is NULL
gob_imageFig5J2 = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig5J2)
Error in grid.draw(gob_imageFig5J2): objet 'gob_imageFig5J2' introuvable

5.1.9 Figure 5K

Quantification of mean pixel intensity of p-eIF2α stain.

Length_EIF2 = 
  d[["5K"]]%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  dplyr::rename(EIF2_int=Mean)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  Length_EIF2%>%
  group_by(Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet): objet 'Length_EIF2' introuvable
###Stats
mod.gen = fitme(log(EIF2_int) ~  Diet + (1 | Repeat),data = Length_EIF2)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Length_EIF2' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(EIF2_int) ~  Diet + (1 / Repeat),data = Length_EIF2)
Error in is.data.frame(data): objet 'Length_EIF2' introuvable
mod.gen1 = fitme(log(EIF2_int) ~  1 + (1 | Repeat),data = Length_EIF2)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'Length_EIF2' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("HS vs HY")),
                               Rep = nlevels(Length_EIF2$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'Length_EIF2' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(EIF2 intensity) ~  Diet + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
### Plot

Plot_Fig5K=
  ggplot(Length_EIF2, aes(x = Diet, y = EIF2_int))+ 
  geom_boxplot(aes(fill = Diet), colour = "black", size = 0.2,outlier.shape = NA) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = 3) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 3, label = paste("(",Sample_size,")",sep="")),size=3)+
        geom_signif(annotation = formatC(paste("p=",tab_stat$Pvalue), digits = 2), textsize = 3, y_position = 135, xmin = 1, xmax = 2, tip_length = c(0.02, 0.02), vjust = -0.2)+

  scale_fill_manual(limits=c("HS","HY"),
                    values=c("#FFB4B4","#C3E6FC"))+
  scale_x_discrete("",
                   limits=c("HS","HY"),
                   labels=c("HS","HY"))+
  scale_y_continuous(expression(paste("Mean pixel intensity p-eIF2",alpha," (a.u.)",sep="")),
                     limits=c(0,140),
                     breaks=seq(0,125,by=25))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text = element_text(size =Smallfont-2, colour = "black",face="italic"),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(Length_EIF2, aes(x = Diet, y = EIF2_int)): objet 'Length_EIF2' introuvable
Plot_Fig5K
Error in eval(expr, envir, enclos): objet 'Plot_Fig5K' introuvable

5.1.10 Figure 5L

Re-enabling translation can restore mitosis in midguts shrinking after being shifted from HY to HS diet for 7 days. Blocking translational inhibition with ActTS>Gcn2-IR or ActTS>LK6-IR is sufficient to increase pH3+ cells in midguts of flies on HS diet. However, ActTS>PEK-IR and ActTS>AMPKα-IR had no effect on the number of pH3+ cells. Statistical comparisons are vs control. Full statistical annotation on chart in pubblication

tab_PH3_Translation = 
  d[["5L"]]%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  dplyr::rename(PH3_positive_cell=Total.PH3,
         Day_of_treatment=Day)%>%
  mutate(Male.Line=fct_relevel(Male.Line,c("Control","Ampk-IR","PEK-IR", "Gcn2-IR", "Lk6-IR")))
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  tab_PH3_Translation%>%
  group_by(Male.Line)%>%
  summarise(Sample_size=n())
Error in group_by(., Male.Line): objet 'tab_PH3_Translation' introuvable
###Stats
#Gcn2-IR
tmp = subset(tab_PH3_Translation,!is.na(PH3_positive_cell) & Male.Line%in%c("Control","Gcn2-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_PH3_Translation' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Male.Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Male.Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Male.Line = as.character(paste("Gcn2-IR")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_GCN=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#PEK-IR
tmp = subset(tab_PH3_Translation,!is.na(PH3_positive_cell) & Male.Line%in%c("Control","PEK-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_PH3_Translation' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Male.Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Male.Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Male.Line = as.character(paste("PEK-IR")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue =  as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=1,scientific=F)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_PEK=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Lk6-IR
tmp = subset(tab_PH3_Translation,!is.na(PH3_positive_cell) & Male.Line%in%c("Control","Lk6-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_PH3_Translation' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Male.Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Male.Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Male.Line = as.character(paste("Lk6-IR")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=5)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_Lk6=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Ampk-IR
tmp = subset(tab_PH3_Translation,!is.na(PH3_positive_cell) & Male.Line%in%c("Control","Ampk-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_PH3_Translation' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Male.Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Male.Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Male.Line = as.character(paste("Ampk-IR")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2,scientific=F)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_Ampk=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat=rbind(tab_stat_PEK,tab_stat_Ampk,tab_stat_Lk6,tab_stat_GCN)
Error in eval(quote(list(...)), env): objet 'tab_stat_PEK' introuvable
tab_stat$padj = as.numeric(format(p.adjust(tab_stat$Pvalue, method = "BH"),digits=2,scientific =T))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'format' : objet 'tab_stat' introuvable
tab_stat$sig = ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*",
             ifelse(tab_stat$padj < 0.01 & tab_stat$padj > 0.001, "**",
              ifelse(tab_stat$padj < 0.001, "***", "")))
Error in ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*", ifelse(tab_stat$padj < : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Difference in Diet", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","p-value adjusted","Signif."),row.names = FALSE) %>%
  add_header_above(c("log(PH3_positive_cell+1) ~  Genotype + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Difference in Diet", "Replicates", "Chi2", : objet 'tab_stat' introuvable
letter_position = aggregate(data=tab_PH3_Translation,PH3_positive_cell ~ Male.Line, max)
Error in eval(m$data, parent.frame()): objet 'tab_PH3_Translation' introuvable
tab_stat=left_join(tab_stat,letter_position)
Error in left_join(tab_stat, letter_position): objet 'tab_stat' introuvable
tab_stat5L = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
### Plot

tab_PH3_Translation$Female.Line = factor(tab_PH3_Translation$Female.Line, labels = c(expression(italic(paste("Ac",t^{TS},">",sep="")))))
Error in factor(tab_PH3_Translation$Female.Line, labels = c(expression(italic(paste("Ac", : objet 'tab_PH3_Translation' introuvable
z=max(tab_PH3_Translation$PH3_positive_cell, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'tab_PH3_Translation' introuvable
Plot_Fig5L=
  ggplot(tab_PH3_Translation, aes(x = Male.Line, y = PH3_positive_cell))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/40) + 
  geom_text(data = Sample_size, mapping = aes(x = Male.Line, y = -3, label = paste("(",Sample_size,")",sep="")),size=3)+
   facet_grid(.~Female.Line, labeller = label_parsed)+
  scale_fill_manual(values="#FFB4B4")+
  scale_x_discrete("",
                   limits=c("Control","Ampk-IR","PEK-IR","Gcn2-IR","Lk6-IR"),
                   labels=c(expression(italic("Control"), italic(paste("AMPK", alpha, "-IR")), italic("PEK-IR"),italic("Gcn2-IR"),italic("Lk6-IR"))))+
  scale_y_continuous(expression(paste("pH3" ^ "+", " cells")),
                     limits=c(-3,64),
                     breaks=seq(0,62,by=20))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1, face = "italic"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_PH3_Translation, aes(x = Male.Line, y = PH3_positive_cell)): objet 'tab_PH3_Translation' introuvable
Plot_Fig5L
Error in eval(expr, envir, enclos): objet 'Plot_Fig5L' introuvable

5.1.11 Figure 5M

Despite increased mitotic activity following repression of translational inhibition in ActTS>Gcn2-IR or ActTS>LK6-IR, midgut size was still reduced on flies kept on HS diet. The statistical comparison is comparing interaction between diet and fly lines. Full statistical annotation on chart in pubblication

tab_length_Translation = 
  d[["5M"]]%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  mutate(Total_Length_mm=Total.L/1000)%>%
  dplyr::rename(Day_of_treatment=Day,
         Female_Line=Female.Line,
         Male_Line=Male.Line)%>%
  as.data.frame()%>%
  mutate(Male_Line=fct_relevel(Male_Line,c("Control","Gcn2-IR","Lk6-IR")))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  tab_length_Translation%>%
  group_by(Diet,Male_Line)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet, Male_Line): objet 'tab_length_Translation' introuvable
###Stats

#Gcn2-IR
tmp = subset(tab_length_Translation,!is.na(Total_Length_mm) & Male_Line%in%c("Control","Gcn2-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_length_Translation' introuvable
mod.gen = fitme(log(Total_Length_mm) ~  Male_Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~  Male_Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Male_Line = as.character(paste("Gcn2-IR")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_GCN=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#lk6-IR
tmp = subset(tab_length_Translation,!is.na(Total_Length_mm) & Male_Line%in%c("Control","Lk6-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_length_Translation' introuvable
mod.gen = fitme(log(Total_Length_mm) ~  Male_Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~  Male_Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Male_Line = as.character(paste("Lk6-IR")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_Lk6=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat=rbind(tab_stat_Lk6,tab_stat_GCN)
Error in eval(quote(list(...)), env): objet 'tab_stat_Lk6' introuvable
tab_stat$padj = format(p.adjust(tab_stat$Pvalue, method = "BH"),digits=2,scientific =F)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'format' : objet 'tab_stat' introuvable
tab_stat$sig = ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*",
             ifelse(tab_stat$padj < 0.01 & tab_stat$padj > 0.001, "**",
              ifelse(tab_stat$padj < 0.001, "***", "")))
Error in ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*", ifelse(tab_stat$padj < : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Difference in Diet", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","p-value adjusted","Signif."),row.names = FALSE) %>%
  add_header_above(c("log(Total_Length_mm) ~  Genotype + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Difference in Diet", "Replicates", "Chi2", : objet 'tab_stat' introuvable
letter_position = aggregate(data=tab_length_Translation,Total_Length_mm ~ Male_Line, max)
Error in eval(m$data, parent.frame()): objet 'tab_length_Translation' introuvable
tab_stat=left_join(tab_stat,letter_position)
Error in left_join(tab_stat, letter_position): objet 'tab_stat' introuvable
tab_stat5M = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
### Plot

tab_length_Translation$Female_Line = factor(tab_length_Translation$Female_Line, labels = c(expression(italic(paste("Ac",t^{TS},">",sep="")))))
Error in factor(tab_length_Translation$Female_Line, labels = c(expression(italic(paste("Ac", : objet 'tab_length_Translation' introuvable
z=max(tab_length_Translation$Total_Length_mm, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'tab_length_Translation' introuvable
Plot_Fig5M=
  ggplot(tab_length_Translation, aes(x = Male_Line, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/50) + 
  geom_text(data = Sample_size, mapping = aes(x = Male_Line, y = 2.6, label = paste("(",Sample_size,")",sep="")),size=3)+
  facet_grid(.~ Female_Line,labeller=label_parsed )+
  scale_fill_manual(values=c("#FFB4B4"))+
  scale_x_discrete("",
                   limits=c("Control","Gcn2-IR", "Lk6-IR"),
                   labels=c("Control","Gcn2-IR", "Lk6-IR"))+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(2.5,6.1),
                     breaks=seq(3,6,by=1))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1, face = "italic"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_length_Translation, aes(x = Male_Line, y = Total_Length_mm)): objet 'tab_length_Translation' introuvable
Plot_Fig5M
Error in eval(expr, envir, enclos): objet 'Plot_Fig5M' introuvable

##Export Figure 5

5.2 Figure 5 - supplementary 1

5.2.1 Figure 5S1A

Survival assay shows lower survival on HS vs HY. Additional information on the statistics can be found in R markdown. Triangles represent the day when survival was recorded.

tab_survival = 
  subset(d[["5 - S1A"]],Treatment%in%c("HS","HY"))%>%
  mutate(TimeToDeath=as.numeric(TimeToDeath),
         Censor=as.numeric(Censor),
         Sex="Male")%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction '%in%' : objet 'Treatment' introuvable
# analysis
model_Surv= coxme(Surv(TimeToDeath,Censor) ~ Treatment + (1|Repeat) , data= tab_survival)
Error in is.data.frame(data): objet 'tab_survival' introuvable
model_Surv1= coxme(Surv(TimeToDeath,Censor) ~ 1  + (1|Repeat) , data= tab_survival)
Error in is.data.frame(data): objet 'tab_survival' introuvable
test = anova(model_Surv1,model_Surv)
Error in anova(model_Surv1, model_Surv): objet 'model_Surv1' introuvable
test[2,4] = pchisq(test$Chisq[2],df=1,lower.tail = F)
Error in test$Chisq: objet de type 'closure' non indiçable
tab_test = data.frame(Variable=c("Full model","(-) Diet"),
                      logLik=as.numeric(test[,1]),
                      Chisq=as.numeric(test[,2]),
                      df=as.numeric(test[,3]),
                      Pvalue=as.numeric(test[,4]))
Error in test[, 1]: objet de type 'closure' non indiçable
tab_test%>%
  kable(col.names = c("Variable","logLik" ,"Chi2","df" ,"p-value"),row.names=FALSE) %>%
  add_header_above(c("coxme(Surv(Time To Death,Censor) ~ Treatment + (1|Repeat))" = 5)) %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Variable", "logLik", "Chi2", "df", "p-value"), : objet 'tab_test' introuvable
## plot
survdata <- survfit(Surv(TimeToDeath,Censor)~Treatment, data=tab_survival)
Error in is.data.frame(data): objet 'tab_survival' introuvable
toplot <- ggplotprep2(survdata, times=c(seq(0,75,by=3)))
Error in data.frame(condition = rep(names(x$strata), x$strata), time = x$time, : objet 'survdata' introuvable
Limits=c("HS","HY")
Name="Diet"
n1 = survdata$n[1]
Error in eval(expr, envir, enclos): objet 'survdata' introuvable
n2 = survdata$n[2]
Error in eval(expr, envir, enclos): objet 'survdata' introuvable
Labels = c(paste("HS (n=",n1,")",sep=""),
           paste("HY (n=",n2,")",sep=""))
Error in eval(quote(list(...)), env): objet 'n1' introuvable
Plot_Fig5S1A=
  ggplot(toplot, aes(x=Time,y=Survival))+
  geom_line(aes(linetype=Condition,colour=Condition),size=0.6)+
  geom_point(aes(shape=Condition,fill=Condition,colour=Condition),size = 2) +
  geom_text(data = subset(tab_test, Variable=="(-) Diet"), mapping = aes(x = 10, y = 0.5, label = paste("p=",format(Pvalue,digits=2))),size=3)+
  geom_errorbar(data=subset(toplot,Time==27),aes(ymin=lower, ymax=upper,colour=Condition), width=.1, alpha=01, size=1, show.legend=FALSE)+
  scale_colour_manual(Name,
                      limits=Limits,
                      values=c("#ff9595", "#abefff"),
                      labels=Labels)+
  scale_linetype_manual(Name,
                        limits=Limits,
                        values=c("solid","solid"),
                        labels=Labels)+
  scale_fill_manual(Name,
                    limits=Limits,
                    values=c(c("#ff9595", "#abefff")),
                    labels=Labels)+
  scale_shape_manual(Name,
                     limits=Limits,
                     values=c(24,25),
                     labels=Labels)+
  scale_x_continuous("Days post-eclosion",
                     limits=c(0, 75),
                     breaks=c(seq(0,75,by=10)))+
  scale_y_continuous("Proportion of survivors",
                     limits=c(0, 1),breaks=c(0,0.2,0.4,0.6,0.8,1))+
  theme(aspect.ratio = 1,
        panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = c(0.25,0.2),
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=Smallfont-2),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size =Smallfont, colour = "black",face="italic"),
        strip.text.y = element_text(size =Smallfont, colour = "black",face="italic"),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(toplot, aes(x = Time, y = Survival)): objet 'toplot' introuvable
Plot_Fig5S1A
Error in eval(expr, envir, enclos): objet 'Plot_Fig5S1A' introuvable

##Export Figure 5S1

5.3 Figure 5 - supplementary 2

5.3.1 Figure 5S2A-D’

p-eIF2α stain is elevated in all cells of the epithelium on HS (A, A’, first row) diet compared to HY (B,B’, second row) diet, and less strongly in visceral muscle (C-D’, third row HS, fourth row HY). In red anti p-eIF2α stain together with EsgTS>UAS-GFP in green (progenitor cells marker) in A, B, or alone in A’, B’. A to B’ are maximum intensity projection of z-stack. In red anti p-eIF2α stain together with HowTS>UAS-GFP in green (Visceral muscle marker) in C, D, or alone in C’, D’ (Single z-stack). Complete graphical annotation can be found in manuscript figures

img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/5 - S2A.jpg") 
Error in transpose(y): object is NULL
gob_imageFig5S2A = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig5S2A)
Error in grid.draw(gob_imageFig5S2A): objet 'gob_imageFig5S2A' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/5 - S2A'.jpg") 
Error in transpose(y): object is NULL
gob_imageFig5S2A1 = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig5S2A1)
Error in grid.draw(gob_imageFig5S2A1): objet 'gob_imageFig5S2A1' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/5 - S2B.jpg") 
Error in transpose(y): object is NULL
gob_imageFig5S2B = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig5S2B)
Error in grid.draw(gob_imageFig5S2B): objet 'gob_imageFig5S2B' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/5 - S2B'.jpg") 
Error in transpose(y): object is NULL
gob_imageFig5S2B1 = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig5S2B1)
Error in grid.draw(gob_imageFig5S2B1): objet 'gob_imageFig5S2B1' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/5 - S2C.jpg") 
Error in transpose(y): object is NULL
gob_imageFig5S2C = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig5S2C)
Error in grid.draw(gob_imageFig5S2C): objet 'gob_imageFig5S2C' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/5 - S2C'.jpg") 
Error in transpose(y): object is NULL
gob_imageFig5S2C1 = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig5S2C1)
Error in grid.draw(gob_imageFig5S2C1): objet 'gob_imageFig5S2C1' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/5 - S2D.jpg") 
Error in transpose(y): object is NULL
gob_imageFig5S2D = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig5S2D)
Error in grid.draw(gob_imageFig5S2D): objet 'gob_imageFig5S2D' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/5 - S2D'.jpg") 
Error in transpose(y): object is NULL
gob_imageFig5S2D1 = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig5S2D1)
Error in grid.draw(gob_imageFig5S2D1): objet 'gob_imageFig5S2D1' introuvable

5.3.2 Figure 5S2E

Blocking translational inhibition with ActTS>Gcn2-IR or ActTS>LK6-IR is sufficient to increase pH3+ cells in midguts of flies shifted from HY to HS diet. However, ActTS>PEK-IR and ActTS>AMPKα-IR had no effect on the number of pH3+ cells. Statistical comparisons are vs control.

tab_PH3_Translation = 
  d[["5 - S2E"]]%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  dplyr::rename(PH3_positive_cell=Total.PH3,
         Day_of_treatment=Day)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  tab_PH3_Translation%>%
  group_by(Male.Line)%>%
  summarise(Sample_size=n())
Error in group_by(., Male.Line): objet 'tab_PH3_Translation' introuvable
###Stats
#Gcn2-IR
tmp = subset(tab_PH3_Translation,!is.na(PH3_positive_cell) & Male.Line%in%c("Control","Gcn2-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_PH3_Translation' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Male.Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Male.Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Male.Line = as.character(paste("Control vs Gcn2-IR")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_GCN=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#PEK-IR
tmp = subset(tab_PH3_Translation,!is.na(PH3_positive_cell) & Male.Line%in%c("Control","PEK-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_PH3_Translation' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Male.Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Male.Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Male.Line = as.character(paste("Control vs PEK-IR")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=1,scientific=F)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_PEK=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Lk6-IR
tmp = subset(tab_PH3_Translation,!is.na(PH3_positive_cell) & Male.Line%in%c("Control","Lk6-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_PH3_Translation' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Male.Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Male.Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Male.Line = as.character(paste("Control vs Lk6-IR")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_Lk6=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Ampk-IR
tmp = subset(tab_PH3_Translation,!is.na(PH3_positive_cell) & Male.Line%in%c("Control","Ampk-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_PH3_Translation' introuvable
tmp$Male.Line = factor(tmp$Male.Line,levels = c("Control","Ampk-IR"))
Error in factor(tmp$Male.Line, levels = c("Control", "Ampk-IR")): objet 'tmp' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Male.Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Male.Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Male.Line = as.character(paste("Control vs Ampk-IR")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=1,scientific=F)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_Ampk=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat=rbind(tab_stat_PEK,tab_stat_Ampk,tab_stat_Lk6,tab_stat_GCN)
Error in eval(quote(list(...)), env): objet 'tab_stat_PEK' introuvable
letter_position = aggregate(data=tab_PH3_Translation,PH3_positive_cell ~ Male.Line, max)
Error in eval(m$data, parent.frame()): objet 'tab_PH3_Translation' introuvable
tab_stat=left_join(tab_stat,letter_position)
Error in left_join(tab_stat, letter_position): objet 'tab_stat' introuvable
tab_stat$padj = as.numeric(format(p.adjust(tab_stat$Pvalue, method = "BH"),digits=2,scientific =T))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'format' : objet 'tab_stat' introuvable
tab_stat$sig = ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*",
             ifelse(tab_stat$padj < 0.01 & tab_stat$padj > 0.001, "**",
              ifelse(tab_stat$padj < 0.001, "***", "")))
Error in ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*", ifelse(tab_stat$padj < : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","letter position","p-value adjusted","Signif."),row.names = FALSE) %>%
  add_header_above(c("log(PH3_positive_cell+1) ~  Genotype + (1 | Repeat)" = 10))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
tab_stat5S2E = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
### Plot

tab_PH3_Translation$Female.Line = factor(tab_PH3_Translation$Female.Line, labels = c(expression(italic(paste("Ac",t^{TS},">",sep="")))))
Error in factor(tab_PH3_Translation$Female.Line, labels = c(expression(italic(paste("Ac", : objet 'tab_PH3_Translation' introuvable
z=max(tab_PH3_Translation$PH3_positive_cell, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'tab_PH3_Translation' introuvable
Plot_Fig5S2E=
  ggplot(tab_PH3_Translation, aes(x = Male.Line, y = PH3_positive_cell))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/40) + 
  geom_text(data = Sample_size, mapping = aes(x = Male.Line, y = -3, label = paste("(",Sample_size,")",sep="")),size=3)+
  facet_grid(.~Female.Line, labeller = label_parsed)+
  scale_fill_manual(values="#FFE5E5")+
  scale_x_discrete("",
                   limits=c("Control", "Ampk-IR", "PEK-IR", "Gcn2-IR","Lk6-IR"),
                   labels=c(expression(italic("Control"), italic(paste("AMPK", alpha, "-IR")), italic("PEK-IR"), italic("Gcn2-IR"),  italic("Lk6-IR"))))+
  scale_y_continuous(expression(paste("pH3" ^ "+", " cells")),
                     limits=c(-3,64),
                     breaks=seq(0,62,by=20))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black", face = "italic"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_PH3_Translation, aes(x = Male.Line, y = PH3_positive_cell)): objet 'tab_PH3_Translation' introuvable
Plot_Fig5S2E
Error in eval(expr, envir, enclos): objet 'Plot_Fig5S2E' introuvable

5.3.3 Figure 5S2F

Despite increased mitotic activity following repression of translational inhibition in ActTS>Gcn2-IR or ActTS>LK6-IR, midgut size was still shrinking on flies shifted from HY to HS diet for 7 days. The statistical comparison is comparing interaction between diet and fly lines. Complete statistical annotation on image can be found in the manuscript’s figure.

tab_length_Translation = 
  d[["5 - S2F"]]%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  mutate(Total_Length_mm=Total.L/1000)%>%
  dplyr::rename(Day_of_treatment=Day,
         Female_Line=Female.Line,
         Male_Line=Male.Line)%>%
  as.data.frame()%>%
  mutate(Male_Line=fct_relevel(Male_Line,c("Control","Gcn2-IR","Lk6-IR")))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  tab_length_Translation%>%
  group_by(Diet,Male_Line)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet, Male_Line): objet 'tab_length_Translation' introuvable
###Stats
#Gcn2-IR
tmp = subset(tab_length_Translation, Male_Line%in%c("Control","Gcn2-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_length_Translation' introuvable
mod.gen = fitme(log(Total_Length_mm) ~  Diet * Male_Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~  Diet + Male_Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~  Diet + Male_Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Male_Line = as.character(paste("Control interaction vs Gcn2-IR interaction")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=1,scientific=F)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_Gcn2=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Lk6-IR
tmp = subset(tab_length_Translation, Male_Line%in%c("Control","Lk6-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_length_Translation' introuvable
mod.gen = fitme(log(Total_Length_mm) ~  Diet * Male_Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~  Diet + Male_Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~  Diet + Male_Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Male_Line = as.character(paste("Control interaction vs Lk6-IR interaction")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=1,scientific=F)))
Error in levels(x): objet 'tmp' introuvable
tab_stat_Lk6=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat=rbind(tab_stat_Lk6,tab_stat_Gcn2)
Error in eval(quote(list(...)), env): objet 'tab_stat_Lk6' introuvable
tab_stat$padj = as.numeric(format(p.adjust(tab_stat$Pvalue, method = "BH"),digits=2,scientific =F))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'format' : objet 'tab_stat' introuvable
tab_stat$sig = ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*",
             ifelse(tab_stat$padj < 0.01 & tab_stat$padj > 0.001, "**",
              ifelse(tab_stat$padj < 0.001, "***", "")))
Error in ifelse(tab_stat$padj < 0.05 & tab_stat$padj > 0.01, "*", ifelse(tab_stat$padj < : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Copparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","p-value adjusted","Signif."),row.names = FALSE) %>%
  add_header_above(c("log(Total_Length_mm) ~  Diet + Genotype + Diet : Genotype + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Copparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
tab_stat5S2F = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
### Plot

tab_length_Translation$Female_Line = factor(tab_length_Translation$Female_Line, labels = c(expression(italic(paste("Ac",t^{TS},">",sep="")))))
Error in factor(tab_length_Translation$Female_Line, labels = c(expression(italic(paste("Ac", : objet 'tab_length_Translation' introuvable
Plot_Fig5S2F=
  ggplot(tab_length_Translation, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = 0.15) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 2.5, label = paste("(",Sample_size,")",sep="")),size=3)+
  facet_grid(.~ Male_Line)+
  scale_fill_manual(values=c("#C3E6FC", "#FFE5E5"))+
  scale_x_discrete("",
                   limits=c("HY D0","HYtoHS D7"),
                   labels=c("HY","HY to HS"))+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(2,9),
                     breaks=seq(2,8,by=1))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  stat_summary(fun = mean, colour = "black", geom = "line", aes(group = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0),face = "italic"),
        strip.text.y = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0), face = "italic"),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_length_Translation, aes(x = Diet, y = Total_Length_mm)): objet 'tab_length_Translation' introuvable
Plot_Fig5S2F
Error in eval(expr, envir, enclos): objet 'Plot_Fig5S2F' introuvable

5.3.4 Figure 5S2G

Knockdown of Gcn2 in ECs (MyoTS>Gcn2-IR), but not in progenitor cells (EsgTS>Gcn2-IR), is sufficient to increase pH3+ cells in midguts of flies shifted after 12 days from eclosion on HY to HS diet for additional 7 days. Statistical comparisons are vs respective controls.

tab_PH3_Translation1 = 
  d[["5 - S2G"]]%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  dplyr::rename(PH3_positive_cell=Total.PH3,
         Day_of_treatment=Day)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  tab_PH3_Translation1%>%
  group_by(Female.Line, Male.Line)%>%
  summarise(Sample_size=n())
Error in group_by(., Female.Line, Male.Line): objet 'tab_PH3_Translation1' introuvable
###Stats
#Esg
tmp = subset(tab_PH3_Translation1,!is.na(PH3_positive_cell) & Female.Line%in%c("Esg"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_PH3_Translation1' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Male.Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Male.Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("Control vs Gcn2-IR EsgTS")),
  Male.Line = as.character(paste("EsgTS x Gcn2-IR")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)),
                               Female.Line = "Esg",
                               Male.line ="Gcn2-IR")
Error in levels(x): objet 'tmp' introuvable
tab_stat_esg=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Myo
tmp = subset(tab_PH3_Translation1,!is.na(PH3_positive_cell) & Female.Line%in%c("Myo"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_PH3_Translation1' introuvable
mod.gen = fitme(log(PH3_positive_cell+1) ~  Male.Line + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(PH3_positive_cell+1) ~  Male.Line + (1 / Repeat),data = tmp)
Error in is.data.frame(data): objet 'tmp' introuvable
mod.gen1 = fitme(log(PH3_positive_cell+1) ~  1 + (1 | Repeat),data = tmp)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tmp' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("Control vs Gcn2-IR EsgTS")),
  Male.Line = as.character(paste("MyoTS x Gcn2-IR")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)),
                               Female.Line = "Myo",
                               Male.line ="Gcn2-IR")
Error in levels(x): objet 'tmp' introuvable
tab_stat_myo=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
#Table making
tab_stat=rbind(tab_stat_esg,tab_stat_myo)
Error in eval(quote(list(...)), env): objet 'tab_stat_esg' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Variable", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Female.Line","Male.Line","Signif."),row.names = FALSE) %>%
  add_header_above(c("log(PH3_positive_cell+1) ~  Genotype + (1 | Repeat)" = 11))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Variable", "Replicates", : objet 'tab_stat' introuvable
tab_stat5S2G = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
### Plot

tab_PH3_Translation1$Female.Line = factor(tab_PH3_Translation1$Female.Line, labels = c(expression(italic(paste("Es",g^{TS},">",sep=""))), expression(italic(paste("My",o^{TS},">",sep="")))))
Error in factor(tab_PH3_Translation1$Female.Line, labels = c(expression(italic(paste("Es", : objet 'tab_PH3_Translation1' introuvable
tab_stat$Female.Line = tab_stat$Female.Line = factor(tab_stat$Female.Line, labels = c(expression(italic(paste("Es",g^{TS},">",sep=""))), expression(italic(paste("My",o^{TS},">",sep="")))))
Error in factor(tab_stat$Female.Line, labels = c(expression(italic(paste("Es", : objet 'tab_stat' introuvable
Sample_size$Female.Line = Sample_size$Female.Line = factor(Sample_size$Female.Line, labels = c(expression(italic(paste("Es",g^{TS},">",sep=""))), expression(italic(paste("My",o^{TS},">",sep="")))))
Error in factor(Sample_size$Female.Line, labels = c(expression(italic(paste("Es", : objet 'Sample_size' introuvable
z=max(tab_PH3_Translation1$PH3_positive_cell, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'tab_PH3_Translation1' introuvable
Plot_Fig5S2G=
  ggplot(tab_PH3_Translation1, aes(x = Male.Line, y = PH3_positive_cell))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/40) + 
  geom_text(data = Sample_size, mapping = aes(x = Male.Line, y = -4, label = paste("(",Sample_size,")",sep="")),size=3)+
  facet_grid(.~Female.Line, labeller = label_parsed)+
  scale_fill_manual(values="#FFE5E5")+
  scale_x_discrete("",
                   limits=c("Control","Gcn2-IR"),
                   labels=c(expression(italic("Control"),italic("Gcn2-IR"))))+
  scale_y_continuous(expression(paste("pH3" ^ "+", " cells")),
                     limits=c(-5,90),
                     breaks=seq(0,80,by=20))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black", face = "italic"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_PH3_Translation1, aes(x = Male.Line, y = PH3_positive_cell)): objet 'tab_PH3_Translation1' introuvable
Plot_Fig5S2G
Error in eval(expr, envir, enclos): objet 'Plot_Fig5S2G' introuvable

##Export Figure 5S2

6 Figure 6. The midgut can resize independently of stem cell proliferation

6.1 Figure 6 - main

6.1.1 Figure 6A

Mitotic index does not correlate with midgut length. Quantification of pH3+ cells across a selected panel of high and low responder DGRP lines shows that midgut length does not correlate with cell proliferation.

wolb = d[["DGRP_wolbachia_DFD"]]
colnames(wolb) = c("dgrp.id", "wolbachia")
Error in `colnames<-`(`*tmp*`, value = c("dgrp.id", "wolbachia")): tentative de modification de 'colnames' sur un objet ayant moins de deux dimensions
wolb$dgrp.id = gsub("line_", "", wolb$dgrp.id)

tab_corr_length_cell_DGRP = subset(d[["6A - 7A"]]) 
Error in subset.default(d[["6A - 7A"]]): l'argument "subset" est manquant, avec aucune valeur par défaut
tab_corr_length_cell_DGRP = merge(tab_corr_length_cell_DGRP, wolb, by.x="DGRP.number", by.y="dgrp.id", all.x=T, all.y=F)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'merge' : objet 'tab_corr_length_cell_DGRP' introuvable
colnames(tab_corr_length_cell_DGRP) = tolower(colnames(tab_corr_length_cell_DGRP))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'tolower' : erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'colnames' : objet 'tab_corr_length_cell_DGRP' introuvable
colnames(tab_corr_length_cell_DGRP)[3] = "repl"
Error in colnames(tab_corr_length_cell_DGRP)[3] = "repl": objet 'tab_corr_length_cell_DGRP' introuvable
tab_corr_length_cell_DGRP$dgrp.number <- as.factor(tab_corr_length_cell_DGRP$dgrp.number)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.factor' : objet 'tab_corr_length_cell_DGRP' introuvable
tab_corr_length_cell_DGRP=
  tab_corr_length_cell_DGRP%>%
  dplyr::rename(ral=dgrp.number,
         len=total.l,
         ph3=total.ph3,
         ec.area=area)%>%
  mutate(ral=paste("Ral",ral,sep="_"))%>%
  mutate_if(is.character,as.factor)
Error in dplyr::rename(., ral = dgrp.number, len = total.l, ph3 = total.ph3, : objet 'tab_corr_length_cell_DGRP' introuvable
gut_mean=
  tab_corr_length_cell_DGRP %>%
  group_by(ral, diet,cross,gutnumber)%>%
  summarize(mean_gut_len=mean(len,na.rm=T),
            mean_cell_size=mean(ec.area,na.rm=T),
            se_cell_size=sd(ec.area)/ sqrt(length(ec.area[!is.na(ec.area)])),
            mean_PH3=mean(ph3,na.rm=T)) %>%
  mutate(Group=paste(cross,gutnumber,sep="_"))
Error in group_by(., ral, diet, cross, gutnumber): objet 'tab_corr_length_cell_DGRP' introuvable
levels(gut_mean$ral) <- c("Ral 356", "Ral 362", "Ral 370", "Ral 502", "Ral 765", "Ral 853", "Ral 911")
Error in levels(gut_mean$ral) <- c("Ral 356", "Ral 362", "Ral 370", "Ral 502", : objet 'gut_mean' introuvable
gut_mean$ral <- factor(gut_mean$ral, levels = c("Ral 356", "Ral 502", "Ral 765", "Ral 853", "Ral 911", "Ral 362", "Ral 370"))
Error in factor(gut_mean$ral, levels = c("Ral 356", "Ral 502", "Ral 765", : objet 'gut_mean' introuvable
# stat over all
mod.gen = fitme(log10(I(mean_gut_len/1000)) ~  mean_PH3 + (1 | ral),data = gut_mean)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'gut_mean' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log10(I(mean_gut_len/1000)) ~  mean_PH3 + (1 / ral),data = gut_mean)
Error in is.data.frame(data): objet 'gut_mean' introuvable
mod.gen1 = fitme(log10(I(mean_gut_len/1000)) ~  1 + (1 | ral),data =gut_mean)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'gut_mean' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("PH3 cell")),
                               Number_genotypes = nlevels(gut_mean$ral),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'gut_mean' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Variable", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log10(I(mean_gut_len/1000)) ~  mean_PH3 + (1 | Genotype)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Variable", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
#stat per line
Cor_PH3=NULL
for(i in unique(gut_mean$ral)){
   #print(i)
cor_PH3_HS=
with(subset(gut_mean,ral==i& diet=="HS"),
cor.test(log(mean_gut_len,10),mean_PH3))

cor_PH3_HY=
with(subset(gut_mean,ral==i& diet=="HY"),
     cor.test(log(mean_gut_len,10),mean_PH3))

Cor_PH3_tmp = data.frame(ral = as.character(i),
                         diet=c("HS","HY"),
                               Cor = c(format(as.numeric(cor_PH3_HS$estimate), digits = 2),format(as.numeric(cor_PH3_HY$estimate), digits = 2)),
                               Pvalue = c(format(as.numeric(cor_PH3_HS$p.value), digits = 2),format(as.numeric(cor_PH3_HY$p.value), digits = 2)))

Cor_PH3= rbind(Cor_PH3,Cor_PH3_tmp)
}
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'unique' : objet 'gut_mean' introuvable
Cor_PH3$padj=p.adjust(Cor_PH3$Pvalue,method = "BH")
Cor_PH3$sig= ifelse(Cor_PH3$padj < 0.05 & Cor_PH3$padj > 0.01, "*",
             ifelse(Cor_PH3$padj < 0.01 & Cor_PH3$padj > 0.001, "**",
              ifelse(Cor_PH3$padj < 0.001, "***", "ns")))


tmp=subset(gut_mean,diet=="HS")
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'gut_mean' introuvable
stat_position_HS = aggregate(data=tmp,mean_gut_len/1000 ~  ral, max)
Error in eval(m$data, parent.frame()): objet 'tmp' introuvable
stat_position_HS$diet="HS"
Error in stat_position_HS$diet = "HS": objet 'stat_position_HS' introuvable
tmp=subset(gut_mean,diet=="HY")
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'gut_mean' introuvable
stat_position_HY = aggregate(data=tmp,mean_gut_len/1000 ~  ral, max)
Error in eval(m$data, parent.frame()): objet 'tmp' introuvable
stat_position_HY$diet="HY"
Error in stat_position_HY$diet = "HY": objet 'stat_position_HY' introuvable
stat_position=rbind(stat_position_HS,stat_position_HY)
Error in eval(quote(list(...)), env): objet 'stat_position_HS' introuvable
colnames(stat_position)[2]="Stat_position"
Error in colnames(stat_position)[2] = "Stat_position": objet 'stat_position' introuvable
Cor_PH3 = left_join(Cor_PH3,stat_position)
Error in UseMethod("left_join"): pas de méthode pour 'left_join' applicable pour un objet de classe "list"
gut_mean$ral <- factor(gut_mean$ral, levels = c("Ral 356", "Ral 502", "Ral 765", "Ral 853", "Ral 911", "Ral 362", "Ral 370"))
Error in factor(gut_mean$ral, levels = c("Ral 356", "Ral 502", "Ral 765", : objet 'gut_mean' introuvable
Cor_PH3$ral <- factor(Cor_PH3$ral, levels = c("Ral 356", "Ral 502", "Ral 765", "Ral 853", "Ral 911", "Ral 362", "Ral 370"))


Sample_size=
  gut_mean%>%
  group_by(diet, ral)%>%
  summarise(Sample_size=n())%>%
  as.data.frame()%>%
  mutate(ral=fct_relevel(ral,"Ral 356", "Ral 502", "Ral 765", "Ral 853", "Ral 911", "Ral 362", "Ral 370"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'gut_mean' introuvable
cor_gut_PH3=
  ggplot(gut_mean,aes(x=mean_PH3, y=mean_gut_len/1000,group=ral))+ 
  geom_point(aes(color=diet,fill=diet),shape=21,size=0.9)+
  geom_text(data = Sample_size, mapping = aes(x = 35, y = 2.5, label = paste("(",Sample_size,")",sep="")),size=3)+
  geom_text(data = Cor_PH3, mapping = aes( x=60,y=7,label = sig),size=3)+
  facet_grid(ral~diet)+
  scale_y_continuous("Midgut length (mm)")+
  scale_x_continuous(expression(paste("pH3" ^ "+", " cells")))+
  scale_color_manual("",
                     limits=c("HS","HY"),
                     values=palette_diet_2)+
  scale_fill_manual("",
                    limits=c("HS","HY"),
                    values=palette_diet_2)+
  geom_smooth(method="lm",color="black",size=0.5)+
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        axis.title.x = element_text(size=Mediumfont,colour="black"),
        axis.title.y = element_text(size=Mediumfont),
        axis.line.x = element_line(colour="black"),
        axis.line.y = element_line(colour="black"),
        axis.ticks.x = element_line(),
        axis.ticks.y = element_line(),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        panel.grid = element_blank(),
        plot.margin = unit(c(0,0,0,0), "cm"),
        legend.direction = "vertical", 
        legend.box = "vertical",
        legend.position = "none",
        legend.key.height = unit(0.3, "cm"),
        legend.key.width= unit(0.3, "cm"),
        strip.text.x = element_text(size =Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size =Smallfont, colour = "black",face="italic", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(color="black",fill=NA),
        strip.placement="outside",
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=Smallfont),
        legend.background = element_rect(fill=NA),
        panel.background = element_rect(fill="transparent"))+
  guides(shape=guide_legend(ncol=1),
         fill=guide_legend(ncol=1),
         col=guide_legend(ncol=1))
Error in ggplot(gut_mean, aes(x = mean_PH3, y = mean_gut_len/1000, group = ral)): objet 'gut_mean' introuvable
cor_gut_PH3
Error in eval(expr, envir, enclos): objet 'cor_gut_PH3' introuvable

6.1.2 Figure 6B-C

Blocking EGF signaling with UAS-Egfr-IR in progenitor cells (B, right) results in progenitor cells being almost wiped out compared to control (C, left).Complete graphical annotation can be found in manuscript figures

img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/6B.jpg") 
Error in transpose(y): object is NULL
gob_imageFig6B = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig6B)
Error in grid.draw(gob_imageFig6B): objet 'gob_imageFig6B' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/6C.jpg") 
Error in transpose(y): object is NULL
gob_imageFig6C = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig6C)
Error in grid.draw(gob_imageFig6C): objet 'gob_imageFig6C' introuvable

6.1.3 Figure 6D

pH3+ counts for EsgTS>Control vs EsgTS> EGFR-IR

tab_PH3_esg = 
  d[["6D"]]%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  dplyr::rename(PH3_positive_cell=Total.PH3,
         Day_of_treatment=Day)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  tab_PH3_esg%>%
  group_by(Male.Line)%>%
  summarise(Sample_size=n())
Error in group_by(., Male.Line): objet 'tab_PH3_esg' introuvable
###Stats

mod.gen = fitme(PH3_positive_cell ~  Male.Line + (1 | Repeat),data = subset(tab_PH3_esg,!is.na(PH3_positive_cell)))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_PH3_esg' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(PH3_positive_cell ~  Male.Line + (1 / Repeat),data = subset(tab_PH3_esg,!is.na(PH3_positive_cell)))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_PH3_esg' introuvable
mod.gen1 = fitme(PH3_positive_cell ~  1 + (1 | Repeat),data = subset(tab_PH3_esg,!is.na(PH3_positive_cell)))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_PH3_esg' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("Control vs Egfr-IR")),
                      Rep = nlevels(tab_PH3_esg$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_PH3_esg' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("PH3_positive_cell ~  Genotype + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
### Plot
tab_PH3_esg$Female.Line = factor(tab_PH3_esg$Female.Line, labels = c(expression(italic(paste("Es",g^{TS},">",sep="")))))
Error in factor(tab_PH3_esg$Female.Line, labels = c(expression(italic(paste("Es", : objet 'tab_PH3_esg' introuvable
Plot_Fig6D=
  ggplot(tab_PH3_esg, aes(x = Male.Line, y = PH3_positive_cell))+ 
  geom_boxplot(aes(fill = Diet), colour = "black", size = 0.2,outlier.shape = NA) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = 0.2) + 
  geom_text(data = Sample_size, mapping = aes(x = Male.Line, y = -0.8, label = paste("(",Sample_size,")",sep="")),size=3)+
      geom_signif(data = tab_stat,aes(xmin = 1, xmax = 2, annotations = formatC(paste("p=",Pvalue), digits = 2), y_position = 8.5), textsize = 3, vjust = -0.2, manual = TRUE, tip_length = c(0.01, 0.01))+

  facet_grid(.~Female.Line, labeller = label_parsed)+
  scale_fill_manual(values="#E5E5FF")+
  scale_x_discrete("",
                   limits=c("Cs","Egfr-IR"),
                   labels=c("Control","Egfr-IR"))+
  scale_y_continuous(expression(paste("pH3" ^ "+", " cells")),
                     limits=c(-1,9),
                     breaks=seq(0,8,by=2))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1, face = "italic"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", face = "italic", margin = margin(t = 1, r = 0, b = 1, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", face = "italic", margin = margin(t = 1, r = 0, b = 1, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_PH3_esg, aes(x = Male.Line, y = PH3_positive_cell)): objet 'tab_PH3_esg' introuvable
Plot_Fig6D
Error in eval(expr, envir, enclos): objet 'Plot_Fig6D' introuvable

6.1.4 Figure 6E

EsgTS>UAS-Egfr-IR midguts are still able to reach a similar length to controls.

tab_length_esg = 
  d[["6E"]]%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  mutate(Total_Length_mm=Total.L/1000)%>%
  dplyr::rename(Day_of_treatment=Day,
         Female_Line=Female.Line,
         Male_Line=Male.Line)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  tab_length_esg%>%
  group_by(Diet,Male_Line)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet, Male_Line): objet 'tab_length_esg' introuvable
###Stats

mod.gen = fitme(log(Total_Length_mm) ~  Diet * Male_Line + (1 | Repeat),data = tab_length_esg)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_length_esg' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~  Diet + Male_Line + (1 / Repeat),data = tab_length_esg)
Error in is.data.frame(data): objet 'tab_length_esg' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~  Diet + Male_Line + (1 | Repeat),data = tab_length_esg)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_length_esg' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("Control vs Egfr-IR")),
                      Rep = nlevels(tab_length_esg$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_length_esg' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(Total_Length_mm) ~  Diet + Genotype + Diet : Genotype + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
tab_stat_6E=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat_6E$Male_Line="Egfr-IR"
Error in tab_stat_6E$Male_Line = "Egfr-IR": objet 'tab_stat_6E' introuvable
### Plot

tab_length_esg$Female_Line = factor(tab_length_esg$Female_Line, labels = c(expression(italic(paste("Es",g^{TS},">",sep="")))))
Error in factor(tab_length_esg$Female_Line, labels = c(expression(italic(paste("Es", : objet 'tab_length_esg' introuvable
Plot_Fig6E=
  ggplot(tab_length_esg, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = 0.15) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 2.4, label = paste("(",Sample_size,")",sep="")),size=3)+
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18,aes(group=Repeat, colour = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  stat_summary(fun = mean, colour = "black", geom = "line", aes(group = Repeat)) +
  scale_color_manual(values = palette_mean) +
  facet_grid(.~ Male_Line)+
  scale_fill_manual(values=cbbHS_HStoHY)+
  scale_x_discrete("",
                   limits=c("HS D0","HStoHY D7"),
                   labels=c("HS","HS to HY"))+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(2,9),
                     breaks=seq(2,8,by=1))+
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", face = "italic", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", face = "italic", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_length_esg, aes(x = Diet, y = Total_Length_mm)): objet 'tab_length_esg' introuvable
Plot_Fig6E
Error in eval(expr, envir, enclos): objet 'Plot_Fig6E' introuvable

6.1.5 Figure 6F

Insulin signaling with a dominant negative construct in progenitor cells results in less proliferation

tab_PH3_InR = 
  d[["6F"]]%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  dplyr::rename(PH3_positive_cell=Total.PH3,
         Day_of_treatment=Day)%>%
  as.data.frame()%>%
  mutate(Male.Line=fct_relevel(Male.Line,c("wdah","InR-DN")))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  tab_PH3_InR%>%
  group_by(Male.Line)%>%
  summarise(Sample_size=n())
Error in group_by(., Male.Line): objet 'tab_PH3_InR' introuvable
###Stats

mod.gen = fitme(PH3_positive_cell ~  Male.Line + (1 | Repeat),data = subset(tab_PH3_InR,!is.na(PH3_positive_cell)))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_PH3_InR' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(PH3_positive_cell ~  Male.Line + (1 / Repeat),data = subset(tab_PH3_InR,!is.na(PH3_positive_cell)))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_PH3_InR' introuvable
mod.gen1 = fitme(PH3_positive_cell ~  1 + (1 | Repeat),data = subset(tab_PH3_InR,!is.na(PH3_positive_cell)))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_PH3_InR' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("Control vs InR-DN")),
                      Rep = nlevels(tab_PH3_InR$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_PH3_InR' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("PH3_positive_cell ~  Genotype + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
### Plot

tab_PH3_InR$Female.Line = factor(tab_PH3_InR$Female.Line, labels = c(expression(italic(paste("Es",g^{TS},">",sep="")))))
Error in factor(tab_PH3_InR$Female.Line, labels = c(expression(italic(paste("Es", : objet 'tab_PH3_InR' introuvable
Plot_Fig6F=
  ggplot(tab_PH3_InR, aes(x = Male.Line, y = PH3_positive_cell))+ 
  geom_boxplot(aes(fill = Diet), colour = "black", size = 0.2,outlier.shape = NA) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = 0.6) + 
  geom_text(data = Sample_size, mapping = aes(x = Male.Line, y = -1.2, label = paste("(",Sample_size,")",sep="")),size=3)+
        geom_signif(data = tab_stat,aes(xmin = 1, xmax = 2, annotations = formatC(paste("p=",Pvalue), digits = 2), y_position = 16), textsize = 3, vjust = -0.2, manual = TRUE, tip_length = c(0.01, 0.01))+

  facet_grid(.~Female.Line, labeller = label_parsed)+
  scale_fill_manual(values="#E5E5FF")+
  scale_x_discrete("",
                   limits=c("wdah","InR-DN"),
                   labels=c("Control","InR-DN"))+
  scale_y_continuous(expression(paste("pH3" ^ "+", " cells")),
                     limits=c(-1.4,21),
                     breaks=seq(0,20,by=4))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black", margin = margin(t = 0, r = -0.15, b = 0, l = 0, unit = "cm")), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1, face= "italic"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", face = "italic", margin = margin(t = 1, r = 0, b = 1, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", face = "italic", margin = margin(t = 1, r = 0, b = 1, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_PH3_InR, aes(x = Male.Line, y = PH3_positive_cell)): objet 'tab_PH3_InR' introuvable
Plot_Fig6F
Error in eval(expr, envir, enclos): objet 'Plot_Fig6F' introuvable

6.1.6 Figure 6G

EsgTS>UAS-InR-DN resulting in the same midgut length growth as the control. Statistical comparison for G is for the interaction between diet and genotype.

tab_length_InDN = 
  subset(d[["6G"]],Diet%in%c("HS D0","HStoHY D7"))%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  mutate(Total_Length_mm=Total.L/1000)%>%
  dplyr::rename(Day_of_treatment=Day,
         Female_Line=Female.Line,
         Male_Line=Male.Line)%>%
  as.data.frame()%>%
  mutate(Male_Line=fct_relevel(Male_Line,c("Control","InR-DN")))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction '%in%' : objet 'Diet' introuvable
Sample_size=
  tab_length_InDN%>%
  group_by(Diet,Male_Line)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet, Male_Line): objet 'tab_length_InDN' introuvable
###Stats

mod.gen = fitme(log(Total_Length_mm) ~  Diet * Male_Line + (1 | PhaseRep),data = tab_length_InDN)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_length_InDN' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~  Diet + Male_Line + (1 / PhaseRep),data = tab_length_InDN)
Error in is.data.frame(data): objet 'tab_length_InDN' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~  Diet + Male_Line + (1 | PhaseRep),data = tab_length_InDN)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_length_InDN' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("Control vs InR-DN")),
                      Rep = nlevels(tab_PH3_esg$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_PH3_esg' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(Total_length_mm) ~  Diet + Genotype + Diet : Genotype + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
tab_stat$Male_Line="InR-DN"
Error in tab_stat$Male_Line = "InR-DN": objet 'tab_stat' introuvable
tab_stat6G = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
### Plot

tab_length_InDN$Male_Line = factor(tab_length_InDN$Male_Line, labels = c("Control","InR-DN"))
Error in factor(tab_length_InDN$Male_Line, labels = c("Control", "InR-DN")): objet 'tab_length_InDN' introuvable
Sample_size$Male_Line = factor(Sample_size$Male_Line, labels = c("Control","InR-DN"))
Error in factor(Sample_size$Male_Line, labels = c("Control", "InR-DN")): objet 'Sample_size' introuvable
Plot_Fig6G=
  ggplot(tab_length_InDN, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = 0.15) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 2.5, label = paste("(",Sample_size,")",sep="")),size=3)+
  facet_grid(.~Male_Line)+
  scale_fill_manual(values=cbbHS_HStoHY)+
  scale_x_discrete("",
                   limits=c("HS D0","HStoHY D7"),
                   labels=c("HS","HS to HY"))+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(2,9),
                     breaks=seq(2,8,by=1))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  stat_summary(fun = mean, colour = "black", geom = "line", aes(group = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", face="italic", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_length_InDN, aes(x = Diet, y = Total_Length_mm)): objet 'tab_length_InDN' introuvable
Plot_Fig6G
Error in eval(expr, envir, enclos): objet 'Plot_Fig6G' introuvable

6.1.7 Figure 6H-I

Increase in midgut length despite proliferation blockage is accompanied with compensatory area increase of EC. Representative pictures of midguts stained with membrane marker Mesh (white), shifted from HS to HY for 7 days show bigger cells on EsgTS>UAS-Egfr-IR (I, right) compared to control (H, left). Complete graphical annotation can be found in manuscript figures

img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/6H.jpg") 
Error in transpose(y): object is NULL
gob_imageFig6H = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig6H)
Error in grid.draw(gob_imageFig6H): objet 'gob_imageFig6H' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/6I.jpg") 
Error in transpose(y): object is NULL
gob_imageFig6I = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig6I)
Error in grid.draw(gob_imageFig6I): objet 'gob_imageFig6I' introuvable

6.1.8 Figure 6J

Quantification of EC cell size shows compensatory effect in ECs of EsgTS>Egfr-IR.Statistical comparison is for the interaction between diet and genotype.

tab_area_esg = 
  subset(d[["6J"]],Area<=1300)%>%
  mutate_at(vars(!starts_with("Area")),as.factor)%>%
  dplyr::rename(Day_of_treatment=Day,
         Female_Line=Female.Line,
         Male_Line=Male.Line)%>%
  as.data.frame()%>%
  mutate(Diet=fct_relevel(Diet,c("HS", "HStoHY")))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'Area' introuvable
Sample_size=
  tab_area_esg%>%
  group_by(Diet,Male_Line)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet, Male_Line): objet 'tab_area_esg' introuvable
###Stats
# D7
mod.gen = fitme(log(Area) ~  Diet * Male_Line + (1 | Repeat) ,data = tab_area_esg)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_area_esg' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Area) ~  Diet * Male_Line+ (1 / Repeat) ,data = tab_area_esg)
Error in is.data.frame(data): objet 'tab_area_esg' introuvable
mod.gen1 = fitme(log(Area) ~  Diet + Male_Line + (1 | Repeat),data = tab_area_esg)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_area_esg' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("Response Control vs Egfr")),
                      Rep = nlevels(tab_area_esg$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[4],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_area_esg' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
                      ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
                             ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Variable", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(Cell area) ~  Diet + Genotype + Diet : Genotype  + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Variable", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
tab_stat_6J=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat_6J$Male_Line="Egfr-IR"
Error in tab_stat_6J$Male_Line = "Egfr-IR": objet 'tab_stat_6J' introuvable
tab_stat_6J$Diet=c("HStoHY")
Error in tab_stat_6J$Diet = c("HStoHY"): objet 'tab_stat_6J' introuvable
tab_stat_6J$yposition = c(0.6)
Error in tab_stat_6J$yposition = c(0.6): objet 'tab_stat_6J' introuvable
tab_stat_6J$xposition = c(1.5)
Error in tab_stat_6J$xposition = c(1.5): objet 'tab_stat_6J' introuvable
### Plot

z = max(tab_area_esg$Area/1000, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'tab_area_esg' introuvable
Plot_Fig6J=
  ggplot(tab_area_esg, aes(x = Diet, y = Area/1000))+ 
  geom_violin(aes(fill = C.G), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 2) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/120) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = -0.1, label = paste("(",Sample_size,")",sep="")),size=3)+
  facet_grid(.~Male_Line)+
  scale_fill_manual(values=cbbHS_HStoHY)+
  scale_x_discrete("",
                   limits=c("HS","HStoHY"),
                   labels=c("HS","HS to HY"))+
  scale_y_continuous(expression(paste("EC area (10"^3, "mm"^2,")",sep="")),
                     limits=c(-0.1,1.1),
                     breaks=seq(0,1.1,by=0.4))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  stat_summary(fun = mean, colour = "black", geom = "line", aes(group = Repeat)) +
  scale_color_manual(values = palette_mean) +
  
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(margin(0, 0, 0, 0, unit = "cm")),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text = element_text(size =Smallfont, colour = "black",face="italic", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_area_esg, aes(x = Diet, y = Area/1000)): objet 'tab_area_esg' introuvable
Plot_Fig6J
Error in eval(expr, envir, enclos): objet 'Plot_Fig6J' introuvable

##Export Figure 6

6.2 Figure 6 - supplementary 1

6.2.1 Figure 6S1A

Changes in the number of pH3+ cells between HS and HY (ratio HY/HS of mean pH3+ cells) does not correlate with changes in midgut size between HS and HY (ratio HY/HS of mean midgut length) across selected DGRP lines.

tab_corr_length_cell_DGRP_mean_ph3 =
  tab_corr_length_cell_DGRP%>%
  group_by(ral,diet)%>%
  summarise(mean_ph3=mean(ph3,na.rm=T))%>%
  spread(diet,mean_ph3)%>%
  dplyr::rename(Mean_ph3_HS=HS,
                Mean_ph3_HY=HY)%>%
  mutate(Ratio_ph3 = Mean_ph3_HY/Mean_ph3_HS)
Error in group_by(., ral, diet): objet 'tab_corr_length_cell_DGRP' introuvable
tab_corr_length_cell_DGRP_mean_length =
  tab_corr_length_cell_DGRP%>%
  group_by(ral,diet)%>%
  summarise(mean_length=mean(len,na.rm=T))%>%
  spread(diet,mean_length)%>%
  dplyr::rename(mean_length_HS=HS,
                mean_length_HY=HY)%>%
  mutate(Ratio_length = mean_length_HY/mean_length_HS)
Error in group_by(., ral, diet): objet 'tab_corr_length_cell_DGRP' introuvable
tab_corr_length_cell_DGRP_mean= left_join(tab_corr_length_cell_DGRP_mean_length,tab_corr_length_cell_DGRP_mean_ph3)
Error in left_join(tab_corr_length_cell_DGRP_mean_length, tab_corr_length_cell_DGRP_mean_ph3): objet 'tab_corr_length_cell_DGRP_mean_length' introuvable
tab_corr_length_cell_DGRP_mean=as.data.frame(tab_corr_length_cell_DGRP_mean)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'tab_corr_length_cell_DGRP_mean' introuvable
test =
with(tab_corr_length_cell_DGRP_mean,
     cor.test(Ratio_ph3,Ratio_length,method="pearson"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'data' lors de la s�lection d'une m�thode pour la fonction 'with' : objet 'tab_corr_length_cell_DGRP_mean' introuvable
tab_stat = data.frame(Statistic = test$statistic,
  cor = test$estimate,
  Pvalue = test$p.value)
Error in test$statistic: objet de type 'closure' non indiçable
levels(tab_corr_length_cell_DGRP_mean$ral) <- c("Ral 356", "Ral 362", "Ral 370", "Ral 502", "Ral 765", "Ral 853", "Ral 911" )
Error in levels(tab_corr_length_cell_DGRP_mean$ral) <- c("Ral 356", "Ral 362", : objet 'tab_corr_length_cell_DGRP_mean' introuvable
Plot_Fig6S1A = 
ggplot(tab_corr_length_cell_DGRP_mean,aes(x=Ratio_ph3,y=Ratio_length,label=ral))+
  geom_point()+
  scale_x_continuous(expression(paste("Ratio HY/HS (mean pH3" ^ "+", " cells)")),
                     limits=c(0.8,1.8),
                     breaks=c(seq(0.8,2.8,by=0.1)))+
  scale_y_continuous("Ratio HY/HS (mean midgut length)",
                     limits=c(0.8,1.8),
                     breaks=c(seq(0.8,2.8,by=0.2)))+
  geom_text_repel(data=tab_corr_length_cell_DGRP_mean,size=3)+
  geom_smooth(method="lm")+
  geom_text(data = tab_stat, mapping = aes(x = 1.6, y = 1.7, label = paste("cor=", format(cor, digits=2),                                       "p=",format(Pvalue,digits=2))),size=3)+   theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        (panel.border = element_blank()),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"),
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_blank(),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "horizontal",
        legend.box = "horizontal",
        legend.position = c(0.25,0.98),
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.4, "cm"),
        legend.title = element_blank(),
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=Smallfont),
        legend.background = element_rect(fill=NA))+
  guides(color=guide_legend(ncol=3))
Error in ggplot(tab_corr_length_cell_DGRP_mean, aes(x = Ratio_ph3, y = Ratio_length, : objet 'tab_corr_length_cell_DGRP_mean' introuvable
Plot_Fig6S1A
Error in eval(expr, envir, enclos): objet 'Plot_Fig6S1A' introuvable

6.2.2 Figure 6S1B-E

Overexpression of reaper in progenitor cells (marked in red) via EsgTS>rpr-OE results in loss of marked progenitor cells (C) compared to control (B) in region 4 of midguts, after 12 days post eclosion on HS diet (7 days at 29°C with TARGET system active). Shifting the flies on HY for additional 7 days results in a change in morphology on midguts overexpressing reaper, reminiscent of EsgTS>UAS-Egfr-IR midguts .Complete graphical annotation can be found in manuscript figures

img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/6 - S1B.jpg") 
Error in transpose(y): object is NULL
gob_imageFig6S1B = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig6S1B)
Error in grid.draw(gob_imageFig6S1B): objet 'gob_imageFig6S1B' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/6 - S1C.jpg") 
Error in transpose(y): object is NULL
gob_imageFig6S1C = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig6S1C)
Error in grid.draw(gob_imageFig6S1C): objet 'gob_imageFig6S1C' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/6 - S1D.jpg") 
Error in transpose(y): object is NULL
gob_imageFig6S1D = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig6S1D)
Error in grid.draw(gob_imageFig6S1D): objet 'gob_imageFig6S1D' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/6 - S1E.jpg") 
Error in transpose(y): object is NULL
gob_imageFig6S1E = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig6S1E)
Error in grid.draw(gob_imageFig6S1E): objet 'gob_imageFig6S1E' introuvable

6.2.3 Figure 6S1F

EsgTS> rpr-OE midguts are still able to reach a similar length to controls .Complete graphical annotation can be found in manuscript figures

tab_length_rpr = 
  d[["6 - S1F"]]%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  mutate(Total_Length_mm=Total.L/1000)%>%
  dplyr::rename(Day_of_treatment=Day,
         Female_Line=Female.Line,
         Male_Line=Male.Line)%>%
  as.data.frame()%>%
  mutate(Male_Line=fct_relevel(Male_Line, "Control", "rpr-OE"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  tab_length_rpr%>%
  group_by(Diet, Male_Line)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet, Male_Line): objet 'tab_length_rpr' introuvable
###Stats

mod.gen = fitme(log(Total_Length_mm) ~  Diet * Male_Line + (1 | Repeat),data = tab_length_rpr)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_length_rpr' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~  Diet + Male_Line + (1 / Repeat),data = tab_length_rpr)
Error in is.data.frame(data): objet 'tab_length_rpr' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~  Diet + Male_Line + (1 | Repeat),data = tab_length_rpr)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_length_rpr' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
test
function (pkg = ".", filter = NULL, stop_on_failure = FALSE, 
    export_all = TRUE, ...) 
{
    save_all()
    pkg <- as.package(pkg)
    if (!uses_testthat(pkg) && interactive()) {
        cli::cli_alert_danger("No testing infrastructure found. Create it?")
        if (utils::menu(c("Yes", "No")) == 1) {
            usethis_use_testthat(pkg)
        }
        return(invisible())
    }
    load_all(pkg$path)
    cli::cli_alert_info("Testing {.pkg {pkg$package}}")
    withr::local_envvar(r_env_vars())
    testthat::test_local(pkg$path, filter = filter, stop_on_failure = stop_on_failure, 
        ...)
}
<bytecode: 0x000000009e53be20>
<environment: namespace:devtools>
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("Interaction Control vs Interaction Rpr-OE")),
                      Male_Line = as.character(paste("rpr-OE")),
                               Rep = nlevels(tmp$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=1,scientific=F)))
Error in levels(x): objet 'tmp' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat_rpr=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat_rpr%>%
  kable(col.names = c("Comparison", "Variable", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%
  add_header_above(c("log(Total_Length_mm) ~  Diet + Genotype + Diet : Genotype + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Variable", "Replicates", : objet 'tab_stat_rpr' introuvable
### Plot

z = max(tab_length_rpr$Total_Length_mm, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'tab_length_rpr' introuvable
Plot_Fig6S1F=
  ggplot(tab_length_rpr, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/40) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 2.5, label = paste("(",Sample_size,")",sep="")),size=3)+
  facet_grid(.~Male_Line )+
  scale_fill_manual(values=cbbHS_HStoHY)+
  scale_x_discrete("",
                   limits=c("HS","HStoHY"),
                   labels=c("HS","HS to HY"))+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(2,9),
                     breaks=seq(2,8,by=1))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  stat_summary(fun = mean, colour = "black", geom = "line", aes(group = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = xSmallfont, colour = "black", angle=0, face = "italic", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = xSmallfont, colour = "black", angle=0, face = "italic", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_length_rpr, aes(x = Diet, y = Total_Length_mm)): objet 'tab_length_rpr' introuvable
Plot_Fig6S1F
Error in eval(expr, envir, enclos): objet 'Plot_Fig6S1F' introuvable

##Export Figure 6 - supplementary 1

7 Figure 7. Enterocyte resizing is required for midgut plasticity

7.1 Figure 7 - main

7.1.1 Figure 7A

Enterocyte size mostly correlates with midgut length. Quantification of EC area across a selected panel of DGRP lines comprising high and low responder shows that midgut length mostly correlates with EC cell area. Lines on plot show smoothed splines.

wolb = d[["DGRP_wolbachia_DFD"]]
colnames(wolb) = c("dgrp.id", "wolbachia")
Error in `colnames<-`(`*tmp*`, value = c("dgrp.id", "wolbachia")): tentative de modification de 'colnames' sur un objet ayant moins de deux dimensions
wolb$dgrp.id = gsub("line_", "", wolb$dgrp.id)

tab_corr_length_cell_DGRP = subset(d[["6A - 7A"]]) 
Error in subset.default(d[["6A - 7A"]]): l'argument "subset" est manquant, avec aucune valeur par défaut
tab_corr_length_cell_DGRP = merge(tab_corr_length_cell_DGRP, wolb, by.x="DGRP.number", by.y="dgrp.id", all.x=T, all.y=F)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'merge' : objet 'tab_corr_length_cell_DGRP' introuvable
colnames(tab_corr_length_cell_DGRP) = tolower(colnames(tab_corr_length_cell_DGRP))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'tolower' : erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'colnames' : objet 'tab_corr_length_cell_DGRP' introuvable
colnames(tab_corr_length_cell_DGRP)[3] = "repl"
Error in colnames(tab_corr_length_cell_DGRP)[3] = "repl": objet 'tab_corr_length_cell_DGRP' introuvable
tab_corr_length_cell_DGRP=
  tab_corr_length_cell_DGRP%>%
  dplyr::rename(ral=dgrp.number,
         len=total.l,
         ph3=total.ph3,
         ec.area=area)%>%
  mutate(ral=paste("Ral",ral,sep="_"))%>%
  mutate_if(is.character,as.factor)
Error in dplyr::rename(., ral = dgrp.number, len = total.l, ph3 = total.ph3, : objet 'tab_corr_length_cell_DGRP' introuvable
gut_mean=
  tab_corr_length_cell_DGRP %>%
  group_by(ral, diet,cross,gutnumber)%>%
  summarize(mean_gut_len=mean(len,na.rm=T),
            mean_cell_size=mean(ec.area,na.rm=T),
            se_cell_size=sd(ec.area,na.rm=T)/ sqrt(length(ec.area[!is.na(ec.area)])),
            mean_PH3=mean(ph3,na.rm=T)) %>%
  mutate(Group=paste(cross,gutnumber,sep="_"))
Error in group_by(., ral, diet, cross, gutnumber): objet 'tab_corr_length_cell_DGRP' introuvable
levels(gut_mean$ral) <- c("Ral 356", "Ral 362", "Ral 370", "Ral 502", "Ral 765", "Ral 853", "Ral 911" )
Error in levels(gut_mean$ral) <- c("Ral 356", "Ral 362", "Ral 370", "Ral 502", : objet 'gut_mean' introuvable
gut_mean$ral <- factor(gut_mean$ral, levels = c("Ral 356", "Ral 502", "Ral 765", "Ral 853", "Ral 911", "Ral 362", "Ral 370"))
Error in factor(gut_mean$ral, levels = c("Ral 356", "Ral 502", "Ral 765", : objet 'gut_mean' introuvable
Sample_size=
  gut_mean%>%
  group_by(diet, ral)%>%
  summarise(Sample_size=n())%>%
  as.data.frame()%>%
  mutate(ral=fct_relevel(ral,"Ral 356", "Ral 502", "Ral 765", "Ral 853", "Ral 911", "Ral 362", "Ral 370"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'gut_mean' introuvable
# stat over all
mod.gen = fitme(log10(I(mean_gut_len/1000)) ~  mean_cell_size + (1 | ral),data = gut_mean)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'gut_mean' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log10(I(mean_gut_len/1000)) ~  mean_cell_size + (1 / ral),data = gut_mean)
Error in is.data.frame(data): objet 'gut_mean' introuvable
mod.gen1 = fitme(log10(I(mean_gut_len/1000)) ~  1 + (1 | ral),data =gut_mean)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'gut_mean' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("Cell area")),
                               Number_genotypes = nlevels(gut_mean$ral),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'gut_mean' introuvable
#stat per line
  
Cor_area=NULL
for(i in unique(gut_mean$ral)){
#   print(i)
Cor_area_HS=
with(subset(gut_mean,ral==i& diet=="HS"),
cor.test(log(mean_gut_len,2),mean_cell_size))

Cor_area_HY=
with(subset(gut_mean,ral==i& diet=="HY"),
     cor.test(log(mean_gut_len,2),mean_cell_size))

Cor_area_tmp = data.frame(ral = as.character(i),
                         diet=c("HS","HY"),
                               Cor = c(format(as.numeric(Cor_area_HS$estimate), digits = 2),format(as.numeric(Cor_area_HY$estimate), digits = 2)),
                               Pvalue = c(format(as.numeric(Cor_area_HS$p.value), digits = 2),format(as.numeric(Cor_area_HY$p.value), digits = 2)))

Cor_area= rbind(Cor_area,Cor_area_tmp)
}
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'unique' : objet 'gut_mean' introuvable
Cor_area$padj=p.adjust(Cor_area$Pvalue,method = "BH")
Cor_area$sig= ifelse(Cor_area$padj < 0.05 & Cor_area$padj > 0.01, "*",
             ifelse(Cor_area$padj < 0.01 & Cor_area$padj > 0.001, "**",
              ifelse(Cor_area$padj < 0.001, "***", "ns")))

tmp=subset(gut_mean,diet=="HS")
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'gut_mean' introuvable
stat_position_HS = aggregate(data=tmp,mean_gut_len/1000 ~  ral, max)
Error in eval(m$data, parent.frame()): objet 'tmp' introuvable
stat_position_HS$diet="HS"
Error in stat_position_HS$diet = "HS": objet 'stat_position_HS' introuvable
tmp=subset(gut_mean,diet=="HY")
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'gut_mean' introuvable
stat_position_HY = aggregate(data=tmp,mean_gut_len/1000 ~  ral, max)
Error in eval(m$data, parent.frame()): objet 'tmp' introuvable
stat_position_HY$diet="HY"
Error in stat_position_HY$diet = "HY": objet 'stat_position_HY' introuvable
stat_position=rbind(stat_position_HS,stat_position_HY)
Error in eval(quote(list(...)), env): objet 'stat_position_HS' introuvable
colnames(stat_position)[2]="Stat_position"
Error in colnames(stat_position)[2] = "Stat_position": objet 'stat_position' introuvable
Cor_area = left_join(Cor_area,stat_position)
Error in UseMethod("left_join"): pas de méthode pour 'left_join' applicable pour un objet de classe "list"
gut_mean$ral <- factor(gut_mean$ral, levels = c("Ral 356", "Ral 502", "Ral 765", "Ral 853", "Ral 911", "Ral 362", "Ral 370"))
Error in factor(gut_mean$ral, levels = c("Ral 356", "Ral 502", "Ral 765", : objet 'gut_mean' introuvable
Cor_area$ral <- factor(Cor_area$ral, levels = c("Ral 356", "Ral 502", "Ral 765", "Ral 853", "Ral 911", "Ral 362", "Ral 370"))

Plot_Fig7A=
  ggplot(gut_mean,aes(x=log2(mean_cell_size), y=mean_gut_len/1000,group=ral))+ 
  geom_point( aes(color=diet,fill=diet),shape=21,size=0.9)+
  geom_text(data = Sample_size, mapping = aes(x = 8, y = 2.5, label = paste("(",Sample_size,")",sep="")),size=3)+
  geom_text(data = Cor_area, mapping = aes( x=7,y=7,label = sig),size=3)+
  facet_grid(ral~diet)+
  scale_y_continuous("Midgut length (mm)")+
  scale_x_continuous(expression(paste("Cell size (", log[2],"(mean\u00B1se))")))+
  scale_color_manual("",
                     limits=c("HS","HY"),
                     values=palette_diet_2)+
  scale_fill_manual("",
                    limits=c("HS","HY"),
                    values=palette_diet_2)+
  geom_smooth(method="lm",color="black",size=0.5)+
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", face = "italic", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(gut_mean, aes(x = log2(mean_cell_size), y = mean_gut_len/1000, : objet 'gut_mean' introuvable
Plot_Fig7A
Error in eval(expr, envir, enclos): objet 'Plot_Fig7A' introuvable

7.1.2 Figure 7B-C-D

Representative pictures of single cell clones (hsFlp; Act>STOP>Gal4, UAS-GFP) suggest that compared to GFP- cells, TOR downregulation (UAS-Tor-IR, GFP+) results in smaller cells, while TOR hyperactivity (UAS-Rheb-OE, C) increases cell size. Quantification of clone size in D. Single cell clones are marked with GFP (green). Complete graphical annotation can be found in manuscript figures

img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/7B.jpg") 
Error in transpose(y): object is NULL
gob_imageFig7B = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig7B)
Error in grid.draw(gob_imageFig7B): objet 'gob_imageFig7B' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/7C.jpg") 
Error in transpose(y): object is NULL
gob_imageFig7C = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig7C)
Error in grid.draw(gob_imageFig7C): objet 'gob_imageFig7C' introuvable
tab_ECclone_quant = 
  d[["7D"]]%>%
  mutate_at(vars(!starts_with("Area")),as.factor)%>%
  
  dplyr::rename(Male_Line=Male.Line)%>%
  as.data.frame()%>%
  mutate(Male_Line=fct_relevel(Male_Line,"Tor-IR","Rheb-OE"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  tab_ECclone_quant%>%
  group_by(Male_Line, GFP)%>%
  summarise(Sample_size=n())%>%
  as.data.frame()%>%
  mutate(Male_Line=fct_relevel(Male_Line,"Tor-IR","Rheb-OE"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'tab_ECclone_quant' introuvable
###Stats

#Tor-IR stats


mod.gen = fitme(log(Area) ~  GFP,data = subset(tab_ECclone_quant, Male_Line=="Tor-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_ECclone_quant' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Area) ~  GFP ,data = subset(tab_ECclone_quant, Male_Line=="Tor-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_ECclone_quant' introuvable
mod.gen1 = fitme(log(Area) ~ 1 ,data = subset(tab_ECclone_quant, Male_Line=="Tor-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_ECclone_quant' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("GFP Negative vs Positive (Tor-IR)")),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in test$basicLRT: objet de type 'closure' non indiçable
tab_stat_TorEC = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
mod.gen = fitme(log(Area) ~  GFP,data = subset(tab_ECclone_quant, Male_Line=="Rheb-OE"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_ECclone_quant' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Area) ~  GFP ,data = subset(tab_ECclone_quant, Male_Line=="Rheb-OE"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_ECclone_quant' introuvable
mod.gen1 = fitme(log(Area) ~ 1 ,data = subset(tab_ECclone_quant, Male_Line=="Rheb-OE"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_ECclone_quant' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("GFP Negative vs Positive (Rheb-OE)")),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in test$basicLRT: objet de type 'closure' non indiçable
tab_stat_RhebOEEC = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat=rbind(tab_stat_TorEC,tab_stat_RhebOEEC)
Error in eval(quote(list(...)), env): objet 'tab_stat_TorEC' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
                      ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
                             ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat$Male_Line = as.factor(c("Tor-IR","Rheb-OE"))
Error in tab_stat$Male_Line = as.factor(c("Tor-IR", "Rheb-OE")): objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Chi2", "Intercept","Estimate","df" ,"p-value", "Signif.", "RNAi line"),row.names = FALSE) %>%   add_header_above(c("log(Cell area) ~  GFP" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Chi2", "Intercept", "Estimate", : objet 'tab_stat' introuvable
### Plot


Plot_Fig7D=
  ggplot(tab_ECclone_quant, aes(x = GFP, y = Area/1000))+ 
  geom_violin(aes(fill = GFP), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = 0.04) + 
  geom_text(data = Sample_size, mapping = aes(x = GFP, y = -0.2, label = paste("(",Sample_size,")",sep="")),size=3)+
  geom_signif(data = tab_stat,aes(xmin = 1, xmax = 2, annotations = formatC(paste("p=",Pvalue), digits = 2), y_position = 2), textsize = 3, vjust = -0.2, manual = TRUE, tip_length = c(0.01, 0.01))+

  facet_grid(.~Male_Line)+
  scale_fill_manual(limits=c("No","Yes"),
                    values=c("#e4e4e4","#8ee53f"))+
  scale_x_discrete("GFP",
                   limits=c("No","Yes"),
                   labels=c("-","+"))+
  scale_y_continuous(expression(paste("EC area (10"^3, "mm"^2,")",sep="")),
                     limits=c(-0.3,2.3),
                     breaks=seq(0,2,by=0.4))+
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, colour = "yellow") +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black", vjust = 6),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", face="italic", margin = margin(t = 1, r = 0, b = 1, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", face="italic", margin = margin(t = 1, r = 0, b = 1, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_ECclone_quant, aes(x = GFP, y = Area/1000)): objet 'tab_ECclone_quant' introuvable
Plot_Fig7D
Error in eval(expr, envir, enclos): objet 'Plot_Fig7D' introuvable

7.1.3 Figure 7E-F

Knockdown of TOR with MyoTS, an EC-specific driver, leads to the increased number of small ECs (F, right) compared to control (E, left); EC-specific GFP is indeed visible in small cells.Complete graphical annotation can be found in manuscript figures

img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/7E.jpg") 
Error in transpose(y): object is NULL
gob_imageFig7E = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig7E)
Error in grid.draw(gob_imageFig7E): objet 'gob_imageFig7E' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/7F.jpg") 
Error in transpose(y): object is NULL
gob_imageFig7F = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig7F)
Error in grid.draw(gob_imageFig7F): objet 'gob_imageFig7F' introuvable

7.1.4 Figure 7G

Quantification of EC area. Statistic annotation on panel present in manuscript’s figure.

tab_area_Tor_IR = 
  d[["7G"]]%>%
  mutate_at(vars(!starts_with("Area")),as.factor)%>%
  dplyr::rename(Day_of_treatment=Day,
         Female_Line=Female.Line,
         Male_Line=Male.Line)%>%
  as.data.frame()%>%
  mutate(Diet=fct_relevel(Diet,c("HS", "HStoHY")),
         Male_Line=fct_relevel(Male_Line,c("Control","Tor-IR")))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  tab_area_Tor_IR%>%
  group_by(Diet,Male_Line)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet, Male_Line): objet 'tab_area_Tor_IR' introuvable
###Stats Tor
# D7
mod.gen = fitme(log(Area) ~  Diet * Male_Line + (1 | Repeat ) ,data = tab_area_Tor_IR)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_area_Tor_IR' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Area) ~  Diet * Male_Line + (1 / Repeat ) ,data = tab_area_Tor_IR)
Error in is.data.frame(data): objet 'tab_area_Tor_IR' introuvable
mod.gen1 = fitme(log(Area) ~  Diet + Male_Line + (1 | Repeat ),data = tab_area_Tor_IR)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_area_Tor_IR' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character("Control vs Tor-IR"),
                               Rep = nlevels(tab_area_Tor_IR$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[4],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_area_Tor_IR' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Response to diet", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(Cell area) ~  Diet + Genotype + Diet : Genotype + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Response to diet", "Replicates", "Chi2", : objet 'tab_stat' introuvable
tab_stat_7E=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat_7E$Male_Line=factor("Tor-IR", labels = c(expression(italic("Tor-IR"))))
Error in tab_stat_7E$Male_Line = factor("Tor-IR", labels = c(expression(italic("Tor-IR")))): objet 'tab_stat_7E' introuvable
tab_stat_7E$Diet=c("HStoHY")
Error in tab_stat_7E$Diet = c("HStoHY"): objet 'tab_stat_7E' introuvable
tab_stat_7E$yposition = c(0.7)
Error in tab_stat_7E$yposition = c(0.7): objet 'tab_stat_7E' introuvable
tab_stat_7E$xposition = c(1.5)
Error in tab_stat_7E$xposition = c(1.5): objet 'tab_stat_7E' introuvable
### Plot

tab_area_Tor_IR$Female_Line = factor(tab_area_Tor_IR$Female_Line, labels = c(expression(italic(paste("My",o^{TS},">",sep="")))))
Error in factor(tab_area_Tor_IR$Female_Line, labels = c(expression(italic(paste("My", : objet 'tab_area_Tor_IR' introuvable
tab_area_Tor_IR$Male_Line = factor(tab_area_Tor_IR$Male_Line, labels = c(expression(italic("Control"),italic("Tor-IR"))))
Error in factor(tab_area_Tor_IR$Male_Line, labels = c(expression(italic("Control"), : objet 'tab_area_Tor_IR' introuvable
Sample_size$Male_Line = factor(Sample_size$Male_Line, labels = c(expression(italic("Control"),italic("Tor-IR"))))
Error in factor(Sample_size$Male_Line, labels = c(expression(italic("Control"), : objet 'Sample_size' introuvable
Plot_Fig7G=
  ggplot(tab_area_Tor_IR, aes(x = Diet, y = Area/1000))+ 
  geom_violin(aes(fill = C.G), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 5) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = 0.008) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = -0.1, label = paste("(",Sample_size,")",sep="")),size=3)+
  facet_grid(.~Male_Line,labeller=label_parsed )+
  scale_fill_manual(values=c("#FFB4B4", "#CCCCFF"))+
  scale_x_discrete("",
                   limits=c("HS","HStoHY"),
                   labels=c("HS","HS to HY"))+
  scale_y_continuous(expression(paste("EC area (10"^3, "mm"^2,")",sep="")),
                     limits=c(-0.12,1),            
                     breaks=seq(0,0.8,by=0.2))+ 
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  stat_summary(fun = mean, colour = "black", geom = "line", aes(group = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text = element_text(size =Smallfont, colour = "black",face="italic", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_area_Tor_IR, aes(x = Diet, y = Area/1000)): objet 'tab_area_Tor_IR' introuvable
Plot_Fig7G
Error in eval(expr, envir, enclos): objet 'Plot_Fig7G' introuvable

7.1.5 Figure 7H

Blocking TOR pathway components in ECs (MyoTS) inhibits diet induced midgut growth. Control showed in chart is representative of multiple experiments. Statistical analyses were performed only on appropriate repeat/experiment and comparing interaction between diet and fly line.

tab_length_Tor = 
  d[["7H"]]%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  mutate(Total_Length_mm=Total.L/1000)%>%
  dplyr::rename(Day_of_treatment=Day,
         Female_Line=Female.Line,
         Male_Line=Male.Line)%>%
  as.data.frame()%>%
  mutate(Male_Line=fct_relevel(Male_Line, "Control", "Tor-IR","dMyc-IR","S6k-IR", "SREBP-IR", "raptor-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  tab_length_Tor%>%
  group_by(Diet,Male_Line)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet, Male_Line): objet 'tab_length_Tor' introuvable
###Stats

list_genotype= c("Tor-IR","dMyc-IR","S6k-IR", "SREBP-IR", "raptor-IR")
tab_stat_Tor=NULL

for (i in list_genotype){
list_control=
 subset(tab_length_Tor,Male_Line%in%c(i)) %>%
  mutate(PhaseRep=factor(PhaseRep))%>%
      summarise(levels(PhaseRep))
list_control = as.list(list_control$`levels(PhaseRep)`)

tmp= subset(tab_length_Tor, Male_Line%in%c(i, "Control") & PhaseRep%in%list_control)%>%
  mutate(Male_Line=factor(Male_Line),
         PhaseRep=factor(PhaseRep))

mod.gen = fitme(log10(Total_Length_mm) ~  Diet * Male_Line + (1 | PhaseRep),data = tmp)
shapiro.test(residuals(mod.gen))
bptest(log10(Total_Length_mm) ~  Diet + Male_Line + (1 / PhaseRep),data = tmp)
mod.gen1 = fitme(log10(Total_Length_mm) ~  Diet + Male_Line + (1 | PhaseRep),data = tmp)
test = anova(mod.gen, mod.gen1)
test

Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])

tab_stat = data.frame(Male_Line = as.character(i),
                               Rep = nlevels(tmp$PhaseRep),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[4],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
tab_stat_Tor = rbind(tab_stat_Tor,tab_stat)
}
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_length_Tor' introuvable
tab_stat_Tor$padj=p.adjust(tab_stat_Tor$Pvalue,method = "BH")
tab_stat_Tor$sig= ifelse(tab_stat_Tor$padj < 0.05 & tab_stat_Tor$padj > 0.01, "*",
             ifelse(tab_stat_Tor$padj < 0.01 & tab_stat_Tor$padj > 0.001, "**",
              ifelse(tab_stat_Tor$padj < 0.001, "***", "ns")))
tab_stat_Tor%>%
  kable(col.names = c("Response to diet", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","p-value adjusted","Signif."),row.names = FALSE) %>%   add_header_above(c("log10(Total_Length_mm) ~  Diet + Genotype + Diet : Genotype + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in dimnames(x) <- dn: la longueur de 'dimnames' [2] n'est pas égale à l'étendue du tableau
tab_stat_Tor=
  tab_stat_Tor%>%
  as.data.frame()%>%
  mutate(Male_Line=fct_relevel(Male_Line, "Tor-IR","dMyc-IR","S6k-IR", "SREBP-IR", "raptor-IR"))
Error: Problem with `mutate()` column `Male_Line`.
i `Male_Line = fct_relevel(...)`.
x objet 'Male_Line' introuvable
### Plot

tab_length_Tor$Female_Line = factor(tab_length_Tor$Female_Line, labels = c(expression(italic(paste("My",o^{TS},">",sep="")))))
Error in factor(tab_length_Tor$Female_Line, labels = c(expression(italic(paste("My", : objet 'tab_length_Tor' introuvable
z = max(tab_length_Tor$Total_Length_mm, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'tab_length_Tor' introuvable
Plot_Fig7H=
  ggplot(tab_length_Tor, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/80) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 2.4, label = paste("(",Sample_size,")",sep="")),size=3)+
  geom_text(data = tab_stat_Tor, mapping = aes(x = 1.5, y = 8.3, label = paste("p=",format(Pvalue,digits=2))),size=3)+
  facet_grid(.~Male_Line )+
  scale_fill_manual(values=cbbHS_HStoHY)+
  scale_x_discrete("",
                   limits=c("HS","HStoHY"),
                   labels=c("HS","HS to HY"))+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(2,8.3),
                     breaks=seq(2,8,by=1))+
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = PhaseRep)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = PhaseRep, colour = PhaseRep)) +
  stat_summary(fun = mean, colour = "black", geom = "line", aes(group = PhaseRep)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = xSmallfont, colour = "black", angle=0, face = "italic", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = xSmallfont, colour = "black", angle=0, face = "italic", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_length_Tor, aes(x = Diet, y = Total_Length_mm)): objet 'tab_length_Tor' introuvable
Plot_Fig7H
Error in eval(expr, envir, enclos): objet 'Plot_Fig7H' introuvable

7.1.6 Figure 7I-J

:::

Representative picture utilizing single cell clonal system suggests that blocking Atg2 (hsFlp; Act>STOP>Gal4, UAS-GFP >UAS-Atg2-IR, GFP+ cells) results in bigger ECs compared to control GFP- cells, quantified in J Complete graphical annotation can be found in manuscript figures

img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/7I.jpg") 
Error in transpose(y): object is NULL
gob_imageFig7I = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig7I)
Error in grid.draw(gob_imageFig7I): objet 'gob_imageFig7I' introuvable

:::

tab_ECclone_quant1 = 
  d[["7J"]]%>%
  mutate_at(vars(!starts_with("Area")),as.factor)%>%
  
  dplyr::rename(Male_Line=Male.Line)%>%
  as.data.frame()
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  tab_ECclone_quant1%>%
  group_by(GFP)%>%
  summarise(Sample_size=n())%>%
  as.data.frame()
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'tab_ECclone_quant1' introuvable
###Stats

mod.gen = fitme(log(Area) ~  GFP,data = subset(tab_ECclone_quant1, Male_Line=="Atg2-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_ECclone_quant1' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Area) ~  GFP ,data = subset(tab_ECclone_quant1, Male_Line=="Atg2-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_ECclone_quant1' introuvable
mod.gen1 = fitme(log(Area) ~ 1 ,data = subset(tab_ECclone_quant1, Male_Line=="Atg2-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'subset' : objet 'tab_ECclone_quant1' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("GFP Negative vs Positive (Atg2-IR)")),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in test$basicLRT: objet de type 'closure' non indiçable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
                      ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
                             ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat$Male_Line = as.factor(c("Atg2-IR"))
Error in tab_stat$Male_Line = as.factor(c("Atg2-IR")): objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Chi2", "Intercept","Estimate","df" ,"p-value","Signif.", "RNAi line"),row.names = FALSE) %>%   add_header_above(c("log(Cell area) ~  GFP" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Chi2", "Intercept", "Estimate", : objet 'tab_stat' introuvable
### Plot


Plot_Fig7J=
  ggplot(tab_ECclone_quant1, aes(x = GFP, y = Area/1000))+ 
  geom_violin(aes(fill = GFP), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = 0.03) + 
  geom_text(data = Sample_size, mapping = aes(x = GFP, y = -0.08, label = paste("(",Sample_size,")",sep="")),size=3)+
  geom_signif(data = tab_stat,aes(xmin = 1, xmax = 2, annotations = formatC(paste("p=",Pvalue), digits = 2), y_position = 0.9), textsize = 3, vjust = -0.2, manual = TRUE, tip_length = c(0.01, 0.01))+

  facet_grid(.~Male_Line)+
  scale_fill_manual(limits=c("No","Yes"),
                    values=c("#e4e4e4","#8ee53f"))+
  scale_x_discrete("GFP",
                   limits=c("No","Yes"),
                   labels=c("-","+"))+
  scale_y_continuous(expression(paste("EC area (10"^3, "mm"^2,")",sep="")),
                     limits=c(-0.1,1),
                     breaks=seq(0,2,by=0.4))+
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, colour = "yellow") +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", face="italic", margin = margin(t = 1, r = 0, b = 1, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", face="italic", margin = margin(t = 1, r = 0, b = 1, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_ECclone_quant1, aes(x = GFP, y = Area/1000)): objet 'tab_ECclone_quant1' introuvable
Plot_Fig7J
Error in eval(expr, envir, enclos): objet 'Plot_Fig7J' introuvable

7.1.7 Figure 7K

Blocking autophagy reduces midgut resizing upon shrinkage (HY to HS for 7 days). Blocking Atg8a expression with RNAi in ECs (MyoTS> UAS-Atg8a-IR) results in less length shrinkage compared to control midguts.

tab_length_Atg8a = 
  d[["7K"]]%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  mutate(Total_Length_mm=Total.L/1000)%>%
  dplyr::rename(Day_of_treatment=Day,
         Female_Line=Female.Line,
         Male_Line=Male.Line)%>%
  as.data.frame()%>%
  mutate(Male_Line=fct_relevel(Male_Line,"Control","Atg8a-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  tab_length_Atg8a%>%
  group_by(Diet,Male_Line)%>%
  summarise(Sample_size=n())%>%
  as.data.frame()%>%
  mutate(Male_Line=fct_relevel(Male_Line,"Control","Atg8a-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'tab_length_Atg8a' introuvable
###Stats

mod.gen = fitme(log10(Total_Length_mm) ~  Diet * Male_Line + (1 | PhaseRep),data = tab_length_Atg8a)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_length_Atg8a' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log10(Total_Length_mm) ~  Diet + Male_Line + (1 / PhaseRep),data = tab_length_Atg8a)
Error in is.data.frame(data): objet 'tab_length_Atg8a' introuvable
mod.gen1 = fitme(log10(Total_Length_mm) ~  Diet + Male_Line + (1 | PhaseRep),data = tab_length_Atg8a)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_length_Atg8a' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("Interaction control vs interaction Atg8a-IR")),
                      Male_Line = as.character("Atg8a-IR"),
                               Rep = nlevels(tab_length_Atg8a$PhaseRep),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[4],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))%>%
                               mutate(Male_Line=fct_relevel(Male_Line,"Atg8a-IR"))
Error in levels(x): objet 'tab_length_Atg8a' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison","Variable", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log10(Total_Length_mm) ~  Diet + Genotype + Diet : Genotype + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Variable", "Replicates", : objet 'tab_stat' introuvable
tab_stat7K = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
### Plot

tab_length_Atg8a$Female_Line = factor(tab_length_Atg8a$Female_Line, labels = c(expression(italic(paste("My",o^{TS},">",sep="")))))
Error in factor(tab_length_Atg8a$Female_Line, labels = c(expression(italic(paste("My", : objet 'tab_length_Atg8a' introuvable
z = max(tab_length_Atg8a$Total_Length_mm, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'tab_length_Atg8a' introuvable
Plot_Fig7K=
  ggplot(tab_length_Atg8a, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/60) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 2.3, label = paste("(",Sample_size,")",sep="")),size=3)+
  facet_grid(.~Male_Line)+
  scale_fill_manual(values=cbbHY_HYtoHS)+
  scale_x_discrete("",
                   limits=c("HY","HYtoHS"),
                   labels=c("HY","HY to HS"))+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(2,7.5),
                     breaks=seq(2,7,by=1))+
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  stat_summary(fun = mean, colour = "black", geom = "line", aes(group = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", face="italic", margin = margin(t = 1, r = 0, b = 1, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", face="italic", margin = margin(t = 1, r = 0, b = 1, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_length_Atg8a, aes(x = Diet, y = Total_Length_mm)): objet 'tab_length_Atg8a' introuvable
Plot_Fig7K
Error in eval(expr, envir, enclos): objet 'Plot_Fig7K' introuvable

7.1.8 Figure 7L

Blocking Atg2 expression with RNAi in ECs (MyoTS> UAS-Atg2-IR) results in less width shrinkage compared to control midguts. Complete statistical annotation in manuscript’s figure.

tab_length_Atg2 = 
  d[["7L"]]%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  mutate(Total_Width_mm=Total.W/1000)%>%
  dplyr::rename(Day_of_treatment=Day,
         Female_Line=Female.Line,
         Male_Line=Male.Line)%>%
  as.data.frame()%>%
  mutate(Male_Line=fct_relevel(Male_Line,"Control","Atg2-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  tab_length_Atg2%>%
  group_by(Diet,Male_Line)%>%
  summarise(Sample_size=n())%>%
  as.data.frame()%>%
  mutate(Male_Line=fct_relevel(Male_Line,"Control","Atg2-IR"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'tab_length_Atg2' introuvable
###Stats

mod.gen = fitme(log10(Total_Width_mm) ~  Diet * Male_Line + (1 | PhaseRep),data = tab_length_Atg2)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_length_Atg2' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log10(Total_Width_mm) ~  Diet + Male_Line + (1 / PhaseRep),data = tab_length_Atg2)
Error in is.data.frame(data): objet 'tab_length_Atg2' introuvable
mod.gen1 = fitme(log10(Total_Width_mm) ~  Diet + Male_Line + (1 | PhaseRep),data = tab_length_Atg2)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_length_Atg2' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("Interaction control vs interaction Atg2-IR")),Male_Line = as.character("Atg2-IR"),
                               Rep = nlevels(tab_length_Atg2$PhaseRep),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[4],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))%>%
                               mutate(Male_Line=fct_relevel(Male_Line,"Atg2-IR"))
Error in levels(x): objet 'tab_length_Atg2' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Variable", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log10(Total_width_mm) ~  Diet + Genotype + Diet : Genotype + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Variable", "Replicates", : objet 'tab_stat' introuvable
tab_stat7L = tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
### Plot

tab_length_Atg2$Female_Line = factor(tab_length_Atg2$Female_Line, labels = c(expression(italic(paste("My",o^{TS},">",sep="")))))
Error in factor(tab_length_Atg2$Female_Line, labels = c(expression(italic(paste("My", : objet 'tab_length_Atg2' introuvable
z = max(tab_length_Atg2$Total_Width_mm, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'tab_length_Atg2' introuvable
Plot_Fig7L=
  ggplot(tab_length_Atg2, aes(x = Diet, y = Total_Width_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/60) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 0.24, label = paste("(",Sample_size,")",sep="")),size=3)+
 # geom_text(data = tab_stat, mapping = aes(x = 1.5, y =0.88, label = paste("p=",Pvalue)),size=3)+
  facet_grid(.~Male_Line)+
  scale_fill_manual(values=cbbHY_HYtoHS)+
  scale_x_discrete("",
                   limits=c("HY","HYtoHS"),
                   labels=c("HY","HY to HS"))+
  scale_y_continuous("Midgut width (mm)",
                     limits=c(0.2,0.9),
                     breaks=seq(0.2,1,by=0.1))+
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  stat_summary(fun = mean, colour = "black", geom = "line", aes(group = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", face="italic", margin = margin(t = 1, r = 0, b = 1, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", face="italic", margin = margin(t = 1, r = 0, b = 1, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_length_Atg2, aes(x = Diet, y = Total_Width_mm)): objet 'tab_length_Atg2' introuvable
Plot_Fig7L
Error in eval(expr, envir, enclos): objet 'Plot_Fig7L' introuvable

##Export Figure 7

7.2 Figure 7 - supplementary 1

7.2.1 Figure 7S1A

The midgut plastically resizes through changes in EC cell size. Quantification of EC area shows that, in addition to total length, the midgut is also able to plastically resize (Figure 4A) its own ECs. ECs scored are derived from midguts measured for length in figure 4A. Letters above violin plots represent grouping by statistical differences (Post hoc Tukey on GLMM).

tab_area_plasticity = 
  d[["7 - S1A"]]%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  tab_area_plasticity%>%
  group_by(Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet): objet 'tab_area_plasticity' introuvable
###Stats

mod.gen = fitme(log10(Area) ~  Diet + (1 | Repeat), data = tab_area_plasticity)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_area_plasticity' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log10(Area) ~ Diet + (1 / Repeat), data = tab_area_plasticity) 
Error in is.data.frame(data): objet 'tab_area_plasticity' introuvable
mod.gen1 = fitme(log10(Area) ~ 1 + (1 | Repeat), data = tab_area_plasticity) 
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_area_plasticity' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("Anova between diets")),
                               Rep = nlevels(tab_area_plasticity$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=2),  
                               estimate = format(format(mod.gen$fixef[2],digits=3),digits=2),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2,scientific=T)))
Error in levels(x): objet 'tab_area_plasticity' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Variable", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log10(Cell area) ~  Diet + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Variable", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
mod.gen = lmer(log10(Area) ~  Diet + (1 | Repeat), data = tab_area_plasticity)
Error: bad 'data': objet 'tab_area_plasticity' introuvable
multcomp = glht(mod.gen, linfct=mcp(Diet="Tukey"))
Error in model.matrix(model) : objet 'mod.gen' introuvable
Error in factor_contrasts(model): no 'model.matrix' method for 'model' found!
tmp = cld(multcomp)
Error in cld(multcomp): objet 'multcomp' introuvable
letter_position = aggregate(data=tab_area_plasticity,I(Area/1000) ~  Diet, max)
Error in eval(m$data, parent.frame()): objet 'tab_area_plasticity' introuvable
tab_letter =  as.data.frame(tmp$mcletters$Letters)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'tmp' introuvable
tab_letter$Diet=rownames(tab_letter)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'rownames' : objet 'tab_letter' introuvable
colnames(tab_letter)[1] = "Letter"
Error in colnames(tab_letter)[1] = "Letter": objet 'tab_letter' introuvable
tab_letter = left_join(tab_letter,letter_position)
Error in left_join(tab_letter, letter_position): objet 'tab_letter' introuvable
colnames(tab_letter)[3] = "Area"
Error in colnames(tab_letter)[3] = "Area": objet 'tab_letter' introuvable
### Plot

z = max(tab_area_plasticity$Area/1000, na.rm = TRUE)
Error in eval(expr, envir, enclos): objet 'tab_area_plasticity' introuvable
Plot_Fig7S1A=
  ggplot(tab_area_plasticity, aes(x = Diet, y = Area/1000))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = z/300) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = -0.01, label = paste("(",Sample_size,")",sep="")),size=3)+
  geom_text(data = tab_stat, mapping = aes(x = 1, y =1.15, label = paste("p< ",format(.Machine$double.xmin,digits=2))),size=3)+
  geom_text(data = tab_letter, mapping = aes(x = Diet, y = Area+0.05, label = Letter),size=3)+
  scale_fill_manual(limits=c("Eclosion", "HY", "HYtoHS", "HYtoHStoHY"),
                    values= cbbPalette_4 )+
  scale_x_discrete("",
                   limits=c("Eclosion", "HY", "HYtoHS", "HYtoHStoHY"),
                   labels=c("Eclosion", "HY", "HY to HS", "HY to HS to HY"))+
  scale_y_continuous(expression(paste("EC area (10"^3, "mm"^2,")",sep="")),
                     limits=c(-0.01,1.22),
                     breaks=seq(0,1.2,by=0.1))+
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(
    panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
    panel.background = element_blank(),
    axis.title.x = element_text(size=Smallfont,colour="black"),
    axis.title.y = element_text(size=Smallfont,colour="black"), 
    axis.line.x = element_line(colour="black",size=0.75),
    axis.line.y = element_line(colour="black",size=0.75),
    axis.ticks.x = element_line(size = 0.75),
    axis.ticks.y = element_line(size = 0.75),
    axis.text.x = element_text(size=Smallfont,colour="black",angle=15,hjust=1),
    axis.text.y = element_text(size=Smallfont,colour="black"),
    plot.margin = unit(Margin, "cm"),
    legend.direction = "vertical", 
    legend.box = "horizontal",
    legend.position = "none",
    legend.key.height = unit(0.4, "cm"),
    legend.key.width= unit(0.6, "cm"),
    legend.title = element_text(face="italic",size=Smallfont), 
    legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
    legend.text = element_text(size=SuperSmallfont),
    legend.background = element_rect(fill=NA))
Error in ggplot(tab_area_plasticity, aes(x = Diet, y = Area/1000)): objet 'tab_area_plasticity' introuvable
Plot_Fig7S1A
Error in eval(expr, envir, enclos): objet 'Plot_Fig7S1A' introuvable

7.2.2 Figure 7S1B

Changes in EC area between HS and HY (ratio HY/HS of mean EC area) significantly correlate with changes in midgut size between HS and HY (ratio HY/HS of mean midgut length) across selected DGRP lines.

tab_corr_length_cell_DGRP_mean_area =
  tab_corr_length_cell_DGRP%>%
  group_by(ral,diet)%>%
  summarise(mean_area=mean(ec.area,na.rm=T))%>%
  spread(diet,mean_area)%>%
  dplyr::rename(mean_area_HS=HS,
                mean_area_HY=HY)%>%
  mutate(Ratio_area = mean_area_HY/mean_area_HS)
Error in group_by(., ral, diet): objet 'tab_corr_length_cell_DGRP' introuvable
tab_corr_length_cell_DGRP_mean_length =
  tab_corr_length_cell_DGRP%>%
  group_by(ral,diet)%>%
  summarise(mean_length=mean(len,na.rm=T))%>%
  spread(diet,mean_length)%>%
  dplyr::rename(mean_length_HS=HS,
                mean_length_HY=HY)%>%
  mutate(Ratio_length = mean_length_HY/mean_length_HS)
Error in group_by(., ral, diet): objet 'tab_corr_length_cell_DGRP' introuvable
tab_corr_length_cell_DGRP_mean= left_join(tab_corr_length_cell_DGRP_mean_length,tab_corr_length_cell_DGRP_mean_area)
Error in left_join(tab_corr_length_cell_DGRP_mean_length, tab_corr_length_cell_DGRP_mean_area): objet 'tab_corr_length_cell_DGRP_mean_length' introuvable
tab_corr_length_cell_DGRP_mean=as.data.frame(tab_corr_length_cell_DGRP_mean)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.data.frame' : objet 'tab_corr_length_cell_DGRP_mean' introuvable
levels(tab_corr_length_cell_DGRP_mean$ral) <- c("Ral 356", "Ral 362", "Ral 370", "Ral 502", "Ral 765", "Ral 853", "Ral 911" )
Error in levels(tab_corr_length_cell_DGRP_mean$ral) <- c("Ral 356", "Ral 362", : objet 'tab_corr_length_cell_DGRP_mean' introuvable
test =
with(tab_corr_length_cell_DGRP_mean,
     cor.test(Ratio_area,Ratio_length,method="pearson"))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'data' lors de la s�lection d'une m�thode pour la fonction 'with' : objet 'tab_corr_length_cell_DGRP_mean' introuvable
tab_stat = data.frame(Statistic = test$statistic,
  cor = test$estimate,
  Pvalue = test$p.value)
Error in test$statistic: objet de type 'closure' non indiçable
#levels(tab_corr_length_cell_DGRP_mean$ral) <- c("Ral 356", "Ral 362", "Ral 370", "Ral 502", "Ral 765", "Ral 853", "Ral 911" )



Plot_Fig7S1B = 
ggplot(tab_corr_length_cell_DGRP_mean,aes(x=Ratio_area,y=Ratio_length,label=ral))+
  geom_point()+
  scale_x_continuous(expression(paste("Ratio HY/HS (mean EC area)")),
                     limits=c(0.8,2.6),
                     breaks=c(seq(0.8,2.8,by=0.2)))+
  scale_y_continuous("Ratio HY/HS (mean midgut length)",
                     limits=c(0.8,2.6),
                     breaks=c(seq(0.8,2.8,by=0.2)))+
  geom_text_repel(data=tab_corr_length_cell_DGRP_mean,size=3)+
  geom_smooth(method="lm")+
  geom_text(data = tab_stat, mapping = aes(x = 1.7, y = 1.7, label = paste("cor=", format(cor, digits=2),                                       "p=",format(Pvalue,digits=2))),size=3)+ 
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        (panel.border = element_blank()),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"),
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_blank(),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "horizontal",
        legend.box = "horizontal",
        legend.position = c(0.25,0.98),
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.4, "cm"),
        legend.title = element_blank(),
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=Smallfont),
        legend.background = element_rect(fill=NA))+
  guides(color=guide_legend(ncol=3))
Error in ggplot(tab_corr_length_cell_DGRP_mean, aes(x = Ratio_area, y = Ratio_length, : objet 'tab_corr_length_cell_DGRP_mean' introuvable
Plot_Fig7S1B
Error in eval(expr, envir, enclos): objet 'Plot_Fig7S1B' introuvable

##Export Figure 7S1

7.3 Figure 7 - supplementary 2

7.3.1 Figure 7S2A-B

A reporter line for Foxo pathway activity, thor-lacZ, has increased intensity on HS (A, A’) compared to HY (B, B’). Quantification of mean pixel intensity of thor-lacZ stain (C). Complete graphical annotation can be found in manuscript figures

img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/7- S2A.jpg") 
Error in transpose(y): object is NULL
gob_imageFig7S2A = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig7S2A)
Error in grid.draw(gob_imageFig7S2A): objet 'gob_imageFig7S2A' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/7- S2A1.jpg") 
Error in transpose(y): object is NULL
gob_imageFig7S2A1 = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig7S2A1)
Error in grid.draw(gob_imageFig7S2A1): objet 'gob_imageFig7S2A1' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/7- S2B.jpg") 
Error in transpose(y): object is NULL
gob_imageFig7S2B = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig7S2B)
Error in grid.draw(gob_imageFig7S2B): objet 'gob_imageFig7S2B' introuvable
img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/7- S2B1.jpg") 
Error in transpose(y): object is NULL
gob_imageFig7S2B1 = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig7S2B1)
Error in grid.draw(gob_imageFig7S2B1): objet 'gob_imageFig7S2B1' introuvable

7.3.2 Figure 7S2C

Quantification thor-lacZ

tab_ThorlacZ_rev = 
  d[["7 - S2C"]]%>%
  mutate_if(is.character,as.factor)%>%
  mutate_if(is.integer,as.factor)%>%
  dplyr::rename(ThorlacZ_int=Mean)
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
  tab_ThorlacZ_rev%>%
  group_by(Diet)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet): objet 'tab_ThorlacZ_rev' introuvable
###Stats
mod.gen = fitme(log(ThorlacZ_int) ~  Diet + (1 | Repeat),data = tab_ThorlacZ_rev)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_ThorlacZ_rev' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(ThorlacZ_int) ~  Diet + (1 / Repeat),data = tab_ThorlacZ_rev)
Error in is.data.frame(data): objet 'tab_ThorlacZ_rev' introuvable
mod.gen1 = fitme(log(ThorlacZ_int) ~  1 + (1 | Repeat),data = tab_ThorlacZ_rev)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_ThorlacZ_rev' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("HS vs HY")),
                      Rep = nlevels(tab_ThorlacZ_rev$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_ThorlacZ_rev' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(Thor-lacZ intensity) ~  Diet + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
### Plot


Plot_Fig7S2C=
  ggplot(tab_ThorlacZ_rev, aes(x = Diet, y = ThorlacZ_int))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = 0.8) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = -3, label = paste("(",Sample_size,")",sep="")),size=3)+
  geom_signif(annotation = formatC(paste("p=",tab_stat$Pvalue), digits = 2), textsize = 3, y_position = 32, xmin = 1, xmax = 2, tip_length = c(0.02, 0.02), vjust = -0.2)+

  scale_fill_manual(limits=c("HS","HY"),
                    values=c("#FFB4B4","#C3E6FC"))+
  scale_x_discrete("",
                   limits=c("HS","HY"),
                   labels=c("HS","HY"))+
  
  scale_y_continuous(bquote(atop("Mean pixel intensity" ,~ italic (Thor-lacZ) ~ "(a.u.)")),
                     limits=c(-5,35),
                     breaks=seq(0,30,by=10))+ 
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  scale_color_manual(values = palette_mean) +
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black"),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text = element_text(size =Smallfont-2, colour = "black",face="italic", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_ThorlacZ_rev, aes(x = Diet, y = ThorlacZ_int)): objet 'tab_ThorlacZ_rev' introuvable
Plot_Fig7S2C
Error in eval(expr, envir, enclos): objet 'Plot_Fig7S2C' introuvable

7.3.3 Figure 7S2D

Blocking TOR in ECs (5966GS> UAS-Tor-IR) inhibits diet induced midgut growth. For control we used flies of the same genotype but not exposed to RU486. Statistical analyses were performed by comparing interaction between diet and fly line.

tab_5966TOR_rev = 
  d[["7 - S2D"]]%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  mutate(Total_Length_mm=Total.L/1000)%>%
  dplyr::rename(Day_of_treatment=Day,
         Female_Line=Female.Line,
         Male_Line=Male.Line)%>%
  mutate(Treatment=fct_relevel(Treatment,"Ethanol","RU486"))
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
 tab_5966TOR_rev%>%
  group_by(Diet,Treatment)%>%
  summarise(Sample_size=n())
Error in group_by(., Diet, Treatment): objet 'tab_5966TOR_rev' introuvable
###Stats

mod.gen = fitme(log(Total_Length_mm) ~  Diet * Treatment + (1 | Repeat),data =tab_5966TOR_rev)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_5966TOR_rev' introuvable
shapiro.test(residuals(mod.gen)) 
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log(Total_Length_mm) ~  Diet + Treatment + (1 / Repeat),data =tab_5966TOR_rev)
Error in is.data.frame(data): objet 'tab_5966TOR_rev' introuvable
mod.gen1 = fitme(log(Total_Length_mm) ~  Diet + Treatment + (1 | Repeat),data =tab_5966TOR_rev)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_5966TOR_rev' introuvable
test = anova(mod.gen, mod.gen1) 
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Variable = as.character(paste("Interaction ethanol vs interaction RU486")),
                      Rep = nlevels(tab_5966TOR_rev$Repeat),
                      chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                      intercept = format(mod.gen$fixef[1],digits=3),
                      estimate = format(mod.gen$fixef[2],digits=3),
                      df = as.numeric(test$basicLRT$df),
                      Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=2)))
Error in levels(x): objet 'tab_5966TOR_rev' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison", "Replicates", "Chi2","Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%   add_header_above(c("log(Total_Length_mm) ~  Diet + Treatment + Diet : Treatment + (1 | Repeat)" = 8))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Replicates", "Chi2", "Intercept", : objet 'tab_stat' introuvable
tab_stat_rev_RU486=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat_rev_RU486$Treatment="RU486"
Error in tab_stat_rev_RU486$Treatment = "RU486": objet 'tab_stat_rev_RU486' introuvable
tab_stat_rev_RU486$Treatment=as.factor(tab_stat_rev_RU486$Treatment)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.factor' : objet 'tab_stat_rev_RU486' introuvable
### Plot


Plot_Fig7S2D =
  ggplot(tab_5966TOR_rev, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = 0.11) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 2.2, label = paste("(",Sample_size,")",sep="")),size=3)+
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18,aes(group=Repeat, colour = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  stat_summary(fun = mean, colour = "black", geom = "line", aes(group = Repeat)) +
  scale_color_manual(values = palette_mean) +
  facet_grid(.~ Treatment)+
  scale_fill_manual(values=cbbHS_HStoHY)+
  scale_x_discrete("",
                   limits=c("HS D0","HStoHY D7"),
                   labels=c("HS","HS to HY"))+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(2,7),
                     breaks=seq(2,7,by=1))+
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", face = "italic", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", face = "italic", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_5966TOR_rev, aes(x = Diet, y = Total_Length_mm)): objet 'tab_5966TOR_rev' introuvable
Plot_Fig7S2D
Error in eval(expr, envir, enclos): objet 'Plot_Fig7S2D' introuvable

7.3.4 Figure 7S2E

Blocking autophagy in ECs reduces midgut resizing upon shrinkage (HY to HS for 7 days) using 5966GS> UAS-Atg8a-IR. For control we used flies of the same genotype but not exposed to RU486. Statistical analyses were performed by comparing interaction between diet and fly line. Complete statistical annotation can be found in manuscript’s figure.

tab_5966atg8a_rev = 
  d[["7 - S2E"]]%>%
  mutate_at(vars(!starts_with("Total")),as.factor)%>%
  mutate(Total_Length_mm=Total.L/1000)%>%
  dplyr::rename(Day_of_treatment=Day,
         Female_Line=Female.Line,
         Male_Line=Male.Line)%>%
  mutate(Treatment=fct_relevel(Treatment,"Ethanol","RU486"))
Error in UseMethod("tbl_vars"): pas de méthode pour 'tbl_vars' applicable pour un objet de classe "NULL"
Sample_size=
 tab_5966atg8a_rev%>%
  group_by(Male_Line,Diet,Treatment)%>%
  summarise(Sample_size=n())
Error in group_by(., Male_Line, Diet, Treatment): objet 'tab_5966atg8a_rev' introuvable
###Stats

mod.gen = fitme(log10(Total_Length_mm) ~  Diet * Treatment + (1 | Repeat),data = tab_5966atg8a_rev)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_5966atg8a_rev' introuvable
shapiro.test(residuals(mod.gen))
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'object' lors de la s�lection d'une m�thode pour la fonction 'residuals' : objet 'mod.gen' introuvable
bptest(log10(Total_Length_mm) ~  Diet * Treatment + (1 / Repeat),data = tab_5966atg8a_rev)
Error in is.data.frame(data): objet 'tab_5966atg8a_rev' introuvable
mod.gen1 = fitme(log10(Total_Length_mm) ~  Diet + Treatment + (1 | Repeat),data = tab_5966atg8a_rev)
Error in (function (control.HLfit, ranFix = NULL, HLmethod, predictor, : objet 'tab_5966atg8a_rev' introuvable
test = anova(mod.gen, mod.gen1)
Error in anova(mod.gen, mod.gen1): objet 'mod.gen' introuvable
test
function (pkg = ".", filter = NULL, stop_on_failure = FALSE, 
    export_all = TRUE, ...) 
{
    save_all()
    pkg <- as.package(pkg)
    if (!uses_testthat(pkg) && interactive()) {
        cli::cli_alert_danger("No testing infrastructure found. Create it?")
        if (utils::menu(c("Yes", "No")) == 1) {
            usethis_use_testthat(pkg)
        }
        return(invisible())
    }
    load_all(pkg$path)
    cli::cli_alert_info("Testing {.pkg {pkg$package}}")
    withr::local_envvar(r_env_vars())
    testthat::test_local(pkg$path, filter = filter, stop_on_failure = stop_on_failure, 
        ...)
}
<bytecode: 0x000000009e53be20>
<environment: namespace:devtools>
Chi2_LRT_growth = 2*(mod.gen$APHLs[["p_v"]]-mod.gen1$APHLs[["p_v"]])
Error in eval(expr, envir, enclos): objet 'mod.gen' introuvable
tab_stat = data.frame(Comparison = as.character(paste("Interaction ethanol vs interaction RU486")),
  Male_Line = as.character(paste("Atg8a-IR")),
                               Rep = nlevels(tab_5966atg8a_rev$Repeat),
                               chi2_LR = round(as.numeric(test$basicLRT$chi2_LR), digits = 2),
                               intercept = format(mod.gen$fixef[1],digits=3),
                               estimate = format(mod.gen$fixef[2],digits=3),
                               df = as.numeric(test$basicLRT$df),
                               Pvalue = as.numeric(format(pchisq(Chi2_LRT_growth,df=1,lower.tail = F),digits=1,scientific=F)))
Error in levels(x): objet 'tab_5966atg8a_rev' introuvable
tab_stat$sig = ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*",
             ifelse(tab_stat$Pvalue < 0.01 & tab_stat$Pvalue > 0.001, "**",
              ifelse(tab_stat$Pvalue < 0.001, "***", "")))
Error in ifelse(tab_stat$Pvalue < 0.05 & tab_stat$Pvalue > 0.01, "*", : objet 'tab_stat' introuvable
tab_stat%>%
  kable(col.names = c("Comparison","Variable", "Replicates", "Chi2", "Intercept","Estimate","df" ,"p-value","Signif."),row.names = FALSE) %>%
  add_header_above(c("log(Total_Length_mm) ~  Diet + Treatment + Diet : Treatment + (1 | Repeat)" = 9))%>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed"), full_width = F)
Error in kable(., col.names = c("Comparison", "Variable", "Replicates", : objet 'tab_stat' introuvable
tab_stat_5966atg8a_rev=tab_stat
Error in eval(expr, envir, enclos): objet 'tab_stat' introuvable
tab_stat_5966atg8a_rev$Treatment="RU486"
Error in tab_stat_5966atg8a_rev$Treatment = "RU486": objet 'tab_stat_5966atg8a_rev' introuvable
tab_stat_5966atg8a_rev$Treatment=as.factor(tab_stat_rev_RU486$Treatment)
Error in h(simpleError(msg, call)): erreur d'�valuation de l'argument 'x' lors de la s�lection d'une m�thode pour la fonction 'as.factor' : objet 'tab_stat_rev_RU486' introuvable
### Plot


Plot_Fig7S2E =
  ggplot(tab_5966atg8a_rev, aes(x = Diet, y = Total_Length_mm))+ 
  geom_violin(aes(fill = Diet), draw_quantiles = c(0.25, 0.5, 0.75), colour = "black", size = 0.2,adjust = 0.8) +
  geom_dotplot( colour = "black", fill = "white", binaxis = "y", stackdir = "center", binwidth = 0.11) + 
  geom_text(data = Sample_size, mapping = aes(x = Diet, y = 2.2, label = paste("(",Sample_size,")",sep="")),size=3)+
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18,aes(group=Repeat, colour = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 3, shape = 18, colour = "black", aes(group = Repeat)) +
  stat_summary(fun = mean, geom = "point", size = 2, shape = 18, aes(group = Repeat, colour = Repeat)) +
  stat_summary(fun = mean, colour = "black", geom = "line", aes(group = Repeat)) +
  scale_color_manual(values = palette_mean) +
  facet_grid(~ Treatment)+
  scale_fill_manual(values=cbbHY_HYtoHS)+
  scale_x_discrete("",
                   limits=c("HY","HYtoHS"),
                   labels=c("HY","HY to HS"))+
  scale_y_continuous("Midgut length (mm)",
                     limits=c(2,8),
                     breaks=seq(2,8,by=1))+
  theme(panel.grid.major.y = element_line(colour = grey(0.45), linetype = "dashed", size = 0.2),
        panel.background = element_blank(),
        axis.title.x = element_text(size=Smallfont,colour="black"),
        axis.title.y = element_text(size=Smallfont,colour="black"), 
        axis.line.x = element_line(colour="black",size=0.75),
        axis.line.y = element_line(colour="black",size=0.75),
        axis.ticks.x = element_line(size = 0.75),
        axis.ticks.y = element_line(size = 0.75),
        axis.text.x = element_text(size=Smallfont,colour="black",angle=30,hjust=1),
        axis.text.y = element_text(size=Smallfont,colour="black"),
        plot.margin = unit(Margin, "cm"),
        legend.direction = "vertical", 
        legend.box = "horizontal",
        legend.position = "none",
        legend.key.height = unit(0.4, "cm"),
        legend.key.width= unit(0.6, "cm"),
        legend.title = element_text(face="italic",size=Smallfont), 
        legend.key = element_rect(colour = 'white', fill = "white", linetype='dashed'),
        legend.text = element_text(size=SuperSmallfont),
        legend.background = element_rect(fill=NA),
        strip.text.x = element_text(size = Smallfont, colour = "black", face = "italic", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.text.y = element_text(size = Smallfont, colour = "black", face = "italic", margin = margin(t = 2, r = 0, b = 2, l = 0)),
        strip.background = element_rect(fill=NA, colour="black"),
        strip.placement="outside")
Error in ggplot(tab_5966atg8a_rev, aes(x = Diet, y = Total_Length_mm)): objet 'tab_5966atg8a_rev' introuvable
Plot_Fig7S2E
Error in eval(expr, envir, enclos): objet 'Plot_Fig7S2E' introuvable

##Export Figure 7S2

7.4 Figure 7 - supplementary 3

7.4.1 Figure 7S3A

Scheme depicting the regulation of midgut size in response to dietary changes. EC size, together with the balance between cell gain and cell loss, determine midgut size. Diet can influence these three parameters, thus influencing midgut size. Yeast promotes midgut growth, and sugar antagonizes it. Sugar inhibits translation and uncouples ISC proliferation from expression of stress-derived pro-mitotic signals, thus resulting in smaller guts.

img = readImage("F:/Dropbox/Github/Bonfini_eLife_2021/data/7 - S3A.jpg") 
Error in transpose(y): object is NULL
gob_imageFig7S3A = rasterGrob(img)
Error in UseMethod("as.raster"): pas de méthode pour 'as.raster' applicable pour un objet de classe "list"
grid.draw(gob_imageFig7S3A)
Error in grid.draw(gob_imageFig7S3A): objet 'gob_imageFig7S3A' introuvable

##Export Figure 7S3


sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)

Matrix products: default

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252   
[3] LC_MONETARY=French_France.1252 LC_NUMERIC=C                  
[5] LC_TIME=French_France.1252    

attached base packages:
 [1] parallel  stats4    grid      stats     graphics  grDevices utils    
 [8] datasets  methods   base     

other attached packages:
 [1] ggsignif_0.6.2              plotfunctions_1.4          
 [3] kableExtra_1.3.4            knitr_1.33                 
 [5] ggplotify_0.1.0             coxme_2.2-16               
 [7] bdsmatrix_1.3-4             DESeq2_1.32.0              
 [9] SummarizedExperiment_1.22.0 Biobase_2.52.0             
[11] MatrixGenerics_1.4.3        matrixStats_0.60.1         
[13] GenomicRanges_1.44.0        GenomeInfoDb_1.28.0        
[15] IRanges_2.26.0              S4Vectors_0.30.0           
[17] BiocGenerics_0.38.0         ggh4x_0.2.0                
[19] forcats_0.5.1               metR_0.11.0                
[21] ggrepel_0.9.1               multcomp_1.4-17            
[23] TH.data_1.0-10              mvtnorm_1.1-2              
[25] gridGraphics_0.5-1          RColorBrewer_1.1-2         
[27] gplots_3.1.1                EBImage_4.34.0             
[29] fields_12.5                 viridis_0.6.1              
[31] viridisLite_0.4.0           spam_2.7-0                 
[33] dotCall64_1.0-1             lme4_1.1-27.1              
[35] Matrix_1.3-3                spaMM_3.8.0                
[37] data.table_1.14.0           phia_0.2-1                 
[39] tidyr_1.1.3                 scales_1.1.1               
[41] stringr_1.4.0               dplyr_1.0.7                
[43] xlsx_0.6.5                  xlsxjars_0.6.1             
[45] rJava_1.0-5                 doBy_4.6.10                
[47] psych_2.1.6                 nparLD_2.1                 
[49] agricolae_1.3-5             gridExtra_2.3              
[51] plotrix_3.8-1               survival_3.2-11            
[53] ggplot2_3.3.5               lmtest_0.9-38              
[55] zoo_1.8-9                   car_3.0-10                 
[57] carData_3.0-4               MASS_7.3-54                
[59] lattice_0.20-44             reshape2_1.4.4             
[61] devtools_2.4.2              usethis_2.0.1              
[63] workflowr_1.6.2            

loaded via a namespace (and not attached):
  [1] bit64_4.0.5            DelayedArray_0.18.0    KEGGREST_1.32.0       
  [4] RCurl_1.98-1.3         generics_0.1.0         callr_3.7.0           
  [7] RSQLite_2.2.7          combinat_0.0-8         proxy_0.4-26          
 [10] bit_4.0.4              webshot_0.5.2          xml2_1.3.2            
 [13] lubridate_1.7.10       httpuv_1.6.1           assertthat_0.2.1      
 [16] xfun_0.24              hms_1.1.0              jquerylib_0.1.4       
 [19] evaluate_0.14          promises_1.2.0.1       fansi_0.5.0           
 [22] caTools_1.18.2         readxl_1.3.1           DBI_1.1.1             
 [25] geneplotter_1.70.0     tmvnsim_1.0-2          htmlwidgets_1.5.3     
 [28] purrr_0.3.4            ellipsis_0.3.2         backports_1.2.1       
 [31] annotate_1.70.0        ROI_1.0-0              vctrs_0.3.8           
 [34] remotes_2.4.1          abind_1.4-5            cachem_1.0.5          
 [37] withr_2.4.2            checkmate_2.0.0        prettyunits_1.1.1     
 [40] mnormt_2.0.2           svglite_2.0.0          cluster_2.1.2         
 [43] crayon_1.4.1           genefilter_1.74.0      pkgconfig_2.0.3       
 [46] slam_0.1-48            nlme_3.1-152           pkgload_1.2.2         
 [49] rlang_0.4.11           questionr_0.7.4        lifecycle_1.0.0       
 [52] miniUI_0.1.1.1         sandwich_3.0-1         registry_0.5-1        
 [55] cellranger_1.1.0       rprojroot_2.0.2        tiff_0.1-8            
 [58] boot_1.3-28            whisker_0.4            processx_3.5.2        
 [61] png_0.1-7              bitops_1.0-7           KernSmooth_2.23-20    
 [64] Biostrings_2.60.1      blob_1.2.1             jpeg_0.1-8.1          
 [67] klaR_0.6-15            memoise_2.0.0          magrittr_2.0.1        
 [70] plyr_1.8.6             zlibbioc_1.38.0        compiler_4.1.0        
 [73] cli_3.0.1              XVector_0.32.0         pbapply_1.4-3         
 [76] ps_1.6.0               tidyselect_1.1.1       stringi_1.6.2         
 [79] highr_0.9              yaml_2.2.1             locfit_1.5-9.4        
 [82] sass_0.4.0             tools_4.1.0            rio_0.5.27            
 [85] rstudioapi_0.13        foreign_0.8-81         git2r_0.28.0          
 [88] digest_0.6.27          shiny_1.6.0            Rcpp_1.0.7            
 [91] microbenchmark_1.4-7   broom_0.7.8            later_1.2.0           
 [94] httr_1.4.2             AnnotationDbi_1.54.1   Deriv_4.1.3           
 [97] colorspace_2.0-2       rvest_1.0.0            XML_3.99-0.6          
[100] fs_1.5.0               splines_4.1.0          yulab.utils_0.0.2     
[103] sessioninfo_1.1.1      systemfonts_1.0.2      xtable_1.8-4          
[106] jsonlite_1.7.2         nloptr_1.2.2.2         AlgDesign_1.2.0       
[109] testthat_3.1.0         R6_2.5.0               pillar_1.6.1          
[112] htmltools_0.5.1.1      mime_0.11              glue_1.4.2            
[115] fastmap_1.1.0          minqa_1.2.4            BiocParallel_1.26.2   
[118] fftwtools_0.9-11       codetools_0.2-18       maps_3.3.0            
[121] pkgbuild_1.2.0         utf8_1.2.1             bslib_0.2.5.1         
[124] tibble_3.1.2           numDeriv_2016.8-1.1    curl_4.3.2            
[127] gtools_3.9.2           zip_2.2.0              openxlsx_4.2.4        
[130] rmarkdown_2.9          desc_1.4.0             curry_0.1.1           
[133] munsell_0.5.0          GenomeInfoDbData_1.2.6 labelled_2.8.0        
[136] haven_2.4.1            gtable_0.3.0