-
Notifications
You must be signed in to change notification settings - Fork 23
/
callKrakenOnConvertedDB.pl
75 lines (54 loc) · 1.35 KB
/
callKrakenOnConvertedDB.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use FindBin;
use lib "$FindBin::Bin/perlLib";
use Cwd qw/getcwd abs_path/;
use File::Copy;
$| = 1;
use SimulationsKraken;
use Util;
my $kraken_binPrefix = SimulationsKraken::getKrakenBinPrefix();
my $Bracken_dir = SimulationsKraken::getBrackenDir();
my $krakenDBTemplate = SimulationsKraken::getKrakenDBTemplate();
unless(scalar(@ARGV) == 3)
{
print_help();
}
my $database = $ARGV[0];
my $FASTQ = $ARGV[1];
my $outputDir = $ARGV[2];
# test that database is valid
# todo reinstate
#my %taxonID_2_contigs;
#my %contigLength;
#Util::read_taxonIDs_and_contigs($database, \%taxonID_2_contigs, \%contigLength);
unless(-e $outputDir)
{
mkdir($outputDir) or die "Cannot mkdir $outputDir";
}
my %taxonID_original_2_contigs;
my %contigLength;
Util::read_taxonIDs_and_contigs($database, \%taxonID_original_2_contigs, \%contigLength);
my $krakenDir = $database . '/kraken';
SimulationsKraken::doKrakenOnExistingDB (
$krakenDir,
$FASTQ,
$outputDir,
$kraken_binPrefix,
$Bracken_dir,
\%taxonID_original_2_contigs
);
sub print_help
{
print qq(
callKrakenOnConvertedDB.pl
Call Kraken/Bracken with a FASTQ file on a converted DB.
Usage:
perl callKrakenOnConvertedDB.pl dbNAME FASTQFILE outputDir
Example:
perl callKrakenOnConvertedDB.pl databases/miniSeq test.fastq testKrakenResults
);
exit;
}