<ahref="./installation.html"class="sidebar-item-text sidebar-link"><spanclass="chapter-number">1</span> <spanclass="chapter-title">Installation of the obitools</span></a>
</div>
</li>
<liclass="sidebar-item">
<divclass="sidebar-item-container">
<ahref="./formats.html"class="sidebar-item-text sidebar-link"><spanclass="chapter-number">2</span> <spanclass="chapter-title">File formats usable with <em>OBITools</em></span></a>
<ahref="./inupt.html"class="sidebar-item-text sidebar-link"><spanclass="chapter-number">4</span> <spanclass="chapter-title">Specifying the data input to <em>OBITools</em> commands</span></a>
<ahref="./common_options.html"class="sidebar-item-text sidebar-link"><spanclass="chapter-number">6</span> <spanclass="chapter-title">Options common to most of the <em>OBITools</em> commands</span></a>
<ahref="./comm_metabarcode_design.html"class="sidebar-item-text sidebar-link"><spanclass="chapter-number">8</span> <spanclass="chapter-title">Metabarcode design and quality assessment</span></a>
</div>
</li>
<liclass="sidebar-item">
<divclass="sidebar-item-container">
<ahref="./comm_reformat.html"class="sidebar-item-text sidebar-link"><spanclass="chapter-number">9</span> <spanclass="chapter-title">File format conversions</span></a>
<ahref="./comm_computation.html"class="sidebar-item-text sidebar-link"><spanclass="chapter-number">11</span> <spanclass="chapter-title">Computations on sequences</span></a>
</div>
</li>
<liclass="sidebar-item">
<divclass="sidebar-item-container">
<ahref="./comm_sampling.html"class="sidebar-item-text sidebar-link"><spanclass="chapter-number">12</span> <spanclass="chapter-title">Sequence sampling and filtering</span></a>
<li><ahref="#variables-usable-in-the-expression"id="toc-variables-usable-in-the-expression"class="nav-link active"data-scroll-target="#variables-usable-in-the-expression"><spanclass="toc-section-number">7.1</span> Variables usable in the expression</a></li>
<li><ahref="#function-defined-in-the-language"id="toc-function-defined-in-the-language"class="nav-link"data-scroll-target="#function-defined-in-the-language"><spanclass="toc-section-number">7.2</span> Function defined in the language</a>
<li><ahref="#string-related-functions"id="toc-string-related-functions"class="nav-link"data-scroll-target="#string-related-functions">String related functions</a></li>
<li><ahref="#sequence-analysis-related-function"id="toc-sequence-analysis-related-function"class="nav-link"data-scroll-target="#sequence-analysis-related-function"><spanclass="toc-section-number">7.2.1</span> Sequence analysis related function</a></li>
<li><ahref="#accessing-to-the-sequence-annotations"id="toc-accessing-to-the-sequence-annotations"class="nav-link"data-scroll-target="#accessing-to-the-sequence-annotations"><spanclass="toc-section-number">7.3</span> Accessing to the sequence annotations</a></li>
<p>Several OBITools (<em>e.g.</em> obigrep, obiannotate) allow the user to specify some simple expressions to compute values or define predicates. This expressions are parsed and evaluated using the <ahref="https://pkg.go.dev/github.com/PaesslerAG/gval"title="Gval (Go eVALuate) for evaluating arbitrary expressions Go-like expressions.">gval</a> go package, which allows for evaluating go-Like expression.</p>
<h2data-number="7.1"class="anchored"data-anchor-id="variables-usable-in-the-expression"><spanclass="header-section-number">7.1</span> Variables usable in the expression</h2>
<ul>
<li><code>sequence</code> is the sequence object on which the expression is evaluated.</li>
<li><code>annotations</code>is a map object containing every annotations associated to the currently processed sequence.</li>
<h2data-number="7.2"class="anchored"data-anchor-id="function-defined-in-the-language"><spanclass="header-section-number">7.2</span> Function defined in the language</h2>
<p>It is a generic function allowing to retreive the size of a object. It returns the length of a sequences, the number of element in a map like <code>annotations</code>, the number of elements in an array. The reurned value is an <code>int</code>.</p>
<p>Allows to combine several values to build a string. <code>format</code> follows the classical C <code>printf</code> syntax. The function returns a <code>string</code>.</p>
</dd>
<dt><strong><code>subspc(x)</code></strong></dt>
<dd>
<p>substitutes every space in the <code>x</code> string by the underscore (<code>_</code>) character. The function returns a <code>string</code>.</p>
<p>The <code>condition</code> value has to be a <code>bool</code> value. If it is <code>true</code> the function returns <code>val1</code>, otherwise, it is returning <code>val2</code>.</p>
<h3data-number="7.2.1"class="anchored"data-anchor-id="sequence-analysis-related-function"><spanclass="header-section-number">7.2.1</span> Sequence analysis related function</h3>
<p>The nucleotide composition of the sequence is returned as as map indexed by <code>a</code>, <code>c</code>, <code>g</code>, or <code>t</code> and each value is the number of occurrences of that nucleotide. A fifth key <code>others</code> accounts for all others symboles.</p>
<h2data-number="7.3"class="anchored"data-anchor-id="accessing-to-the-sequence-annotations"><spanclass="header-section-number">7.3</span> Accessing to the sequence annotations</h2>
<p>The <code>annotations</code> variable is a map object containing all the annotations associated to the currently processed sequence. Index of the map are the attribute names. It exists to possibillities to retreive an annotation. It is possible to use the classical <code>[]</code> indexing operator, putting the attribute name quoted by double quotes between them.</p>
<divclass="sourceCode"id="cb1"><preclass="sourceCode go code-with-copy"><codeclass="sourceCode go"><spanid="cb1-1"><ahref="#cb1-1"aria-hidden="true"tabindex="-1"></a>annotations<spanclass="op">[</span><spanclass="st">"direction"</span><spanclass="op">]</span></span></code><buttontitle="Copy to Clipboard"class="code-copy-button"><iclass="bi"></i></button></pre></div>
<p>The above code retreives the <code>direction</code> annotation. A second notation using the dot (<code>.</code>) is often more convenient.</p>
<divclass="sourceCode"id="cb2"><preclass="sourceCode go code-with-copy"><codeclass="sourceCode go"><spanid="cb2-1"><ahref="#cb2-1"aria-hidden="true"tabindex="-1"></a>annotations<spanclass="op">.</span>direction</span></code><buttontitle="Copy to Clipboard"class="code-copy-button"><iclass="bi"></i></button></pre></div>
<p>Special attributes of the sequence are accessible only by dedicated methods of the <code>sequence</code> object.</p>
<divclass="sourceCode"id="cb3"><preclass="sourceCode go code-with-copy"><codeclass="sourceCode go"><spanid="cb3-1"><ahref="#cb3-1"aria-hidden="true"tabindex="-1"></a>sequence<spanclass="op">.</span>Id<spanclass="op">()</span></span></code><buttontitle="Copy to Clipboard"class="code-copy-button"><iclass="bi"></i></button></pre></div>
<iclass="bi bi-arrow-left-short"></i><spanclass="nav-page-text"><spanclass="chapter-number">6</span> <spanclass="chapter-title">Options common to most of the <em>OBITools</em> commands</span></span>