-
Notifications
You must be signed in to change notification settings - Fork 0
/
modencode_mart_load.pl
101 lines (88 loc) · 2.54 KB
/
modencode_mart_load.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
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
#!/usr/bin/perl
use strict;
use warnings;
my ($root_dir, $schema_dump_dir);
BEGIN {
$root_dir = $0;
$root_dir =~ s/[^\/]*$//;
$root_dir = "./" unless $root_dir =~ /\//;
$schema_dump_dir = $root_dir . 'Mart';
push @INC, $root_dir;
push @INC, $schema_dump_dir;
}
use Data::Dumper;
use Config::IniFiles;
use Getopt::Long;
use ModENCODE::Parser::LWChado;
use GEO::LWReporter;
use Loader::TransfacTranscriptionalFactorMain_Loader;
use Loader::TransfacBindingSitesMain_Loader;
use Loader::TransfacDevelopmentalStageDm_Loader;
use Loader::TransfacTissueDm_Loader;
use Pipeline::Pipeline;
print "initializing...\n";
my ($unique_id, $config, $gff);
$config = $root_dir . 'config/modencode_mart.ini';
my $option = GetOptions ("unique_id=s" => \$unique_id,
"config=s" => \$config,
"gff=s" => \$gff) or usage();
usage() unless defined($unique_id);
usage() unless -e $config;
my %ini;
tie %ini, 'Config::IniFiles', (-file => $config);
my $pipe = new Pipeline::Pipeline({
'config' => \%ini});
my ($reader, $experiment) = $pipe->load_experiment($unique_id);
print $experiment->to_string();
my $reporter = new GEO::LWReporter({
'unique_id' => $unique_id,
'reader' => $reader,
'experiment' => $experiment});
$reporter->set_all();
my $species = $reporter->get_organism();
my $pname = $reporter->get_tgt_gene();
my $devstage = $reporter->get_devstage();
my $tissue = $reporter->get_tissue();
my $sex = $reporter->get_sex();
my $antibody = $reporter->get_antibody();
$pname = $antibody unless $pname;
my $tfl = new Loader::TransfacTranscriptionalFactorMain_Loader({
dcc_id => $unique_id,
config => \%ini,
species => $species,
pname => $pname
});
$tfl->info;
my $tf = $tfl->load; #a tf table dbix::class
if ($devstage) {
my $devl = new Loader::TransfacDevelopmentalStageDm_Loader({
config => \%ini,
tf_id_key => $tf->tf_id_key,
official_name => $devstage,
species => $species,
sex => $sex
});
$devl->load();
}
if ($tissue) {
my $tl = new Loader::TransfacTissueDm_Loader({
config => \%ini,
tf_id_key => $tf->tf_id_key,
official_name => $tissue,
species => $species,
sex => $sex
});
$tl->load();
}
my $bsl = new Loader::TransfacBindingSitesMain_Loader({
config => \%ini,
species => $species,
tf_id_key => $tf->tf_id_key
});
$gff = $pipe->download_gff() unless $gff;
$bsl->load($gff);
sub usage {
my $usage = qq[$0 -unique_id <submission_id> -config <config_file> --no_insert <0|1> --no_create <0|1> --force_recreate <0|1>];
print "Usage: $usage\n";
exit 2;
}