/
index_genome.pl
executable file
·62 lines (54 loc) · 1.58 KB
/
index_genome.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
#!/usr/bin/perl -w
use strict;
use File::Basename;
use File::Copy;
use File::Path qw( make_path remove_tree );
use File::Spec;
use File::Spec::Functions;
use Parallel::ForkManager;
use Carp;
use Data::Dumper;
use Getopt::Long;
my $h_genome; #host genome fasta file
my $index_db; #directory containing indexed genomes
my $method = "bowtie2"; #search method, used to determine how to index
my $index_name; #basename of the index
GetOptions(
"i=s" => \$h_genome,
"d=s" => \$index_db,
"m:s" => \$method,
"n=s" => \$index_name,
);
if( !defined( $index_db ) ){
die( "You must define the index_db directory with -d\n" );
}
if( !defined( $h_genome ) ){
die( "You must provide a host genome to index with -i\n" );
}
if( !defined( $index_name ) ){
die( "You must provide an index_name with -n\n" );
}
if( $method eq "bowtie2" ){
my $cmd = "bowtie2-build ${h_genome} ${index_db}/${index_name}";
print "$cmd\n";
system( $cmd );
}
if( $method eq "deconseq" ){
my $cmd = "bwa index -p ${index_db}/${index_name} ${h_genome}";
print "$cmd\n";
system( $cmd );
}
if( $method eq "bmtagger" ){
#bmfilter index
my $cmd = "bmtool -d ${h_genome} -o ${index_db}/${index_name}.bitmask -w 18";
print "$cmd\n";
system( $cmd );
#srprism index
$cmd = "srprism mkindex -i ${h_genome} -o ${index_db}/${index_name}.srprism -M 7168";
print "$cmd\n";
system( $cmd );
#blast index
$cmd = "makeblastdb -in ${h_genome} -dbtype nucl -out ${index_db}/${index_name}.blast";
print "$cmd\n";
system( $cmd );
}