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

Add parsing elements to deal with exonerate 2.2.0 changes

parent e1edc701
......@@ -8,7 +8,7 @@ sub parser{
my %pos_aln;
my %pos_boj;
open(my $MAP, '<', "$infile") if ( -e "$infile" ) or die "$!\n\n";
open(my $MAP, '<', "$infile") if ( -e "$infile" ) or die "$!\n\n";
my $flag = 0;
my ($Match, $Genom, $Query) = ('', '', '');
my $margeL = 0;
......@@ -18,7 +18,8 @@ sub parser{
if ( $flag==1 && $margeL==0 && $_ =~ /^( +\d+ : )[\w\-\{\} \>\<\*]+ : +\d+$/ ){ #\* for stop codon management
$margeL = length($1);
}
if ( $flag==0 && $_ =~ /^ +Target range: \d+ -> \d+/ ){
if ( $flag==0 && $_ =~ /^\s+Target range: \d+ -> \d+/ ){
$flag = 1;
}
elsif ( $_ =~ /^vulgar:/ ){
......@@ -37,26 +38,27 @@ sub parser{
chomp($Match);
$flag++;
}
elsif ( $flag==3 && $_ =~ /^ +[\w\-\{\}\*\#]+/ ){
elsif ( $flag==3 && $_ =~ /^ +[\w\+\-\{\}\*\#]+/ ){
$flag++;
}
elsif ( $flag==4 && $_ =~ /^ +\d+ : ([\w\-\{\}\.]+) : +\d+/ ){
$Genom .= $1;
$flag = 1;
}
elsif ( $flag==8 && $_ =~ /exonerate:protein2[a-z]+\tsimilarity\t\d+\t/ ){
elsif ( $flag==8 && $_ =~ /exonerate:protein2[\w\:]+\tsimilarity\t\d+\t/ ){
my $similarity_query = $_;
chomp($similarity_query);
$similarity_query =~ s{^[^;]+; }{};
$similarity_query =~ s{^[^;]+?; *}{};
$similarity_query =~ s{^Target [^;]+; *}{};
while( $similarity_query =~ m/^ ?Align (\d+) / ){
push(@cdsUp, $1);
$similarity_query =~ s/^ ?Align \d+ \d+ \d+ ;//;
$similarity_query =~ s/^ ?Align \d+ \d+ \d+ *;?//;
}
$flag = 9;
}
}
close $MAP;
print {*STDERR} "[@cdsUp]\n" if ( $debug );
print {*STDERR} "[@cdsUp]\n" if ( $debug );
my $drap = 0;
......
......@@ -1048,9 +1048,9 @@ sub runExonerate{
open(my $FASTA, '>', "$cache/$date.$order.fas");
my $seq2aln = $original;
$seq2aln =~ s{-}{}g;
$seq2aln .= '*' if ( $seq2aln !~ /\*$/ ); # Add artificially stop codon triplet at the end of the protein seq
# * is aligned only if there is one stop codon similar at the last position of protein
# If not, * is excluded from the alignment because of external/local border misalignment
$seq2aln .= '*' if ( $seq2aln !~ /\*$/ ); # Add artificially stop codon triplet at the end of the protein seq
# * is aligned only if there is one stop codon similar at the last position of protein
# If not, * is excluded from the alignment because of external/local border misalignment
print {$FASTA} ">$order\n$seq2aln\n";
close $FASTA;
......@@ -1072,12 +1072,12 @@ sub runExonerate{
}
my $targetNT = $gis[$b];
$targetNT = 'gi|'.$targetNT.'|' if ( $gis[$b] =~ /^\d+$/ );
print {*STDERR} "\n@@ -> $b ... $targetNT\n" if ( $debug );
$targetNT = 'gi|'.$targetNT.'|' if ( $gis[$b] =~ /^\d+$/ );
print {*STDERR} "\n@@ -> $b ... $targetNT\n" if ( $debug );
# Remove exonerate Error file if it has failed to align protein and nucleotide sequences
unlink("$cache/Error:") if ( $tmp == 0 || -z "$cache/Error:" );
unlink("$cache/Error:") if ( $tmp == 0 || -z "$cache/Error:" );
if ( !-e "$cache/$date.$order.exon" || -s "$cache/$date.$order.exon" < 520 ){
......@@ -1094,8 +1094,8 @@ sub runExonerate{
$best_pos = testPositions($posiTions, $gis[$b], $best_pos);
$best_boj = testBOJ($posBOJ, $gis[$b], $best_boj);
my $whichGI = $gis[$b];
$whichGI = 'gi|'.$whichGI.'|' if ( $whichGI =~ /^\d+$/ );
print "\tNo exon-intron structure found for $whichGI with $fasta_header\n" if ( %$posBOJ eq 0 );
$whichGI = 'gi|'.$whichGI.'|' if ( $whichGI =~ /^\d+$/ );
print "\tNo exon-intron structure found for $whichGI with $fasta_header\n" if ( %$posBOJ eq 0 );
}
# Remove temp files from exonerate and query sequence for exonerate
......@@ -1463,7 +1463,7 @@ sub checkAndCleanStderrFiles{
open(my $ERRSTD, '<', "$ExonerateStderrFiles");
while(<$ERRSTD>){
%uniq = (%uniq, "$_" => '')
if ( $_ !~ /^$/ && $_ !~ /Exhaustively generating suboptimal alignments will be very slow/
if ( $_ !~ /^$/ && $_ !~ /Exhaustively generating suboptimal alignments will be (VERY SLOW|very slow)/
&& $_ !~ /Message: Exhaustive alignment of/ && $_ !~ /Missing calc_macro for Calc/ && $_ !~ /Warning zero length sequence/ );
}
close $ERRSTD;
......
......@@ -180,7 +180,7 @@ $css </style>
</head>
<body>
<div align='center'>New '<font color='red'>Beta</font>' CDS output</div>
<div align='center'><font color='red'>Beta</font> CDS output</div>
<pre>
";
}
......
......@@ -391,7 +391,7 @@ $css </style>
</head>
<body>
<div align='center'>New '<font color='red'>Beta</font>' CDS output</div>
<div align='center'><font color='red'>Beta</font> CDS output</div>
<pre>
";
}
......
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