in reply to Count the occurrence of an element in an array
I would not think that a 32MB file should be a problem unless you have a tiny computer. But you could count the aminoacids while reading the file:
#!/usr/bin/perl use strict; use warnings; use diagnostics; my %count; open PROTEOME, '<', 'human_complete_proteome_without_isoforms.fasta'; while(<PROTEOME>){ next if /^>/; chomp; $count{$_}++ for split //; } print "hash has finished searching the document\n"; foreach (keys %count) { print "$_ \t occurs $count{$_} times \n"; }
|
|---|