This repository has been archived by the owner on Aug 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Launch.pm
103 lines (92 loc) · 2.65 KB
/
Launch.pm
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
102
103
package Launch;
use strict;
use HPRD;
use Biogrid;
use Mint;
use Dip;
use Intact;
use Bind;
use HomoloGene;
use DBConnector;
use Data::Dumper;
sub new {
my ( $classe, $host, $port, $database, $user, $passwd ) =
@_; #Sending arguments to constructor
my $this =
{ 'DBconnector' => undef
};
$this->{DBconnector} = DBConnector->new( $host, $port, $database, $user, $passwd );
#print Dumper $this->{DBConnector};
die "Cannot connect DBI\n" unless ($this->{DBconnector});
bless( $this, $classe ); #Linking the reference to the class
return $this; #Returning the blessed reference
}
sub help {
my ( $this ) = @_;
print "Usage: perl main.pl\n\t--host host --parse <biogrid|intact|mint|hprd|bind>\n\t--port 1111\n\t--database <dbname>\n\t--user <username>\n\t--password <pswd>\n\t[-debug 123]\n\t[-v]\n";
exit;
}
sub execute {
my ( $this, $db, $taille, $path ) = @_;
$taille = defined($taille) ? $taille : -1;
$path = defined($path) ? $path : "";
my $database;
if ( $db eq "hprd" ) {
$database = HPRD->new( $this->{DBconnector} );
my ( $path, $code ) = $database->download();
if ( $code == 1 || $code == -1 ) {
$database->parse( $taille, $path );
}
}
elsif ( $db eq "biogrid" ) {
$database = Biogrid->new( $this->{DBconnector} );
my ( $path, $code ) = $database->download();
if ( $code == 1 || $code == -1 ) {
$database->parse( $taille, $path );
}
}
elsif ( $db eq "intact" ) {
$database = Intact->new( $this->{DBconnector} );
my ( $path, $code ) = $database->download( $this->{DBconnector} );
if ( $code == 1 || $code == -1 ) {
$database->parse( $taille, $path );
}
}
elsif ( $db eq "dip" ) {
$database = Dip->new( "pidupuis", "toto", $this->{DBconnector} );
my ( $path, $code ) = $database->download();
if ( $code == 1 || $code == -1 ) {
$database->parse( $taille, $path );
}
}
elsif ( $db eq "mint" ) {
$database = Mint->new( $this->{DBconnector} );
my ( $path, $code ) = $database->download();
if ( $code == 1 || $code == -1 ) {
$database->parse( $taille, $path );
}
}
elsif ( $db eq "bind" ) {
$database =
Bind->new( "ppimapbuilder\@gmail.com", "ppimapbuilder",
$this->{DBconnector} );
#my ($path, $code) = $database->download();
my $path = "BIND/Bind.txt";
my $code = 1;
if ( $code == 1 || $code == -1 ) {
$database->parse( $taille, $path );
}
}
elsif ( $db eq "homologene" ) {
#print Dumper $this->{DBconnector};
$database = HomoloGene->new( $this->{DBconnector} );
#my ( $path, $code ) = $database->download( $this->{DBconnector} );
#if ($code == 1 or $code == -1) {
$database->parse("homologene.data.txt");
#}
}
else {
$this->help();
}
}
1;