Commit 25692be6 authored by Sebastien Moretti's avatar Sebastien Moretti
Browse files

General function for fetch XML NCBI message

parent 9b8392da
......@@ -831,6 +831,12 @@ sub fetch {
}
print {*STDERR} "Problem with NCBI eutils, please try again later/n";
exit(4);
}
sub fetch_fasta {
my ($url, $outfile) = @_;
}
......@@ -965,9 +971,9 @@ sub downloadSeqFromGIs{
my $whatNumber = 0;
if ( $amont =~ /^\d+$/ && $aval =~ /^\d+$/ ){
GET_CHR_SEQ:
for(my $rep=0;$rep <= 4; $rep++){
system("wget -q -O $cache/${acc[$a]}-${amont}.fas 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nucleotide&id=${acc[$a]}&rettype=fasta&retmode=text&from=$amont&to=$aval&tool=ProtoGene&email=smoretti\@unil.ch'") if ( !-e "$cache/${acc[$a]}-${amont}.fas" || -z "$cache/${acc[$a]}-${amont}.fas" || $cache eq 'none' || ($cache eq 'update' && -M "$cache/${acc[$a]}-${amont}.fas" > $cacheStorageTime ) );
open(my $CIBLE, '<', "$cache/${acc[$a]}-${amont}.fas");
for(my $rep=0; $rep <= 4; $rep++){
system("wget -q -O $cache/$acc[$a]-$amont.fas 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nucleotide&id=$acc[$a]&rettype=fasta&retmode=text&from=$amont&to=$aval&tool=ProtoGene&email=smoretti\@unil.ch'") if ( !-e "$cache/$acc[$a]-$amont.fas" || -z "$cache/$acc[$a]-$amont.fas" || $cache eq 'none' || ($cache eq 'update' && -M "$cache/$acc[$a]-$amont.fas" > $cacheStorageTime ) );
open(my $CIBLE, '<', "$cache/$acc[$a]-$amont.fas");
my $counter = 0;
my $lines = 0;
CHECK_CHR_SEQ:
......@@ -983,15 +989,15 @@ sub downloadSeqFromGIs{
last GET_CHR_SEQ if ( $whatNumber==20 );
if ( $counter != 1 ){
$rep = $rep-1;
unlink("$cache/${acc[$a]}-${amont}.fas");
unlink("$cache/$acc[$a]-$amont.fas");
}
}
}
else{
GET_OTHER_SEQ:
for(my $rep=0;$rep <= 4; $rep++){
system("wget -q -O $cache/${acc[$a]}.fas 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nucleotide&id=${acc[$a]}&rettype=fasta&retmode=text&tool=ProtoGene&email=smoretti\@unil.ch'") if ( !-e "$cache/${acc[$a]}.fas" || -z "$cache/${acc[$a]}.fas" || $cache eq 'none' || ($cache eq 'update' && -M "$cache/${acc[$a]}.fas" > $cacheStorageTime ) );
open(my $CIBLE, '<', "$cache/${acc[$a]}.fas");
for(my $rep=0; $rep <= 4; $rep++){
system("wget -q -O $cache/$acc[$a].fas 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nucleotide&id=$acc[$a]&rettype=fasta&retmode=text&tool=ProtoGene&email=smoretti\@unil.ch'") if ( !-e "$cache/$acc[$a].fas" || -z "$cache/$acc[$a].fas" || $cache eq 'none' || ($cache eq 'update' && -M "$cache/$acc[$a].fas" > $cacheStorageTime ) );
open(my $CIBLE, '<', "$cache/$acc[$a].fas");
my $counter = 0;
my $lines = 0;
CHECK_OTHER_SEQ:
......@@ -1006,7 +1012,7 @@ sub downloadSeqFromGIs{
last GET_OTHER_SEQ if ( $whatNumber==20 );
if ( $counter != 1 ){
$rep=$rep-1;
unlink("$cache/${acc[$a]}.fas");
unlink("$cache/$acc[$a].fas");
}
}
}
......
Supports Markdown
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