<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Orthology Inference using orthologr â€¢ orthologr</title>
<!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png">
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png">
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png">
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css">
<script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script><meta property="og:title" content="Orthology Inference using orthologr">
<meta property="og:description" content="orthologr">
<meta property="og:image" content="/logo.png">
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body data-spy="scroll" data-target="#toc">
    

    <div class="container template-article">
      <header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <span class="navbar-brand">
        <a class="navbar-link" href="../index.html">orthologr</a>
        <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">0.4.2</span>
      </span>
    </div>

    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
<li>
  <a href="../reference/index.html">Reference</a>
</li>
<li class="dropdown">
  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
    Articles
     
    <span class="caret"></span>
  </a>
  <ul class="dropdown-menu" role="menu">
<li>
      <a href="../articles/Install.html">Installing Prerequisite Tools</a>
    </li>
    <li>
      <a href="../articles/blast.html">BLAST searches using orthologr</a>
    </li>
    <li>
      <a href="../articles/dNdS_estimation.html">Orthology inference dNdS estimation of orthologous genes using orthologr</a>
    </li>
    <li>
      <a href="../articles/divergence_stratigraphy.html">Performing Divergence Stratigraphy</a>
    </li>
    <li>
      <a href="../articles/orthology_inference.html">Orthology Inference using orthologr</a>
    </li>
    <li>
      <a href="../articles/sequence_alignments.html">Sequence alignments with orthologr</a>
    </li>
  </ul>
</li>
<li>
  <a href="../news/index.html">Changelog</a>
</li>
      </ul>
<ul class="nav navbar-nav navbar-right">
<li>
  <a href="https://github.com/drostlab/orthologr/" class="external-link">
    <span class="fab fa-github fa-lg"></span>
     
  </a>
</li>
      </ul>
</div>
<!--/.nav-collapse -->
  </div>
<!--/.container -->
</div>
<!--/.navbar -->

      

      </header><div class="row">
  <div class="col-md-9 contents">
    <div class="page-header toc-ignore">
      <h1 data-toc-skip>Orthology Inference using orthologr</h1>
            
            <h4 data-toc-skip class="date">2023-10-10</h4>
      
      <small class="dont-index">Source: <a href="https://github.com/drostlab/orthologr/blob/HEAD/vignettes/orthology_inference.Rmd" class="external-link"><code>vignettes/orthology_inference.Rmd</code></a></small>
      <div class="hidden name"><code>orthology_inference.Rmd</code></div>

    </div>

    
    
<p>Orthology Inference is the process of detecting <a href="https://www.biostars.org/p/1595/" class="external-link">orthologous genes</a> between a
query organism and a set of subject organisms. Motivated by the
discussion on which orthology inference method, paradigm or program is
the <a href="https://www.biostars.org/p/7568/" class="external-link">most accurate</a> or <a href="https://www.nature.com/articles/nmeth.3830" class="external-link">the fastest</a> one,
the <code>orthologr</code> package provides functions to perform genome
wide orthology inference following two different paradigms:</p>
<blockquote>
<ol style="list-style-type: decimal">
<li><p>orthology inference based on 1-1 orthology relationship using
<code>BLAST reciprocal best hit</code></p></li>
<li><p>orthology inference based on 1-many homology relationship using
orthologous groups (OrthoFinder2)</p></li>
</ol>
</blockquote>
<p>To perform orthology inference you can start with the
<code><a href="../reference/orthologs.html">orthologs()</a></code> function provided by <code>orthologr</code>.
The <code><a href="../reference/orthologs.html">orthologs()</a></code> function takes nucleotide or protein
sequences stored in fasta files for a set of organisms as input and
performs orthology inference to detect orthologous genes or orthologous
groups within the given organisms based on selected orthology inference
programs.</p>
<p>The following interfaces are (yet) implemented in the
<code><a href="../reference/orthologs.html">orthologs()</a></code> function:</p>
<div class="section level3">
<h3 id="blast-based-methods">BLAST based methods:<a class="anchor" aria-label="anchor" href="#blast-based-methods"></a>
</h3>
<ul>
<li><p>BLASTp best hit (BH): see <code><a href="../reference/blast_best.html">blast_best()</a></code>.</p></li>
<li><p>BLASTp reciprocal best hit (RBH): see
<code><a href="../reference/blast_rec.html">blast_rec()</a></code>.</p></li>
</ul>
<div class="section level4">
<h4 id="advantages">Advantages:<a class="anchor" aria-label="anchor" href="#advantages"></a>
</h4>
</div>
<div class="section level4">
<h4 id="disadvantages">Disadvantages:<a class="anchor" aria-label="anchor" href="#disadvantages"></a>
</h4>
</div>
</div>
<div class="section level3">
<h3 id="orthogroup-based-methods">Orthogroup based methods:<a class="anchor" aria-label="anchor" href="#orthogroup-based-methods"></a>
</h3>
<ul>
<li>
<a href="https://github.com/davidemms/OrthoFinder" class="external-link">Orthofinder2</a>:
see <code><a href="../reference/orthofinder2.html">orthofinder2()</a></code>.</li>
</ul>
<div class="section level4">
<h4 id="advantages-1">Advantages:<a class="anchor" aria-label="anchor" href="#advantages-1"></a>
</h4>
</div>
<div class="section level4">
<h4 id="disadvantages-1">Disadvantages:<a class="anchor" aria-label="anchor" href="#disadvantages-1"></a>
</h4>
</div>
</div>
<div class="section level3">
<h3 id="examples-blast-based-methods">Examples: BLAST based methods<a class="anchor" aria-label="anchor" href="#examples-blast-based-methods"></a>
</h3>
<p>Using a simple example stored in the package environment of
<code>orthologr</code> you can get an impression on how to use the
<code><a href="../reference/orthologs.html">orthologs()</a></code> function.</p>
<p><strong>Note:</strong> it is assumed that when using
<code><a href="../reference/orthologs.html">orthologs()</a></code> all corresponding programs you want to use are
already installed on your machine and are executable via either the
default execution PATH or you specifically define the location of the
executable file via the <code>path</code> argument that can be passed to
<code><a href="../reference/orthologs.html">orthologs()</a></code>.</p>
<p>In the following examples, we will use toy fasta files stored within
the <code>orthologr</code> package:
<code>system.file('seqs/ortho_thal_aa.fasta', package = 'orthologr')</code>.</p>
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># perform orthology inference using BLAST reciprocal best hit</span></span>
<span><span class="co"># and fasta sequence files storing protein sequences</span></span>
<span><span class="fu">orthologr</span><span class="fu">::</span><span class="fu"><a href="../reference/orthologs.html">orthologs</a></span><span class="op">(</span>query_file <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/system.file.html" class="external-link">system.file</a></span><span class="op">(</span><span class="st">'seqs/ortho_thal_aa.fasta'</span>, package <span class="op">=</span> <span class="st">'orthologr'</span><span class="op">)</span>,</span>
<span>          subject_files   <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/system.file.html" class="external-link">system.file</a></span><span class="op">(</span><span class="st">'seqs/ortho_lyra_aa.fasta'</span>, package <span class="op">=</span> <span class="st">'orthologr'</span><span class="op">)</span>,</span>
<span>          seq_type        <span class="op">=</span> <span class="st">"protein"</span>, </span>
<span>          ortho_detection <span class="op">=</span> <span class="st">"RBH"</span>,</span>
<span>          comp_cores      <span class="op">=</span> <span class="fl">1</span>,</span>
<span>          clean_folders   <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></span></code></pre></div>
<pre><code>Running blastp: 2.9.0+ ...


Building a new DB, current time: 07/06/2019 16:22:29
New DB name:   blastdb_ortho_lyra_aa.fasta_protein.fasta
New DB title:  blastdb_ortho_lyra_aa.fasta_protein.fasta
Sequence type: Protein
Deleted existing BLAST database with identical name.
Keep Linkouts: T
Keep MBits: T
Maximum file size: 1000000000B
Adding sequences from FASTA; added 20 sequences in 0.00440097 seconds.
Running blastp: 2.9.0+ ...


Building a new DB, current time: 07/06/2019 16:22:30
New DB name:   blastdb_ortho_thal_aa.fasta_protein.fasta
New DB title:  blastdb_ortho_thal_aa.fasta_protein.fasta
Sequence type: Protein
Deleted existing BLAST database with identical name.
Keep Linkouts: T
Keep MBits: T
Maximum file size: 1000000000B
Adding sequences from FASTA; added 20 sequences in 0.003829 seconds.
# A tibble: 20 x 21
# Groups:   query_id [20]
   query_id subject_id perc_identity num_ident_match... alig_length
   &lt;chr&gt;    &lt;chr&gt;              &lt;dbl&gt;            &lt;int&gt;       &lt;int&gt;
 1 AT1G010... 333554|PA...          74.0              347         469
 2 AT1G010... 470181|PA...          91.1              224         246
 3 AT1G010... 470180|PA...          95.5              343         359
 4 AT1G010... 333551|PA...          92.0             1812        1970
 5 AT1G010... 909874|PA...         100                213         213
 6 AT1G010... 470177|PA...          89.5              580         648
 7 AT1G010... 918864|PA...          95.1              348         366
 8 AT1G010... 909871|PA...          90.3              271         300
 9 AT1G010... 470171|PA...          96.8              420         434
10 AT1G011... 333544|PA...          93.6              494         528
11 AT1G011... 918858|PA...          99.2              525         529
12 AT1G011... 470161|PA...          98.4              446         453
13 AT1G011... 918855|PA...          72.6              207         285
14 AT1G011... 918854|PA...          84.9              152         179
15 AT1G011... 311317|PA...          85.6               83          97
16 AT1G011... 909860|PA...          92.6              287         310
17 AT1G011... 311315|PA...          94.2              502         533
18 AT1G012... 470156|PA...          95.8              228         238
19 AT1G012... 311313|PA...          95.3              102         107
20 AT1G012... 470155|PA...          96.7             1021        1056
# ... with 16 more variables: mismatches &lt;int&gt;, gap_openings &lt;int&gt;,
#   n_gaps &lt;int&gt;, pos_match &lt;int&gt;, ppos &lt;dbl&gt;, q_start &lt;int&gt;,
#   q_end &lt;int&gt;, q_len &lt;int&gt;, qcov &lt;int&gt;, qcovhsp &lt;int&gt;,
#   s_start &lt;int&gt;, s_end &lt;dbl&gt;, s_len &lt;dbl&gt;, evalue &lt;dbl&gt;,
#   bit_score &lt;chr&gt;, score_raw &lt;dbl&gt;
&gt;</code></pre>
<p>This small example returns 20 orthologous genes between
<em>Arabidopsis thaliana</em> and <em>Arabidopsis lyrata</em>. As you
can see, the <code>query_file</code> and <code>subject_files</code>
arguments take the proteomes of <em>Arabidopsis thaliana</em>
(<code>query_file</code>) and <em>Arabidopsis lyrata</em>
(<code>subject_files</code>) stored in fasta files. The
<code>seq_type</code> argument specifies that you will pass protein
sequences (proteomes) to the <code><a href="../reference/orthologs.html">orthologs()</a></code> function. In case
you only have either genomes (DNA sequences) or CDS files, you can
modify the <code>seq_type</code> argument to
<code>seq_type = "dna"</code> (when working with only genome data) or
<code>seq_type = "cds"</code> (when working with CDS files). Internally
the <code><a href="../reference/orthologs.html">orthologs()</a></code> function will perform a CDS prediction
using <code>predict_cds()</code> and will furthermore translate the
predicted CDS sequences into protein sequences. Analogously when
<code>seq_type = "cds"</code> is specified, internally the
<code><a href="../reference/orthologs.html">orthologs()</a></code> function will translate all CDS sequences into
protein sequences to run orthology inference based on protein
sequences.</p>
<p><strong>The advantage of this type of output is that in addition to
having the orthology relationship between genes from two different
genomes, users also retrieve the BLAST results of the respective
orthology relationship which allows them to perform subsequent filtering
for either more conservative or more liberal orthology
relationships.</strong></p>
<p><strong>Note</strong>: future versions of <code>orthologr</code> will
allow to perform orthology inference using DNA sequences. Nevertheless,
since most orthology inference methods or paradigms rely on protein
sequences, the first version of <code>orthologr</code> will follow this
paradigm.</p>
<p>In case you have to specify the path to the corresponding orthology
inference method you can use the <code>path</code> argument as
follows:</p>
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># using an external execution path</span></span>
<span><span class="fu">orthologr</span><span class="fu">::</span><span class="fu"><a href="../reference/orthologs.html">orthologs</a></span><span class="op">(</span>query_file      <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/system.file.html" class="external-link">system.file</a></span><span class="op">(</span><span class="st">'seqs/ortho_thal_aa.fasta'</span>, package <span class="op">=</span> <span class="st">'orthologr'</span><span class="op">)</span>,</span>
<span>          subject_files   <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/system.file.html" class="external-link">system.file</a></span><span class="op">(</span><span class="st">'seqs/ortho_lyra_aa.fasta'</span>, package <span class="op">=</span> <span class="st">'orthologr'</span><span class="op">)</span>,</span>
<span>          seq_type        <span class="op">=</span> <span class="st">"protein"</span>, </span>
<span>          ortho_detection <span class="op">=</span> <span class="st">"RBH"</span>, </span>
<span>          path            <span class="op">=</span> <span class="st">"here/path/to/blastp"</span>, </span>
<span>          clean_folders   <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span>          comp_cores      <span class="op">=</span> <span class="fl">1</span><span class="op">)</span></span></code></pre></div>
<p>When you are working on a multicore machine, you can also specify the
<code>comp_cores</code> argument that will allow you to run all analyses
in parallel (to speed up computations).</p>
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># running orthology inference in parallel using 2 cores</span></span>
<span><span class="fu">orthologr</span><span class="fu">::</span><span class="fu"><a href="../reference/orthologs.html">orthologs</a></span><span class="op">(</span>query_file      <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/system.file.html" class="external-link">system.file</a></span><span class="op">(</span><span class="st">'seqs/ortho_thal_aa.fasta'</span>, package <span class="op">=</span> <span class="st">'orthologr'</span><span class="op">)</span>,</span>
<span>          subject_files   <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/system.file.html" class="external-link">system.file</a></span><span class="op">(</span><span class="st">'seqs/ortho_lyra_aa.fasta'</span>, package <span class="op">=</span> <span class="st">'orthologr'</span><span class="op">)</span>,</span>
<span>          seq_type        <span class="op">=</span> <span class="st">"protein"</span>, </span>
<span>          ortho_detection <span class="op">=</span> <span class="st">"RBH"</span>, </span>
<span>          clean_folders   <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span>          comp_cores      <span class="op">=</span> <span class="fl">2</span><span class="op">)</span></span></code></pre></div>
<pre><code># A tibble: 20 x 12
# Groups:   query_id [20]
   query_id subject_id perc_identity alig_length
   &lt;chr&gt;    &lt;chr&gt;              &lt;dbl&gt;       &lt;dbl&gt;
 1 AT1G010... 333554|PA...          74.0         469
 2 AT1G010... 470181|PA...          91.1         246
 3 AT1G010... 470180|PA...          95.5         359
 4 AT1G010... 333551|PA...          92.0        1970
 5 AT1G010... 909874|PA...         100           213
 6 AT1G010... 470177|PA...          89.5         648
 7 AT1G010... 918864|PA...          95.1         366
 8 AT1G010... 909871|PA...          90.3         300
 9 AT1G010... 470171|PA...          96.8         434
10 AT1G011... 333544|PA...          93.6         528
11 AT1G011... 918858|PA...          99.2         529
12 AT1G011... 470161|PA...          98.4         453
13 AT1G011... 918855|PA...          72.6         285
14 AT1G011... 918854|PA...          84.9         179
15 AT1G011... 311317|PA...          85.6          97
16 AT1G011... 909860|PA...          92.6         310
17 AT1G011... 311315|PA...          94.2         533
18 AT1G012... 470156|PA...          95.8         238
19 AT1G012... 311313|PA...          95.3         107
20 AT1G012... 470155|PA...          96.7        1056
# ... with 8 more variables: mismatches &lt;dbl&gt;,
#   gap_openings &lt;dbl&gt;, q_start &lt;dbl&gt;, q_end &lt;dbl&gt;,
#   s_start &lt;dbl&gt;, s_end &lt;dbl&gt;, evalue &lt;dbl&gt;,
#   bit_score &lt;dbl&gt;</code></pre>
<p>In this case 2 cores are being used to perform parallel processing,
the <code>clean_folders</code> argument specifies that all files
returned by the corresponding orthology inference method are removed
after analyses.</p>
</div>
<div class="section level2">
<h2 id="program-specific-use-of-the-orthologs-function">Program specific use of the orthologs() function<a class="anchor" aria-label="anchor" href="#program-specific-use-of-the-orthologs-function"></a>
</h2>
<p>In this section small examples will illustrate the use of the
<code><a href="../reference/orthologs.html">orthologs()</a></code> function for each orthology inference
program.</p>
<div class="section level3">
<h3 id="blastp-best-hit">BLASTp best hit<a class="anchor" aria-label="anchor" href="#blastp-best-hit"></a>
</h3>
<p>The BLASTp best hit method is a uni-directional BLAST best hit search
of a <code>query organism A</code> against a
<code>subject organism B</code> based on the <code>e-value</code>.</p>
<p>Orthology Inference using BLASTp best hit can be performed by
specifying the argument <code>ortho_detection = "BH"</code> and one
computing core <code>comp_core = 1</code>:</p>
<div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># perform orthology inference using BLAST best hit</span></span>
<span><span class="co"># and fasta sequence files storing protein sequences</span></span>
<span><span class="fu">orthologr</span><span class="fu">::</span><span class="fu"><a href="../reference/orthologs.html">orthologs</a></span><span class="op">(</span>query_file      <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/system.file.html" class="external-link">system.file</a></span><span class="op">(</span><span class="st">'seqs/ortho_thal_aa.fasta'</span>, package <span class="op">=</span> <span class="st">'orthologr'</span><span class="op">)</span>,</span>
<span>          subject_files   <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/system.file.html" class="external-link">system.file</a></span><span class="op">(</span><span class="st">'seqs/ortho_lyra_aa.fasta'</span>, package <span class="op">=</span> <span class="st">'orthologr'</span><span class="op">)</span>,</span>
<span>          seq_type        <span class="op">=</span> <span class="st">"protein"</span>, </span>
<span>          ortho_detection <span class="op">=</span> <span class="st">"BH"</span>, </span>
<span>          clean_folders   <span class="op">=</span> <span class="cn">TRUE</span>,</span>
<span>          comp_cores      <span class="op">=</span> <span class="fl">1</span><span class="op">)</span></span></code></pre></div>
<pre><code> # A tibble: 20 x 12
# Groups:   query_id [20]
   query_id subject_id perc_identity alig_length
   &lt;chr&gt;    &lt;chr&gt;              &lt;dbl&gt;       &lt;dbl&gt;
 1 AT1G010... 333554|PA...          74.0         469
 2 AT1G010... 470181|PA...          91.1         246
 3 AT1G010... 470180|PA...          95.5         359
 4 AT1G010... 333551|PA...          92.0        1970
 5 AT1G010... 909874|PA...         100           213
 6 AT1G010... 470177|PA...          89.5         648
 7 AT1G010... 918864|PA...          95.1         366
 8 AT1G010... 909871|PA...          90.3         300
 9 AT1G010... 470171|PA...          96.8         434
10 AT1G011... 333544|PA...          93.6         528
11 AT1G011... 918858|PA...          99.2         529
12 AT1G011... 470161|PA...          98.4         453
13 AT1G011... 918855|PA...          72.6         285
14 AT1G011... 918854|PA...          84.9         179
15 AT1G011... 311317|PA...          85.6          97
16 AT1G011... 909860|PA...          92.6         310
17 AT1G011... 311315|PA...          94.2         533
18 AT1G012... 470156|PA...          95.8         238
19 AT1G012... 311313|PA...          95.3         107
20 AT1G012... 470155|PA...          96.7        1056
# ... with 8 more variables: mismatches &lt;dbl&gt;,
#   gap_openings &lt;dbl&gt;, q_start &lt;dbl&gt;, q_end &lt;dbl&gt;,
#   s_start &lt;dbl&gt;, s_end &lt;dbl&gt;, evalue &lt;dbl&gt;,
#   bit_score &lt;dbl&gt;</code></pre>
<p>The resulting table stores the orthologous gene pairs and the
corresponding e-value of the best hit. By specifying
<code>detailed_output = TRUE</code> more information of the BLAST result
can be obtained.</p>
</div>
<div class="section level3">
<h3 id="blastp-best-reciprocal-hit">BLASTp best reciprocal hit<a class="anchor" aria-label="anchor" href="#blastp-best-reciprocal-hit"></a>
</h3>
<p>The BLAST best reciprocal hit is a bi-directional BLAST best hit
search of a <code>query organism A</code> against a
<code>subject organism B</code> based on the <code>e-value</code>.</p>
<p>The Algorithm for BLAST best reciprocal hit runs as follows:</p>
<ol style="list-style-type: decimal">
<li><p><code>bh_A &lt;- best_hit(A,B)</code></p></li>
<li><p><code>bh_B &lt;- best_hit(B,A)</code></p></li>
<li><p><code>join(bh_A,bh_B)</code> by tupel
<code>(query_id, subject_id)</code></p></li>
</ol>
<p>In other words, only in case the tuple
<code>(query_id, subject_id)</code> is returned as best hit based on the
<code>e-value</code> in both BLAST directions, the corresponding tupel
<code>(query_id, subject_id)</code> is retained as orthologous gene
pair.</p>
<p>As demonstrated before a simple call of <code><a href="../reference/orthologs.html">orthologs()</a></code>
using <code>ortho_detection = "RBH"</code> and one computing core
<code>comp_core = 1</code> can be performed as follows:</p>
<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://github.com/drostlab/orthologr" class="external-link">orthologr</a></span><span class="op">)</span></span>
<span></span>
<span><span class="co"># perform orthology inference using BLAST reciprocal best hit</span></span>
<span><span class="co"># and fasta sequence files storing protein sequences</span></span>
<span><span class="fu"><a href="../reference/orthologs.html">orthologs</a></span><span class="op">(</span>query_file      <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/system.file.html" class="external-link">system.file</a></span><span class="op">(</span><span class="st">'seqs/ortho_thal_aa.fasta'</span>, package <span class="op">=</span> <span class="st">'orthologr'</span><span class="op">)</span>,</span>
<span>          subject_files   <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/system.file.html" class="external-link">system.file</a></span><span class="op">(</span><span class="st">'seqs/ortho_lyra_aa.fasta'</span>, package <span class="op">=</span> <span class="st">'orthologr'</span><span class="op">)</span>,</span>
<span>          seq_type        <span class="op">=</span> <span class="st">"protein"</span>, </span>
<span>          ortho_detection <span class="op">=</span> <span class="st">"RBH"</span>, </span>
<span>          clean_folders   <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span>          comp_cores      <span class="op">=</span> <span class="fl">1</span><span class="op">)</span></span></code></pre></div>
<pre><code>
      query_id            subject_id evalue
1  AT1G01010.1 333554|PACid:16033839  0e+00
2  AT1G01020.1 470181|PACid:16064328 7e-166
3  AT1G01030.1 470180|PACid:16054974  0e+00
4  AT1G01040.1 333551|PACid:16057793  0e+00
5  AT1G01050.1 909874|PACid:16064489 2e-160
6  AT1G01060.3 470177|PACid:16043374  0e+00
7  AT1G01070.1 918864|PACid:16052578  0e+00
8  AT1G01080.1 909871|PACid:16053217 1e-178
9  AT1G01090.1 470171|PACid:16052860  0e+00
10 AT1G01110.2 333544|PACid:16034284  0e+00
11 AT1G01120.1 918858|PACid:16049140  0e+00
12 AT1G01140.3 470161|PACid:16036015  0e+00
13 AT1G01150.1 918855|PACid:16037307 3e-150
14 AT1G01160.1 918854|PACid:16044153  1e-93
15 AT1G01170.2 311317|PACid:16052302  3e-54
16 AT1G01180.1 909860|PACid:16056125  0e+00
17 AT1G01190.1 311315|PACid:16059488  0e+00
18 AT1G01200.1 470156|PACid:16041002 3e-172
19 AT1G01210.1 311313|PACid:16057125  7e-76
20 AT1G01220.1 470155|PACid:16047984  0e+00
</code></pre>
<p>When you need more parameters returned by <code>RBH</code>, you can
specify the <code>detailed_output = TRUE</code> argument to obtain all
BLAST parameters.</p>
<div class="sourceCode" id="cb10"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://github.com/drostlab/orthologr" class="external-link">orthologr</a></span><span class="op">)</span></span>
<span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://dplyr.tidyverse.org" class="external-link">dplyr</a></span><span class="op">)</span></span>
<span></span>
<span><span class="co"># perform orthology inference using BLAST reciprocal best hit</span></span>
<span><span class="co"># and fasta sequence files storing protein sequences</span></span>
<span><span class="va">RBH</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/orthologs.html">orthologs</a></span><span class="op">(</span>query_file <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/system.file.html" class="external-link">system.file</a></span><span class="op">(</span><span class="st">'seqs/ortho_thal_aa.fasta'</span>, package <span class="op">=</span> <span class="st">'orthologr'</span><span class="op">)</span>,</span>
<span>          subject_files     <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/system.file.html" class="external-link">system.file</a></span><span class="op">(</span><span class="st">'seqs/ortho_lyra_aa.fasta'</span>, package <span class="op">=</span> <span class="st">'orthologr'</span><span class="op">)</span>,</span>
<span>          seq_type          <span class="op">=</span> <span class="st">"protein"</span>, </span>
<span>          ortho_detection   <span class="op">=</span> <span class="st">"RBH"</span>,</span>
<span>          detailed_output   <span class="op">=</span> <span class="cn">TRUE</span>, </span>
<span>          clean_folders     <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span>          comp_cores        <span class="op">=</span> <span class="fl">1</span><span class="op">)</span></span>
<span></span>
<span></span>
<span><span class="fu"><a href="https://pillar.r-lib.org/reference/glimpse.html" class="external-link">glimpse</a></span><span class="op">(</span><span class="va">RBH</span><span class="op">)</span></span></code></pre></div>
<pre><code>Variables:
$ query_id      (chr) "AT1G01010.1", "AT1G01020.1", "AT1G01030.1", "AT1G01040.1"...
$ subject_id    (chr) "333554|PACid:16033839", "470181|PACid:16064328", "470180|...
$ perc_identity (dbl) 73.99, 91.06, 95.54, 91.98, 100.00, 89.51, 95.08, 90.33, 9...
$ alig_length   (dbl) 469, 246, 359, 1970, 213, 648, 366, 300, 434, 528, 529, 45...
$ mismatches    (dbl) 80, 22, 12, 85, 0, 58, 14, 22, 8, 34, 4, 6, 68, 19, 0, 20,...
$ gap_openings  (dbl) 8, 0, 2, 10, 0, 5, 2, 2, 3, 0, 0, 1, 3, 2, 1, 1, 1, 0, 0, 0
$ q_start       (dbl) 1, 1, 1, 6, 1, 1, 1, 1, 1, 1, 1, 1, 5, 4, 2, 1, 1, 1, 1, 1
$ q_end         (dbl) 430, 246, 359, 1910, 213, 646, 366, 294, 429, 528, 529, 45...
$ s_start       (dbl) 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 16, 2, 4, 1, 6, 1, 1, 1
$ s_end         (dbl) 466, 246, 355, 1963, 213, 640, 362, 299, 433, 528, 529, 45...
$ evalue        (dbl) 0e+00, 7e-166, 0e+00, 0e+00, 2e-160, 0e+00, 0e+00, 1e-178,...
$ bit_score     (dbl) 627, 454, 698, 3704, 437, 1037, 696, 491, 859, 972, 1092, ...</code></pre>
<p>In case you would like to store the corresponding
<code>hit tables</code> returned by BLAST for subsequent analyses, you
can specify the <code>clean_folders = FALSE</code> argument. The
corresponding BLAST hit table can then be found in
<code>file.path(tempdir(),"_blast_db")</code>.</p>
<p>A detailed overview of further analyses that can be done with the
corresponding BLAST output can be found in the <a href="https://github.com/HajkD/orthologr/blob/master/vignettes/blast.Rmd" class="external-link">BLAST
vignette</a>.</p>
</div>
<div class="section level3">
<h3 id="examples-orthogroup-based-methods">Examples: Orthogroup based methods<a class="anchor" aria-label="anchor" href="#examples-orthogroup-based-methods"></a>
</h3>
</div>
</div>
  </div>

  <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">

        <nav id="toc" data-toggle="toc"><h2 data-toc-skip>Contents</h2>
    </nav>
</div>

</div>



      <footer><div class="copyright">
  <p></p>
<p>Developed by Hajk-Georg Drost.</p>
</div>

<div class="pkgdown">
  <p></p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>

      </footer>
</div>

  


  

  </body>
</html>
