Commit 81ee4623 authored by Sebastien Moretti's avatar Sebastien Moretti
Browse files

ProtoGene 3.4.0 with beta html View

parent be8b8ca3
......@@ -23,6 +23,7 @@ use File::Which qw(which); # Locate external executable programs
use Mail::Send; # Send warnings and errors files by e-mail ==> only if the $userEMail variable is defined
use loci_from_Exonerate; # Exonerate parser
use Views; # Non-text outputs, e.g. HTML/CSS
#use output_checker; # Check output for cds consistancy with query
......@@ -33,7 +34,7 @@ $ENV{'PATH'} .= ':/mnt/local/bin/'; # additional path for executable on the serv
my $Version = '3.2.6';
my $Version = '3.4.0';
my $uct = 15; # UpdateCacheThreshold: number of days before update
my $cachedir = '/scratch/frt/tcoffee/ProtoGene_Cache'; # Cache directory
##### User settings ####################################
......@@ -106,7 +107,7 @@ my ($templG, $templP, $templSeq);
#Short help message
if ( $msa eq '' || $species eq '' || $db eq '' || $cache eq '' ){
my $appli = basename($0);
print {*STDERR} "\n\tCannot open the MSA file in fasta format
print {*STDERR} "\n\tCannot open the MSA file in FASTA format
\tTry: $appli --msa=path_of_the_fasta_msa_file [Options]
\tOptions: --orgm=All_organisms, Bacteria, Viruses, Vertebrata,
......@@ -171,12 +172,12 @@ while(<$MSA>){
close $MSA;
if ( $fasta_checker == -1 ){
&failure;
print {*STDERR} "\tThe MSA file does NOT seem to be a protein fasta format\n\n";
print {*STDERR} "\tThe MSA file does NOT seem to be a protein FASTA format\n\n";
exit(1);
}
elsif ( $lim >0 && $fasta_checker > $lim ){
&failure;
print {*STDERR} "\tThe fasta file is too large, try with less than $lim sequences\n\tor split your file\n\n";
print {*STDERR} "\tThe FASTA file is too large, try with less than $lim sequences\n\tor split your file\n\n";
exit(1);
}
elsif ( exists( $original_seq[0] ) && $original_seq[0] =~ /[acgtu]/i){
......@@ -506,9 +507,9 @@ PROTOGENE re-builds the original alignment with nucleotidic information it has g
=over 8
=item version 3.2.6
=item version 3.4.0
=item on Jan 8th, 2008
=item on Mar 14th, 2008
=back
......
#File Views.pm
package Views;
my %css = ('species' => '',
'odd' => '',
'oddodd' => '',
'oddeven' => '',
'even' => '',
'evenodd' => '',
'eveneven' => '',
'match_on' => '',
my %css = ('species' => qq{font-style: italic;\n},
'odd' => qq{background-color: #FF8C00;\n}, #darkorange
'oddodd' => qq{background-color: #FFA07A;\n}, #lightsalmon
'oddeven' => qq{background-color: #F4A460;\n}, #sandybrown
'even' => qq{background-color: #556B2F;\n}, #darkolivegreen
'evenodd' => qq{background-color: #90EE90;\n}, #lightgreen
'eveneven' => qq{background-color: #8FBC8F;\n}, #darkseagreen
'match_on' => qq{background-color: #8B008B;\n font-weight: bolder;\n}, #darkmagenta
);
sub Html {
my ($file) = @_;
return 0 if ( $file !~ /\.cdsP$/ || -z $file || !-r $file );
open (my $CDSP, '<', "$file") or die "\tCannot open '$file'\n";
open (my $CDSHTML, '>', "$file.html") or die "\tCannot create in '$file.html'\n";
print {$CDSHTML} &htmlHeader($file);
{
my $isOdd = 'odd';
my $isSubOdd = 'odd';
#local $/ = '>'; #Change end of line delimiter: it is the beginning of sequences instead of \n
CDS_FILE:
while(<$CDSP>){
chomp();
next CDS_FILE if ( /^$/ );
s{>}{&gt;}g;
s{<}{&lt;}g;
if ( m/ MATCHES_ON ([\w\.\-]+) ([\w\.\-]+)/ ){
my $firstM = $1;
my $secondM = $2;
if ( $firstM =~ /\./ || $firstM =~ /human/i ){
s{MATCHES_ON $firstM}{<span class='match_on'>MATCHES_ON <span class='species'>$firstM</span></span>};
}
else {
s{MATCHES_ON $firstM $secondM}{<span class='match_on'>MATCHES_ON <span class='species'>$firstM $secondM</span></span>};
}
}
if ( m/^&gt;.*MATCHES_ON / ){
print {$CDSHTML} "<span class='$isOdd$isSubOdd'>", $_, "\n";
$isSubOdd = $isSubOdd eq 'odd' ? 'even' : 'odd';
}
elsif ( m/^&gt;.*/ && !m/MATCHES_ON / ){
print {$CDSHTML} "<span class='$isOdd'>", $_, "\n";
$isOdd = $isOdd eq 'odd' ? 'even' : 'odd';
$isSubOdd = 'odd';
}
else {
print {$CDSHTML} $_, "</span>\n";
}
# $_ =~ ($isOdd==0 && $isSubOdd==0 && m/MATCHES_ON / ) ? s{$_}{<span class='eveneven'>$_</span>\n}
# : ($isOdd==0 && $isSubOdd==1 && m/MATCHES_ON / ) ? s{$_}{<span class='evenodd'>$_</span>\n}
# : ($isOdd==1 && $isSubOdd==0 && m/MATCHES_ON / ) ? s{$_}{<span class='oddeven'>$_</span>\n}
# : s{$_}{<span class='oddodd'>$_</span>\n};
}
}
print {$CDSHTML} &htmlFooter();
close $CDSHTML;
close $CDSP;
return 1;
}
sub htmlHeader {
my ($jobName) = @_;
$jobName =~ s{^.*/([^\/]+?)\.cdsP$}{$1};
my $css = '';
for my $style ( keys(%css) ){
$css .= " .$style {
$css{$style} }\n";
}
return "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
<title>ProtoGene xHTML/CSS output for $jobName</title>
<meta http-equiv='content-type' content='text/html;charset=UTF-8' />
<meta http-equiv='Content-Style-Type' content='text/css' />
<style type='text/css'>
$css </style>
</head>
<body>
<pre>
";
}
sub htmlFooter {
return " </pre>
</body>
</html>
";
}
1;
#
#Version: 3.2.6
#Version: 3.4.0
#OS: Linux
#Author: Sebastien Moretti
#E-mail: moretti.sebastien [AT] gmail.com
#
History of ProtoGene/PACMAN improvements:
3.4.0
Add html/css output
3.2.6
Remove '>' sign in annotation line if any e.g.: NM_105729
......
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