This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn throttle [c ms] | |
(let [c' (chan)] | |
(go | |
(while true | |
(>! c' (<! c)) | |
(<! (timeout ms)))) | |
c')) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import '[java.util.concurrent RejectedExecutionHandler])) | |
(def block-policy | |
"When the threadpool is maxed out, submit the runnable to the pool blockingly." | |
(reify RejectedExecutionHandler | |
(rejectedExecution [this runnable thread-pool] | |
(try | |
(.put (.getQueue thread-pool) runnable) | |
(catch InterruptedException e | |
(.interrupt (.currentThread Thread))))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- ./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) = @_; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $protease = Bio::Protease->new(specificity => 'trypsin'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $cutting_pattern = Bio::Tools::SeqPattern->new( | |
-SEQ => 'XXXW[^P]RSX', -TYPE => 'Amino' | |
); | |
my $protease = Bio::Protease->new(specificity => $cutting_pattern); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my @products = $protease->digest('MAAEEELLKKVVIKP'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my @cut_sites = $protease->cleavage_sites($seq); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my @products = $protease->cut($seq, $cut_sites[rand @cut_sites]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $watcher = POE::Component::DirWatch::Object::NewFile->new( | |
directory => '/home/brunov/translate', | |
callback => \&translate, | |
); | |
sub translate { ... } | |
$poe_kernel->run(); | |
OlderNewer