masschroq-condor.pl 3.42 KB
Newer Older
Edlira Nano's avatar
Edlira Nano committed
1
2
#!/usr/bin/perl -w

3
# This script creates a masschroq condor job submit file
Edlira Nano's avatar
Edlira Nano committed
4
# condor_submit_masschroq.txt. It takes the same arguments than 
5
# masschroq and puts them in this condor submit file as 
Edlira Nano's avatar
Edlira Nano committed
6
7
8
# arguments to the masschroq job to be launched. It also creates a
# temporary directory for where condor will put all
# the log, out err ... output files for this job. 
Edlira Nano's avatar
Edlira Nano committed
9
10

use strict;
11
use warnings;
12
13
use File::Temp qw/ tempdir /;

Edlira Nano's avatar
Edlira Nano committed
14

15
16
display_help() if (@ARGV < 1 or 
		   $ARGV[0] =~ m/^(-h|--help)$/);
Edlira Nano's avatar
Edlira Nano committed
17

18
19
20

my ($tempdir_location, $tempdir_template, $tempdir);

Edlira Nano's avatar
Edlira Nano committed
21
# temporary directory filename (by default it is the system's one) 
22
$tempdir_location = "/gorgone/pappso/tmp";
Edlira Nano's avatar
Edlira Nano committed
23
# template name for the temporary directories we will create
24
$tempdir_template = "temp_masschroq_condor_jobXXXX";
Edlira Nano's avatar
Edlira Nano committed
25
# create a temporary directory in the choosen temporary directory
26
27
$tempdir = tempdir($tempdir_template, DIR => $tempdir_location);

Edlira Nano's avatar
Edlira Nano committed
28
#create condor file in current directory
29
open my $condor_file, 
30
    ">".$tempdir."/submit_condor_masschroq.txt"
31
    or die  "Can't write condor_submit.txt: $!";
Edlira Nano's avatar
Edlira Nano committed
32

33
print $condor_file "Universe   = vanilla\n";
Edlira Nano's avatar
Edlira Nano committed
34

Olivier Langella's avatar
Olivier Langella committed
35
print $condor_file "Executable = ${CMAKE_INSTALL_PREFIX}/bin/masschroq\n";
Edlira Nano's avatar
Edlira Nano committed
36

37
print $condor_file "Log        = $tempdir/submit_condor.log\n";
Edlira Nano's avatar
Edlira Nano committed
38

39
print $condor_file "Output     = $tempdir/masschroq.out\n";
Edlira Nano's avatar
Edlira Nano committed
40

41
print $condor_file "Error      = $tempdir/masschroq.error\n";
Edlira Nano's avatar
Edlira Nano committed
42

43
print $condor_file "requirements  = Cpus == 8\n";
44

45
print $condor_file "\n";
Edlira Nano's avatar
Edlira Nano committed
46

47
print $condor_file "Arguments  = -c 8 -t /tmp ";
48
49
50
51
52
53
54
55
56
foreach (@ARGV) {
    print $condor_file " $_"
}
print $condor_file "\n";

print $condor_file "Queue\n";

close $condor_file;

Olivier Langella's avatar
Olivier Langella committed
57
58
print "masschroq condor submission file submit_condor_masschroq.txt created\n";
print "condor job temporary directory $tempdir created\n";
59

60
print "Starting masschroq in condor\n";
61
62
63
64
65

system("condor_submit ".$tempdir."/submit_condor_masschroq.txt");

#eval "

Edlira Nano's avatar
Edlira Nano committed
66
# help function
67
68
#    print "  -t, --tmpdir DIRECTORY\tuse DIRECTORY as temporary working direcory for masschroq : temporary files generated by masschroq during execution time (one file or several slices at a time per xml data file being analysed) will go there. By default DIRECTORY is the current working directory of masschroq. Use this option if you want to set another one.\n";

69
70
71
72
73
74
75
76
77
78
79
80
sub display_help {
    print "Unknown option: @_\n" if ( @_ );
    print "Usage: masschroq-condor [OPTION] [FILE]\n";
    print "Perform Mass Chromatogram Quantification as indicated in XML input FILE via masschroq on a condor system.\n";
    print "Options:\n";
    print"  -h, --help\t\t\tdisplay this help and exit\n";
    print "  -p, --parse-peptides\t\tperform peptide text file parsing only, no quantification. If the identified peptides are given to masschroq via peptide text files (defined in FILE), he parses them, creates a new file called parsed-peptides_FILE which contains the FILE content (minus the lines relative to thr peptide text files to parse) plus the parsed peptides information. By default masschroq continues analysis and quantification on this new file. Use this option if you want masschroq only to parse the petide files but not to continue quantification on them. This allows you to check the parsed peptides and to add trace information on specific peptides before quantification.\n";
    print "  -v, --version\t\t\tdisplay version number and exit\n";
    print "For additional information, see the MassChroQ Homepage :\n";
    print "http://pappso.inra.fr/bioinfo/masschroq/\n";
    exit;
}