Commit a7e69e85 authored by Sebastien Moretti's avatar Sebastien Moretti
Browse files

Until 1st download of seq from NCBI

parent eb2753fd
......@@ -319,31 +319,36 @@ for(my $r=0; $r<=$#original_names; $r++){
#When multiple equivalent blast hits ==> use, and add, every hits
my ($resultPOS, $resultBOJ) = ('', '');
my @failureStatus = ('');
my @failureStatus = (''); # To always have $failureStatus[0] defined
my @intronStatus = ('');
HIT_LINK:
for(my $qq=0; $qq<=$#equivalent_blast_hits; $qq++){
print "\n$fasta_header --> [$equivalent_blast_hits[$qq]]\n";
my @nt_GIs;
my $intronStep = 0;
if ( exists($template_NT->{$short_name}) && $template_NT->{$short_name} ne '' && $template_NT->{$short_name} !~ /^My_Seq$/i ){
downloadSeq($cache, $date, '', '', $template_NT->{$short_name});
@nt_GIs = $template_NT->{$short_name};
}
elsif ( exists($template_NT->{$short_name}) && $template_NT->{$short_name} ne '' && $template_NT->{$short_name} =~ /^My_Seq$/i ){
open(my $MYSEQ, '>', "$cache/My_Seq-$$.fas");
print {$MYSEQ} ">My_Seq-$$ for $short_name\n".$template_SEQ->{$short_name}."\n";
close $MYSEQ;
@nt_GIs = "My_Seq-$$";
# Get Nt sequence from template
if ( exists($template_NT->{$short_name}) && $template_NT->{$short_name} ne '' ){
if ( $template_NT->{$short_name} !~ /^My_Seq$/i ){
downloadSeq($cache, $date, '', '', $template_NT->{$short_name});
@nt_GIs = $template_NT->{$short_name};
}
else {
open(my $MYSEQ, '>', "$cache/My_Seq-$$.fas");
print {$MYSEQ} ">My_Seq-$$ for $short_name\n".$template_SEQ->{$short_name}."\n";
close $MYSEQ;
@nt_GIs = "My_Seq-$$";
}
}
# Get Nt sequence through prot acc -> prot gi -> nt linked gi -> nt acc
else{
#Prot ACC -> PUID
my $protGI = blastPAcc2PGI($equivalent_blast_hits[$qq]);
if ( $protGI eq '' ){
print "\tNo protein (prot GI) link found for $equivalent_blast_hits[$qq] in $fasta_header\n\n";
@failureStatus = ('PUI_unavailable', $equivalent_blast_hits[$qq]);
next;
next HIT_LINK;
}
# print "\t$protGI\n";
......@@ -352,7 +357,7 @@ for(my $r=0; $r<=$#original_names; $r++){
if ( $ntGIs eq '' && $geneID eq '' ){
print "\tNo nucleotide (nt GIs) link found for $equivalent_blast_hits[$qq] in $fasta_header\n\n";
@failureStatus = ('No_nt_link', $equivalent_blast_hits[$qq]);
next;
next HIT_LINK;
}
print " linked with [$ntGIs $geneID]\n";
......@@ -397,9 +402,13 @@ for(my $r=0; $r<=$#original_names; $r++){
if ( $resultPOS eq '' ){
buildFailureOutputFiles($r, $failureStatus[1], $failureStatus[0], '') if ( $failureStatus[0] ne '' );
buildFailureOutputFiles($r, $equivalent_blast_hits[0], 'Alignment_failure', '') if ( $failureStatus[0] eq '' );
next;
if ( $failureStatus[0] ne '' ){
buildFailureOutputFiles($r, $failureStatus[1], $failureStatus[0], '');
}
else {
buildFailureOutputFiles($r, $equivalent_blast_hits[0], 'Alignment_failure', '');
}
next HIT_LINK;
}
elsif ( $resultBOJ eq '' ){
if ( $failureStatus[0] eq 'PUI_unavailable' || $failureStatus[0] eq 'No_nt_link' ){
......
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