查找共享拼接基序
作者:L. Grondin
http://rosalind.info/problems/lcsq/
示例输入
>Rosalind_23 AACCTTGG >Rosalind_64 ACACTGTGA
示例输出
AACTGG
注意:需要先构建 lcsq 共享库。例如,在 Linux 系统上使用以下命令
$ gcc --std=c99 -fPIC -c -o lcsq.o lcsq.c $ gcc -shared -o lcsq.so lcsq.o
源代码: lcsq-grondilu.pl
use v6;
use NativeCall;
sub lcsq(Str $, Str $ --> Str) is native($*SPEC.catdir($*PROGRAM-NAME.IO.dirname, 'lcsq')) {*}
my $default-input = q:to/END/;
>Rosalind_23
AACCTTGG
>Rosalind_64
ACACTGTGA
END
sub MAIN($input-file = Nil) {
my $input = $input-file ?? $input-file.IO.slurp !! $default-input;
say lcsq |gather for $input.match:
/ ^^ '>Rosalind_' <digit>+ \n (<[\nACGT]>*) /, :g {
take ~.[0].subst(/\n/,'', :g);
}
}
Perl 6 示例