Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env perl
use Modern::Perl;
use Sub::Call::Recur;
use Sub::Call::Tail;
use Benchmark 'cmpthese';
no warnings 'recursion';
sub fact_recur {
my ($n, $accum) = @_;
coerce BioSimpleAlign,
from BioSeqIO, via { _seq_to_aln( _seqI_to_seq($_) ) },
from BioSeq, via { _seq_to_aln($_) },
from BioAlignIO, via { $_->next_aln },
from ProfileFile, via { _filename_to_aln($_) };
use Class::Autouse qw(:superloader);
my $thing = Dep::2->new;
use Dep::1;
use Dep::2;
...
use Dep::10;
my $thing = Dep::2->new;
brunov@dora:~$ re.pl
$_ my $thing = Foo->new;
$Foo1 = Foo=HASH(0xa77cb98)
$_ my $other = Bar->new;
$Bar1 = Bar=HASH(0xabc4eb8)
# in ~/.repl/repl.rc:
use Class::Autouse qw(:superloader);
my @deps; push "Dep::$_" for (1..10);
use Class::Autouse @deps;
my $thing = Dep::2->new;
#!/usr/bin/perl
use Modern::Perl;
use POE qw(Component::DirWatch::Object::NewFile);
use Bio::SeqIO;
use Bio::Seq;
use File::Temp;
use File::Copy qw(move);
use Gtk2::Notify -init, "Translator";
my $watcher = POE::Component::DirWatch::Object::NewFile->new(
sub translate {
my ( $filename, $fullpath ) = @_;
my $seqI = Bio::SeqIO->new( -file => $fullpath );
my $tempfile = File::Temp->new( SUFFIX => '.fasta' )->filename;
my $seqO = Bio::SeqIO->new(
-file => ">$tempfile",
-format => 'fasta'
sub translate {
# Translate the input file from dna to protein, replacing the
# original file. Sequences that are already protein remain
# untouched.
my ( $filename, $fullpath ) = @_;
# Input sequence stream.
my $seqI = Bio::SeqIO->new( -file => $fullpath );