Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,19 @@
my $fasta_example = <<'END_FASTA_EXAMPLE';
>Rosetta_Example_1
THERECANBENOSPACE
>Rosetta_Example_2
THERECANBESEVERAL
LINESBUTTHEYALLMUST
BECONCATENATED
END_FASTA_EXAMPLE
my $num_newlines = 0;
while ( < $fasta_example > ) {
if (/\A\>(.*)/) {
print "\n" x $num_newlines, $1, ': ';
}
else {
$num_newlines = 1;
print;
}
}

View file

@ -0,0 +1,23 @@
#!/usr/bin/perl
use strict; # https://rosettacode.org/wiki/FASTA_format
use warnings;
my $fasta_example = <<''; # end at first empty line
>Rosetta_Example_1
THERECANBENOSPACE
>Rosetta_Example_2
THERECANBESEVERAL
LINESBUTTHEYALLMUST
BECONCATENATED
open my $fh, '<', \$fasta_example or die "$! on open";
local $/ = "\n>"; # to read one sequence at a time
while( <$fh> )
{
chomp;
print s/^>//r # remove a leading '>' if present
=~ s/\n/: /r # change the first newline to ': '
=~ tr/\n//dr, # remove the rest of the newlines
"\n"; # and put one newline at the end
}