Commit 164fa2dd authored by Sebastien Moretti's avatar Sebastien Moretti
Browse files

Clean code + simplify code + add new RefSeq genomic id beginning

parent 9b4020bc
......@@ -393,12 +393,12 @@ for(my $r=0; $r<=$#original_names; $r++){
my ($POSresult, $bestNucleotide) = prepareResults4CDS($POS, $equivalent_blast_hits[$qq], $original_seq[$r], $fasta_header);
$resultPOS .= $POSresult if ( $bestNucleotide ne '' && $POSresult ne '' && $resultPOS !~ /_G_$bestNucleotide/ );
@intronStatus = ($POS->{0}, $equivalent_blast_hits[$qq], '') if ( $intronStep==1 && exists($POS->{0}) && $POS->{0} ne '' && $POS->{0} =~ /\:/ );
@intronStatus = ($POS->{0}, $equivalent_blast_hits[$qq], $bestNucleotide) if ( $intronStep==0 && ($bestNucleotide =~ /^N[CTWZG]_/ || $bestNucleotide =~ /^AC_/) );
@intronStatus = ($POS->{0}, $equivalent_blast_hits[$qq], '') if ( $intronStep==1 && exists($POS->{0}) && $POS->{0} =~ /\:/ );
@intronStatus = ($POS->{0}, $equivalent_blast_hits[$qq], $bestNucleotide) if ( $intronStep==0 && $bestNucleotide =~ /^NA[CTWZGS]_/ );
my ($intronLess, $nameLess) = ('', '');
$intronLess = $POS->{0} if ( %$BOJ eq 0 && exists($POS->{0}) && $POS->{0} ne '' );
$nameLess = $bestNucleotide if ( %$BOJ eq 0 && $intronStep==0 && ($bestNucleotide =~ /^N[CTWZG]_/ || $bestNucleotide =~ /^AC_/) );
$nameLess = $bestNucleotide if ( %$BOJ eq 0 && $intronStep==0 && $bestNucleotide =~ /^NA[CTWZGS]_/ );
my ($BOJresult, $bestGenomic) = prepareResults4BOJ($BOJ, $equivalent_blast_hits[$qq], $original_seq[$r], $fasta_header, $intronLess, $nameLess);
$resultBOJ .= $BOJresult if ( $bestGenomic ne '' && $BOJresult ne '' && $resultBOJ !~ /_G_$bestGenomic[ \-]/ );
}
......@@ -1049,8 +1049,8 @@ sub runExonerate{
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 to the last position of protein
# If not, * is excluded from the alignment because of external border misalignment
# * 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;
......@@ -1076,7 +1076,7 @@ sub runExonerate{
print "\n@@ -> $b ... $targetNT\n" if ( $debug );
# Remove exonerate Error file is it fails to align protein and nucleotide sequences
# Remove exonerate Error file if it has failed to align protein and nucleotide sequences
unlink("$cache/Error:") if ( $tmp == 0 || -z "$cache/Error:" );
......@@ -1202,7 +1202,7 @@ sub prepareResults4BOJ{
my $description = $annot;
my $readyname = '';
$readyname = fastaHeaders4ProtoGene($input_name);
if ( $intronLess =~ /:.+/ || $bestOne =~ /^N[CTWZG]_/ || $bestOne =~ /^AC_/ || $nameLess =~ /^N[CTWZG]_/ || $nameLess =~ /^AC_/ ){
if ( $intronLess =~ /:.+/ || $bestOne =~ /^NA[CTWZGS]_/ || $nameLess =~ /^NA[CTWZGS]_/ ){
$readyname =~ s/_G_@@/_G_$bestOne-IntronLess _S_ $blastHit _DESC_ / if ( $nameLess eq '' );
$readyname =~ s/_G_@@/_G_$nameLess-IntronLess _S_ $blastHit _DESC_ / if ( $nameLess ne '' );
$readyname =~ s/(.)$/$1 MATCHES_ON $description/ if ( $description ne '' );
......@@ -1249,7 +1249,7 @@ sub prepareAnnotation{
sub buildAnnotation{
my ($bestOne, $annot, $input_name, $blastHit) = @_;
$annot =~ s{>}{}g; #Remove > sign in annotation if any e.g.: NM_105729
$annot =~ s{>}{}g; #Remove > sign in annotation if any e.g.: see NM_105729
my $readyName = '';
$readyName = fastaHeaders4ProtoGene($input_name);
$readyName =~ s/_G_@@/_G_$bestOne _S_ $blastHit _DESC_ /;
......@@ -1269,7 +1269,7 @@ sub buildCDSseq{
$locus++;
if ( exists($POSITIONS{$locus}) && ($POSITIONS{$locus} eq 'TAA' || $POSITIONS{$locus} eq 'TAG' || $POSITIONS{$locus} eq 'TGA') ){
$cdsSeq .= $POSITIONS{$locus};
#To add properly the stop codon, if any, at the end of the CDS
#To add properly the stop codon, if any, at the end of the CDS
}
else{
$cdsSeq .= '---'; #Else add 3x'-', if no stop codon were found, to keep the original MSA side length
......
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