ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/scripts/pfam_slice.psx
Revision: 24
Committed: Tue Jul 26 21:46:39 2011 UTC (13 years, 2 months ago) by gpertea
File size: 1785 byte(s)
Log Message:
Line File contents
1 #!/usr/bin/perl
2 use strict;
3 umask 0002;
4 my $usage=q{
5 gridx/psx slice processing script for pfam - never to be used by itself.
6
7 Usage:
8
9 gridx [gridx_opts] -i <proteinfile> pfam_slice.psx <pfam_domains_dir> \
10 [pfam_scan.pl_options]
11
12 Example:
13
14 gridx -p 20 -n 1000 -m gpertea -q -i tranprots.fa pfam_slice.psx \
15 /fs/szgenefinding/domains/pfam --fast
16
17 (searching 1000 proteins at a time from input file tranprots.fa,
18 using at most 20 cpus on the grid; notify user gpertea by e-mail
19 when finished)
20 };
21
22 # 1 is the name of the slice file
23 # 2 is the # of sequences in the slice file
24 # 3 is the slice# being processed (1-based)
25 # 4 is 1 if this is the last slice, 0 if not the last slice
26 # 5 is the # of sequences skipped initially
27 # 6 is the upper limit of slices to be processed (-1 = ALL)
28 # 7.. user parameters
29 # 1 2 3 4 5 6 7 ...
30 my ($file, $numpass, $slice_num, $last, $skipped, $total, $pfamdir, @otheropts)=@ARGV;
31
32 die "$usage\n" unless -d $pfamdir;
33
34 my $log_file='log_std';
35 my $err_file='err_log';
36 # -- redirect output just in case..
37 open(STDERR, '>>'.$err_file);
38 open(STDOUT, '>>'.$log_file);
39
40 my $pfam_res=$file.'.pfam';
41 my $pfamopts=join(' ',@otheropts);
42 my $cmd="/fs/szannotation/bin/pfam_scan.pl $pfamopts -d $pfamdir".
43 " -o $pfam_res $file";
44 my $slno=sprintf("slice:%09d",$slice_num);
45 print STDERR ">>$slno: $cmd\n";
46 &runCmd($cmd, $pfam_res);
47 print STDERR "<<$slno: done.\n";
48
49 unlink($file);
50 exit 0;
51
52 sub runCmd {
53 my ($docmd, @todel) = @_;
54 my $errmsg = `($docmd) 2>&1`;
55 if ($? || ($errmsg=~/ERROR/si) || ($errmsg=~/Segmentation/si) || ($errmsg=~/Failed/s) || $errmsg=~/Invalid/s) {
56 print STDERR "!Error at:\n$docmd\n";
57 print STDERR "$errmsg\n";
58 foreach (@todel) {
59 unlink($_);
60 }
61 exit(1);
62 }
63 }

Properties

Name Value
svn:executable *