diff --git a/covid_comp_dataset.Rnw b/covid_comp_dataset.Rnw
new file mode 100644
index 0000000000000000000000000000000000000000..bc6395ba8e8e242e9e2f436631ba3ec0837d688c
--- /dev/null
+++ b/covid_comp_dataset.Rnw
@@ -0,0 +1,199 @@
+\documentclass[11pt, oneside]{article}   	% use "amsart" instead of "article" for AMSLaTeX format
+%\usepackage{geometry}                		% See geometry.pdf to learn the layout options. There are lots.
+%\geometry{letterpaper}                   		% ... or a4paper or a5paper or ... 
+%\geometry{landscape}                		% Activate for for rotated page geometry
+%\usepackage[parfill]{parskip}    		% Activate to begin paragraphs with an empty line rather than an indent
+%\usepackage{graphicx}				% Use pdf, png, jpg, or eps with pdflatex; use eps in DVI mode
+								% TeX will automatically convert eps --> pdf in pdflatex		
+%\usepackage{amssymb}
+
+\usepackage[utf8]{inputenc}
+%\usepackage[cyr]{aeguill}
+%\usepackage[francais]{babel}
+%\usepackage{hyperref}
+
+
+\title{Positive selection on genes interacting with SARS-Cov2, comparison of different analysis}
+\author{Marie Cariou}
+\date{Janvier 2021}							% Activate to display a given date or no date
+
+\begin{document}
+\maketitle
+
+\tableofcontents
+
+\newpage
+
+\section{Data}
+
+Analysis were formatted by the script covid\_comp\_script0\_table.Rnw.
+
+
+<<>>=
+workdir<-"/home/adminmarie/Documents/CIRI_BIBS_projects/2020_05_Etienne_covid/"
+
+tab<-read.delim(paste0(workdir, 
+  "covid_comp/covid_comp_complete.txt"), h=T, sep="\t")
+dim(tab)
+@
+
+
+\section{Comparison of dataset}
+
+\subsection{Data}
+
+<<data>>=
+tmp<-na.omit(tab[,c("Gene.name", "bats_BUSTED", "bats_BppM1M2", "bats_BppM7M8", 
+    "bats_codemlM1M2", "bats_codemlM7M8", "dginn.primate_codemlM1M2", 
+    "dginn.primate_codemlM7M8", "dginn.primate_BppM1M2", 
+    "dginn.primate_BppM7M8", "dginn.primate_BUSTED")])
+dim(tmp)
+@
+\subsection{Mondrian}
+
+<<mondrianbats>>=
+library(Mondrian)
+
+monddata<-as.data.frame(tmp$Gene.name)
+
+batstmp<-rowSums(cbind(tmp$bats_codemlM1M2=="Y", tmp$bats_codemlM7M8=="Y", 
+tmp$bats_BppM1M2=="Y", tmp$bats_BppM7M8=="Y", tmp$bats_BUSTED=="Y")) 
+
+primatetmp<-rowSums(cbind(tmp$"dginn.primate_codemlM1M2"=="Y", 
+  tmp$"dginn.primat_codemlM7M8"=="Y", tmp$"dginn.primate_BppM1M2"=="Y", 
+  tmp$"dginn.primate_BppM7M8"=="Y", tmp$"dginn.primate_BUSTED"=="Y")) 
+                                       
+monddata$bats_dginn3<-ifelse(batstmp>=3, 1,0)
+monddata$primate_dginn3<-ifelse(primatetmp>=3, 1,0)
+monddata$bats_dginn4<-ifelse(batstmp>=4, 1,0)
+monddata$primate_dginn4<-ifelse(primatetmp>=4, 1,0)
+
+mondrian(monddata[,2:3], labels=c("DGINN bats >3", "DGINN primate >3"))
+
+mondrian(monddata[,4:5], labels=c("DGINN bats >4", "DGINN primate >4"))
+
+@
+
+\subsection{subsetR}
+
+<<subsetbats>>=
+library(UpSetR)
+
+upset(monddata, nsets = 4, matrix.color = "#DC267F", 
+main.bar.color = "#648FFF", sets.bar.color = "#FE6100")
+
+upset(monddata[,1:3], nsets = 2, matrix.color = "#DC267F", 
+main.bar.color = "#648FFF", sets.bar.color = "#FE6100")
+
+upset(monddata[,c(1,4,5)], nsets = 2, matrix.color = "#DC267F", 
+main.bar.color = "#648FFF", sets.bar.color = "#FE6100")
+@
+
+\section{Which are these genes?}
+
+\subsection{Gene under positive selection in both bats and primates}
+
+4 methods:
+
+<<>>=
+monddata[monddata$bats_dginn4==1 & monddata$primate_dginn4==1,]
+@
+
+3 methods:
+
+<<>>=
+monddata[monddata$bats_dginn3==1 & monddata$primate_dginn3==1,]
+@
+
+
+\subsection{Gene under positive selection only in primates}
+
+4 methods:
+
+<<>>=
+monddata[monddata$bats_dginn4==0 & monddata$primate_dginn4==1,]
+@
+
+3 methods:
+
+<<t>>=
+monddata[monddata$bats_dginn3==0 & monddata$primate_dginn3==1,]
+@
+
+
+\subsection{Gene under positive selection only in bats}
+
+4 methods:
+
+<<>>=
+monddata[monddata$bats_dginn4==1 & monddata$primate_dginn4==0,]
+@
+
+3 methods:
+
+<<>>=
+monddata[monddata$bats_dginn3==1 & monddata$primate_dginn3==0,]
+@
+
+\subsection{Figure tableau}
+
+<<tablo>>=
+tablo<-as.data.frame(tmp$Gene.name)
+tablo$nbats<-batstmp
+tablo$nprimates<-primatetmp
+
+plot(NULL, xlim=c(-0.5,5.5), ylim=c(-3,5.5), xlab="bats", ylab="primates", main="Genes supported by x,y methods in bats and primates", bty="n", xaxt="n", yaxt="n")
+
+text(x=rep(-0.6, 6), y=0:5, 0:5)
+text(y=rep(-0.65, 6), x=0:5, 0:5)
+sapply(seq(from=-0.5, to=5.5, by=1), function(x){
+  segments(x0=x, x1=x, y0=-0.5, y1=5.5)
+})
+
+sapply(seq(from=-0.5, to=5.5, by=1), function(x){
+  segments(x0=-0.5, x1=5.5, y0=x, y1=x)
+})
+
+for (p in 0:5){
+  for (b in 0:5){
+    tmp<-tablo$`tmp$Gene.name`[tablo$nbats==b & tablo$nprimates==p]
+    if(length(tmp)>0 & length(tmp)<8){
+      text(b,seq(from=(p-0.4), to=(p+0.4), length.out = length(tmp)), tmp, cex=0.4)
+    }else if (length(tmp)>8 & length(tmp)<16){
+      print(c(p, b))
+      text((b-0.3),seq(from=(p-0.4), to=(p+0.4), length.out = 8), tmp[1:8], cex=0.4)      
+      text((b+0.3),seq(from=(p-0.4), to=(p+0.4), length.out = (length(tmp)-8)), tmp[9:length(tmp)], cex=0.4)
+    }else if (length(tmp)>16){
+      text(b,p, paste0(length(tmp), " values"))
+      }  
+  }
+}
+
+
+tmp<-tablo$`tmp$Gene.name`[tablo$nbats==0 & tablo$nprimates==1]
+text(-0.4,-1.2, "p=1/n=0", cex=0.6)
+text(seq(from=0.1, to=5.5, length.out = 18),-1.1, tmp[1:18], cex=0.4)
+text(seq(from=0.1, to=3, length.out = length(tmp)-18),-1.3, tmp[19:length(tmp)], cex=0.4)
+
+tmp<-tablo$`tmp$Gene.name`[tablo$nbats==1 & tablo$nprimates==1]
+text(-0.4,-1.7, "p=1/n=1", cex=0.6)
+text(seq(from=0.1, to=5.5, length.out = 18),-1.6, tmp[1:18], cex=0.4)
+text(seq(from=0.1, to=2, length.out = length(tmp)-18),-1.8, tmp[19:length(tmp)], cex=0.4)
+
+
+tmp<-tablo$`tmp$Gene.name`[tablo$nbats==0 & tablo$nprimates==0]
+text(-0.4,-2.2, "p=0/n=0", cex=0.6)
+text(seq(from=0.1, to=5.5, length.out = 17),-2.1, tmp[1:17], cex=0.4)
+text(seq(from=0.1, to=4.4, length.out = length(tmp)-17),-2.3, tmp[18:length(tmp)], cex=0.4)
+
+tmp<-tablo$`tmp$Gene.name`[tablo$nbats==2 & tablo$nprimates==0]
+text(-0.4,-2.7, "p=0/n=2", cex=0.6)
+text(seq(from=0.1, to=5.5, length.out = 18),-2.6, tmp[1:18], cex=0.4)
+text(seq(from=0.1, to=1, length.out = length(tmp)-18),-2.8, tmp[19:length(tmp)], cex=0.4)
+
+
+
+@
+
+\end{document}
+
diff --git a/covid_comp_dataset.pdf b/covid_comp_dataset.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..922d30e3b054eaa7f607931e6ffc2f352e90fe11
Binary files /dev/null and b/covid_comp_dataset.pdf differ
diff --git a/covid_comp_dataset.tex b/covid_comp_dataset.tex
new file mode 100644
index 0000000000000000000000000000000000000000..a64505b5f74343baae9d22fb7c655cb75b68704c
--- /dev/null
+++ b/covid_comp_dataset.tex
@@ -0,0 +1,454 @@
+\documentclass[11pt, oneside]{article}\usepackage[]{graphicx}\usepackage[]{color}
+% maxwidth is the original width if it is less than linewidth
+% otherwise use linewidth (to make sure the graphics do not exceed the margin)
+\makeatletter
+\def\maxwidth{ %
+  \ifdim\Gin@nat@width>\linewidth
+    \linewidth
+  \else
+    \Gin@nat@width
+  \fi
+}
+\makeatother
+
+\definecolor{fgcolor}{rgb}{0.345, 0.345, 0.345}
+\newcommand{\hlnum}[1]{\textcolor[rgb]{0.686,0.059,0.569}{#1}}%
+\newcommand{\hlstr}[1]{\textcolor[rgb]{0.192,0.494,0.8}{#1}}%
+\newcommand{\hlcom}[1]{\textcolor[rgb]{0.678,0.584,0.686}{\textit{#1}}}%
+\newcommand{\hlopt}[1]{\textcolor[rgb]{0,0,0}{#1}}%
+\newcommand{\hlstd}[1]{\textcolor[rgb]{0.345,0.345,0.345}{#1}}%
+\newcommand{\hlkwa}[1]{\textcolor[rgb]{0.161,0.373,0.58}{\textbf{#1}}}%
+\newcommand{\hlkwb}[1]{\textcolor[rgb]{0.69,0.353,0.396}{#1}}%
+\newcommand{\hlkwc}[1]{\textcolor[rgb]{0.333,0.667,0.333}{#1}}%
+\newcommand{\hlkwd}[1]{\textcolor[rgb]{0.737,0.353,0.396}{\textbf{#1}}}%
+\let\hlipl\hlkwb
+
+\usepackage{framed}
+\makeatletter
+\newenvironment{kframe}{%
+ \def\at@end@of@kframe{}%
+ \ifinner\ifhmode%
+  \def\at@end@of@kframe{\end{minipage}}%
+  \begin{minipage}{\columnwidth}%
+ \fi\fi%
+ \def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep
+ \colorbox{shadecolor}{##1}\hskip-\fboxsep
+     % There is no \\@totalrightmargin, so:
+     \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
+ \MakeFramed {\advance\hsize-\width
+   \@totalleftmargin\z@ \linewidth\hsize
+   \@setminipage}}%
+ {\par\unskip\endMakeFramed%
+ \at@end@of@kframe}
+\makeatother
+
+\definecolor{shadecolor}{rgb}{.97, .97, .97}
+\definecolor{messagecolor}{rgb}{0, 0, 0}
+\definecolor{warningcolor}{rgb}{1, 0, 1}
+\definecolor{errorcolor}{rgb}{1, 0, 0}
+\newenvironment{knitrout}{}{} % an empty environment to be redefined in TeX
+
+\usepackage{alltt}   	% use "amsart" instead of "article" for AMSLaTeX format
+%\usepackage{geometry}                		% See geometry.pdf to learn the layout options. There are lots.
+%\geometry{letterpaper}                   		% ... or a4paper or a5paper or ... 
+%\geometry{landscape}                		% Activate for for rotated page geometry
+%\usepackage[parfill]{parskip}    		% Activate to begin paragraphs with an empty line rather than an indent
+%\usepackage{graphicx}				% Use pdf, png, jpg, or eps with pdflatex; use eps in DVI mode
+								% TeX will automatically convert eps --> pdf in pdflatex		
+%\usepackage{amssymb}
+
+\usepackage[utf8]{inputenc}
+%\usepackage[cyr]{aeguill}
+%\usepackage[francais]{babel}
+%\usepackage{hyperref}
+
+
+\title{Positive selection on genes interacting with SARS-Cov2, comparison of different analysis}
+\author{Marie Cariou}
+\date{Janvier 2021}							% Activate to display a given date or no date
+\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
+\begin{document}
+\maketitle
+
+\tableofcontents
+
+\newpage
+
+\section{Data}
+
+Analysis were formatted by the script covid\_comp\_script0\_table.Rnw.
+
+
+\begin{knitrout}
+\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
+\begin{alltt}
+\hlstd{workdir}\hlkwb{<-}\hlstr{"/home/adminmarie/Documents/CIRI_BIBS_projects/2020_05_Etienne_covid/"}
+
+\hlstd{tab}\hlkwb{<-}\hlkwd{read.delim}\hlstd{(}\hlkwd{paste0}\hlstd{(workdir,}
+  \hlstr{"covid_comp/covid_comp_complete.txt"}\hlstd{),} \hlkwc{h}\hlstd{=T,} \hlkwc{sep}\hlstd{=}\hlstr{"\textbackslash{}t"}\hlstd{)}
+\hlkwd{dim}\hlstd{(tab)}
+\end{alltt}
+\begin{verbatim}
+## [1] 333 161
+\end{verbatim}
+\end{kframe}
+\end{knitrout}
+
+
+\section{Comparison of dataset}
+
+\subsection{Data}
+
+\begin{knitrout}
+\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
+\begin{alltt}
+\hlstd{tmp}\hlkwb{<-}\hlkwd{na.omit}\hlstd{(tab[,}\hlkwd{c}\hlstd{(}\hlstr{"Gene.name"}\hlstd{,} \hlstr{"bats_BUSTED"}\hlstd{,} \hlstr{"bats_BppM1M2"}\hlstd{,} \hlstr{"bats_BppM7M8"}\hlstd{,}
+    \hlstr{"bats_codemlM1M2"}\hlstd{,} \hlstr{"bats_codemlM7M8"}\hlstd{,} \hlstr{"dginn.primate_codemlM1M2"}\hlstd{,}
+    \hlstr{"dginn.primate_codemlM7M8"}\hlstd{,} \hlstr{"dginn.primate_BppM1M2"}\hlstd{,}
+    \hlstr{"dginn.primate_BppM7M8"}\hlstd{,} \hlstr{"dginn.primate_BUSTED"}\hlstd{)])}
+\hlkwd{dim}\hlstd{(tmp)}
+\end{alltt}
+\begin{verbatim}
+## [1] 206  11
+\end{verbatim}
+\end{kframe}
+\end{knitrout}
+\subsection{Mondrian}
+
+\begin{knitrout}
+\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
+\begin{alltt}
+\hlkwd{library}\hlstd{(Mondrian)}
+
+\hlstd{monddata}\hlkwb{<-}\hlkwd{as.data.frame}\hlstd{(tmp}\hlopt{$}\hlstd{Gene.name)}
+
+\hlstd{batstmp}\hlkwb{<-}\hlkwd{rowSums}\hlstd{(}\hlkwd{cbind}\hlstd{(tmp}\hlopt{$}\hlstd{bats_codemlM1M2}\hlopt{==}\hlstr{"Y"}\hlstd{, tmp}\hlopt{$}\hlstd{bats_codemlM7M8}\hlopt{==}\hlstr{"Y"}\hlstd{,}
+\hlstd{tmp}\hlopt{$}\hlstd{bats_BppM1M2}\hlopt{==}\hlstr{"Y"}\hlstd{, tmp}\hlopt{$}\hlstd{bats_BppM7M8}\hlopt{==}\hlstr{"Y"}\hlstd{, tmp}\hlopt{$}\hlstd{bats_BUSTED}\hlopt{==}\hlstr{"Y"}\hlstd{))}
+
+\hlstd{primatetmp}\hlkwb{<-}\hlkwd{rowSums}\hlstd{(}\hlkwd{cbind}\hlstd{(tmp}\hlopt{$}\hlstr{"dginn.primate_codemlM1M2"}\hlopt{==}\hlstr{"Y"}\hlstd{,}
+  \hlstd{tmp}\hlopt{$}\hlstr{"dginn.primat_codemlM7M8"}\hlopt{==}\hlstr{"Y"}\hlstd{, tmp}\hlopt{$}\hlstr{"dginn.primate_BppM1M2"}\hlopt{==}\hlstr{"Y"}\hlstd{,}
+  \hlstd{tmp}\hlopt{$}\hlstr{"dginn.primate_BppM7M8"}\hlopt{==}\hlstr{"Y"}\hlstd{, tmp}\hlopt{$}\hlstr{"dginn.primate_BUSTED"}\hlopt{==}\hlstr{"Y"}\hlstd{))}
+
+\hlstd{monddata}\hlopt{$}\hlstd{bats_dginn3}\hlkwb{<-}\hlkwd{ifelse}\hlstd{(batstmp}\hlopt{>=}\hlnum{3}\hlstd{,} \hlnum{1}\hlstd{,}\hlnum{0}\hlstd{)}
+\hlstd{monddata}\hlopt{$}\hlstd{primate_dginn3}\hlkwb{<-}\hlkwd{ifelse}\hlstd{(primatetmp}\hlopt{>=}\hlnum{3}\hlstd{,} \hlnum{1}\hlstd{,}\hlnum{0}\hlstd{)}
+\hlstd{monddata}\hlopt{$}\hlstd{bats_dginn4}\hlkwb{<-}\hlkwd{ifelse}\hlstd{(batstmp}\hlopt{>=}\hlnum{4}\hlstd{,} \hlnum{1}\hlstd{,}\hlnum{0}\hlstd{)}
+\hlstd{monddata}\hlopt{$}\hlstd{primate_dginn4}\hlkwb{<-}\hlkwd{ifelse}\hlstd{(primatetmp}\hlopt{>=}\hlnum{4}\hlstd{,} \hlnum{1}\hlstd{,}\hlnum{0}\hlstd{)}
+
+\hlkwd{mondrian}\hlstd{(monddata[,}\hlnum{2}\hlopt{:}\hlnum{3}\hlstd{],} \hlkwc{labels}\hlstd{=}\hlkwd{c}\hlstd{(}\hlstr{"DGINN bats >3"}\hlstd{,} \hlstr{"DGINN primate >3"}\hlstd{))}
+\end{alltt}
+\end{kframe}
+\includegraphics[width=\maxwidth]{figure/mondrianbats-1} 
+\begin{kframe}\begin{alltt}
+\hlkwd{mondrian}\hlstd{(monddata[,}\hlnum{4}\hlopt{:}\hlnum{5}\hlstd{],} \hlkwc{labels}\hlstd{=}\hlkwd{c}\hlstd{(}\hlstr{"DGINN bats >4"}\hlstd{,} \hlstr{"DGINN primate >4"}\hlstd{))}
+\end{alltt}
+\end{kframe}
+\includegraphics[width=\maxwidth]{figure/mondrianbats-2} 
+
+\end{knitrout}
+
+\subsection{subsetR}
+
+\begin{knitrout}
+\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
+\begin{alltt}
+\hlkwd{library}\hlstd{(UpSetR)}
+
+\hlkwd{upset}\hlstd{(monddata,} \hlkwc{nsets} \hlstd{=} \hlnum{4}\hlstd{,} \hlkwc{matrix.color} \hlstd{=} \hlstr{"#DC267F"}\hlstd{,}
+\hlkwc{main.bar.color} \hlstd{=} \hlstr{"#648FFF"}\hlstd{,} \hlkwc{sets.bar.color} \hlstd{=} \hlstr{"#FE6100"}\hlstd{)}
+\end{alltt}
+\end{kframe}
+\includegraphics[width=\maxwidth]{figure/subsetbats-1} 
+\begin{kframe}\begin{alltt}
+\hlkwd{upset}\hlstd{(monddata[,}\hlnum{1}\hlopt{:}\hlnum{3}\hlstd{],} \hlkwc{nsets} \hlstd{=} \hlnum{2}\hlstd{,} \hlkwc{matrix.color} \hlstd{=} \hlstr{"#DC267F"}\hlstd{,}
+\hlkwc{main.bar.color} \hlstd{=} \hlstr{"#648FFF"}\hlstd{,} \hlkwc{sets.bar.color} \hlstd{=} \hlstr{"#FE6100"}\hlstd{)}
+\end{alltt}
+\end{kframe}
+\includegraphics[width=\maxwidth]{figure/subsetbats-2} 
+\begin{kframe}\begin{alltt}
+\hlkwd{upset}\hlstd{(monddata[,}\hlkwd{c}\hlstd{(}\hlnum{1}\hlstd{,}\hlnum{4}\hlstd{,}\hlnum{5}\hlstd{)],} \hlkwc{nsets} \hlstd{=} \hlnum{2}\hlstd{,} \hlkwc{matrix.color} \hlstd{=} \hlstr{"#DC267F"}\hlstd{,}
+\hlkwc{main.bar.color} \hlstd{=} \hlstr{"#648FFF"}\hlstd{,} \hlkwc{sets.bar.color} \hlstd{=} \hlstr{"#FE6100"}\hlstd{)}
+\end{alltt}
+\end{kframe}
+\includegraphics[width=\maxwidth]{figure/subsetbats-3} 
+
+\end{knitrout}
+
+\section{Which are these genes?}
+
+\subsection{Gene under positive selection in both bats and primates}
+
+4 methods:
+
+\begin{knitrout}
+\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
+\begin{alltt}
+\hlstd{monddata[monddata}\hlopt{$}\hlstd{bats_dginn4}\hlopt{==}\hlnum{1} \hlopt{&} \hlstd{monddata}\hlopt{$}\hlstd{primate_dginn4}\hlopt{==}\hlnum{1}\hlstd{,]}
+\end{alltt}
+\begin{verbatim}
+##     tmp$Gene.name bats_dginn3 primate_dginn3 bats_dginn4 primate_dginn4
+## 4           ACADM           1              1           1              1
+## 73            GGH           1              1           1              1
+## 78         GOLGA7           1              1           1              1
+## 89            IDE           1              1           1              1
+## 94          ITGB1           1              1           1              1
+## 132         POLA1           1              1           1              1
+## 188      TOR1AIP1           1              1           1              1
+## 201         VPS39           1              1           1              1
+\end{verbatim}
+\end{kframe}
+\end{knitrout}
+
+3 methods:
+
+\begin{knitrout}
+\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
+\begin{alltt}
+\hlstd{monddata[monddata}\hlopt{$}\hlstd{bats_dginn3}\hlopt{==}\hlnum{1} \hlopt{&} \hlstd{monddata}\hlopt{$}\hlstd{primate_dginn3}\hlopt{==}\hlnum{1}\hlstd{,]}
+\end{alltt}
+\begin{verbatim}
+##     tmp$Gene.name bats_dginn3 primate_dginn3 bats_dginn4 primate_dginn4
+## 4           ACADM           1              1           1              1
+## 20       CDK5RAP2           1              1           0              1
+## 48          EDEM3           1              1           1              0
+## 73            GGH           1              1           1              1
+## 78         GOLGA7           1              1           1              1
+## 89            IDE           1              1           1              1
+## 94          ITGB1           1              1           1              1
+## 97          LMAN2           1              1           1              0
+## 132         POLA1           1              1           1              1
+## 164       SLC27A2           1              1           1              0
+## 188      TOR1AIP1           1              1           1              1
+## 201         VPS39           1              1           1              1
+\end{verbatim}
+\end{kframe}
+\end{knitrout}
+
+
+\subsection{Gene under positive selection only in primates}
+
+4 methods:
+
+\begin{knitrout}
+\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
+\begin{alltt}
+\hlstd{monddata[monddata}\hlopt{$}\hlstd{bats_dginn4}\hlopt{==}\hlnum{0} \hlopt{&} \hlstd{monddata}\hlopt{$}\hlstd{primate_dginn4}\hlopt{==}\hlnum{1}\hlstd{,]}
+\end{alltt}
+\begin{verbatim}
+##     tmp$Gene.name bats_dginn3 primate_dginn3 bats_dginn4 primate_dginn4
+## 20       CDK5RAP2           1              1           0              1
+## 26          CEP68           0              1           0              1
+## 50           EMC1           0              1           0              1
+## 68          FYCO1           0              1           0              1
+## 83         HECTD1           0              1           0              1
+## 108        MYCBP2           0              1           0              1
+## 160       SEPSECS           0              1           0              1
+## 204        ZNF318           0              1           0              1
+\end{verbatim}
+\end{kframe}
+\end{knitrout}
+
+3 methods:
+
+\begin{knitrout}
+\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
+\begin{alltt}
+\hlstd{monddata[monddata}\hlopt{$}\hlstd{bats_dginn3}\hlopt{==}\hlnum{0} \hlopt{&} \hlstd{monddata}\hlopt{$}\hlstd{primate_dginn3}\hlopt{==}\hlnum{1}\hlstd{,]}
+\end{alltt}
+\begin{verbatim}
+##     tmp$Gene.name bats_dginn3 primate_dginn3 bats_dginn4 primate_dginn4
+## 23         CEP135           0              1           0              0
+## 26          CEP68           0              1           0              1
+## 32          CLIP4           0              1           0              0
+## 33          CNTRL           0              1           0              0
+## 45           DPH5           0              1           0              0
+## 50           EMC1           0              1           0              1
+## 68          FYCO1           0              1           0              1
+## 74         GIGYF2           0              1           0              0
+## 75            GLA           0              1           0              0
+## 79         GOLGB1           0              1           0              0
+## 83         HECTD1           0              1           0              1
+## 95          LARP1           0              1           0              0
+## 108        MYCBP2           0              1           0              1
+## 111        NDUFB9           0              1           0              0
+## 138       PRKAR2A           0              1           0              0
+## 153         RIPK1           0              1           0              0
+## 156         SAAL1           0              1           0              0
+## 160       SEPSECS           0              1           0              1
+## 162         SIRT5           0              1           0              0
+## 163      SLC25A21           0              1           0              0
+## 185       TMEM39B           0              1           0              0
+## 191       TUBGCP2           0              1           0              0
+## 194         UBAP2           0              1           0              0
+## 197         UGGT2           0              1           0              0
+## 199         USP54           0              1           0              0
+## 204        ZNF318           0              1           0              1
+\end{verbatim}
+\end{kframe}
+\end{knitrout}
+
+
+\subsection{Gene under positive selection only in bats}
+
+4 methods:
+
+\begin{knitrout}
+\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
+\begin{alltt}
+\hlstd{monddata[monddata}\hlopt{$}\hlstd{bats_dginn4}\hlopt{==}\hlnum{1} \hlopt{&} \hlstd{monddata}\hlopt{$}\hlstd{primate_dginn4}\hlopt{==}\hlnum{0}\hlstd{,]}
+\end{alltt}
+\begin{verbatim}
+##     tmp$Gene.name bats_dginn3 primate_dginn3 bats_dginn4 primate_dginn4
+## 48          EDEM3           1              1           1              0
+## 52         ERGIC1           1              0           1              0
+## 91         IMPDH2           1              0           1              0
+## 92          INHBE           1              0           1              0
+## 97          LMAN2           1              1           1              0
+## 164       SLC27A2           1              1           1              0
+## 166       SLC44A2           1              0           1              0
+## 177          TBK1           1              0           1              0
+\end{verbatim}
+\end{kframe}
+\end{knitrout}
+
+3 methods:
+
+\begin{knitrout}
+\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
+\begin{alltt}
+\hlstd{monddata[monddata}\hlopt{$}\hlstd{bats_dginn3}\hlopt{==}\hlnum{1} \hlopt{&} \hlstd{monddata}\hlopt{$}\hlstd{primate_dginn3}\hlopt{==}\hlnum{0}\hlstd{,]}
+\end{alltt}
+\begin{verbatim}
+##     tmp$Gene.name bats_dginn3 primate_dginn3 bats_dginn4 primate_dginn4
+## 7            AGPS           1              0           0              0
+## 52         ERGIC1           1              0           1              0
+## 81        GRIPAP1           1              0           0              0
+## 82         GRPEL1           1              0           0              0
+## 91         IMPDH2           1              0           1              0
+## 92          INHBE           1              0           1              0
+## 104         MOV10           1              0           0              0
+## 120        NUP214           1              0           0              0
+## 136         PRIM1           1              0           0              0
+## 165       SLC30A9           1              0           0              0
+## 166       SLC44A2           1              0           1              0
+## 177          TBK1           1              0           1              0
+\end{verbatim}
+\end{kframe}
+\end{knitrout}
+
+\subsection{Figure tableau}
+
+\begin{knitrout}
+\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
+\begin{alltt}
+\hlstd{tablo}\hlkwb{<-}\hlkwd{as.data.frame}\hlstd{(tmp}\hlopt{$}\hlstd{Gene.name)}
+\hlstd{tablo}\hlopt{$}\hlstd{nbats}\hlkwb{<-}\hlstd{batstmp}
+\hlstd{tablo}\hlopt{$}\hlstd{nprimates}\hlkwb{<-}\hlstd{primatetmp}
+
+\hlkwd{plot}\hlstd{(}\hlkwa{NULL}\hlstd{,} \hlkwc{xlim}\hlstd{=}\hlkwd{c}\hlstd{(}\hlopt{-}\hlnum{0.5}\hlstd{,}\hlnum{5.5}\hlstd{),} \hlkwc{ylim}\hlstd{=}\hlkwd{c}\hlstd{(}\hlopt{-}\hlnum{3}\hlstd{,}\hlnum{5.5}\hlstd{),} \hlkwc{xlab}\hlstd{=}\hlstr{"bats"}\hlstd{,} \hlkwc{ylab}\hlstd{=}\hlstr{"primates"}\hlstd{,} \hlkwc{main}\hlstd{=}\hlstr{"Genes supported by x,y methods in bats and primates"}\hlstd{,} \hlkwc{bty}\hlstd{=}\hlstr{"n"}\hlstd{,} \hlkwc{xaxt}\hlstd{=}\hlstr{"n"}\hlstd{,} \hlkwc{yaxt}\hlstd{=}\hlstr{"n"}\hlstd{)}
+
+\hlkwd{text}\hlstd{(}\hlkwc{x}\hlstd{=}\hlkwd{rep}\hlstd{(}\hlopt{-}\hlnum{0.6}\hlstd{,} \hlnum{6}\hlstd{),} \hlkwc{y}\hlstd{=}\hlnum{0}\hlopt{:}\hlnum{5}\hlstd{,} \hlnum{0}\hlopt{:}\hlnum{5}\hlstd{)}
+\hlkwd{text}\hlstd{(}\hlkwc{y}\hlstd{=}\hlkwd{rep}\hlstd{(}\hlopt{-}\hlnum{0.65}\hlstd{,} \hlnum{6}\hlstd{),} \hlkwc{x}\hlstd{=}\hlnum{0}\hlopt{:}\hlnum{5}\hlstd{,} \hlnum{0}\hlopt{:}\hlnum{5}\hlstd{)}
+\hlkwd{sapply}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlkwc{from}\hlstd{=}\hlopt{-}\hlnum{0.5}\hlstd{,} \hlkwc{to}\hlstd{=}\hlnum{5.5}\hlstd{,} \hlkwc{by}\hlstd{=}\hlnum{1}\hlstd{),} \hlkwa{function}\hlstd{(}\hlkwc{x}\hlstd{)\{}
+  \hlkwd{segments}\hlstd{(}\hlkwc{x0}\hlstd{=x,} \hlkwc{x1}\hlstd{=x,} \hlkwc{y0}\hlstd{=}\hlopt{-}\hlnum{0.5}\hlstd{,} \hlkwc{y1}\hlstd{=}\hlnum{5.5}\hlstd{)}
+\hlstd{\})}
+\end{alltt}
+\begin{verbatim}
+## [[1]]
+## NULL
+## 
+## [[2]]
+## NULL
+## 
+## [[3]]
+## NULL
+## 
+## [[4]]
+## NULL
+## 
+## [[5]]
+## NULL
+## 
+## [[6]]
+## NULL
+## 
+## [[7]]
+## NULL
+\end{verbatim}
+\begin{alltt}
+\hlkwd{sapply}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlkwc{from}\hlstd{=}\hlopt{-}\hlnum{0.5}\hlstd{,} \hlkwc{to}\hlstd{=}\hlnum{5.5}\hlstd{,} \hlkwc{by}\hlstd{=}\hlnum{1}\hlstd{),} \hlkwa{function}\hlstd{(}\hlkwc{x}\hlstd{)\{}
+  \hlkwd{segments}\hlstd{(}\hlkwc{x0}\hlstd{=}\hlopt{-}\hlnum{0.5}\hlstd{,} \hlkwc{x1}\hlstd{=}\hlnum{5.5}\hlstd{,} \hlkwc{y0}\hlstd{=x,} \hlkwc{y1}\hlstd{=x)}
+\hlstd{\})}
+\end{alltt}
+\begin{verbatim}
+## [[1]]
+## NULL
+## 
+## [[2]]
+## NULL
+## 
+## [[3]]
+## NULL
+## 
+## [[4]]
+## NULL
+## 
+## [[5]]
+## NULL
+## 
+## [[6]]
+## NULL
+## 
+## [[7]]
+## NULL
+\end{verbatim}
+\begin{alltt}
+\hlkwa{for} \hlstd{(p} \hlkwa{in} \hlnum{0}\hlopt{:}\hlnum{5}\hlstd{)\{}
+  \hlkwa{for} \hlstd{(b} \hlkwa{in} \hlnum{0}\hlopt{:}\hlnum{5}\hlstd{)\{}
+    \hlstd{tmp}\hlkwb{<-}\hlstd{tablo}\hlopt{$}\hlstd{`tmp$Gene.name`[tablo}\hlopt{$}\hlstd{nbats}\hlopt{==}\hlstd{b} \hlopt{&} \hlstd{tablo}\hlopt{$}\hlstd{nprimates}\hlopt{==}\hlstd{p]}
+    \hlkwa{if}\hlstd{(}\hlkwd{length}\hlstd{(tmp)}\hlopt{>}\hlnum{0} \hlopt{&} \hlkwd{length}\hlstd{(tmp)}\hlopt{<}\hlnum{8}\hlstd{)\{}
+      \hlkwd{text}\hlstd{(b,}\hlkwd{seq}\hlstd{(}\hlkwc{from}\hlstd{=(p}\hlopt{-}\hlnum{0.4}\hlstd{),} \hlkwc{to}\hlstd{=(p}\hlopt{+}\hlnum{0.4}\hlstd{),} \hlkwc{length.out} \hlstd{=} \hlkwd{length}\hlstd{(tmp)), tmp,} \hlkwc{cex}\hlstd{=}\hlnum{0.4}\hlstd{)}
+    \hlstd{\}}\hlkwa{else if} \hlstd{(}\hlkwd{length}\hlstd{(tmp)}\hlopt{>}\hlnum{8} \hlopt{&} \hlkwd{length}\hlstd{(tmp)}\hlopt{<}\hlnum{16}\hlstd{)\{}
+      \hlkwd{print}\hlstd{(}\hlkwd{c}\hlstd{(p, b))}
+      \hlkwd{text}\hlstd{((b}\hlopt{-}\hlnum{0.3}\hlstd{),}\hlkwd{seq}\hlstd{(}\hlkwc{from}\hlstd{=(p}\hlopt{-}\hlnum{0.4}\hlstd{),} \hlkwc{to}\hlstd{=(p}\hlopt{+}\hlnum{0.4}\hlstd{),} \hlkwc{length.out} \hlstd{=} \hlnum{8}\hlstd{), tmp[}\hlnum{1}\hlopt{:}\hlnum{8}\hlstd{],} \hlkwc{cex}\hlstd{=}\hlnum{0.4}\hlstd{)}
+      \hlkwd{text}\hlstd{((b}\hlopt{+}\hlnum{0.3}\hlstd{),}\hlkwd{seq}\hlstd{(}\hlkwc{from}\hlstd{=(p}\hlopt{-}\hlnum{0.4}\hlstd{),} \hlkwc{to}\hlstd{=(p}\hlopt{+}\hlnum{0.4}\hlstd{),} \hlkwc{length.out} \hlstd{= (}\hlkwd{length}\hlstd{(tmp)}\hlopt{-}\hlnum{8}\hlstd{)), tmp[}\hlnum{9}\hlopt{:}\hlkwd{length}\hlstd{(tmp)],} \hlkwc{cex}\hlstd{=}\hlnum{0.4}\hlstd{)}
+    \hlstd{\}}\hlkwa{else if} \hlstd{(}\hlkwd{length}\hlstd{(tmp)}\hlopt{>}\hlnum{16}\hlstd{)\{}
+      \hlkwd{text}\hlstd{(b,p,} \hlkwd{paste0}\hlstd{(}\hlkwd{length}\hlstd{(tmp),} \hlstr{" values"}\hlstd{))}
+      \hlstd{\}}
+  \hlstd{\}}
+\hlstd{\}}
+\end{alltt}
+\begin{verbatim}
+## [1] 0 1
+## [1] 2 0
+## [1] 2 1
+## [1] 3 1
+\end{verbatim}
+\begin{alltt}
+\hlstd{tmp}\hlkwb{<-}\hlstd{tablo}\hlopt{$}\hlstd{`tmp$Gene.name`[tablo}\hlopt{$}\hlstd{nbats}\hlopt{==}\hlnum{0} \hlopt{&} \hlstd{tablo}\hlopt{$}\hlstd{nprimates}\hlopt{==}\hlnum{1}\hlstd{]}
+\hlkwd{text}\hlstd{(}\hlopt{-}\hlnum{0.4}\hlstd{,}\hlopt{-}\hlnum{1.2}\hlstd{,} \hlstr{"p=1/n=0"}\hlstd{,} \hlkwc{cex}\hlstd{=}\hlnum{0.6}\hlstd{)}
+\hlkwd{text}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlkwc{from}\hlstd{=}\hlnum{0.1}\hlstd{,} \hlkwc{to}\hlstd{=}\hlnum{5.5}\hlstd{,} \hlkwc{length.out} \hlstd{=} \hlnum{18}\hlstd{),}\hlopt{-}\hlnum{1.1}\hlstd{, tmp[}\hlnum{1}\hlopt{:}\hlnum{18}\hlstd{],} \hlkwc{cex}\hlstd{=}\hlnum{0.4}\hlstd{)}
+\hlkwd{text}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlkwc{from}\hlstd{=}\hlnum{0.1}\hlstd{,} \hlkwc{to}\hlstd{=}\hlnum{3}\hlstd{,} \hlkwc{length.out} \hlstd{=} \hlkwd{length}\hlstd{(tmp)}\hlopt{-}\hlnum{18}\hlstd{),}\hlopt{-}\hlnum{1.3}\hlstd{, tmp[}\hlnum{19}\hlopt{:}\hlkwd{length}\hlstd{(tmp)],} \hlkwc{cex}\hlstd{=}\hlnum{0.4}\hlstd{)}
+
+\hlstd{tmp}\hlkwb{<-}\hlstd{tablo}\hlopt{$}\hlstd{`tmp$Gene.name`[tablo}\hlopt{$}\hlstd{nbats}\hlopt{==}\hlnum{1} \hlopt{&} \hlstd{tablo}\hlopt{$}\hlstd{nprimates}\hlopt{==}\hlnum{1}\hlstd{]}
+\hlkwd{text}\hlstd{(}\hlopt{-}\hlnum{0.4}\hlstd{,}\hlopt{-}\hlnum{1.7}\hlstd{,} \hlstr{"p=1/n=1"}\hlstd{,} \hlkwc{cex}\hlstd{=}\hlnum{0.6}\hlstd{)}
+\hlkwd{text}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlkwc{from}\hlstd{=}\hlnum{0.1}\hlstd{,} \hlkwc{to}\hlstd{=}\hlnum{5.5}\hlstd{,} \hlkwc{length.out} \hlstd{=} \hlnum{18}\hlstd{),}\hlopt{-}\hlnum{1.6}\hlstd{, tmp[}\hlnum{1}\hlopt{:}\hlnum{18}\hlstd{],} \hlkwc{cex}\hlstd{=}\hlnum{0.4}\hlstd{)}
+\hlkwd{text}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlkwc{from}\hlstd{=}\hlnum{0.1}\hlstd{,} \hlkwc{to}\hlstd{=}\hlnum{2}\hlstd{,} \hlkwc{length.out} \hlstd{=} \hlkwd{length}\hlstd{(tmp)}\hlopt{-}\hlnum{18}\hlstd{),}\hlopt{-}\hlnum{1.8}\hlstd{, tmp[}\hlnum{19}\hlopt{:}\hlkwd{length}\hlstd{(tmp)],} \hlkwc{cex}\hlstd{=}\hlnum{0.4}\hlstd{)}
+
+
+\hlstd{tmp}\hlkwb{<-}\hlstd{tablo}\hlopt{$}\hlstd{`tmp$Gene.name`[tablo}\hlopt{$}\hlstd{nbats}\hlopt{==}\hlnum{0} \hlopt{&} \hlstd{tablo}\hlopt{$}\hlstd{nprimates}\hlopt{==}\hlnum{0}\hlstd{]}
+\hlkwd{text}\hlstd{(}\hlopt{-}\hlnum{0.4}\hlstd{,}\hlopt{-}\hlnum{2.2}\hlstd{,} \hlstr{"p=0/n=0"}\hlstd{,} \hlkwc{cex}\hlstd{=}\hlnum{0.6}\hlstd{)}
+\hlkwd{text}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlkwc{from}\hlstd{=}\hlnum{0.1}\hlstd{,} \hlkwc{to}\hlstd{=}\hlnum{5.5}\hlstd{,} \hlkwc{length.out} \hlstd{=} \hlnum{17}\hlstd{),}\hlopt{-}\hlnum{2.1}\hlstd{, tmp[}\hlnum{1}\hlopt{:}\hlnum{17}\hlstd{],} \hlkwc{cex}\hlstd{=}\hlnum{0.4}\hlstd{)}
+\hlkwd{text}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlkwc{from}\hlstd{=}\hlnum{0.1}\hlstd{,} \hlkwc{to}\hlstd{=}\hlnum{4.4}\hlstd{,} \hlkwc{length.out} \hlstd{=} \hlkwd{length}\hlstd{(tmp)}\hlopt{-}\hlnum{17}\hlstd{),}\hlopt{-}\hlnum{2.3}\hlstd{, tmp[}\hlnum{18}\hlopt{:}\hlkwd{length}\hlstd{(tmp)],} \hlkwc{cex}\hlstd{=}\hlnum{0.4}\hlstd{)}
+
+\hlstd{tmp}\hlkwb{<-}\hlstd{tablo}\hlopt{$}\hlstd{`tmp$Gene.name`[tablo}\hlopt{$}\hlstd{nbats}\hlopt{==}\hlnum{2} \hlopt{&} \hlstd{tablo}\hlopt{$}\hlstd{nprimates}\hlopt{==}\hlnum{0}\hlstd{]}
+\hlkwd{text}\hlstd{(}\hlopt{-}\hlnum{0.4}\hlstd{,}\hlopt{-}\hlnum{2.7}\hlstd{,} \hlstr{"p=0/n=2"}\hlstd{,} \hlkwc{cex}\hlstd{=}\hlnum{0.6}\hlstd{)}
+\hlkwd{text}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlkwc{from}\hlstd{=}\hlnum{0.1}\hlstd{,} \hlkwc{to}\hlstd{=}\hlnum{5.5}\hlstd{,} \hlkwc{length.out} \hlstd{=} \hlnum{18}\hlstd{),}\hlopt{-}\hlnum{2.6}\hlstd{, tmp[}\hlnum{1}\hlopt{:}\hlnum{18}\hlstd{],} \hlkwc{cex}\hlstd{=}\hlnum{0.4}\hlstd{)}
+\hlkwd{text}\hlstd{(}\hlkwd{seq}\hlstd{(}\hlkwc{from}\hlstd{=}\hlnum{0.1}\hlstd{,} \hlkwc{to}\hlstd{=}\hlnum{1}\hlstd{,} \hlkwc{length.out} \hlstd{=} \hlkwd{length}\hlstd{(tmp)}\hlopt{-}\hlnum{18}\hlstd{),}\hlopt{-}\hlnum{2.8}\hlstd{, tmp[}\hlnum{19}\hlopt{:}\hlkwd{length}\hlstd{(tmp)],} \hlkwc{cex}\hlstd{=}\hlnum{0.4}\hlstd{)}
+\end{alltt}
+\end{kframe}
+\includegraphics[width=\maxwidth]{figure/tablo-1} 
+
+\end{knitrout}
+
+\end{document}
+