<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\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&gt;\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 --&gt; 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{March 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{home}\hlkwb{&lt;-}\hlstr{"/home/adminmarie/Documents/"}
\hlstd{workdir}\hlkwb{&lt;-}\hlkwd{paste0}\hlstd{(home,} \hlstr{"CIRI_BIBS_projects/2020_05_Etienne_covid/"}\hlstd{)}

\hlstd{tab}\hlkwb{&lt;-}\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}
\end{kframe}
\end{knitrout}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlstd{home}\hlkwb{&lt;-}\hlstr{"/home/adminmarie/Documents/"}
\hlstd{workdir}\hlkwb{&lt;-}\hlkwd{paste0}\hlstd{(home,} \hlstr{"CIRI_BIBS_projects/2020_05_Etienne_covid/"}\hlstd{)}

\hlstd{tab}\hlkwb{&lt;-}\hlkwd{read.delim}\hlstd{(}\hlkwd{paste0}\hlstd{(workdir,}
  \hlstr{"covid_comp/covid_comp_alldginn.txt"}\hlstd{),} \hlkwc{h}\hlstd{=T,} \hlkwc{sep}\hlstd{=}\hlstr{"\textbackslash{}t"}\hlstd{)}
\hlkwd{dim}\hlstd{(tab)}
\end{alltt}
\begin{verbatim}
## [1] 442  56
\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{&lt;-}\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{)])}
\hlstd{col}\hlkwb{&lt;-}\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] 324  11
\end{verbatim}
\end{kframe}
\end{knitrout}

\subsection{Omega plot}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlstd{tab}\hlopt{$}\hlstd{dginn.primate_omegaM0Bpp[tab}\hlopt{$}\hlstd{dginn.primate_omegaM0Bpp}\hlopt{==}\hlstr{"na"}\hlstd{]}\hlkwb{&lt;-}\hlnum{NA}
\hlstd{x}\hlkwb{=}\hlkwd{as.numeric}\hlstd{(}\hlkwd{as.character}\hlstd{(}
  \hlstd{tab}\hlopt{$}\hlstd{dginn.primate_omegaM0Bpp[tab}\hlopt{$}\hlstd{status}\hlopt{==}\hlstr{"shared"}\hlstd{]))}

\hlstd{tab}\hlopt{$}\hlstd{bats_omegaM0Bpp[tab}\hlopt{$}\hlstd{bats_omegaM0Bpp}\hlopt{==}\hlstr{"na"}\hlstd{]}\hlkwb{&lt;-}\hlnum{NA}
\hlstd{y}\hlkwb{=}\hlkwd{as.numeric}\hlstd{(}\hlkwd{as.character}\hlstd{(}
  \hlstd{tab}\hlopt{$}\hlstd{bats_omegaM0Bpp[tab}\hlopt{$}\hlstd{status}\hlopt{==}\hlstr{"shared"}\hlstd{]))}

\hlkwd{names}\hlstd{(x)}\hlkwb{&lt;-}\hlstd{tab}\hlopt{$}\hlstd{Gene.name[tab}\hlopt{$}\hlstd{status}\hlopt{==}\hlstr{"shared"}\hlstd{]}

\hlkwd{plot}\hlstd{(x,y,} \hlkwc{xlab}\hlstd{=}\hlstr{"bpp omega primate"}\hlstd{,} \hlkwc{ylab}\hlstd{=}\hlstr{"bpp omega bats"}\hlstd{,} \hlkwc{cex}\hlstd{=}\hlnum{0.5}\hlstd{)}
\hlkwd{abline}\hlstd{(}\hlnum{0}\hlstd{,}\hlnum{1}\hlstd{)}
\hlkwd{abline}\hlstd{(}\hlkwd{lm}\hlstd{(y}\hlopt{~}\hlstd{x),} \hlkwc{col}\hlstd{=}\hlstr{"red"}\hlstd{)}

\hlkwd{text}\hlstd{(x[x}\hlopt{&gt;}\hlnum{0.5} \hlopt{&amp;}\hlstd{y}\hlopt{&lt;}\hlnum{0.4}\hlstd{], (y[x}\hlopt{&gt;}\hlnum{0.5} \hlopt{&amp;}\hlstd{y}\hlopt{&lt;}\hlnum{0.4}\hlstd{]}\hlopt{+}\hlnum{0.01}\hlstd{),}
     \hlkwd{names}\hlstd{(x)[x}\hlopt{&gt;}\hlnum{0.5} \hlopt{&amp;}\hlstd{y}\hlopt{&lt;}\hlnum{0.4}\hlstd{],} \hlkwc{cex}\hlstd{=}\hlnum{0.7}\hlstd{)}
\hlkwd{text}\hlstd{(x[x}\hlopt{&lt;}\hlnum{0.45} \hlopt{&amp;}\hlstd{y}\hlopt{&gt;}\hlnum{0.45}\hlstd{], (y[x}\hlopt{&lt;}\hlnum{0.45} \hlopt{&amp;}\hlstd{y}\hlopt{&gt;}\hlnum{0.45}\hlstd{]}\hlopt{+}\hlnum{0.01}\hlstd{),}
     \hlkwd{names}\hlstd{(x)[x}\hlopt{&lt;}\hlnum{0.45} \hlopt{&amp;}\hlstd{y}\hlopt{&gt;}\hlnum{0.45}\hlstd{],} \hlkwc{cex}\hlstd{=}\hlnum{0.7}\hlstd{)}
\hlkwd{text}\hlstd{(x[x}\hlopt{&gt;}\hlnum{0.45} \hlopt{&amp;}\hlstd{y}\hlopt{&gt;}\hlnum{0.4}\hlstd{], (y[x}\hlopt{&gt;}\hlnum{0.45} \hlopt{&amp;}\hlstd{y}\hlopt{&gt;}\hlnum{0.4}\hlstd{]}\hlopt{+}\hlnum{0.01}\hlstd{),}
     \hlkwd{names}\hlstd{(x)[x}\hlopt{&gt;}\hlnum{0.45} \hlopt{&amp;}\hlstd{y}\hlopt{&gt;}\hlnum{0.4}\hlstd{],} \hlkwc{cex}\hlstd{=}\hlnum{0.7}\hlstd{)}
\end{alltt}
\end{kframe}
\includegraphics[width=\maxwidth]{figure/unnamed-chunk-3-1} 

\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{&lt;-}\hlkwd{as.data.frame}\hlstd{(tmp}\hlopt{$}\hlstd{Gene.name)}

\hlstd{batstmp}\hlkwb{&lt;-}\hlkwd{rowSums}\hlstd{(}\hlkwd{cbind}\hlstd{(tmp}\hlopt{$}\hlstd{bats_codemlM1M2}\hlopt{==}\hlstr{"Y"}\hlstd{,}
                       \hlstd{tmp}\hlopt{$}\hlstd{bats_codemlM7M8}\hlopt{==}\hlstr{"Y"}\hlstd{,}
                       \hlstd{tmp}\hlopt{$}\hlstd{bats_BppM1M2}\hlopt{==}\hlstr{"Y"}\hlstd{,}
                       \hlstd{tmp}\hlopt{$}\hlstd{bats_BppM7M8}\hlopt{==}\hlstr{"Y"}\hlstd{,}
                       \hlstd{tmp}\hlopt{$}\hlstd{bats_BUSTED}\hlopt{==}\hlstr{"Y"}\hlstd{))}

\hlstd{primatetmp}\hlkwb{&lt;-}\hlkwd{rowSums}\hlstd{(}\hlkwd{cbind}\hlstd{(tmp}\hlopt{$}\hlstr{"dginn.primate_codemlM1M2"}\hlopt{==}\hlstr{"Y"}\hlstd{,}
                          \hlstd{tmp}\hlopt{$}\hlstr{"dginn.primate_codemlM7M8"}\hlopt{==}\hlstr{"Y"}\hlstd{,}
                          \hlstd{tmp}\hlopt{$}\hlstr{"dginn.primate_BppM1M2"}\hlopt{==}\hlstr{"Y"}\hlstd{,}
                          \hlstd{tmp}\hlopt{$}\hlstr{"dginn.primate_BppM7M8"}\hlopt{==}\hlstr{"Y"}\hlstd{,}
                          \hlstd{tmp}\hlopt{$}\hlstr{"dginn.primate_BUSTED"}\hlopt{==}\hlstr{"Y"}\hlstd{))}

\hlstd{monddata}\hlopt{$}\hlstd{bats_dginn3}\hlkwb{&lt;-}\hlkwd{ifelse}\hlstd{(batstmp}\hlopt{&gt;=}\hlnum{3}\hlstd{,} \hlnum{1}\hlstd{,}\hlnum{0}\hlstd{)}
\hlstd{monddata}\hlopt{$}\hlstd{primate_dginn3}\hlkwb{&lt;-}\hlkwd{ifelse}\hlstd{(primatetmp}\hlopt{&gt;=}\hlnum{3}\hlstd{,} \hlnum{1}\hlstd{,}\hlnum{0}\hlstd{)}
\hlstd{monddata}\hlopt{$}\hlstd{bats_dginn4}\hlkwb{&lt;-}\hlkwd{ifelse}\hlstd{(batstmp}\hlopt{&gt;=}\hlnum{4}\hlstd{,} \hlnum{1}\hlstd{,}\hlnum{0}\hlstd{)}
\hlstd{monddata}\hlopt{$}\hlstd{primate_dginn4}\hlkwb{&lt;-}\hlkwd{ifelse}\hlstd{(primatetmp}\hlopt{&gt;=}\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 &gt;3"}\hlstd{,} \hlstr{"DGINN primate &gt;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 &gt;4"}\hlstd{,} \hlstr{"DGINN primate &gt;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{&amp;} \hlstd{monddata}\hlopt{$}\hlstd{primate_dginn4}\hlopt{==}\hlnum{1}\hlstd{,]}
\end{alltt}
\begin{verbatim}
##     tmp$Gene.name bats_dginn3 primate_dginn3 bats_dginn4
## 6           ACADM           1              1           1
## 7            ACE2           1              1           1
## 109           GGH           1              1           1
## 117        GOLGA7           1              1           1
## 134           IDE           1              1           1
## 139         ITGB1           1              1           1
## 146         LMAN2           1              1           1
## 212         POLA1           1              1           1
## 264       SLC27A2           1              1           1
## 302      TOR1AIP1           1              1           1
## 315         VPS39           1              1           1
##     primate_dginn4
## 6                1
## 7                1
## 109              1
## 117              1
## 134              1
## 139              1
## 146              1
## 212              1
## 264              1
## 302              1
## 315              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{&amp;} \hlstd{monddata}\hlopt{$}\hlstd{primate_dginn3}\hlopt{==}\hlnum{1}\hlstd{,]}
\end{alltt}
\begin{verbatim}
##     tmp$Gene.name bats_dginn3 primate_dginn3 bats_dginn4
## 6           ACADM           1              1           1
## 7            ACE2           1              1           1
## 9           ADAM9           1              1           0
## 34       CDK5RAP2           1              1           0
## 71          EDEM3           1              1           1
## 109           GGH           1              1           1
## 117        GOLGA7           1              1           1
## 134           IDE           1              1           1
## 139         ITGB1           1              1           1
## 146         LMAN2           1              1           1
## 157        MIPOL1           1              1           0
## 159         MOV10           1              1           0
## 212         POLA1           1              1           1
## 239      RAP1GDS1           1              1           1
## 257        SCCPDH           1              1           0
## 264       SLC27A2           1              1           1
## 302      TOR1AIP1           1              1           1
## 315         VPS39           1              1           1
##     primate_dginn4
## 6                1
## 7                1
## 9                0
## 34               1
## 71               0
## 109              1
## 117              1
## 134              1
## 139              1
## 146              1
## 157              1
## 159              0
## 212              1
## 239              0
## 257              0
## 264              1
## 302              1
## 315              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{&amp;} \hlstd{monddata}\hlopt{$}\hlstd{primate_dginn4}\hlopt{==}\hlnum{1}\hlstd{,]}
\end{alltt}
\begin{verbatim}
##     tmp$Gene.name bats_dginn3 primate_dginn3 bats_dginn4
## 31           BRD4           0              1           0
## 34       CDK5RAP2           1              1           0
## 37         CEP135           0              1           0
## 40          CEP68           0              1           0
## 47          CLIP4           0              1           0
## 67          DNMT1           0              1           0
## 68           DPH5           0              1           0
## 75           EMC1           0              1           0
## 80          ERO1B           0              1           0
## 101         FYCO1           0              1           0
## 105          GCC2           0              1           0
## 110         GHITM           0              1           0
## 111        GIGYF2           0              1           0
## 112           GLA           0              1           0
## 127        HECTD1           0              1           0
## 143         LARP1           0              1           0
## 144        LARP4B           0              1           0
## 150         MARK1           0              1           0
## 157        MIPOL1           1              1           0
## 160     MPHOSPH10           0              1           0
## 166        MYCBP2           0              1           0
## 171       NDUFAF2           0              1           0
## 172        NDUFB9           0              1           0
## 187         NUP58           0              1           0
## 195          PCNT           0              1           0
## 218         PRIM2           0              1           0
## 220       PRKAR2A           0              1           0
## 227           PVR           0              1           0
## 245         REEP6           0              1           0
## 248         RIPK1           0              1           0
## 253         SAAL1           0              1           0
## 260       SEPSECS           0              1           0
## 262         SIRT5           0              1           0
## 263      SLC25A21           0              1           0
## 297       TMEM39B           0              1           0
## 299       TMPRSS2           0              1           0
## 305       TUBGCP2           0              1           0
## 308         UBAP2           0              1           0
## 311         UGGT2           0              1           0
## 322        ZNF318           0              1           0
##     primate_dginn4
## 31               1
## 34               1
## 37               1
## 40               1
## 47               1
## 67               1
## 68               1
## 75               1
## 80               1
## 101              1
## 105              1
## 110              1
## 111              1
## 112              1
## 127              1
## 143              1
## 144              1
## 150              1
## 157              1
## 160              1
## 166              1
## 171              1
## 172              1
## 187              1
## 195              1
## 218              1
## 220              1
## 227              1
## 245              1
## 248              1
## 253              1
## 260              1
## 262              1
## 263              1
## 297              1
## 299              1
## 305              1
## 308              1
## 311              1
## 322              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{&amp;} \hlstd{monddata}\hlopt{$}\hlstd{primate_dginn3}\hlopt{==}\hlnum{1}\hlstd{,]}
\end{alltt}
\begin{verbatim}
##     tmp$Gene.name bats_dginn3 primate_dginn3 bats_dginn4
## 19          AP2A2           0              1           0
## 23           ATE1           0              1           0
## 31           BRD4           0              1           0
## 32           BZW2           0              1           0
## 37         CEP135           0              1           0
## 40          CEP68           0              1           0
## 47          CLIP4           0              1           0
## 48          CNTRL           0              1           0
## 67          DNMT1           0              1           0
## 68           DPH5           0              1           0
## 72         EIF4E2           0              1           0
## 75           EMC1           0              1           0
## 80          ERO1B           0              1           0
## 83         EXOSC2           0              1           0
## 101         FYCO1           0              1           0
## 105          GCC2           0              1           0
## 110         GHITM           0              1           0
## 111        GIGYF2           0              1           0
## 112           GLA           0              1           0
## 118        GOLGB1           0              1           0
## 119       GORASP1           0              1           0
## 125         HDAC2           0              1           0
## 127        HECTD1           0              1           0
## 131        HS6ST2           0              1           0
## 143         LARP1           0              1           0
## 144        LARP4B           0              1           0
## 145         LARP7           0              1           0
## 150         MARK1           0              1           0
## 154          MDN1           0              1           0
## 160     MPHOSPH10           0              1           0
## 164         MRPS5           0              1           0
## 166        MYCBP2           0              1           0
## 168         NAT14           0              1           0
## 171       NDUFAF2           0              1           0
## 172        NDUFB9           0              1           0
## 176         NGLY1           0              1           0
## 181          NPC2           0              1           0
## 187         NUP58           0              1           0
## 195          PCNT           0              1           0
## 202        PITRM1           0              1           0
## 204          PLAT           0              1           0
## 208         PLOD2           0              1           0
## 210         PMPCB           0              1           0
## 214           POR           0              1           0
## 218         PRIM2           0              1           0
## 220       PRKAR2A           0              1           0
## 224         PTBP2           0              1           0
## 227           PVR           0              1           0
## 230         RAB14           0              1           0
## 232         RAB1A           0              1           0
## 233         RAB2A           0              1           0
## 242          RBX1           0              1           0
## 245         REEP6           0              1           0
## 248         RIPK1           0              1           0
## 250         RPL36           0              1           0
## 253         SAAL1           0              1           0
## 260       SEPSECS           0              1           0
## 262         SIRT5           0              1           0
## 263      SLC25A21           0              1           0
## 278          STOM           0              1           0
## 291        TIMM8B           0              1           0
## 297       TMEM39B           0              1           0
## 299       TMPRSS2           0              1           0
## 303        TRIM59           0              1           0
## 304         TRMT1           0              1           0
## 305       TUBGCP2           0              1           0
## 308         UBAP2           0              1           0
## 311         UGGT2           0              1           0
## 313         USP54           0              1           0
## 322        ZNF318           0              1           0
##     primate_dginn4
## 19               0
## 23               0
## 31               1
## 32               0
## 37               1
## 40               1
## 47               1
## 48               0
## 67               1
## 68               1
## 72               0
## 75               1
## 80               1
## 83               0
## 101              1
## 105              1
## 110              1
## 111              1
## 112              1
## 118              0
## 119              0
## 125              0
## 127              1
## 131              0
## 143              1
## 144              1
## 145              0
## 150              1
## 154              0
## 160              1
## 164              0
## 166              1
## 168              0
## 171              1
## 172              1
## 176              0
## 181              0
## 187              1
## 195              1
## 202              0
## 204              0
## 208              0
## 210              0
## 214              0
## 218              1
## 220              1
## 224              0
## 227              1
## 230              0
## 232              0
## 233              0
## 242              0
## 245              1
## 248              1
## 250              0
## 253              1
## 260              1
## 262              1
## 263              1
## 278              0
## 291              0
## 297              1
## 299              1
## 303              0
## 304              0
## 305              1
## 308              1
## 311              1
## 313              0
## 322              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{&amp;} \hlstd{monddata}\hlopt{$}\hlstd{primate_dginn4}\hlopt{==}\hlnum{0}\hlstd{,]}
\end{alltt}
\begin{verbatim}
##     tmp$Gene.name bats_dginn3 primate_dginn3 bats_dginn4
## 14          AKAP9           1              0           1
## 26        ATP6AP1           1              0           1
## 44          CISD3           1              0           1
## 71          EDEM3           1              1           1
## 77         ERGIC1           1              0           1
## 136        IMPDH2           1              0           1
## 137         INHBE           1              0           1
## 231         RAB18           1              0           1
## 239      RAP1GDS1           1              1           1
## 268       SLC44A2           1              0           1
## 284          TBK1           1              0           1
##     primate_dginn4
## 14               0
## 26               0
## 44               0
## 71               0
## 77               0
## 136              0
## 137              0
## 231              0
## 239              0
## 268              0
## 284              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{&amp;} \hlstd{monddata}\hlopt{$}\hlstd{primate_dginn3}\hlopt{==}\hlnum{0}\hlstd{,]}
\end{alltt}
\begin{verbatim}
##     tmp$Gene.name bats_dginn3 primate_dginn3 bats_dginn4
## 5           ACAD9           1              0           0
## 11           AGPS           1              0           0
## 14          AKAP9           1              0           1
## 26        ATP6AP1           1              0           1
## 44          CISD3           1              0           1
## 49         COL6A1           1              0           0
## 77         ERGIC1           1              0           1
## 122       GRIPAP1           1              0           0
## 123        GRPEL1           1              0           0
## 136        IMPDH2           1              0           1
## 137         INHBE           1              0           1
## 151         MARK2           1              0           0
## 185        NUP214           1              0           0
## 217         PRIM1           1              0           0
## 226         PUSL1           1              0           0
## 231         RAB18           1              0           1
## 267       SLC30A9           1              0           0
## 268       SLC44A2           1              0           1
## 269      SLC9A3R1           1              0           0
## 284          TBK1           1              0           1
##     primate_dginn4
## 5                0
## 11               0
## 14               0
## 26               0
## 44               0
## 49               0
## 77               0
## 122              0
## 123              0
## 136              0
## 137              0
## 151              0
## 185              0
## 217              0
## 226              0
## 231              0
## 267              0
## 268              0
## 269              0
## 284              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{&lt;-}\hlkwd{as.data.frame}\hlstd{(tmp}\hlopt{$}\hlstd{Gene.name)}
\hlstd{tablo}\hlopt{$}\hlstd{nbats}\hlkwb{&lt;-}\hlstd{batstmp}
\hlstd{tablo}\hlopt{$}\hlstd{nprimates}\hlkwb{&lt;-}\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{&lt;-}\hlstd{tablo}\hlopt{$}\hlstd{`tmp$Gene.name`[tablo}\hlopt{$}\hlstd{nbats}\hlopt{==}\hlstd{b} \hlopt{&amp;} \hlstd{tablo}\hlopt{$}\hlstd{nprimates}\hlopt{==}\hlstd{p]}
    \hlkwa{if}\hlstd{(}\hlkwd{length}\hlstd{(tmp)}\hlopt{&gt;}\hlnum{0} \hlopt{&amp;} \hlkwd{length}\hlstd{(tmp)}\hlopt{&lt;=}\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)),}
           \hlstd{tmp,} \hlkwc{cex}\hlstd{=}\hlnum{0.4}\hlstd{)}
    \hlstd{\}}\hlkwa{else if} \hlstd{(}\hlkwd{length}\hlstd{(tmp)}\hlopt{&gt;}\hlnum{8} \hlopt{&amp;} \hlkwd{length}\hlstd{(tmp)}\hlopt{&lt;=}\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{),}
           \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{)),}
           \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{&gt;}\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] 1 2
## [1] 2 0
## [1] 2 1
## [1] 2 2
## [1] 3 0
## [1] 3 1
## [1] 4 0
## [1] 4 1
\end{verbatim}
\begin{alltt}
\hlstd{tmp}\hlkwb{&lt;-}\hlstd{tablo}\hlopt{$}\hlstd{`tmp$Gene.name`[tablo}\hlopt{$}\hlstd{nbats}\hlopt{==}\hlnum{0} \hlopt{&amp;} \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{19}\hlstd{),}
     \hlopt{-}\hlnum{1.1}\hlstd{,}
     \hlstd{tmp[}\hlnum{1}\hlopt{:}\hlnum{19}\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{5.5}\hlstd{,} \hlkwc{length.out} \hlstd{=} \hlkwd{length}\hlstd{(tmp)}\hlopt{-}\hlnum{19}\hlstd{),}
     \hlopt{-}\hlnum{1.3}\hlstd{,}
     \hlstd{tmp[}\hlnum{20}\hlopt{:}\hlkwd{length}\hlstd{(tmp)],}
     \hlkwc{cex}\hlstd{=}\hlnum{0.4}\hlstd{)}

\hlstd{tmp}\hlkwb{&lt;-}\hlstd{tablo}\hlopt{$}\hlstd{`tmp$Gene.name`[tablo}\hlopt{$}\hlstd{nbats}\hlopt{==}\hlnum{1} \hlopt{&amp;} \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{,}
     \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{4.5}\hlstd{,} \hlkwc{length.out} \hlstd{=} \hlkwd{length}\hlstd{(tmp)}\hlopt{-}\hlnum{18}\hlstd{),}
     \hlopt{-}\hlnum{1.8}\hlstd{,}
     \hlstd{tmp[}\hlnum{19}\hlopt{:}\hlkwd{length}\hlstd{(tmp)],}
     \hlkwc{cex}\hlstd{=}\hlnum{0.4}\hlstd{)}


\hlstd{tmp}\hlkwb{&lt;-}\hlstd{tablo}\hlopt{$}\hlstd{`tmp$Gene.name`[tablo}\hlopt{$}\hlstd{nbats}\hlopt{==}\hlnum{0} \hlopt{&amp;} \hlstd{tablo}\hlopt{$}\hlstd{nprimates}\hlopt{==}\hlnum{0}\hlstd{]}
\hlkwd{text}\hlstd{(}\hlopt{-}\hlnum{0.4}\hlstd{,}\hlopt{-}\hlnum{2.3}\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{5.5}\hlstd{,} \hlkwc{length.out} \hlstd{=} \hlnum{17}\hlstd{),}\hlopt{-}\hlnum{2.3}\hlstd{, tmp[}\hlnum{18}\hlopt{:}\hlnum{34}\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{5.5}\hlstd{,} \hlkwc{length.out} \hlstd{=} \hlkwd{length}\hlstd{(tmp)}\hlopt{-}\hlnum{34}\hlstd{),}\hlopt{-}\hlnum{2.5}\hlstd{, tmp[}\hlnum{35}\hlopt{:}\hlkwd{length}\hlstd{(tmp)],} \hlkwc{cex}\hlstd{=}\hlnum{0.4}\hlstd{)}


\hlstd{tmp}\hlkwb{&lt;-}\hlstd{tablo}\hlopt{$}\hlstd{`tmp$Gene.name`[tablo}\hlopt{$}\hlstd{nbats}\hlopt{==}\hlnum{2} \hlopt{&amp;} \hlstd{tablo}\hlopt{$}\hlstd{nprimates}\hlopt{==}\hlnum{0}\hlstd{]}
\hlkwd{text}\hlstd{(}\hlopt{-}\hlnum{0.4}\hlstd{,}\hlopt{-}\hlnum{2.9}\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.8}\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{3.0}\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}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlkwd{write.csv}\hlstd{(tablo[tablo}\hlopt{$}\hlstd{nbats}\hlopt{&gt;=}\hlnum{3}\hlstd{,}\hlstr{"tmp$Gene.name"}\hlstd{],} \hlstr{"batssup3.csv"}\hlstd{,}
          \hlkwc{row.names}\hlstd{=}\hlnum{FALSE}\hlstd{,}
          \hlkwc{quote}\hlstd{=}\hlnum{FALSE}\hlstd{)}

\hlkwd{write.csv}\hlstd{(tablo[tablo}\hlopt{$}\hlstd{nprimates}\hlopt{&gt;=}\hlnum{3}\hlstd{,}\hlstr{"tmp$Gene.name"}\hlstd{],} \hlstr{"primatessup3.csv"}\hlstd{,}
          \hlkwc{row.names}\hlstd{=}\hlnum{FALSE}\hlstd{,}
          \hlkwc{quote}\hlstd{=}\hlnum{FALSE}\hlstd{)}
\hlkwd{write.csv}\hlstd{(tablo,} \hlstr{"primatesVbats.csv"}\hlstd{,}
          \hlkwc{row.names}\hlstd{=}\hlnum{FALSE}\hlstd{,}
          \hlkwc{quote}\hlstd{=}\hlnum{FALSE}\hlstd{)}
\end{alltt}
\end{kframe}
\end{knitrout}

Restreindre ce tableau aux gènes présent dans l'analyse de Krogan.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlcom{# Reading the Krogan table}
\hlstd{tab}\hlkwb{&lt;-}\hlkwd{read.delim}\hlstd{(}\hlkwd{paste0}\hlstd{(workdir,}
  \hlstr{"covid_comp/covid_comp_complete.txt"}\hlstd{),}
        \hlkwc{fill}\hlstd{=T,} \hlkwc{h}\hlstd{=T,} \hlkwc{dec}\hlstd{=}\hlstr{","}\hlstd{)}
\hlkwd{dim}\hlstd{(tab)}
\end{alltt}
\begin{verbatim}
## [1] 332 141
\end{verbatim}
\begin{alltt}
\hlcom{#Adding ACE2 and TMPRSS2}
\hlstd{krogan}\hlkwb{&lt;-}\hlkwd{c}\hlstd{(}\hlkwd{as.character}\hlstd{(tab}\hlopt{$}\hlstd{merge.Gene),}  \hlstr{"ACE2"}\hlstd{,} \hlstr{"TMPRSS2"}\hlstd{)}

\hlcom{# The list}
\hlkwd{length}\hlstd{(krogan)}
\end{alltt}
\begin{verbatim}
## [1] 334
\end{verbatim}
\begin{alltt}
\hlstd{krogan}
\end{alltt}
\begin{verbatim}
##   [1] "AAR2"      "AASS"      "AATF"      "ABCC1"     "ACAD9"    
##   [6] "ACADM"     "ACSL3"     "ADAM9"     "ADAMTS1"   "AGPS"     
##  [11] "AKAP8"     "AKAP8L"    "AKAP9"     "ALG11"     "ALG5"     
##  [16] "ALG8"      "ANO6"      "AP2A2"     "AP2M1"     "AP3B1"    
##  [21] "ARF6"      "ARL6IP6"   "ATE1"      "ATP13A3"   "ATP1B1"   
##  [26] "ATP5MG"    "ATP6AP1"   "ATP6V1A"   "BAG5"      "BCKDK"    
##  [31] "BCS1L"     "BRD2"      "BRD4"      "BZW2"      "C1orf50"  
##  [36] "CCDC86"    "CDK5RAP2"  "CENPF"     "CEP112"    "CEP135"   
##  [41] "CEP250"    "CEP350"    "CEP43"     "CEP68"     "CHMP2A"   
##  [46] "CHPF"      "CHPF2"     "CISD3"     "CIT"       "CLCC1"    
##  [51] "CLIP4"     "CNTRL"     "COL6A1"    "COLGALT1"  "COMT"     
##  [56] "COQ8B"     "CRTC3"     "CSDE1"     "CSNK2A2"   "CSNK2B"   
##  [61] "CUL2"      "CWC27"     "CYB5B"     "CYB5R3"    "DCAF7"    
##  [66] "DCAKD"     "DCTPP1"    "DDX10"     "DDX21"     "DNAJC11"  
##  [71] "DNAJC19"   "DNMT1"     "DPH5"      "DPY19L1"   "ECSIT"    
##  [76] "EDEM3"     "EIF4E2"    "EIF4H"     "ELOB"      "ELOC"     
##  [81] "EMC1"      "ERC1"      "ERGIC1"    "ERLEC1"    "ERMP1"    
##  [86] "ERO1B"     "ERP44"     "ETFA"      "EXOSC2"    "EXOSC3"   
##  [91] "EXOSC5"    "EXOSC8"    "F2RL1"     "FAM162A"   "FAM8A1"   
##  [96] "FAM98A"    "FAR2"      "FASTKD5"   "FBLN5"     "FBN1"     
## [101] "FBN2"      "FBXL12"    "FKBP10"    "FKBP15"    "FKBP7"    
## [106] "FOXRED2"   "FYCO1"     "G3BP1"     "G3BP2"     "GCC1"     
## [111] "GCC2"      "GDF15"     "GFER"      "GGCX"      "GGH"      
## [116] "GHITM"     "GIGYF2"    "GLA"       "GNB1"      "GNG5"     
## [121] "GOLGA2"    "GOLGA3"    "GOLGA7"    "GOLGB1"    "GORASP1"  
## [126] "GPAA1"     "GPX1"      "GRIPAP1"   "GRPEL1"    "GTF2F2"   
## [131] "HDAC2"     "HEATR3"    "HECTD1"    "HMOX1"     "HOOK1"    
## [136] "HS2ST1"    "HS6ST2"    "HSBP1"     "HYOU1"     "IDE"      
## [141] "IL17RA"    "IMPDH2"    "INHBE"     "INTS4"     "ITGB1"    
## [146] "JAKMIP1"   "LARP1"     "LARP4B"    "LARP7"     "LMAN2"    
## [151] "LOX"       "MAP7D1"    "MARC1"     "MARK1"     "MARK2"    
## [156] "MARK3"     "MAT2B"     "MDN1"      "MEPCE"     "MFGE8"    
## [161] "MIB1"      "MIPOL1"    "MOGS"      "MOV10"     "MPHOSPH10"
## [166] "MRPS2"     "MRPS25"    "MRPS27"    "MRPS5"     "MTCH1"    
## [171] "MYCBP2"    "NARS2"     "NAT14"     "NDFIP2"    "NDUFAF1"  
## [176] "NDUFAF2"   "NDUFB9"    "NEK9"      "NEU1"      "NGDN"     
## [181] "NGLY1"     "NIN"       "NINL"      "NLRX1"     "NOL10"    
## [186] "NPC2"      "NPTX1"     "NSD2"      "NUP210"    "NUP214"   
## [191] "NUP54"     "NUP58"     "NUP62"     "NUP88"     "NUP98"    
## [196] "NUTF2"     "OS9"       "PABPC1"    "PABPC4"    "PCNT"     
## [201] "PCSK6"     "PDE4DIP"   "PDZD11"    "PIGO"      "PIGS"     
## [206] "PITRM1"    "PKP2"      "PLAT"      "PLD3"      "PLEKHA5"  
## [211] "PLEKHF2"   "PLOD2"     "PMPCA"     "PMPCB"     "POFUT1"   
## [216] "POGLUT2"   "POGLUT3"   "POLA1"     "POLA2"     "POR"      
## [221] "PPIL3"     "PPT1"      "PRIM1"     "PRIM2"     "PRKACA"   
## [226] "PRKAR2A"   "PRKAR2B"   "PRRC2B"    "PSMD8"     "PTBP2"    
## [231] "PTGES2"    "PUSL1"     "PVR"       "QSOX2"     "RAB10"    
## [236] "RAB14"     "RAB18"     "RAB1A"     "RAB2A"     "RAB5C"    
## [241] "RAB7A"     "RAB8A"     "RAE1"      "RALA"      "RAP1GDS1" 
## [246] "RBM28"     "RBM41"     "RBX1"      "RDX"       "REEP5"    
## [251] "REEP6"     "RETREG3"   "RHOA"      "RIPK1"     "RNF41"    
## [256] "RPL36"     "RRP9"      "RTN4"      "SAAL1"     "SBNO1"    
## [261] "SCAP"      "SCARB1"    "SCCPDH"    "SDF2"      "SELENOS"  
## [266] "SEPSECS"   "SIGMAR1"   "SIL1"      "SIRT5"     "SLC25A21" 
## [271] "SLC27A2"   "SLC30A6"   "SLC30A7"   "SLC30A9"   "SLC44A2"  
## [276] "SLC9A3R1"  "SLU7"      "SMOC1"     "SNIP1"     "SPART"    
## [281] "SRP19"     "SRP54"     "SRP72"     "STC2"      "STOM"     
## [286] "STOML2"    "SUN2"      "TAPT1"     "TARS2"     "TBCA"     
## [291] "TBK1"      "TBKBP1"    "TCF12"     "THTPA"     "TIMM10"   
## [296] "TIMM10B"   "TIMM29"    "TIMM8B"    "TIMM9"     "TLE1"     
## [301] "TLE3"      "TLE5"      "TM2D3"     "TMED5"     "TMEM39B"  
## [306] "TMEM97"    "TOMM70"    "TOR1A"     "TOR1AIP1"  "TRIM59"   
## [311] "TRMT1"     "TUBGCP2"   "TUBGCP3"   "TYSND1"    "UBAP2"    
## [316] "UBAP2L"    "UBXN8"     "UGGT2"     "UPF1"      "USP13"    
## [321] "USP54"     "VPS11"     "VPS39"     "WASHC4"    "WFS1"     
## [326] "YIF1A"     "ZC3H18"    "ZC3H7A"    "ZDHHC5"    "ZNF318"   
## [331] "ZNF503"    "ZYG11B"    "ACE2"      "TMPRSS2"
\end{verbatim}
\begin{alltt}
\hlcom{#In the table, I select line that match the krogan gene name liste}
\hlstd{tabloK}\hlkwb{&lt;-}\hlstd{tablo[tablo}\hlopt{$}\hlstd{`tmp$Gene.name`} \hlopt{%in%} \hlstd{krogan,]}

\hlcom{# How many gene lost?}
\hlkwd{dim}\hlstd{(tablo)}
\end{alltt}
\begin{verbatim}
## [1] 324   3
\end{verbatim}
\begin{alltt}
\hlkwd{dim}\hlstd{(tabloK)}
\end{alltt}
\begin{verbatim}
## [1] 321   3
\end{verbatim}
\begin{alltt}
\hlcom{# Les gènes perdus (dans le tableau mais pas dans la liste de Krogan)}
\hlkwd{sort}\hlstd{(tablo}\hlopt{$}\hlstd{`tmp$Gene.name`[tablo}\hlopt{$}\hlstd{`tmp$Gene.name`} \hlopt{%in%} \hlstd{krogan}\hlopt{==}\hlstd{F])}
\end{alltt}
\begin{verbatim}
## [1] KDELC1 KDELC2 PCSK5 
## 442 Levels: AAR2 AASS AATF ABCC1 ACAD9 ACADM ACE2 ACSL3 ... ZYG11B
\end{verbatim}
\begin{alltt}
\hlcom{# Les gènes de Krogan non présent dans cette liste}
\hlkwd{sort}\hlstd{(krogan[krogan} \hlopt{%in%} \hlstd{tablo}\hlopt{$}\hlstd{`tmp$Gene.name`}\hlopt{==}\hlstd{F])}
\end{alltt}
\begin{verbatim}
##  [1] "ARL6IP6" "ATP5MG"  "BCS1L"   "C1orf50" "CEP43"   "CYB5R3" 
##  [7] "ELOB"    "MFGE8"   "POGLUT2" "POGLUT3" "SIGMAR1" "TLE5"   
## [13] "USP13"
\end{verbatim}
\begin{alltt}
\hlkwd{write.csv}\hlstd{(tabloK,} \hlstr{"primatesVbats_onlykrogan.csv"}\hlstd{,} \hlkwc{row.names}\hlstd{=}\hlnum{FALSE}\hlstd{,} \hlkwc{quote}\hlstd{=}\hlnum{FALSE}\hlstd{)}
\end{alltt}
\end{kframe}
\end{knitrout}

\section{Tanglegram}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlcom{#install.packages('dendextend') # stable CRAN version}
\hlkwd{library}\hlstd{(dendextend)} \hlcom{# load the package}
\hlcom{#install.packages("phytools") # stable CRAN version}
\hlkwd{library}\hlstd{(phytools)} \hlcom{# load the package}
\hlkwd{library}\hlstd{(ggraph)}
\hlkwd{library}\hlstd{(igraph)}
\hlkwd{library}\hlstd{(tidyverse)}

\hlstd{tmp}\hlkwb{&lt;-}\hlstd{tablo[(tablo}\hlopt{$}\hlstd{nbats}\hlopt{!=}\hlnum{0} \hlopt{|} \hlstd{tablo}\hlopt{$}\hlstd{nprimates}\hlopt{!=}\hlnum{0}\hlstd{),]}
\hlcom{#tmp&lt;-head(tablo, 20)}
\hlcom{#tmp&lt;-rbind(as.matrix(tmp), c("outgroup", 50, 50))}
\hlstd{tmp}\hlkwb{&lt;-}\hlkwd{as.data.frame}\hlstd{(tmp)}
\hlstd{matbats}\hlkwb{&lt;-}\hlkwd{hclust}\hlstd{(}\hlkwd{dist}\hlstd{(tmp}\hlopt{$}\hlstd{nbats))}
\hlstd{matpri}\hlkwb{&lt;-}\hlkwd{hclust}\hlstd{(}\hlkwd{dist}\hlstd{(tmp}\hlopt{$}\hlstd{nprimates))}

\hlstd{tmp[}\hlkwd{order}\hlstd{(tmp}\hlopt{$}\hlstd{nbats),]}
\end{alltt}
\begin{verbatim}
##     tmp$Gene.name nbats nprimates
## 3            AATF     0         1
## 8           ACSL3     0         1
## 13         AKAP8L     0         1
## 16           ALG5     0         2
## 20          AP2M1     0         1
## 23           ATE1     0         3
## 24        ATP13A3     0         2
## 29          BCKDK     0         1
## 32           BZW2     0         3
## 37         CEP135     0         4
## 39         CEP350     0         2
## 42           CHPF     0         2
## 46          CLCC1     0         1
## 54          CSDE1     0         1
## 56         CSNK2B     0         1
## 60          DCAF7     0         1
## 68           DPH5     0         4
## 78         ERLEC1     0         2
## 80          ERO1B     0         4
## 83         EXOSC2     0         3
## 96         FBXL12     0         2
## 99          FKBP7     0         2
## 105          GCC2     0         4
## 107          GFER     0         1
## 110         GHITM     0         4
## 113          GNB1     0         1
## 114          GNG5     0         1
## 116        GOLGA3     0         1
## 119       GORASP1     0         3
## 121          GPX1     0         1
## 125         HDAC2     0         3
## 131        HS6ST2     0         3
## 132         HSBP1     0         1
## 144        LARP4B     0         4
## 145         LARP7     0         3
## 148        MAP7D1     0         1
## 161         MRPS2     0         1
## 168         NAT14     0         3
## 169        NDFIP2     0         1
## 170       NDUFAF1     0         2
## 171       NDUFAF2     0         5
## 172        NDUFB9     0         4
## 178          NINL     0         2
## 181          NPC2     0         3
## 190         NUP98     0         1
## 191         NUTF2     0         1
## 198       PDE4DIP     0         1
## 199        PDZD11     0         1
## 200          PIGO     0         1
## 203          PKP2     0         1
## 205          PLD3     0         1
## 209         PMPCA     0         2
## 215         PPIL3     0         1
## 218         PRIM2     0         5
## 224         PTBP2     0         3
## 230         RAB14     0         3
## 232         RAB1A     0         3
## 233         RAB2A     0         3
## 234         RAB5C     0         2
## 235         RAB7A     0         1
## 241         RBM41     0         2
## 242          RBX1     0         3
## 245         REEP6     0         5
## 246       RETREG3     0         1
## 259       SELENOS     0         1
## 263      SLC25A21     0         4
## 271         SMOC1     0         2
## 274         SRP19     0         1
## 282         TARS2     0         1
## 285        TBKBP1     0         2
## 286         TCF12     0         1
## 291        TIMM8B     0         3
## 294          TLE3     0         1
## 298        TMEM97     0         1
## 299       TMPRSS2     0         4
## 300        TOMM70     0         1
## 303        TRIM59     0         3
## 305       TUBGCP2     0         4
## 308         UBAP2     0         4
## 310         UBXN8     0         1
## 322        ZNF318     0         5
## 323        ZNF503     0         1
## 324        ZYG11B     0         2
## 4           ABCC1     1         2
## 15          ALG11     1         0
## 17           ALG8     1         1
## 19          AP2A2     1         3
## 21          AP3B1     1         1
## 27        ATP6V1A     1         1
## 30           BRD2     1         0
## 35          CENPF     1         2
## 36         CEP112     1         1
## 38         CEP250     1         2
## 40          CEP68     1         5
## 43          CHPF2     1         1
## 45            CIT     1         2
## 48          CNTRL     1         3
## 52          COQ8B     1         0
## 53          CRTC3     1         2
## 58          CWC27     1         2
## 59          CYB5B     1         0
## 64          DDX21     1         1
## 65        DNAJC11     1         0
## 67          DNMT1     1         5
## 72         EIF4E2     1         3
## 76           ERC1     1         1
## 81          ERP44     1         0
## 84         EXOSC3     1         0
## 87          F2RL1     1         0
## 89         FAM8A1     1         1
## 93          FBLN5     1         1
## 97         FKBP10     1         0
## 102         G3BP1     1         1
## 103         G3BP2     1         0
## 104          GCC1     1         0
## 108          GGCX     1         0
## 111        GIGYF2     1         4
## 112           GLA     1         4
## 126        HEATR3     1         0
## 128         HMOX1     1         1
## 135        IL17RA     1         0
## 138         INTS4     1         0
## 141        KDELC1     1         1
## 143         LARP1     1         4
## 147           LOX     1         1
## 150         MARK1     1         4
## 160     MPHOSPH10     1         4
## 162        MRPS25     1         0
## 163        MRPS27     1         2
## 165         MTCH1     1         0
## 167         NARS2     1         1
## 176         NGLY1     1         3
## 177           NIN     1         0
## 179         NLRX1     1         2
## 180         NOL10     1         1
## 182         NPTX1     1         0
## 187         NUP58     1         5
## 188         NUP62     1         1
## 194        PABPC4     1         2
## 196         PCSK5     1         0
## 202        PITRM1     1         3
## 204          PLAT     1         3
## 208         PLOD2     1         3
## 213         POLA2     1         0
## 216          PPT1     1         0
## 219        PRKACA     1         0
## 220       PRKAR2A     1         4
## 221       PRKAR2B     1         2
## 222        PRRC2B     1         0
## 228         QSOX2     1         1
## 236         RAB8A     1         0
## 237          RAE1     1         1
## 250         RPL36     1         3
## 252          RTN4     1         2
## 253         SAAL1     1         4
## 255          SCAP     1         2
## 261          SIL1     1         0
## 262         SIRT5     1         4
## 266       SLC30A7     1         1
## 270          SLU7     1         2
## 273         SPART     1         0
## 276         SRP72     1         1
## 278          STOM     1         3
## 281         TAPT1     1         2
## 288        TIMM10     1         0
## 290        TIMM29     1         1
## 295         TM2D3     1         1
## 301         TOR1A     1         1
## 304         TRMT1     1         3
## 309        UBAP2L     1         1
## 311         UGGT2     1         4
## 313         USP54     1         3
## 314         VPS11     1         1
## 319        ZC3H18     1         1
## 320        ZC3H7A     1         1
## 321        ZDHHC5     1         2
## 2            AASS     2         0
## 18           ANO6     2         2
## 25         ATP1B1     2         0
## 31           BRD4     2         4
## 41         CHMP2A     2         1
## 47          CLIP4     2         4
## 50       COLGALT1     2         1
## 51           COMT     2         0
## 57           CUL2     2         0
## 63          DDX10     2         0
## 74           ELOC     2         0
## 75           EMC1     2         5
## 79          ERMP1     2         0
## 91           FAR2     2         2
## 94           FBN1     2         2
## 95           FBN2     2         2
## 100       FOXRED2     2         0
## 101         FYCO1     2         5
## 106         GDF15     2         1
## 115        GOLGA2     2         2
## 118        GOLGB1     2         3
## 120         GPAA1     2         0
## 127        HECTD1     2         5
## 130        HS2ST1     2         0
## 133         HYOU1     2         1
## 140       JAKMIP1     2         0
## 152         MARK3     2         1
## 154          MDN1     2         3
## 155         MEPCE     2         0
## 156          MIB1     2         0
## 164         MRPS5     2         3
## 166        MYCBP2     2         5
## 173          NEK9     2         0
## 174          NEU1     2         0
## 183          NSD2     2         1
## 184        NUP210     2         2
## 195          PCNT     2         4
## 197         PCSK6     2         0
## 207       PLEKHF2     2         0
## 210         PMPCB     2         3
## 211        POFUT1     2         1
## 214           POR     2         3
## 223         PSMD8     2         1
## 225        PTGES2     2         1
## 227           PVR     2         5
## 240         RBM28     2         0
## 243           RDX     2         0
## 248         RIPK1     2         4
## 251          RRP9     2         1
## 254         SBNO1     2         2
## 256        SCARB1     2         2
## 260       SEPSECS     2         5
## 280          SUN2     2         0
## 283          TBCA     2         1
## 293          TLE1     2         1
## 296         TMED5     2         0
## 297       TMEM39B     2         4
## 306       TUBGCP3     2         1
## 307        TYSND1     2         0
## 316        WASHC4     2         2
## 317          WFS1     2         2
## 5           ACAD9     3         1
## 9           ADAM9     3         3
## 11           AGPS     3         1
## 34       CDK5RAP2     3         5
## 49         COL6A1     3         2
## 122       GRIPAP1     3         1
## 123        GRPEL1     3         0
## 151         MARK2     3         0
## 157        MIPOL1     3         4
## 159         MOV10     3         3
## 185        NUP214     3         2
## 217         PRIM1     3         2
## 226         PUSL1     3         1
## 257        SCCPDH     3         3
## 267       SLC30A9     3         0
## 269      SLC9A3R1     3         0
## 6           ACADM     4         5
## 14          AKAP9     4         2
## 26        ATP6AP1     4         1
## 44          CISD3     4         1
## 77         ERGIC1     4         0
## 134           IDE     4         4
## 136        IMPDH2     4         1
## 139         ITGB1     4         5
## 146         LMAN2     4         4
## 212         POLA1     4         4
## 7            ACE2     5         5
## 71          EDEM3     5         3
## 109           GGH     5         5
## 117        GOLGA7     5         5
## 137         INHBE     5         0
## 231         RAB18     5         1
## 239      RAP1GDS1     5         3
## 264       SLC27A2     5         4
## 268       SLC44A2     5         0
## 284          TBK1     5         2
## 302      TOR1AIP1     5         5
## 315         VPS39     5         5
\end{verbatim}
\begin{alltt}
\hlstd{dendpri}\hlkwb{&lt;-}\hlkwd{as.dendrogram}\hlstd{(matpri)}
\hlstd{dendbats}\hlkwb{&lt;-}\hlkwd{as.dendrogram}\hlstd{(matbats)}

\hlkwd{labels}\hlstd{(dendpri)}\hlkwb{&lt;-}\hlkwd{as.character}\hlstd{(tmp}\hlopt{$}\hlstd{`tmp$Gene.name`[}\hlkwd{labels}\hlstd{(dendpri)])}
\hlkwd{labels}\hlstd{(dendbats)}\hlkwb{&lt;-}\hlkwd{as.character}\hlstd{(tmp}\hlopt{$}\hlstd{`tmp$Gene.name`[}\hlkwd{labels}\hlstd{(dendbats)])}


\hlstd{tmp[}\hlkwd{order}\hlstd{(tmp}\hlopt{$}\hlstd{nprimates,} \hlkwc{decreasing}\hlstd{=}\hlnum{FALSE}\hlstd{),]}\hlopt{$}\hlstr{'tmp$Gene.name'}\hlkwb{-&gt;} \hlstd{order}
\hlstd{dendpri}\hlkwb{&lt;-}\hlstd{dendextend}\hlopt{::}\hlkwd{rotate}\hlstd{(dendpri,} \hlkwc{order}\hlstd{=order)}

\hlstd{tmp[}\hlkwd{order}\hlstd{(tmp}\hlopt{$}\hlstd{nbats,} \hlkwc{decreasing}\hlstd{=}\hlnum{FALSE}\hlstd{),]}\hlopt{$}\hlstr{'tmp$Gene.name'}\hlkwb{-&gt;} \hlstd{order}
\hlstd{dendbats}\hlkwb{&lt;-}\hlstd{dendextend}\hlopt{::}\hlkwd{rotate}\hlstd{(dendbats,} \hlkwc{order}\hlstd{=order)}

\hlcom{#### Il faut swapper certains neud de l'arbrese}
\hlkwd{class}\hlstd{(}\hlkwd{labels}\hlstd{(dendpri))}
\end{alltt}
\begin{verbatim}
## [1] "character"
\end{verbatim}
\begin{alltt}
\hlstd{dend12} \hlkwb{&lt;-} \hlkwd{dendlist}\hlstd{(dendbats, dendpri)}

\hlkwd{png}\hlstd{(}\hlstr{"figure/tanglegramm.png"}\hlstd{,} \hlkwc{width} \hlstd{=} \hlnum{1800}\hlstd{,} \hlkwc{height} \hlstd{=} \hlnum{3000}\hlstd{)}
\hlkwd{tanglegram}\hlstd{(dend12,} \hlkwc{columns_width}\hlstd{=}\hlkwd{c}\hlstd{(}\hlnum{3}\hlstd{,} \hlnum{3}\hlstd{,}\hlnum{3}\hlstd{),} \hlkwc{axes}\hlstd{=}\hlnum{FALSE}\hlstd{,}
           \hlkwc{edge.lwd}\hlstd{=}\hlnum{0}\hlstd{,} \hlkwc{margin_inner}\hlstd{=}\hlnum{6}\hlstd{,}
           \hlkwc{margin_top}\hlstd{=}\hlnum{2}\hlstd{,}
           \hlkwc{main_left}\hlstd{=}\hlstr{"                  bats"}\hlstd{,}
           \hlkwc{main_right} \hlstd{=} \hlstr{"primates                  "}\hlstd{,}
           \hlkwc{lwd}\hlstd{=}\hlnum{0.5}\hlstd{,}
           \hlkwc{cex_main}\hlstd{=}\hlnum{1}\hlstd{,}
           \hlkwc{lab.cex}\hlstd{=}\hlnum{1}\hlstd{,}
           \hlkwc{k_labels}\hlstd{=}\hlnum{6}\hlstd{)}

\hlkwd{dev.off}\hlstd{()}
\end{alltt}
\begin{verbatim}
## RStudioGD 
##         2
\end{verbatim}
\end{kframe}
\end{knitrout}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlstd{ace}\hlkwb{&lt;-}\hlnum{264}
\hlstd{tmprss2}\hlkwb{&lt;-}\hlnum{75}
\hlstd{znf318}\hlkwb{&lt;-}\hlnum{81}
\hlstd{sepsecs}\hlkwb{&lt;-}\hlnum{228}
\hlstd{tbk1}\hlkwb{&lt;-}\hlnum{273}
\hlstd{ripk1}\hlkwb{&lt;-}\hlnum{224}

\hlstd{col}\hlkwb{&lt;-}\hlkwd{rep}\hlstd{(}\hlstr{"grey"}\hlstd{,} \hlkwd{length}\hlstd{(}\hlkwd{labels}\hlstd{(dendpri)))}
\hlstd{col[ace]}\hlkwb{&lt;-}\hlstr{"black"}
\hlstd{col[tmprss2]}\hlkwb{&lt;-}\hlstr{"black"}
\hlstd{col[znf318]}\hlkwb{&lt;-}\hlstr{"black"}
\hlstd{col[sepsecs]}\hlkwb{&lt;-}\hlstr{"black"}
\hlstd{col[tbk1]}\hlkwb{&lt;-}\hlstr{"black"}
\hlstd{col[ripk1]}\hlkwb{&lt;-}\hlstr{"black"}

\hlstd{font}\hlkwb{&lt;-}\hlkwd{rep}\hlstd{(}\hlnum{1}\hlstd{,} \hlkwd{length}\hlstd{(}\hlkwd{labels}\hlstd{(dendpri))}\hlopt{*}\hlnum{2}\hlstd{)}
\hlcom{#font[ace]&lt;-1.3}
\hlcom{#font[tmprss2]&lt;-1.3}
\hlcom{#font[length(labels(dendpri))+160]&lt;-1.3}

\hlkwd{png}\hlstd{(}\hlstr{"figure/tanglegramm.png"}\hlstd{,} \hlkwc{width} \hlstd{=} \hlnum{1800}\hlstd{,} \hlkwc{height} \hlstd{=} \hlnum{3000}\hlstd{)}
\hlkwd{tanglegram}\hlstd{(dend12,} \hlkwc{columns_width}\hlstd{=}\hlkwd{c}\hlstd{(}\hlnum{3}\hlstd{,} \hlnum{3}\hlstd{,}\hlnum{3}\hlstd{),} \hlkwc{axes}\hlstd{=}\hlnum{FALSE}\hlstd{,}
           \hlkwc{edge.lwd}\hlstd{=}\hlnum{0}\hlstd{,} \hlkwc{margin_inner}\hlstd{=}\hlnum{6}\hlstd{,}
           \hlkwc{margin_top}\hlstd{=}\hlnum{2}\hlstd{,}
           \hlkwc{main_left}\hlstd{=}\hlstr{"                  bats"}\hlstd{,}
           \hlkwc{main_right} \hlstd{=} \hlstr{"primates                  "}\hlstd{,}
           \hlkwc{lwd}\hlstd{=}\hlnum{0.5}\hlstd{,}
           \hlkwc{cex_main}\hlstd{=}\hlnum{1}\hlstd{,}
           \hlkwc{lab.cex}\hlstd{=font,}
           \hlkwc{k_labels}\hlstd{=}\hlnum{6}\hlstd{,}
           \hlkwc{color_lines}\hlstd{=col)}

\hlkwd{dev.off}\hlstd{()}
\end{alltt}
\begin{verbatim}
## RStudioGD 
##         2
\end{verbatim}
\end{kframe}
\end{knitrout}


\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlstd{tmp}\hlkwb{&lt;-}\hlstd{tablo[(tablo}\hlopt{$}\hlstd{nbats}\hlopt{&gt;=}\hlnum{3} \hlopt{|} \hlstd{tablo}\hlopt{$}\hlstd{nprimates}\hlopt{&gt;=}\hlnum{3}\hlstd{),]}
\hlkwd{dim}\hlstd{(tmp)}
\end{alltt}
\begin{verbatim}
## [1] 108   3
\end{verbatim}
\begin{alltt}
\hlstd{tmp}\hlkwb{&lt;-}\hlkwd{as.data.frame}\hlstd{(tmp)}
\hlkwd{names}\hlstd{(tmp)}\hlkwb{&lt;-}\hlkwd{c}\hlstd{(}\hlstr{"tmp.Gene.name"}\hlstd{,} \hlstr{"nbats"}\hlstd{,} \hlstr{"nprimates"}\hlstd{)}

\hlstd{matbats}\hlkwb{&lt;-}\hlkwd{hclust}\hlstd{(}\hlkwd{dist}\hlstd{(tmp}\hlopt{$}\hlstd{nbats))}
\hlstd{matpri}\hlkwb{&lt;-}\hlkwd{hclust}\hlstd{(}\hlkwd{dist}\hlstd{(tmp}\hlopt{$}\hlstd{nprimates))}
\hlcom{#tmp[order(tmp$nbats),]}

\hlstd{dendpri}\hlkwb{&lt;-}\hlkwd{as.dendrogram}\hlstd{(matpri)}
\hlstd{dendbats}\hlkwb{&lt;-}\hlkwd{as.dendrogram}\hlstd{(matbats)}

\hlkwd{labels}\hlstd{(dendpri)}\hlkwb{&lt;-}\hlkwd{as.character}\hlstd{(tmp}\hlopt{$}\hlstd{tmp.Gene.name[}\hlkwd{labels}\hlstd{(dendpri)])}
\hlkwd{labels}\hlstd{(dendbats)}\hlkwb{&lt;-}\hlkwd{as.character}\hlstd{(tmp}\hlopt{$}\hlstd{tmp.Gene.name[}\hlkwd{labels}\hlstd{(dendbats)])}

\hlstd{tmp[}\hlkwd{order}\hlstd{(tmp}\hlopt{$}\hlstd{nprimates,} \hlkwc{decreasing}\hlstd{=}\hlnum{FALSE}\hlstd{),]}\hlopt{$}\hlstd{tmp.Gene.name}\hlkwb{-&gt;} \hlstd{order}
\hlstd{dendpri}\hlkwb{&lt;-}\hlstd{dendextend}\hlopt{::}\hlkwd{rotate}\hlstd{(dendpri,} \hlkwc{order}\hlstd{=order)}

\hlstd{tmp[}\hlkwd{order}\hlstd{(tmp}\hlopt{$}\hlstd{nbats,} \hlkwc{decreasing}\hlstd{=}\hlnum{FALSE}\hlstd{),]}\hlopt{$}\hlstd{tmp.Gene.name}\hlkwb{-&gt;} \hlstd{order}
\hlstd{dendbats}\hlkwb{&lt;-}\hlstd{dendextend}\hlopt{::}\hlkwd{rotate}\hlstd{(dendbats,} \hlkwc{order}\hlstd{=order)}

\hlcom{#### Il faut swapper certains neuds de l'arbres}
\hlkwd{class}\hlstd{(}\hlkwd{labels}\hlstd{(dendpri))}
\end{alltt}
\begin{verbatim}
## [1] "character"
\end{verbatim}
\begin{alltt}
\hlstd{dend12} \hlkwb{&lt;-} \hlkwd{dendlist}\hlstd{(dendbats, dendpri)}

\hlstd{ace}\hlkwb{&lt;-}\hlnum{97}
\hlstd{tmprss2}\hlkwb{&lt;-}\hlnum{27}
\hlstd{znf318}\hlkwb{&lt;-}\hlnum{31}
\hlstd{sepsecs}\hlkwb{&lt;-}\hlnum{69}
\hlstd{tbk1}\hlkwb{&lt;-}\hlnum{106}
\hlstd{ripk1}\hlkwb{&lt;-}\hlnum{68}

\hlstd{col}\hlkwb{&lt;-}\hlkwd{rep}\hlstd{(}\hlstr{"lightblue"}\hlstd{,} \hlkwd{length}\hlstd{(}\hlkwd{labels}\hlstd{(dendpri)))}

\hlstd{plusplus}\hlkwb{&lt;-}\hlstd{tmp}\hlopt{$}\hlstd{tmp.Gene.name[tmp}\hlopt{$}\hlstd{nbats}\hlopt{&gt;=}\hlnum{3} \hlopt{&amp;} \hlstd{tmp}\hlopt{$}\hlstd{nprimates}\hlopt{&gt;=}\hlnum{3}\hlstd{]}
\hlstd{col[}\hlkwd{which}\hlstd{(}\hlkwd{labels}\hlstd{(dendbats)} \hlopt{%in%} \hlstd{plusplus)]}\hlkwb{&lt;-}\hlstr{"pink"}

\hlstd{interest}\hlkwb{&lt;-}\hlkwd{c}\hlstd{(}\hlstr{"TMPRSS2"}\hlstd{,}\hlstr{"ZNF318"}\hlstd{,} \hlstr{"SEPSECS"}\hlstd{,}\hlstr{"TBK1"}\hlstd{,} \hlstr{"RIPK1"}\hlstd{)}
\hlstd{col[}\hlkwd{which}\hlstd{(}\hlkwd{labels}\hlstd{(dendbats)} \hlopt{%in%} \hlstd{interest)]}\hlkwb{&lt;-}\hlstr{"blue"}

\hlstd{interestpp}\hlkwb{&lt;-}\hlkwd{c}\hlstd{(}\hlstr{"ACE2"}\hlstd{)}
\hlstd{col[}\hlkwd{which}\hlstd{(}\hlkwd{labels}\hlstd{(dendbats)} \hlopt{%in%} \hlstd{interestpp)]}\hlkwb{&lt;-}\hlstr{"red"}




\hlkwd{png}\hlstd{(}\hlstr{"figure/tanglegrammsup3.png"}\hlstd{,} \hlkwc{width} \hlstd{=} \hlnum{500}\hlstd{,} \hlkwc{height} \hlstd{=} \hlnum{1200}\hlstd{)}
\hlkwd{tanglegram}\hlstd{(dend12,} \hlkwc{columns_width}\hlstd{=}\hlkwd{c}\hlstd{(}\hlnum{3}\hlstd{,} \hlnum{3}\hlstd{,}\hlnum{3}\hlstd{),} \hlkwc{axes}\hlstd{=}\hlnum{FALSE}\hlstd{,}
           \hlkwc{edge.lwd}\hlstd{=}\hlnum{0}\hlstd{,} \hlkwc{margin_inner}\hlstd{=}\hlnum{6}\hlstd{,}
           \hlkwc{margin_top}\hlstd{=}\hlnum{3}\hlstd{,}
           \hlkwc{main_left}\hlstd{=}\hlstr{"          bats"}\hlstd{,}
           \hlkwc{main_right} \hlstd{=} \hlstr{"primates         "}\hlstd{,}
           \hlkwc{lwd}\hlstd{=}\hlnum{0.5}\hlstd{,}
           \hlkwc{cex_main}\hlstd{=}\hlnum{2}\hlstd{,}
           \hlkwc{lab.cex}\hlstd{=}\hlnum{1}\hlstd{,}
           \hlkwc{k_labels}\hlstd{=}\hlnum{6}\hlstd{,}
           \hlkwc{color_lines}\hlstd{=col)}

\hlkwd{dev.off}\hlstd{()}
\end{alltt}
\begin{verbatim}
## RStudioGD 
##         2
\end{verbatim}
\begin{alltt}
\hlcom{### Changer couleurs des groupes}
\hlcom{## changer couleurs des lines sel vs sel or sel vs non-sel}

\hlkwd{setEPS}\hlstd{()}
\end{alltt}
\end{kframe}
\includegraphics[width=\maxwidth]{figure/unnamed-chunk-13-1} 
\begin{kframe}\begin{alltt}
\hlkwd{postscript}\hlstd{(}\hlstr{"figure/tanglegramsup3.eps"}\hlstd{,} \hlkwc{height}\hlstd{=}\hlnum{15}\hlstd{,} \hlkwc{width}\hlstd{=}\hlnum{5}\hlstd{)}
\hlkwd{tanglegram}\hlstd{(dend12,} \hlkwc{columns_width}\hlstd{=}\hlkwd{c}\hlstd{(}\hlnum{3}\hlstd{,} \hlnum{3}\hlstd{,}\hlnum{3}\hlstd{),} \hlkwc{axes}\hlstd{=}\hlnum{FALSE}\hlstd{,}
           \hlkwc{edge.lwd}\hlstd{=}\hlnum{0}\hlstd{,} \hlkwc{margin_inner}\hlstd{=}\hlnum{6}\hlstd{,}
           \hlkwc{margin_top}\hlstd{=}\hlnum{3}\hlstd{,}
           \hlkwc{main_left}\hlstd{=}\hlstr{"          bats"}\hlstd{,}
           \hlkwc{main_right} \hlstd{=} \hlstr{"primates         "}\hlstd{,}
           \hlkwc{lwd}\hlstd{=}\hlnum{0.5}\hlstd{,}
           \hlkwc{cex_main}\hlstd{=}\hlnum{2}\hlstd{,}
           \hlkwc{lab.cex}\hlstd{=}\hlnum{1}\hlstd{,}
     \hlcom{#      k_labels=6,}
           \hlkwc{color_lines}\hlstd{=col)}
\hlkwd{dev.off}\hlstd{()}
\end{alltt}
\begin{verbatim}
## RStudioGD 
##         2
\end{verbatim}
\begin{alltt}
\hlkwd{labels_colors}\hlstd{(dend12[[}\hlnum{1}\hlstd{]])}\hlkwb{&lt;-}\hlkwd{rep}\hlstd{(}\hlkwd{rainbow}\hlstd{(}\hlnum{15}\hlstd{)[}\hlkwd{c}\hlstd{(}\hlnum{1}\hlopt{:}\hlnum{3}\hlstd{,} \hlnum{9}\hlopt{:}\hlnum{11}\hlstd{)],} \hlkwd{table}\hlstd{(tmp}\hlopt{$}\hlstd{nbats))}
\hlkwd{labels_colors}\hlstd{(dend12[[}\hlnum{2}\hlstd{]])}\hlkwb{&lt;-}\hlkwd{rep}\hlstd{(}\hlkwd{rainbow}\hlstd{(}\hlnum{15}\hlstd{)[}\hlkwd{c}\hlstd{(}\hlnum{1}\hlopt{:}\hlnum{3}\hlstd{,} \hlnum{9}\hlopt{:}\hlnum{11}\hlstd{)],} \hlkwd{table}\hlstd{(tmp}\hlopt{$}\hlstd{nprimates))}


\hlkwd{labels_colors}\hlstd{(dend12[[}\hlnum{1}\hlstd{]])}\hlkwb{&lt;-}\hlkwd{rep}\hlstd{(}\hlkwd{viridis}\hlstd{(}\hlnum{10}\hlstd{)[}\hlkwd{c}\hlstd{(}\hlnum{1}\hlopt{:}\hlnum{3}\hlstd{,} \hlnum{7}\hlopt{:}\hlnum{9}\hlstd{)],} \hlkwd{table}\hlstd{(tmp}\hlopt{$}\hlstd{nbats))}
\end{alltt}


{\ttfamily\noindent\bfseries\color{errorcolor}{\#\# Error in viridis(10): impossible de trouver la fonction "{}viridis"{}}}\begin{alltt}
\hlkwd{labels_colors}\hlstd{(dend12[[}\hlnum{2}\hlstd{]])}\hlkwb{&lt;-}\hlkwd{rep}\hlstd{(}\hlkwd{viridis}\hlstd{(}\hlnum{10}\hlstd{)[}\hlkwd{c}\hlstd{(}\hlnum{1}\hlopt{:}\hlnum{3}\hlstd{,} \hlnum{7}\hlopt{:}\hlnum{9}\hlstd{)],} \hlkwd{table}\hlstd{(tmp}\hlopt{$}\hlstd{nprimates))}
\end{alltt}


{\ttfamily\noindent\bfseries\color{errorcolor}{\#\# Error in viridis(10): impossible de trouver la fonction "{}viridis"{}}}\begin{alltt}
\hlkwd{setEPS}\hlstd{()}
\hlkwd{postscript}\hlstd{(}\hlstr{"figure/tanglegramsup3_V2.eps"}\hlstd{,} \hlkwc{height}\hlstd{=}\hlnum{15}\hlstd{,} \hlkwc{width}\hlstd{=}\hlnum{5}\hlstd{)}
\hlkwd{tanglegram}\hlstd{(dend12,} \hlkwc{columns_width}\hlstd{=}\hlkwd{c}\hlstd{(}\hlnum{3}\hlstd{,} \hlnum{3}\hlstd{,}\hlnum{3}\hlstd{),} \hlkwc{axes}\hlstd{=}\hlnum{FALSE}\hlstd{,}
           \hlkwc{edge.lwd}\hlstd{=}\hlnum{0}\hlstd{,} \hlkwc{margin_inner}\hlstd{=}\hlnum{6}\hlstd{,}
           \hlkwc{margin_top}\hlstd{=}\hlnum{3}\hlstd{,}
           \hlkwc{main_left}\hlstd{=}\hlstr{"          bats"}\hlstd{,}
           \hlkwc{main_right} \hlstd{=} \hlstr{"primates         "}\hlstd{,}
           \hlkwc{lwd}\hlstd{=}\hlnum{0.5}\hlstd{,}
           \hlkwc{cex_main}\hlstd{=}\hlnum{2}\hlstd{,}
           \hlkwc{lab.cex}\hlstd{=}\hlnum{1}\hlstd{,}
     \hlcom{#      k_labels=6,}
           \hlkwc{color_lines}\hlstd{=col)}
\hlkwd{dev.off}\hlstd{()}
\end{alltt}
\begin{verbatim}
## RStudioGD 
##         2
\end{verbatim}
\end{kframe}
\end{knitrout}




\end{document}




</pre></body></html>