public
Last active

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
pyrimidine1:biomoose cjfields$ cat benchmark_fasta.pl
#!/usr/bin/perl -w
 
use strict;
use warnings;
use Bio::PrimarySeq;
use Bio::Moose::PrimarySeq;
use Benchmark ':hireswallclock';
use Modern::Perl;
 
my $file = shift;
 
timethese (1000, {
'BioPerl' => \&bp,
'BioMoose' => \&bm,
}
);
 
sub bp {
local $/ = "\n>";
my $c = 'Bio::PrimarySeq';
open (my $fasta, '<', $file) || die "$!";
my @seqs;
while (defined(my $chunk = <$fasta>)) {
my ($header, $seq) = split("\n", $chunk, 2);
$header =~ s{^>}{};
$seq =~ s{[\s>]}{}g;
my $seqobj = $c->new(-seq => $seq, desc => $header);
push @seqs, $seqobj;
}
close $fasta;
}
 
sub bm {
local $/ = "\n>";
my $c = 'Bio::Moose::PrimarySeq';
open (my $fasta, '<', $file) || die "$!";
my @seqs;
while (defined(my $chunk = <$fasta>)) {
my ($header, $seq) = split("\n", $chunk, 2);
$header =~ s{^>}{};
$seq =~ s{[\s>]}{}g;
my $seqobj = $c->new(-rawseq => $seq, description => $header);
push @seqs, $seqobj;
}
close $fasta;
}
 
pyrimidine1:biomoose cjfields$ cat testfasta2.faa
>gi|224368035|ref|YP_002602198.1| PyrR [Desulfobacterium autotrophicum HRM2]
MKKRRTILNAEDMERVITRMAYEIIETHRGVKDVALAGIMTRGDFLAHRLQEKILKIEGVKVPVGAMDIN
LYRDDWTQISHYPVVRASKISFSVDNQNIILVDDVLFTGRTIRAAMDAIMDFGRPARIELAVLVDRGHRE
LPLQADYKGTTLATLHSDMVNVCLSEHDGKDTVFIEQEA
 
>gi|83746228|ref|ZP_00943282.1| PyrR [Ralstonia solanacearum UW551]
MAASRLRGRHAGSPGRRGPADDQAGQTLWQPVAWPLWSAGHLGGRTLLVDRRAGCRRHRRRARCRGRSHH
PPTILRRIPRMTSQQIDAEALYQSLVAQLRTRMAGTHGSNWAVAGIVSGGAWIAARLAQDLGLPDHGVVN
VALHRDDYAKKGLHAQAQPTTLPFEVEERRILLVDDVLATGRTIRAAINELFDYGRPAAVELAVLVDRGE
RQLPIAPDYIGERITLAADESLVLRRDGEGASARFTFTREPKAA
 
>gi|254383579|ref|ZP_04998929.1| pyrR [Streptomyces sp. Mg1]
MDTQQHSTDDMRPVLEAQDIARVLTRIAHEIVERAKGADDVVLLGIPTRGVYLARRLAAKLEEITGTKIP
VGSLDITMYRDDLRMKPARAIGRTEIPGDDIDGRLVVLIDDVLFSGRTIRAALDALGDLGRPRAVQLAVL
VDRGHRELPIRADYVGKNLPTSLRETVKVQLQEEDGRDAVLLGQRTVQAAGL
 
>gi|254376970|ref|ZP_04992438.1| pyrR [Streptomyces sp. SPB74]
MDSHTPGHTPGEVPGGPRPVLEGPDIARVLTRIAHEIVERAKGADDVVLLGIPTRGVHLAERLAAKLAAI
TGRPVPTGSLDITMYRDDLRLKPARALGRTEIPAEGLDGRLVVLVDDVLFSGRTIRAALDALGDIGRPRA
VQLAVLVDRGHRELPIRADYVGKNLPTSLRETVKVQLTEEDGRDAVLLGGTAPR
 
>gi|251782206|ref|YP_002996508.1| PyrR bifunctional protein [Streptococcus dysgalactiae subsp. equisimilis GGS_124]
MKSKEIVDDVTMKRAITRITYEIIERNKQLDNVVLAGIKTRGVFLARRIQERLRQLEGLELPIGELDIKP
FRDDVKVDEDTTLMPVDITGKDVILVDDVLYTGRTIRAAIDNLVSLGRPARVSLAVLVDRGHRELPIRAD
YVGKNIPTSSVEEIIVEVVEVDGRDRVSIVDPT
 
>gi|153953826|ref|YP_001394591.1| pyrimidine regulatory protein PyrR [Clostridium kluyveri DSM 555]
MKLKALILDEKAMNRTLTRISHEIIEKNKGAEDIVLVGIKRRGYPLAKRISENIYKIEKLKLRVESVDIS
LYRDDLSRLSDQPAIKKSHPIDVEDKKIILVDDVIYTGRTARAAIDAIIHSGRPKLIQLAVLIDRGHREL
PIRADYVGKNIPTSRDEIVSVEISEIDKCNSVKIYEV
 
>gi|116873275|ref|YP_850056.1| pyrimidine regulatory protein PyrR [Listeria welshimeri serovar 6b str. SLCC5334]
MQKQVVVMDEAAIKRALTRVSYEIIERNKGTKDLALVGIKTRGIYLAERLHTRILEIEGMDVPVGDIDIT
LYRDDLSYKDDDTREPAVHGTNIPFDINGKKVVLVDDVLYTGRTVRAAMDALMDVGRPAQIHLAVLADRG
HRELPIRADYVGKNIPTSANERVEVRLTDVDHAEDAVIINKNE
 
>gi|126700215|ref|YP_001089112.1| PyrR bifunctional protein [Clostridium difficile 630]
MVEKAQLMDEKAIARAITRISHEIIERNKGVENLVLVGIKTRGVPIANRISKKIEQIEGTKVDTGDIDIT
LYRDDLEKIHVEPVVKGTYLDFNVNDKTVVLVDDVLYTGRTVRASLDAIIDIGRPKSIQLAVLVDRGHRE
LPIRADYVGKNVPTSRHEIISVSLLEIDGEDSVTIKE
 
>gi|222152893|ref|YP_002562070.1| PyrR bifunctional protein [Streptococcus uberis 0140J]
MKKKEIVDDVTMKRAITRITYEIIERNKSLDNLVLAGIKTRGVYLARRIQERLKQLEGIELPIGELDIKP
FRDDMKVEEDTTDMPFDINGKDVILVDDVLYTGRTIRAAIDNLVSLGRPARVGLAVLVDRGHRELPIRAD
YVGKNIPTSSIEEIVVEVIEVDGKDCVSIVDPS
 
>gi|221231966|ref|YP_002511118.1| PyrR bifunctional protein [Streptococcus pneumoniae ATCC 700669]
MKTKEVVDELTVKRAITRITYEIIERNKDLNKIVLAGIKTRGVFIAHRIQERLKQLENLSVPVVELDTKP
FRDDVKSGEDTSLVSVDVTDREVILVDDVLYTGRTIRAAIDNIVGHGRPARVSLAVLVDRGHRELPIRPD
YVGKNIPTSRSEEIIVEMTELDDQDRVLITEEA
 
pyrimidine1:biomoose cjfields$ perl benchmark_fasta.pl testfasta2.faa
Benchmark: timing 1000 iterations of BioMoose, BioPerl...
BioMoose: 0.656269 wallclock secs ( 0.62 usr + 0.02 sys = 0.64 CPU) @ 1562.50/s (n=1000)
BioPerl: 0.924359 wallclock secs ( 0.89 usr + 0.02 sys = 0.91 CPU) @ 1098.90/s (n=1000)
pyrimidine1:biomoose cjfields$

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.