/
gbrowse_syn_load_alignment_database.pl
executable file
·73 lines (52 loc) · 1.75 KB
/
gbrowse_syn_load_alignment_database.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
#!/usr/bin/perl -w
use strict;
=head1 NAME
load_alignment_database.pl - a script to load the database for gbrowse_syn.
=head1 DESCRIPTION
The expected file format is tab-delimited (shown below):
species1 ref1 start1 end1 strand1 cigar_string1 \
species2 ref2 start2 end2 strand2 cigar_string2 \
coords1... | coords2...
the coords (coordinate) format:
pos1_species1 pos1_species2 ... posn_species1 posn_species2 | \
pos1_species2 pos1_species1 ... posn_species2 posn_species1
where pos is the matching sequence coordinate (ungapped) in each
species.
=cut
use strict;
use Getopt::Long;
use Pod::Usage;
use constant VERBOSE => 0;
use Bio::DB::Synteny::Store;
use Bio::DB::Synteny::Store::Loader::Tabular;
my ( $format, $user, $pass, $dsn, $verbose, $nomap, $create, $adaptor );
GetOptions(
'f|format=s' => \$format,
'a|adaptor=s' => \$adaptor,
'u|user=s' => \$user,
'p|pass=s' => \$pass,
'd|dsn=s' => \$dsn,
'v|verbose' => \$verbose,
'M|nomap' => \$nomap,
'c|create' => \$create
);
my $usage = "Usage: load_alignment_database.pl -u username -p password -d database [-m map_resolution, -v, -n, -c] file1, file2 ... filen\n\n";
$dsn || pod2usage();
$verbose ||= VERBOSE;
my $syn_store = Bio::DB::Synteny::Store->new(
-adaptor => $adaptor || 'DBI::mysql',
-dsn => $dsn,
-user => $user,
-pass => $pass,
-create => $create,
-verbose => $verbose,
);
my $loader = Bio::DB::Synteny::Store::Loader::Tabular->new(
-store => $syn_store,
-nomap => $nomap,
-verbose => $verbose,
);
# wrap the load in a transaction for speed
$syn_store->dbh->{AutoCommit} = 0;
$loader->load( @ARGV );
$syn_store->dbh->{AutoCommit} = 0;