forked from csf-ngs/fastqc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fastqc
executable file
·248 lines (189 loc) · 7.84 KB
/
fastqc
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
#!/usr/bin/perl
use warnings;
use strict;
use FindBin qw($RealBin);
use Getopt::Long;
# Check to see if they've mistakenly downloaded the source distribution
# since several people have made this mistake
if (-e "$RealBin/uk/ac/bbsrc/babraham/FastQC/FastQCApplication.java") {
die "This is the source distribution of FastQC. You need to get the compiled version if you want to run the program\n";
}
my $delimiter = ':';
if ($^O =~ /Win/) {
$delimiter = ';';
}
if ($ENV{CLASSPATH}) {
$ENV{CLASSPATH} .= "$delimiter$RealBin$delimiter$RealBin/sam-1.32.jar$delimiter$RealBin/jbzip2-0.9.jar";
}
else {
$ENV{CLASSPATH} = "$RealBin$delimiter$RealBin/sam-1.32.jar$delimiter$RealBin/jbzip2-0.9.jar";
}
my @java_args;
my @files;
# We now need to scan the command line for switches which we're going
# to pass on to the main java program.
my $version;
my $help;
my $outdir;
my $unzip;
my $format;
my $contaminant;
my $threads;
my $quiet;
my $nogroup;
my $casava;
my $read;
my $result = GetOptions('version' => \$version,
'help' => \$help,
'quiet' => \$quiet,
'nogroup' => \$nogroup,
'outdir=s' => \$outdir,
'extract!' => \$unzip,
'format=s' => \$format,
'threads=i' => \$threads,
'casava' => \$casava,
'read' => \$read,
'contaminants=s' => \$contaminant,
);
# Check the simple stuff first
if ($help) {
# Just print the help and exit
print while(<DATA>);
exit;
}
if ($version) {
push @java_args ,"-Dfastqc.show_version=true";
}
# Now parse any additional options
if ($outdir) {
unless(-e $outdir and -d $outdir) {
die "Specified output directory '$outdir' does not exist\n";
}
push @java_args ,"-Dfastqc.output_dir=$outdir";
}
if ($contaminant) {
unless (-e $contaminant and -r $contaminant) {
die "Contaminant file '$contaminant' did not exist, or could not be read\n";
}
push @java_args ,"-Dfastqc.contaminant_file=$contaminant";
}
if ($threads) {
if ($threads < 1) {
die "Number of threads must be a positive integer";
}
push @java_args ,"-Dfastqc.threads=$threads";
my $memory = 250 * $threads;
unshift @java_args,"-Xmx${memory}m";
}
else {
unshift @java_args,'-Xmx250m';
}
if ($quiet) {
push @java_args ,"-Dfastqc.quiet=true";
}
if ($casava) {
push @java_args ,"-Dfastqc.casava=true";
}
if ($nogroup) {
push @java_args ,"-Dfastqc.nogroup=true";
}
if (defined $unzip) {
if ($unzip) {
$unzip = 'true';
}
else {
$unzip = 'false';
}
push @java_args,"-Dfastqc.unzip=$unzip";
}
if ($format) {
unless ($format eq 'bam' || $format eq 'sam' || $format eq 'fastq' || $format eq 'sam_mapped' || $format eq 'bam_mapped') {
die "Unrecognised sequence format '$format', acceptale formats are bam,sam,bam_mapped,sam_mapped and fastq\n";
}
push @java_args,"-Dfastqc.sequence_format=$format";
}
if ($read) {
unless (grep { $_ eq $read } ("0", "1", "2", "3", "4", "5")){
die "this is a specialised version of fastqc you have to specify the read: 0 (SR), 1 (PE:1), 2 (PE:2), 3 (SR:Q-), 4 (PE:1:Q-), 5 (PE:2:Q-)\n";
}
}else{
die "this is a specialised version of fastqc you have to specify the read: 0 (SR), 1 (PE:1), 2 (PE:2), 3 (SR:Q-), 4 (PE:1:Q-), 5 (PE:2:Q-)\n";
}
foreach (@ARGV) {
if (/^\-D/) {
push @java_args,$_;
}
else {
push @files,$_;
}
}
# This is set internally as well, but on some JREs it doesn't
# pick up the internally set value properly, so we'll set it
# outside as well which should work.
if (@files or $version or $help) {
push @java_args, "-Djava.awt.headless=true";
}
exec "java",@java_args, "uk.ac.bbsrc.babraham.FastQC.FastQCApplication", @files;
__DATA__
FastQC - A high throughput sequence QC analysis tool
SYNOPSIS
fastqc seqfile1 seqfile2 .. seqfileN
fastqc [-o output dir] [--(no)extract] [-f fastq|bam|sam]
[-c contaminant file] seqfile1 .. seqfileN
DESCRIPTION
FastQC reads a set of sequence files and produces from each one a quality
control report consisting of a number of different modules, each one of
which will help to identify a different potential type of problem in your
data.
If no files to process are specified on the command line then the program
will start as an interactive graphical application. If files are provided
on the commmand line then the program will run with no user interaction
required. In this mode it is suitable for inclusion into a standardised
analysis pipeline.
The options for the program as as follows:
-h --help Print this help file and exit
-v --version Print the version of the program and exit
-o --outdir Create all output files in the specified output directory.
Please note that this directory must exist as the program
will not create it. If this option is not set then the
output file for each sequence file is created in the same
directory as the sequence file which was processed.
--casava Files come from raw casava output. Files in the same sample
group (differing only by the group number) will be analysed
as a set rather than individually. Sequences with the filter
flag set in the header will be excluded from the analysis.
Files must have the same names given to them by casava
(including being gzipped and ending with .gz) otherwise they
won't be grouped together correctly.
--extract If set then the zipped output file will be uncomressed in
the same directory after it has been created. By default
this option will be set if fastqc is run in non-interactive
mode.
--noextract Do not uncompress the output file after creating it. You
should set this option if you do not wish to uncompress
the output when running in non-interactive mode.
--nogroup Disable grouping of bases for reads >50bp. All reports will
show data for every base in the read. WARNING: Using this
option will cause fastqc to crash and burn if you use it on
really long reads, and your plots may end up a ridiculous size.
You have been warned!
-f --format Bypasses the normal sequence file format detection and
forces the program to use the specified format. Valid
formats are bam,sam,bam_mapped,sam_mapped and fastq
-t --threads Specifies the number of files which can be processed
simultaneously. Each thread will be allocated 250MB of
memory so you shouldn't run more threads than your
available memory will cope with, and not more than
6 threads on a 32 bit machine
-c Specifies a non-default file which contains the list of
--contaminants contaminants to screen overrepresented sequences against.
The file must contain sets of named contaminants in the
form name[tab]sequence. Lines prefixed with a hash will
be ignored.
--read The read number from the unaligned bam file:
0 for SE, 1 for first read in pair => 77, 2 for second read in pair => 141, for non QC filtered reads (i.e. good reads)
3 for SE, 4 PE1, 5 PE2 for QC filtered reads (i.e. bad reads)
-q --quiet Supress all progress messages on stdout and only report errors.
BUGS
Any bugs in fastqc should be reported either to [email protected]
or in www.bioinformatics.bbsrc.ac.uk/bugzilla/