Skip to content

Instantly share code, notes, and snippets.

@AlexDaniel
Created July 7, 2020 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexDaniel/de2ea5b684e3d630b803028940c80bf0 to your computer and use it in GitHub Desktop.
Save AlexDaniel/de2ea5b684e3d630b803028940c80bf0 to your computer and use it in GitHub Desktop.
sub open_and_parse_fasta($filepath) {
my %FASTA_hash;
my $FASTA_label = "";
for $filepath.IO.lines.map(*.trim-trailing) {
if .starts-with(">") {
$FASTA_label = .substr(1,);
} else {
%FASTA_hash{$FASTA_label}.push: $_;
}
}
%FASTA_hash{$_} .= join for %FASTA_hash.keys;
return %FASTA_hash
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment