bionode
Version:
A Node.js JavaScript library for client and server side bioinformatics
1,036 lines (714 loc) • 39.7 kB
HTML
<html><head>
<title>bionode-fasta</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css">
</head><body><div id="container"><h1>Bionode Documentation</h1><p>This documentation is autogenerated and merges the documentation of each bionode module.</p><p>Usually each module section starts with some usage examples and is then subdivided by the methods the module provides.</p><ul>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">¶</a>
</div>
<h1 id="bionode-fasta"><a href="https://rawgit.com/bionode/bionode-fasta/master/docs/bionode-fasta.html">bionode-fasta <span style="font-size:.5em;">(see source)</span></a></h1>
<blockquote>
<p>Streamable FASTA parser.</p>
<p>doi: <a href="?">?</a>
author: <a href="http://bmpvieira.com">Bruno Vieira</a>
email: <a href="mailto:mail@bmpvieira.com">mail@bmpvieira.com</a>
license: <a href="https://raw.githubusercontent.com/bionode/bionode-fasta/master/LICENSE">MIT</a></p>
</blockquote>
<hr>
</div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">¶</a>
</div>
<h2 id="usage">Usage</h2>
<p>This module can be used in Node.js as described further below, or as a command line tool.
Examples:</p>
<pre><code>$ npm install -g bionode-fasta
# bionode-fasta [options] [input file] [output file]
$ bionode-fasta input.fasta.gz output.json
# You can also use fasta files compressed <span class="hljs-keyword">with</span> gzip
# If no output is provided, the result will be printed to stdout
# Options: -p, --path: Includes the path of the original file as a property of the output objects
</code></pre>
</div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">¶</a>
</div>
<h2 id="fasta">Fasta</h2>
<p>Returns a Writable Stream that parses a FASTA content Buffer into a JSON Buffer</p>
<pre><code><span class="hljs-keyword">var</span> fasta = <span class="hljs-built_in">require</span>(<span class="hljs-string">'bionode-fasta'</span>)
fs.createReadStream(<span class="hljs-string">'./input.fasta'</span>)
.pipe(fasta())
.pipe(process.stdout)
=> { <span class="hljs-string">"id"</span>: <span class="hljs-string">"contig1"</span>,
<span class="hljs-string">"seq"</span>: <span class="hljs-string">"AGTCATGACTGACGTACGCATG"</span> }
=> { <span class="hljs-string">"id"</span>: <span class="hljs-string">"contig2"</span>,
<span class="hljs-string">"seq"</span>: <span class="hljs-string">"ATGTACGTACTGCATGC"</span> }
=> [...]
</code></pre><p>Can also parse content from filenames Strings streamed to it</p>
<pre><code>fs.createReadStream(<span class="hljs-string">'./fasta-list.txt'</span>)
.pipe(split())
.pipe(fasta({filenameMode: <span class="hljs-literal">true</span>}))
.pipe(process.stdout)
</code></pre><p>When filenames are Streamed like in the previous example, or passed directly
to the parser Stream, they can be added to the output Objects</p>
<pre><code>fasta({includePath: <span class="hljs-literal">true</span>}, <span class="hljs-string">'./input.fasta'</span>)
.pipe(process.stdout)
=> { <span class="hljs-string">"id"</span>: <span class="hljs-string">"contig1"</span>,
<span class="hljs-string">"seq"</span>: <span class="hljs-string">"AGTCATGACTGACGTACGCATG"</span> }
<span class="hljs-string">"path"</span>: <span class="hljs-string">"./input.fasta"</span> }
</code></pre><p>The output from the parser can also be available as Objects instead of Buffers</p>
<pre><code>fasta({objectMode: <span class="hljs-literal">true</span>}, <span class="hljs-string">'./input.fasta'</span>)
.on(<span class="hljs-string">'data'</span>, <span class="hljs-built_in">console</span>.log)
</code></pre><p>Shortcut version of previous example</p>
<pre><code>fasta.obj(<span class="hljs-string">'./input.fasta'</span>).on(<span class="hljs-string">'data'</span>, <span class="hljs-built_in">console</span>.log)
</code></pre><p>Callback style can also be used, however they might not be the best for large files</p>
<pre><code>fasta.obj(<span class="hljs-string">'./input.fasta'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(data)</span> </span>{
<span class="hljs-built_in">console</span>.log(data)
})
</code></pre>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">¶</a>
</div>
<h1 id="bionode-ncbi"><a href="https://rawgit.com/bionode/bionode-ncbi/master/docs/bionode-ncbi.html">bionode-ncbi <span style="font-size:.5em;">(see source)</span></a></h1>
<blockquote>
<p>Node.js module for working with the NCBI API (aka e-utils) using Streams.</p>
<p>doi: <a href="http://dx.doi.org/10.5281/zenodo.10610">10.5281/zenodo.10610</a>
author: <a href="http://bmpvieira.com">Bruno Vieira</a>
email: <a href="mailto:mail@bmpvieira.com">mail@bmpvieira.com</a>
license: <a href="https://raw.githubusercontent.com/bionode/bionode-ncbi/master/LICENSE">MIT</a></p>
</blockquote>
<hr>
</div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">¶</a>
</div>
<h2 id="usage">Usage</h2>
<p>This module can be used in Node.js as described further below, or as a command line tool.
Examples:</p>
<pre><code>$ npm install -g bionode-ncbi
# bionode-ncbi [command] [arguments] --limit (-l) --throughput (-t)
$ bionode-ncbi search taxonomy solenopsis
$ bionode-ncbi search sra human --limit 500 # only return 500 items
$ bionode-ncbi search sra human --throughput 250 # fetch 250 items per API request
$ bionode-ncbi download assembly solenopsis invicta
$ bionode-ncbi urls sra solenopsis invicta
$ bionode-ncbi link assembly bioproject 244018
$ bionode-ncbi search gds solenopsis | dat import --json
</code></pre>
</div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">¶</a>
</div>
<h2 id="search">Search</h2>
<p>Takes a NCBI database string and a optional search term and returns a stream of objects found:</p>
<pre><code>ncbi.search('sra', 'solenopsis').on('data', console.log)
=> { uid: '280116',
expxml: {"Summary":{"Title":"Single Solenopsis invicta male","Platform":{"_":"ILLUMINA", [...],
runs: {"Run":[{"acc":"SRR620577","total_spots":"23699662","total_bases":"4787331724", [...],
extlinks: ' ',
createdate: '2013/02/07',
updatedate: '2012/11/28' }
=> { uid: '280243',
expxml: {"Summary":{"Title":"Illumina small-insert paired end","Platform":{"_":"ILLUMINA", [...],
runs: {"Run":[{"acc":"SRR621118","total_spots":"343209818","total_bases":"34320981800", [...],
extlinks: ' ',
createdate: '2013/02/07,
updatedate: '2012/11/28' }
=> [...]
</code></pre><p>Arguments can be passed as an object instead:</p>
<pre><code>ncbi.search({ db: <span class="hljs-string">'sra'</span>, term: <span class="hljs-string">'solenopsis'</span> })
.on(<span class="hljs-string">'data'</span>, <span class="hljs-built_in">console</span>.log)
</code></pre><p>Advanced options can be passed using the previous syntax:</p>
<pre><code><span class="hljs-keyword">var</span> options = {
db: <span class="hljs-string">'assembly'</span>, <span class="hljs-comment">// database to search</span>
term: <span class="hljs-string">'human'</span>, <span class="hljs-comment">// optional term for search</span>
limit: <span class="hljs-number">500</span>, <span class="hljs-comment">// optional limit of NCBI results</span>
throughput: <span class="hljs-number">100</span> <span class="hljs-comment">// optional number of items per request</span>
}
</code></pre><p>The search term can also be passed with write:</p>
<pre><code><span class="hljs-keyword">var</span> search = ncbi.search(<span class="hljs-string">'sra'</span>).on(<span class="hljs-string">'data'</span>, <span class="hljs-built_in">console</span>.log)
search.write(<span class="hljs-string">'solenopsis'</span>)
</code></pre><p>Or piped, for example, from a file:</p>
<pre><code><span class="hljs-keyword">var</span> split = <span class="hljs-built_in">require</span>(<span class="hljs-string">'split'</span>)
fs.createReadStream(<span class="hljs-string">'searchTerms.txt'</span>)
.pipe(split())
.pipe(search)
</code></pre>
</div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">¶</a>
</div>
<h2 id="link">Link</h2>
<p>Takes a string for source NCBI database and another for destination db and returns
a objects stream with unique IDs linked to the passed source db unique ID.</p>
<pre><code>ncbi.link(<span class="hljs-string">'taxonomy'</span>, <span class="hljs-string">'sra'</span>, <span class="hljs-number">443821</span>)
=> { <span class="hljs-string">"srcDB"</span>:<span class="hljs-string">"taxonomy"</span>,
<span class="hljs-string">"destDB"</span>:<span class="hljs-string">"sra"</span>,
<span class="hljs-string">"srcUID"</span>:<span class="hljs-string">"443821"</span>,
<span class="hljs-string">"destUID"</span>:<span class="hljs-string">"677548"</span> }
=> { <span class="hljs-string">"srcDB"</span>:<span class="hljs-string">"taxonomy"</span>,
<span class="hljs-string">"destDB"</span>:<span class="hljs-string">"sra"</span>,
<span class="hljs-string">"srcUID"</span>:<span class="hljs-string">"443821"</span>,
<span class="hljs-string">"destUID"</span>:<span class="hljs-string">"677547"</span> }
=> [...]
</code></pre><p>Also works with write and pipe, like <strong>Search</strong>.</p>
</div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">¶</a>
</div>
<h2 id="property-link-plink-">Property link (Plink)</h2>
<p>Similar to Link but taked the srcID from a property of the Streamed object
and attached the result to a property with the name of the destination DB.</p>
<pre><code>ncbi.search(<span class="hljs-string">'genome'</span>, <span class="hljs-string">'arthropoda'</span>)
.pipe(ncbi.expand(<span class="hljs-string">'tax'</span>))
.pipe(ncbi.plink(<span class="hljs-string">'tax'</span>, <span class="hljs-string">'sra'</span>)
</code></pre>
</div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">¶</a>
</div>
<h2 id="download">Download</h2>
<p>Takes a NCBI database string and a optional search term and downloads the datasets/sequence files.
<strong> Currently only supports sra and assembly databases. </strong>
Also accepts the keyword gff for annotations.
Returns a stream that emits download progress and ends with download path
The name of the folder where the file is saved corresponds to the UID from NCBI.</p>
<pre><code>ncbi.download('assembly', 'solenopsis invicta')
.on('data', console.log)
.on('end', function(path) {
console.log('File saved at ' + path)
}
=> Downloading 244018/unplaced.scaf.fa.gz 0.94 % of 106 MB at 0.48 MB/s
=> Downloading 244018/unplaced.scaf.fa.gz 100.00 % of 106 MB at 0.49 MB/s"
=> File saved at 244018/unplaced.scaf.fa.gz
</code></pre>
</div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">¶</a>
</div>
<h2 id="urls">URLs</h2>
<p>Takes a NCBI database string and a optional search term and returns as stream of dataset/sequence files URLs.
<strong> Currently only supports sra and assembly databases. </strong>
Also accepts the keyword gff for annotations.
The value of the uid property corresponds to the UID from NCBI.</p>
<pre><code>ncbi.urls(<span class="hljs-string">'assembly'</span>, <span class="hljs-string">'solenopsis invicta'</span>)
.on(<span class="hljs-string">'data'</span>, <span class="hljs-built_in">console</span>.log)
=> {<span class="hljs-string">"url"</span>:<span class="hljs-string">"http://ftp.ncbi.nlm.nih.gov/genbank/genomes/Eukaryotes/invertebrates/Solenopsis_invicta/Si_gnG/Primary_Assembly/unplaced_scaffolds/FASTA/unplaced.scaf.fa.gz"</span>,
<span class="hljs-string">"uid"</span>:<span class="hljs-string">"244018/"</span>}
</code></pre>
</div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">¶</a>
</div>
<h2 id="expand">Expand</h2>
<p>Takes a property (e.g., biosample) and optional destination property
(e.g., sample) and looks for a field named property+id (biosampleid)
in the Streamed object. Then it will do a ncbi.search for that id and save
the result under Streamed object.property.</p>
<pre><code>ncbi.search(<span class="hljs-string">'genome'</span>, <span class="hljs-string">'arthropoda'</span>).pipe(ncbi.expand(<span class="hljs-string">'assembly'</span>))
</code></pre>
</div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">¶</a>
</div>
<p>Taxonomy doesn’t work just with ID number</p>
</div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">¶</a>
</div>
<h2 id="fetch">Fetch</h2>
<p>Allows retrieval of records from NCBI databases. Takes the database name, and a search term,
and returns the records from the database that match the search term. There are optional
advanced parameters that allow you to define how many records to retrieve and extra options
for genes. These parameters should be passed as an object.</p>
<p>i.e it can return a subset of a genetic sequence of a requested species</p>
<pre><code> ncbi.fetch('sra', 'solenopsis_invicta')
=> {"EXPERIMENT_PACKAGE_SET":
{"EXPERIMENT_PACKAGE":
[{"EXPERIMENT":
[{"$":{"xmlns":"","alias":"Me","accession":"SRX757228,
...
</code></pre><p>With advanced parameters for sequence databases(all are optional):</p>
<pre><code> var opts = {
db: 'nucest',
term: 'guillardia_theta',
strand: 1,
complexity: 4
}
ncbi.fetch(opts)
=> { id: 'gi|557436392|gb|HE992975.1|HE992975 HE992975 Guillardia theta CCMP 327 Guillardia theta cDNA clone sg-p_014_h06, mRNA sequence',
seq: 'GAAGGCGATTCCAATGGTGCGAGCGAGGCAGCGAACAGACGCAGCGGGGAGAG...
}
=> [...]
</code></pre><p>For some databases there are multiple return types. A default one will be chosen
automatically, however it is possible to specify this via the rettype option e.g:</p>
<p>The NCBI website provides a list of databasese supported by efetch here:
<a href="http://www.ncbi.nlm.nih.gov/books/NBK25497/table/chapter2.T._entrez_unique_identifiers_ui/?report=objectonly">http://www.ncbi.nlm.nih.gov/books/NBK25497/table/chapter2.T._entrez_unique_identifiers_ui/?report=objectonly</a></p>
</div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">¶</a>
</div>
<p>Default rettypes if user doesn’t provide any</p>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">¶</a>
</div>
<h1 id="bionode-seq"><a href="https://rawgit.com/bionode/bionode-seq/master/docs/bionode-seq.html">bionode-seq <span style="font-size:.5em;">(see source)</span></a></h1>
<blockquote>
<p>Module for DNA, RNA and protein sequences manipulation.</p>
<p>doi: <a href="?">?</a>
author: <a href="http://bmpvieira.com">Bruno Vieira</a>
email: <a href="mailto:mail@bmpvieira.com">mail@bmpvieira.com</a>
license: <a href="https://raw.githubusercontent.com/bionode/bionode-seq/master/LICENSE">MIT</a></p>
</blockquote>
<hr>
</div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">¶</a>
</div>
<h2 id="usage">Usage</h2>
<p>See the methods below.</p>
</div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">¶</a>
</div>
<h3 id="check-sequence-type">Check sequence type</h3>
</div>
</li>
<li id="section-4">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-4">¶</a>
</div>
<p>Takes a sequence string and checks if it’s DNA, RNA or protein. Follows <a href="http://en.wikipedia.org/wiki/Nucleic_acid_notation#IUPAC_notation">IUPAC notation</a> which allows ambiguous sequence notation. In this case the sequence is labelled as ambiguous nucleotide rather than amino acid sequence.</p>
<pre><code>seq.checkType(<span class="hljs-string">"ATGACCCTGAGAAGAGCACCG"</span>);
=> <span class="hljs-string">"dna"</span>
seq.checkType(<span class="hljs-string">"AUGACCCUGAAGGUGAAUGAA"</span>);
=> <span class="hljs-string">"rna"</span>
seq.checkType(<span class="hljs-string">"MAYKSGKRPTFFEVFKAHCSDS"</span>);
=> <span class="hljs-string">"protein"</span>
seq.checkType(<span class="hljs-string">"AMTGACCCTGAGAAGAGCACCG"</span>);
=> <span class="hljs-string">"ambiguousDna"</span>
seq.checkType(<span class="hljs-string">"AMUGACCCUGAAGGUGAAUGAA"</span>);
=> <span class="hljs-string">"ambiguousRna"</span>
</code></pre>
</div>
</li>
<li id="section-5">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-5">¶</a>
</div>
<p>Takes a sequence type argument and returns a function to complement bases.</p>
</div>
</li>
<li id="section-6">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-6">¶</a>
</div>
<h3 id="reverse-sequence">Reverse sequence</h3>
</div>
</li>
<li id="section-7">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-7">¶</a>
</div>
<p>Takes sequence string and returns the reverse sequence.</p>
<pre><code>seq.reverse(<span class="hljs-string">"ATGACCCTGAAGGTGAA"</span>);
=> <span class="hljs-string">"AAGTGGAAGTCCCAGTA"</span>
</code></pre>
</div>
</li>
<li id="section-8">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-8">¶</a>
</div>
<h3 id="-reverse-complement-sequence">(Reverse) complement sequence</h3>
</div>
</li>
<li id="section-9">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-9">¶</a>
</div>
<p>Takes a sequence string and optional boolean for reverse, and returns its complement.</p>
<pre><code>seq.complement(<span class="hljs-string">"ATGACCCTGAAGGTGAA"</span>);
=> <span class="hljs-string">"TACTGGGACTTCCACTT"</span>
seq.complement(<span class="hljs-string">"ATGACCCTGAAGGTGAA"</span>, <span class="hljs-literal">true</span>);
=> <span class="hljs-string">"TTCACCTTCAGGGTCAT"</span>
<span class="hljs-comment">//Alias</span>
seq.reverseComplement(<span class="hljs-string">"ATGACCCTGAAGGTGAA"</span>);
=> <span class="hljs-string">"TTCACCTTCAGGGTCAT"</span>
</code></pre>
</div>
</li>
<li id="section-10">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-10">¶</a>
</div>
<p>Takes a sequence string and returns the reverse complement (syntax sugar).</p>
</div>
</li>
<li id="section-11">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-11">¶</a>
</div>
<h3 id="transcribe-base">Transcribe base</h3>
</div>
</li>
<li id="section-12">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-12">¶</a>
</div>
<p>Takes a base character and returns the transcript base.</p>
<pre><code>seq.getTranscribedBase(<span class="hljs-string">"A"</span>);
=> <span class="hljs-string">"U"</span>
seq.getTranscribedBase(<span class="hljs-string">"T"</span>);
=> <span class="hljs-string">"A"</span>
seq.getTranscribedBase(<span class="hljs-string">"t"</span>);
=> <span class="hljs-string">"a"</span>
seq.getTranscribedBase(<span class="hljs-string">"C"</span>);
=> <span class="hljs-string">"G"</span>
</code></pre>
</div>
</li>
<li id="section-13">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-13">¶</a>
</div>
<h3 id="get-codon-amino-acid">Get codon amino acid</h3>
</div>
</li>
<li id="section-14">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-14">¶</a>
</div>
<p>Takes an RNA codon and returns the translated amino acid.</p>
<pre><code>seq.getTranslatedAA(<span class="hljs-string">"AUG"</span>);
=> <span class="hljs-string">"M"</span>
seq.getTranslatedAA(<span class="hljs-string">"GCU"</span>);
=> <span class="hljs-string">"A"</span>
seq.getTranslatedAA(<span class="hljs-string">"CUU"</span>);
=> <span class="hljs-string">"L"</span>
</code></pre>
</div>
</li>
<li id="section-15">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-15">¶</a>
</div>
<h3 id="remove-introns">Remove introns</h3>
</div>
</li>
<li id="section-16">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-16">¶</a>
</div>
<p>Take a sequence and an array of exonsRanges and removes them.</p>
<pre><code>seq.removeIntrons(<span class="hljs-string">"ATGACCCTGAAGGTGAATGACAG"</span>, [[<span class="hljs-number">1</span>, <span class="hljs-number">8</span>]]);
=> <span class="hljs-string">"TGACCCT"</span>
seq.removeIntrons(<span class="hljs-string">"ATGACCCTGAAGGTGAATGACAG"</span>, [[<span class="hljs-number">2</span>, <span class="hljs-number">9</span>], [<span class="hljs-number">12</span>, <span class="hljs-number">20</span>]]);
=> <span class="hljs-string">"GACCCTGGTGAATGA"</span>
</code></pre>
</div>
</li>
<li id="section-17">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-17">¶</a>
</div>
<h3 id="transcribe-sequence">Transcribe sequence</h3>
</div>
</li>
<li id="section-18">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-18">¶</a>
</div>
<p>Takes a sequence string and returns the transcribed sequence (dna <-> rna).
If an array of exons is given, the introns will be removed from the sequence.</p>
<pre><code>seq.transcribe(<span class="hljs-string">"ATGACCCTGAAGGTGAA"</span>);
=> <span class="hljs-string">"AUGACCCUGAAGGUGAA"</span>
seq.transcribe(<span class="hljs-string">"AUGACCCUGAAGGUGAA"</span>); <span class="hljs-comment">//reverse</span>
=> <span class="hljs-string">"ATGACCCTGAAGGTGAA"</span>
</code></pre>
</div>
</li>
<li id="section-19">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-19">¶</a>
</div>
<h3 id="translate-sequence">Translate sequence</h3>
</div>
</li>
<li id="section-20">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-20">¶</a>
</div>
<p>Takes a DNA or RNA sequence and translates it to protein
If an array of exons is given, the introns will be removed from the sequence.</p>
<pre><code>seq.translate(<span class="hljs-string">"ATGACCCTGAAGGTGAATGACAGGAAGCCCAAC"</span>); <span class="hljs-comment">//dna</span>
=> <span class="hljs-string">"MTLKVNDRKPN"</span>
seq.translate(<span class="hljs-string">"AUGACCCUGAAGGUGAAUGACAGGAAGCCCAAC"</span>); <span class="hljs-comment">//rna</span>
=> <span class="hljs-string">"MTLKVNDRKPN"</span>
seq.translate(<span class="hljs-string">"ATGACCCTGAAGGTGAATGACAGGAAGCC"</span>, [[<span class="hljs-number">3</span>, <span class="hljs-number">21</span>]]);
=> <span class="hljs-string">"LKVND"</span>
</code></pre>
</div>
</li>
<li id="section-21">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-21">¶</a>
</div>
<h3 id="reverse-exons">Reverse exons</h3>
</div>
</li>
<li id="section-22">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-22">¶</a>
</div>
<p>Takes an array of exons and the length of the reference and returns inverted coordinates.</p>
<pre><code>seq.reverseExons([[<span class="hljs-number">2</span>,<span class="hljs-number">8</span>]], <span class="hljs-number">20</span>);
=> [ [ <span class="hljs-number">12</span>, <span class="hljs-number">18</span> ] ]
seq.reverseExons([[<span class="hljs-number">10</span>,<span class="hljs-number">45</span>], [<span class="hljs-number">65</span>,<span class="hljs-number">105</span>]], <span class="hljs-number">180</span>);
=> [ [ <span class="hljs-number">135</span>, <span class="hljs-number">170</span> ], [ <span class="hljs-number">75</span>, <span class="hljs-number">115</span> ] ]
</code></pre>
</div>
</li>
<li id="section-23">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-23">¶</a>
</div>
<h3 id="find-non-canonical-splice-sites">Find non-canonical splice sites</h3>
</div>
</li>
<li id="section-24">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-24">¶</a>
</div>
<p>Takes a sequence and exons ranges and returns an array of non canonical splice sites.</p>
<pre><code>seq.findNonCanonicalSplices(<span class="hljs-string">"GGCGGCGGCGGTGAGGTGGACCTGCGCGAATACGTGGTCGCCCTGT"</span>, [[<span class="hljs-number">0</span>, <span class="hljs-number">10</span>], [<span class="hljs-number">20</span>, <span class="hljs-number">30</span>]]);
=> [ <span class="hljs-number">20</span> ]
seq.findNonCanonicalSplices(<span class="hljs-string">"GGCGGCGGCGGTGAGGTGAGCCTGCGCGAATACGTGGTCGCCCTGT"</span>, [[<span class="hljs-number">0</span>, <span class="hljs-number">10</span>], [<span class="hljs-number">20</span>, <span class="hljs-number">30</span>]]);
=> []
</code></pre>
</div>
</li>
<li id="section-25">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-25">¶</a>
</div>
<h3 id="check-canonical-translation-start-site">Check canonical translation start site</h3>
</div>
</li>
<li id="section-26">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-26">¶</a>
</div>
<p>Takes a sequence and returns boolean for canonical translation start site.</p>
<pre><code>seq.checkCanonicalTranslationStartSite(<span class="hljs-string">"ATGACCCTGAAGGT"</span>);
=> <span class="hljs-literal">true</span>
seq.checkCanonicalTranslationStartSite(<span class="hljs-string">"AATGACCCTGAAGGT"</span>);
=> <span class="hljs-literal">false</span>
</code></pre>
</div>
</li>
<li id="section-27">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-27">¶</a>
</div>
<h3 id="get-reading-frames">Get reading frames</h3>
</div>
</li>
<li id="section-28">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-28">¶</a>
</div>
<p>Takes a sequence and returns an array with the six possible Reading Frames (+1, +2, +3, -1, -2, -3).</p>
<pre><code>seq.getReadingFrames(<span class="hljs-string">"ATGACCCTGAAGGTGAATGACAGGAAGCCCAAC"</span>);
=> [ <span class="hljs-string">'ATGACCCTGAAGGTGAATGACAGGAAGCCCAAC'</span>,
<span class="hljs-string">'TGACCCTGAAGGTGAATGACAGGAAGCCCAAC'</span>,
<span class="hljs-string">'GACCCTGAAGGTGAATGACAGGAAGCCCAAC'</span>,
<span class="hljs-string">'GTTGGGCTTCCTGTCATTCACCTTCAGGGTCAT'</span>,
<span class="hljs-string">'TTGGGCTTCCTGTCATTCACCTTCAGGGTCAT'</span>,
<span class="hljs-string">'TGGGCTTCCTGTCATTCACCTTCAGGGTCAT'</span> ]
</code></pre>
</div>
</li>
<li id="section-29">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-29">¶</a>
</div>
<h3 id="get-open-reading-frames">Get open reading frames</h3>
</div>
</li>
<li id="section-30">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-30">¶</a>
</div>
<p>Takes a Reading Frame sequence and returns an array of Open Reading Frames.</p>
<pre><code>seq.getOpenReadingFrames(<span class="hljs-string">"ATGACCCTGAAGGTGAATGACAGGAAGCCCAAC"</span>);
=> [ <span class="hljs-string">'ATGACCCTGAAGGTGAATGACAGGAAGCCCAAC'</span> ]
seq.getOpenReadingFrames(<span class="hljs-string">"AUGACCCUGAAGGUGAAUGACAGGAAGCCCAAC"</span>);
=> [ <span class="hljs-string">'AUGACCCUGAAGGUGAAUGACAGGAAGCCCAAC'</span> ]
seq.getOpenReadingFrames(<span class="hljs-string">"ATGAGAAGCCCAACATGAGGACTGA"</span>);
=> [ <span class="hljs-string">'ATGAGAAGCCCAACATGA'</span>, <span class="hljs-string">'GGACTGA'</span> ]
</code></pre>
</div>
</li>
<li id="section-31">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-31">¶</a>
</div>
<h3 id="get-all-open-reading-frames">Get all open reading frames</h3>
</div>
</li>
<li id="section-32">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-32">¶</a>
</div>
<p>Takes a sequence and returns all Open Reading Frames in the six Reading Frames.</p>
<pre><code>seq.getAllOpenReadingFrames(<span class="hljs-string">"ATGACCCTGAAGGTGAATGACA"</span>);
=> [ [ <span class="hljs-string">'ATGACCCTGAAGGTGAATGACA'</span> ],
[ <span class="hljs-string">'TGA'</span>, <span class="hljs-string">'CCCTGA'</span>, <span class="hljs-string">'AGGTGA'</span>, <span class="hljs-string">'ATGACA'</span> ],
[ <span class="hljs-string">'GACCCTGAAGGTGAATGA'</span>, <span class="hljs-string">'CA'</span> ],
[ <span class="hljs-string">'TGTCATTCACCTTCAGGGTCAT'</span> ],
[ <span class="hljs-string">'GTCATTCACCTTCAGGGTCAT'</span> ],
[ <span class="hljs-string">'TCATTCACCTTCAGGGTCAT'</span> ] ]
</code></pre>
</div>
</li>
<li id="section-33">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-33">¶</a>
</div>
<h3 id="find-longest-open-reading-frame">Find longest open reading frame</h3>
</div>
</li>
<li id="section-34">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-34">¶</a>
</div>
<p>Takes a sequence and returns the longest ORF from all six reading frames and
corresponding frame symbol (+1, +2, +3, -1, -2, -3). If a frame symbol is specified,
only look for longest ORF on that frame.
When sorting ORFs, if there’s a tie, choose the one that starts with start codon Methionine.
If there’s still a tie, return one randomly.</p>
<pre><code>seq.findLongestOpenReadingFrame(<span class="hljs-string">"ATGACCCTGAAGGTGAATGACA"</span>);
=> [ <span class="hljs-string">'ATGACCCTGAAGGTGAATGACA'</span>, <span class="hljs-string">'+1'</span> ]
seq.findLongestOpenReadingFrame(<span class="hljs-string">"ATGACCCTGAAGGTGAATGACA"</span>, <span class="hljs-string">"-1"</span>);
=> <span class="hljs-string">"TGTCATTCACCTTCAGGGTCAT"</span>
</code></pre>
</div>
</li>
<li id="section-35">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-35">¶</a>
</div>
<p>Get longest ORFs for all six possible reading frames</p>
</div>
</li>
<li id="section-36">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-36">¶</a>
</div>
<p>Get longest ORF</p>
</div>
</li>
<li id="section-37">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-37">¶</a>
</div>
<p>Helper that sorts by length, giving priority to ones that start with ATG/AUG</p>
</div>
</li>
<li id="section-38">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-38">¶</a>
</div>
<p>Helper that takes an array and returns longest Reading Frame</p>
</div>
</li>
</ul></div></body></html>