Bioinformatics/Global alignment: Difference between revisions
m
syntax highlighting fixup automation
(→{{header|Perl}}: added Pascal by prepending to perl) |
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
||
Line 58:
{{trans|Nim}}
<
F permutations(slist)
Line 137:
L(test) TestSequences
V scs = shortestCommonSuperstring(test)
printCounts(scs)</
{{out}}
Line 185:
=={{header|Go}}==
{{trans|Julia}}
<
import (
Line 355:
printCounts(scs)
}
}</
{{out}}
Line 403:
{{works with|jq}}
'''Works with gojq, the Go implementation of jq'''
<syntaxhighlight lang=jq>
### Generic helper functions
Line 415:
range(0;length) as $i
| [.[$i]] + (del(.[$i])|permutations)
end ;</
# Give a synoptic view of the input string,
# highlighting the occurrence of ACGTU letters
Line 475:
else . end)
| .shortestsuper;
</syntaxhighlight>
'''The specific tasks'''
<syntaxhighlight lang=jq>
def examples:
[
Line 509:
| "Task \($i+1):", ($examples[$i]|t), "";
tasks</
{{out}}
<pre>
Line 558:
=={{header|Julia}}==
<
""" Given a DNA sequence, report the sequence, length and base counts"""
Line 639:
printcounts(scs)
end
</
<pre>
Nucleotide counts for TAAGAA:
Line 684:
=={{header|Nim}}==
{{trans|Wren}}
<
const ACGT = ['A', 'C', 'G', 'T'] # Four DNA bases.
Line 765:
for test in TestSequences:
let scs = test.shortestCommonSuperstring
scs.printCounts()</
{{out}}
Line 812:
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.
<
program BaseInDNA;
{$IFDEF FPC}
Line 1,103:
find;
END.
</syntaxhighlight>
{{out}}
<pre>
Line 1,127:
=={{header|Perl}}==
<
use strict; # https://rosettacode.org/wiki/Bioinformatics/global_alignment
Line 1,210:
use Data::Dump 'dd'; dd \%ch;
}
}</
{{out}}
<pre>
Line 1,227:
=={{header|Phix}}==
<!--<
<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,312:
<span style="color: #0000FF;">}</span>
<span style="color: #7060A8;">papply</span><span style="color: #0000FF;">(</span><span style="color: #000000;">tests</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">shortest_common_superstring</span><span style="color: #0000FF;">)</span>
<!--</
{{out}}
(Shows three length-6 results for the first test)
Line 1,343:
{{trans|Go}}
<
from collections import Counter
Line 1,459:
#
# .. if you don't want all possible shortest superstrings.
</syntaxhighlight>
{{out}}
Line 1,527:
{{trans|Go}}
{{trans|Julia}}
<syntaxhighlight lang=raku
sub printCounts(\seq) {
Line 1,583:
>,
)
</syntaxhighlight>
{{out}}
Line 1,607:
{{libheader|Wren-str}}
{{libheader|Wren-math}}
<
import "/seq" for Lst
import "/str" for Str
Line 1,725:
var scs = shortestCommonSuperstring.call(test)
printCounts.call(scs)
}</
{{out}}
|