Skip to content
Snippets Groups Projects
Commit fd07aeca authored by Ian Longden's avatar Ian Longden
Browse files

tidy up of code

parent b7483588
No related branches found
No related tags found
No related merge requests found
...@@ -38,9 +38,8 @@ if(defined($dumpcheck) && defined($maxdump)){ ...@@ -38,9 +38,8 @@ if(defined($dumpcheck) && defined($maxdump)){
open(FILE, $file) or die("Could not open input file '$file'"); open(FILE, $file) or die("Could not open input file '$file'");
my @all_species; my @all_species;
my $xref; my $xref=undef;
#my $output=undef; my $species=undef;
my $new=undef;
my $type; my $type;
while( my $line = <FILE> ) { while( my $line = <FILE> ) {
chomp($line); chomp($line);
...@@ -49,67 +48,57 @@ while( my $line = <FILE> ) { ...@@ -49,67 +48,57 @@ while( my $line = <FILE> ) {
# print $line."\n"; # print $line."\n";
my ($key, $value) = split("=",$line); my ($key, $value) = split("=",$line);
if($key eq "species" || $key eq "xref"){ if($key eq "species"){
if(defined($new)){ #save old one $type = "species";
if($type eq "species"){ if(defined($species)){
push @all_species, $new; push @all_species, $species;
} $species = undef;
else{
$xref = $new;
}
$new = undef;
} }
if($key eq "species"){ eval "require XrefMapper::$value";
$type = "species"; my $module;
eval "require XrefMapper::$value"; if($@) {
my $module; warn("Could not require mapper module XrefMapper::$value\n" .
if($@) { "Using XrefMapper::BasicMapper instead:\n$@");
warn("Could not require mapper module XrefMapper::$value\n" . require XrefMapper::BasicMapper;
"Using XrefMapper::BasicMapper instead:\n$@"); $module = "BasicMapper";
require XrefMapper::BasicMapper;
$module = "BasicMapper";
}
else{
$module = $value;
}
{
no strict 'refs';
$new = "XrefMapper::$module"->new();
$new->species($value);
}
if(defined($dumpcheck)){
$new->dumpcheck("yes");
}
if(defined($maxdump)){
$new->maxdump($maxdump);
}
if(defined($use_existing_mappings)){
$new->use_existing_mappings("yes");
}
} }
else{ else{
$type= "xref"; $module = $value;
$new = new XrefMapper::db(); }
{
no strict 'refs';
$species = "XrefMapper::$module"->new();
$species->species($value);
}
if(defined($dumpcheck)){
$species->dumpcheck("yes");
}
if(defined($maxdump)){
$species->maxdump($maxdump);
}
if(defined($use_existing_mappings)){
$species->use_existing_mappings("yes");
} }
} }
else{ elsif($key eq "xref"){
$new->$key($value); $type = "xref";
$xref = new XrefMapper::db();
} }
} elsif($type eq "species"){ # processing species data
$species->$key($value);
if(defined($new)){ #save last one
if($type eq "species"){
push @all_species, $new;
} }
else{ elsif($type eq "xref"){ # processing xref data
$xref = $new; $xref->$key($value);
} }
$new = undef;
} }
if(defined($species)){
push @all_species, $species;
}
for my $species ( @all_species ) { for my $species ( @all_species ) {
$species->xref($xref); $species->xref($xref); # attach xref object to species object
$species->dump_seqs(); $species->dump_seqs();
$species->run_matching(); $species->run_matching();
$species->store(); $species->store();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment