in reply to Orf subsequences
Is this sufficient?
#!/usr/bin/perl use strict; use warnings; my(@codons)= qw(ATG GTG); my $dna = "AAAATGGGGTAAGTGAACGGGTAA"; my $splitter= join('|', @codons); my @sequences= split /($splitter)/,$dna; shift @sequences; my $codon= 1; foreach (@sequences) { if ($codon) { print $_,"-"; } else { print $_,"\n" } $codon= not $codon; }
output
ATG-GGGTAA GTG-AACGGGTAA
it works by splitting at codons, but capturing them. Then discarding the first (possibly empty) ouput of split and putting together every two elements of split's output.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |