Bioinformatics/Global alignment: Difference between revisions

m
Automated syntax highlighting fixup (second round - minor fixes)
m (syntax highlighting fixup automation)
m (Automated syntax highlighting fixup (second round - minor fixes))
Line 1:
{{Draft task}}[[Category:Bioinfomatics]][[Category:Strings]]
[[Category:Strings]]
 
{{Draft task}}
Global alignment is designed to search for highly similar regions in two or more DNA sequences, where the
sequences appear in the same order and orientation, fitting the sequences in as pieces in a puzzle.
Line 53 ⟶ 54:
:* [[Bioinformatics/Sequence_mutation|Bioinformatics sequence mutation]].
<br><br>
 
 
=={{header|11l}}==
{{trans|Nim}}
 
<syntaxhighlight lang="11l">-V ACGT = [‘A’, ‘C’, ‘G’, ‘T’]
 
F permutations(slist)
Line 182 ⟶ 181:
Total length 300
</pre>
 
=={{header|Go}}==
{{trans|Julia}}
<syntaxhighlight lang="go">package main
 
import (
Line 399 ⟶ 397:
Total length 300
</pre>
 
=={{header|jq}}==
{{works with|jq}}
'''Works with gojq, the Go implementation of jq'''
<syntaxhighlight lang="jq">
### Generic helper functions
 
Line 415 ⟶ 412:
range(0;length) as $i
| [.[$i]] + (del(.[$i])|permutations)
end ;</syntaxhighlight><syntaxhighlight lang="jq">
# Give a synoptic view of the input string,
# highlighting the occurrence of ACGTU letters
Line 477 ⟶ 474:
</syntaxhighlight>
'''The specific tasks'''
<syntaxhighlight lang="jq">
def examples:
[
Line 556 ⟶ 553:
Σ: 300
</pre>
 
=={{header|Julia}}==
<syntaxhighlight lang="julia">using Combinatorics
 
""" Given a DNA sequence, report the sequence, length and base counts"""
Line 681 ⟶ 677:
Total length 300
</pre>
 
=={{header|Nim}}==
{{trans|Wren}}
<syntaxhighlight lang=Nim"nim">import algorithm, sequtils, strformat, strutils, tables
 
const ACGT = ['A', 'C', 'G', 'T'] # Four DNA bases.
Line 807 ⟶ 802:
————————————————————
Total length 300</pre>
 
=={{header|Pascal}}==
Used a matrix of head-tail overlapping and modified n-queens to generate the permutations.<BR>
Here nearly no runtime.But see [[N-queens_problem]] that using permutation is not the way for > 17<BR>
Of course this is more a traveling salesman problem.
<syntaxhighlight lang="pascal">
program BaseInDNA;
{$IFDEF FPC}
Line 1,125 ⟶ 1,119:
A : 74 C : 57 G : 75 T : 94 U : 0
</pre>
 
=={{header|Perl}}==
<syntaxhighlight lang="perl">#!/usr/bin/perl
 
use strict; # https://rosettacode.org/wiki/Bioinformatics/global_alignment
Line 1,225 ⟶ 1,218:
{ A => 74, C => 57, G => 75, T => 94 }
</pre>
 
=={{header|Phix}}==
<!--<syntaxhighlight lang=Phix"phix">(phixonline)-->
<span style="color: #008080;">procedure</span> <span style="color: #000000;">printcounts</span><span style="color: #0000FF;">(</span><span style="color: #004080;">sequence</span> <span style="color: #000000;">ss</span><span style="color: #0000FF;">)</span>
<span style="color: #000080;font-style:italic;">-- Given DNA sequence(s), report the sequence, length and base counts</span>
Line 1,339 ⟶ 1,331:
Base counts: Other:0, A:74, C:57, G:75, T:94, total:300
</pre>
 
=={{header|Python}}==
{{trans|Go}}
 
<syntaxhighlight lang="python">import os
 
from collections import Counter
Line 1,523 ⟶ 1,514:
Total length 300
</pre>
 
=={{header|Raku}}==
{{trans|Go}}
{{trans|Julia}}
<syntaxhighlight lang="raku" line># 20210209 Raku programming solution
 
sub printCounts(\seq) {
Line 1,600 ⟶ 1,590:
(C 57 G 75 A 74 T 94) and total length = 300
</pre>
 
=={{header|Wren}}==
{{trans|Julia}}
Line 1,607 ⟶ 1,596:
{{libheader|Wren-str}}
{{libheader|Wren-math}}
<syntaxhighlight lang="ecmascript">import "/fmt" for Fmt
import "/seq" for Lst
import "/str" for Str
10,333

edits