Skip to content

Instantly share code, notes, and snippets.

@brunoV
brunoV / Array.pm
Created January 17, 2009 19:28
Patches that implement sort and sort_in_place for MX::AttributeHelpers::MethodProviders::(List,Array)
--- ./Array.pm 2009/01/17 16:37:01 1.1
+++ ./Array.pm 2009/01/17 20:16:42
@@ -136,6 +136,18 @@
}
}
+sub sort_in_place : method {
+ my ($attr, $reader, $writer) = @_;
+ return sub {
+ my ($instance, $predicate) = @_;
my $protease = Bio::Protease->new(specificity => 'trypsin');
my $cutting_pattern = Bio::Tools::SeqPattern->new(
-SEQ => 'XXXW[^P]RSX', -TYPE => 'Amino'
);
my $protease = Bio::Protease->new(specificity => $cutting_pattern);
my $nobel_prize_winning_specificity_model = sub {
my $peptide = shift;
# decide whether to cut $peptide or not
}
my $protease = Bio::Protease->new(
specificity => $nobel_prize_winning_specificity_model;
);
my @products = $protease->digest('MAAEEELLKKVVIKP');
my @cut_sites = $protease->cleavage_sites($seq);
my @products = $protease->cut($seq, $cut_sites[rand @cut_sites]);
We couldn’t find that file to show.
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 );
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'