-
Notifications
You must be signed in to change notification settings - Fork 1
/
SRRDownloadbyWget.pl
56 lines (51 loc) · 1.15 KB
/
SRRDownloadbyWget.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/perl
use strict;
use Cwd;
my $dir=getcwd;
chdir $dir;
my $file=shift @ARGV;
my $submit=shift @ARGV;
open F,$file;
my %list;
while(<F>){
if(/(SRR\d+).*(ftp.*gz)/){
$list{$1}=$2;
}
}
my @job=glob("*.job");
my @fastq=glob("*.gz");
foreach my $job(@job){
my ($sample,undef)=split/\./,$job;
my $exist=1;
foreach my $fastq(@fastq){
$exist=0 if $fastq =~/$sample/;
next;
}
# print "$list{$sample}\n" if $exist eq 1;
if($exist eq 1){
my $id=$sample;
my $curr_dir = $dir;
my $queue="hotel";
my $walltime="168:00:00";
my $ppn=1;
my $job_file_name="$sample.job";
open(OUT, ">$job_file_name") || die("Error in opening file $job_file_name.\n");
print OUT "#!/bin/csh\n";
print OUT "#PBS -N $id\n";
print OUT "#PBS -q $queue\n"; # glean is free, pdafm
print OUT "#PBS -l nodes=1:ppn=$ppn\n";
print OUT "#PBS -l walltime=$walltime\n";
print OUT "#PBS -o ".$id.".log\n";
print OUT "#PBS -e ".$id.".err\n";
print OUT "#PBS -V\n";
print OUT "#PBS -M shicheng.guo\@gmail.com \n";
print OUT "#PBS -m abe\n";
print OUT "#PBS -A k4zhang-group\n";
print OUT "cd $curr_dir\n";
print OUT "wget $list{$sample}\n";
close(OUT);
if($submit eq 'submit'){
system("qsub $job_file_name");
}
}
}