-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodencode_mart_load_transcript_cl.pl
88 lines (77 loc) · 2.44 KB
/
modencode_mart_load_transcript_cl.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
#!/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 Loader::TranscriptionFeatureMain_Loader;
#use Loader::
print "initializing...\n";
#my ($unique_id, $config, $gff, $species, $pname, $devstage, $tissue, $sex);
my ($unique_id, $config, $gff, $species, $devstage, $tissue, $sex);
$config = $root_dir . 'config/modencode_transcriptome.ini';
my $option = GetOptions ("id=s" => \$unique_id,
"config:s" => \$config,
"gff=s" => \$gff,
"sp=s" => \$species,
#"tf=s" => \$pname,
"devstage:s" => \$devstage,
"tissue:s" => \$tissue,
"sex:s" => \$sex) or usage();
usage("unique submission id needed.") unless defined($unique_id);
usage("configure file $config not exists.") unless -e $config;
usage("please specify the species.") unless defined($species);
#usage() unless defined($pname);
usage("gff file $gff not exists.") unless -e $gff;
#usage("please specify devstage or tissue.") unless defined($devstage) || defined($tissue);
#usage() unless defined($sex);
my %ini;
tie %ini, 'Config::IniFiles', (-file => $config);
$species = uniform_species($species);
$devstage = uniform_devstage($devstage);
$tissue = uniform_tissue($tissue);
$sex = uniform_sex($sex);
my $fl = new Loader::TranscriptionFeatureMain_Loader({
config => \%ini,
dcc_id => $unique_id,
species => $species,
devstage => $devstage,
tissue => $tissue,
sex => $sex
});
$fl->load($gff);
sub usage {
my $hint = shift;
my $usage = qq[$0 -id <submission_id> -cfg <config_file> -sp <species> -devstage <development stage> -sex <sex> -tissue <tissue> -gff <gff3 file>];
print "Usage: $usage\n";
print "$hint\n";
exit 2;
}
sub uniform_species {
my $sp = lc(shift);
my %map = ('worm' => 'Caenorhabditis elegans',
'fly' => 'Drosophila melanogaster');
return $map{$sp} if exists $map{$sp};
return undef;
}
sub uniform_devstage {
my $devstage = lc(shift);
return $devstage;
}
sub uniform_tissue {
my $tissue = lc(shift);
return $tissue;
}
sub uniform_sex {
my $sex = lc(shift);
return $sex;
}