Created
January 9, 2011 14:16
-
-
Save amackey/771717 to your computer and use it in GitHub Desktop.
ncbi_decrypt: utility script to submit decryption jobs to PBS cluster
This file contains hidden or 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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
my $path = shift @ARGV; | |
$path ||= $ENV{PWD}; | |
unless ($path =~ m/^\//) { | |
$path = "$ENV{PWD}/$path"; | |
} | |
print "enter decryption password: "; | |
my $password = <>; | |
chomp($password); | |
my @files = `find $path -name \*.ncbi_enc`; | |
my $jobid; | |
for my $file (@files) { | |
chomp($file); | |
my $decrypted = $file; | |
$decrypted =~ s/\.ncbi_enc$//; | |
next if -e "$decrypted"; | |
my $backup = "$decrypted~"; | |
unlink $backup if -e $backup; | |
my ($basename) = `basename \Q$file`; | |
chomp($basename); | |
$basename = "\Q$basename"; | |
my ($dirname) = `dirname \Q$file`; | |
chomp($dirname); | |
chdir $dirname or die $!; | |
$dirname = "\Q$dirname"; | |
print "cd $dirname\n"; | |
print <<EOL; | |
echo 'cd \$PBS_O_WORKDIR; /h3/t1/apps/genutil/decrypt/decrypt -password $password $basename' | qsub -q cphg -Wgroup_list=CPHG -l select=1:ncpus=1:mem=1GB -l walltime=1:00:00 -W umask=002 -o /dev/null -e /dev/null @{[$jobid ? " -W depend=afterok:$jobid" : '']} | |
EOL | |
($jobid) = `echo 'cd \$PBS_O_WORKDIR; /h3/t1/apps/genutil/decrypt/decrypt -password $password $basename' | qsub -q cphg -Wgroup_list=CPHG -l select=1:ncpus=1:mem=1GB -l walltime=1:00:00 -W umask=002 -o /dev/null -e /dev/null @{[$jobid ? " -W depend=afterok:$jobid" : '']}`; | |
chomp($jobid); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment