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

-dumpcheck option added which will not dump out the fasta files if they already exist

parent 97a51fd4
No related branches found
No related tags found
No related merge requests found
......@@ -224,6 +224,23 @@ sub dump_xref{
my @lists =@{$self->get_set_lists()};
my $i=0;
if(defined($self->dumpcheck())){
my $skip = 1;
foreach my $list (@lists){
if(!-e $xref->dir()."/xref_".$i."_dna.fasta"){
$skip = 0;
}
if(!-e $xref->dir()."/xref_".$i."_prot.fasta"){
$skip = 0;
}
$i++;
}
if($skip){
return;
}
}
$i=0;
foreach my $list (@lists){
print "method->".@$list[0]."\n";
$method[$i] = shift @$list;
......@@ -407,6 +424,9 @@ sub fetch_and_dump_seq{
# store ensembl protein file name and open it
#
$self->ensembl_protein_file($self->dir."/".$self->species."_protein.fasta");
if(defined($self->dumpcheck()) and -e $self->ensembl_protein_file() and -e $self->ensembl_dna_file()){
return;
}
open(PEP,">".$self->ensembl_protein_file())
|| die("Could not open dna file for writing: ".$self->ensembl_protein_file."\n");
......
......@@ -183,6 +183,15 @@ sub dir {
}
sub dumpcheck {
my ($self, $arg) = @_;
(defined $arg) &&
($self->{_dumpcheck} = $arg );
return $self->{_dumpcheck};
}
sub process_dir {
my ($dir) = @_;
......
......@@ -15,10 +15,11 @@ $dir = join('/', @d);
unshift @INC, $dir;
my ($file, $verbose, $help);
my ($file, $verbose, $dumpcheck, $help);
GetOptions ('file=s' => \$file,
'verbose' => \$verbose,
'dumpcheck' => \$dumpcheck,
'help' => sub { &show_help(); exit 1;} );
usage("-file option is required") if(!$file);
......@@ -44,9 +45,6 @@ while( my $line = <FILE> ) {
if($type eq "species"){
push @all_species, $new;
}
# elsif($type eq "output"){
# $output = $new;
# }
else{
$xref = $new;
}
......@@ -70,11 +68,10 @@ while( my $line = <FILE> ) {
$new = "XrefMapper::$module"->new();
$new->species($value);
}
if(defined($dumpcheck) and $dumpcheck){
$new->dumpcheck("yes");
}
}
# elsif($key eq "output"){
# $type= "output";
# $new = new XrefMapper::db();
# }
else{
$type= "xref";
$new = new XrefMapper::db();
......@@ -89,9 +86,6 @@ if(defined($new)){ #save last one
if($type eq "species"){
push @all_species, $new;
}
# elsif($type eq "output"){
# $output= $new;
# }
else{
$xref = $new;
}
......@@ -116,9 +110,8 @@ sub usage {
print STDERR <<EOF;
usage: perl xref_mapper <options>
options: -file <input_file> input file with tab delimited 'species',
options: -file <input_file> input file with keyword pairs for 'species',
'host', 'port', 'dbname' ,'user', 'password' and 'directory'
values on each line
-verbose print out debug statements
......
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