-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.pl
46 lines (40 loc) · 1.41 KB
/
search.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
#!/usr/bin/perl -w
use strict;
use File::Find;
sub fileSearch {
my $extension;
my @extensions;
chomp;
# If this is part of an incremental run, check if this is a bam file from a previous release.
if ($_ =~ /\.bam$/ && $_ =~ /$main::aligner/ && $_ !~ /single/i && $_ !~ /paired/i) {
if (/$main::date/) {
push(@main::currentIncrementBams, "$File::Find::dir/$_");
} elsif (defined $main::previousDate && $_ =~ /$main::previousDate/) {
push(@main::previousIncrementBams, "$File::Find::dir/$_");
} else {
push(@main::previousBams, "$File::Find::dir/$_");
}
} elsif ($_ =~ /fastq/i) {
if (!defined $main::fastqList) {$main::fastq{$_} = $File::Find::dir;}
} elsif ($_ =~ /\.glf/) {
$main::existingGlf{$_} = $File::Find::dir;
} elsif ($_ =~ /$main::date/ && $_ =~ /$main::aligner/ && $_ =~ /bam$/) {
# Exclude bams containing "unaligned.bam", "special.bam" and "multiple.bam".
if ($_ !~ /unaligned.bam$/ && $_ !~ /special.bam$/ && $_ !~ /multiple.bam$/) {
push(@main::existingFiles, "$File::Find::dir/$_");
}
}
}
# Search for fastq files only.
sub findFastq {
chomp;
if ($_ =~ /fastq/i) {
if (exists $main::fastq{$_}) {
print("\n\n***SCRIPT TERMINATED***\n\n");
print("Fastq file \"$_\" appears twice:\n\t$main::fastq{$_}/$_\n\t$File::Find::dir/$_\n");
die("Error in search::findFastq,\n");
}
$main::fastq{$_} = $File::Find::dir;
}
}
1;