Commit f10a884d authored by lcottret's avatar lcottret
parents cd8b81c7 15b5df4a
# README # # README #
Outil d'aide à l'interprétation de résultats OrthoMCL Outil d'aide à l'interprétation de résultats OrthoMCL
### What is this repository for? ###
* Quick summary ### TODO ###
* Version
* [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
### How do I get set up? ### * Import zip
La structure du zip doit etre:
zip/
|-- CODE1.fasta
|-- CODE1.iprscan
|-- CODE1.txt
|-- CODE2.fasta
|-- CODE2.iprscan
|-- CODE2.txt
|-- CODE3.fasta
|-- CODE3.iprscan
|-- CODE3.txt
|-- reference.txt
* Diagrammes de Venn (JVENN)
* Get description des termes GO (et pathways ?) pour iprscan v5
### INSTALL ###
* Summary of set up
* Configuration * Configuration
WEBAPP: Fichier site/cfg/site.cfg WEBAPP: Fichier site/cfg/site.cfg
...@@ -42,7 +60,7 @@ TESTER LE CLI-A ...@@ -42,7 +60,7 @@ TESTER LE CLI-A
./bin/int/bbric_orthomcl-companion.pl --outdir test --analysis_cfg test/analysis.json --verbose ./bin/int/bbric_orthomcl-companion.pl --outdir test --analysis_cfg test/analysis.json --verbose
### Who do I talk to? ### ### AUTEURS ###
* sebastien.carrere@toulouse.inra.fr * sebastien.carrere@toulouse.inra.fr
* ludovic.cottret@toulouse.inra.fr * ludovic.cottret@toulouse.inra.fr
......
...@@ -16,6 +16,8 @@ sub ListGroupAndUniqueForAllProteomes ...@@ -16,6 +16,8 @@ sub ListGroupAndUniqueForAllProteomes
my ($rh_orthomcl, $rh_species, $outdir) = @_; my ($rh_orthomcl, $rh_species, $outdir) = @_;
my %ListGroupByCode; my %ListGroupByCode;
my $rh_specific = {}; my $rh_specific = {};
&Log("INFO - ListGroupAndUniqueForAllProteomes");
foreach my $code (keys %{$rh_species}) foreach my $code (keys %{$rh_species})
{ {
...@@ -55,38 +57,6 @@ sub ListGroupAndUniqueForAllProteomes ...@@ -55,38 +57,6 @@ sub ListGroupAndUniqueForAllProteomes
return; return;
} }
=head3 function __DeleteSequencesFromGroupId
Title : __DeleteSequencesFromGroupId
Usage : &__DeleteSequencesFromGroupId($outdir,\%ListGroupByCode)
Prerequisite : none
Function : Keep only specific protein for each proteome
Returns : none
Args : hash ref of orthomcl groups,
Globals : none
=cut
sub __DeleteSequencesFromGroupId
{
my ($rh_orthomcl, $rh_specific, $groupid) = @_;
foreach my $code (keys %{$rh_orthomcl->{$groupid}})
{
foreach my $seqid (@{$rh_orthomcl->{$groupid}->{$code}})
{
if (!defined $rh_specific->{$code}->{$seqid})
{
&Log("WARNING - __DeleteSequencesFromGroupId - $seqid not defined in $code sequence file");
}
else
{
delete $rh_specific->{$code}->{$seqid};
}
}
}
return;
}
=head3 function PrintListGroupProteome =head3 function PrintListGroupProteome
Title : PrintListGroupProteome Title : PrintListGroupProteome
...@@ -107,7 +77,7 @@ sub PrintListGroupProteome ...@@ -107,7 +77,7 @@ sub PrintListGroupProteome
'directory with for each proteome (one file / proteome), a list of all group with a protein of this proteome + unique protein'; 'directory with for each proteome (one file / proteome), a list of all group with a protein of this proteome + unique protein';
mkdir "$outdir/$subdirectory"; mkdir "$outdir/$subdirectory";
# push (@A_OUTPUT_DATA, {'directory' => $subdirectory, 'description' => $subdirectory_description}); push (@A_OUTPUT_DATA, {'directory' => $subdirectory, 'description' => $subdirectory_description});
foreach my $code (keys %{$rh_listgroupbycode}) foreach my $code (keys %{$rh_listgroupbycode})
{ {
my $fh_liste = &GetStreamOut("$outdir/$subdirectory/$code.list.txt"); my $fh_liste = &GetStreamOut("$outdir/$subdirectory/$code.list.txt");
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
sub ParseIprscan sub ParseIprscan
{ {
my $iprscan_file = shift; my $iprscan_file = shift;
&Log("INFO - ParseIprscan");
my %h_iprscan = (); my %h_iprscan = ();
my $firstline = `grep --max-count=1 IPR $iprscan_file`; my $firstline = `grep --max-count=1 IPR $iprscan_file`;
chomp $firstline; chomp $firstline;
...@@ -185,6 +186,7 @@ sub ParseProteomes ...@@ -185,6 +186,7 @@ sub ParseProteomes
my ($rh_proteomes) = @_; my ($rh_proteomes) = @_;
my %h_species = (); my %h_species = ();
&Log("INFO - ParseProteomes");
foreach my $code (keys %{$rh_proteomes}) foreach my $code (keys %{$rh_proteomes})
{ {
...@@ -238,6 +240,7 @@ sub ParseOrthomclResults ...@@ -238,6 +240,7 @@ sub ParseOrthomclResults
{ {
my ($outfile, $version) = @_; my ($outfile, $version) = @_;
&Log("INFO - ParseOrthomclResults");
my %h_orthomcl = (); my %h_orthomcl = ();
my $fh_in = &GetStreamIn($outfile); my $fh_in = &GetStreamIn($outfile);
...@@ -336,9 +339,9 @@ sub BuildIprscanDBTables ...@@ -336,9 +339,9 @@ sub BuildIprscanDBTables
foreach my $dbacc (keys %{$rh_sequences->{$seqid}->{'iprscan'}->{$dbname}}) foreach my $dbacc (keys %{$rh_sequences->{$seqid}->{'iprscan'}->{$dbname}})
{ {
$dbdesc = $rh_sequences->{$seqid}->{'iprscan'}->{$dbname}->{$dbacc}; $dbdesc = $rh_sequences->{$seqid}->{'iprscan'}->{$dbname}->{$dbacc};
print $fh_out "$seqid\t$groupid\t" . $dbacc . "\t" . $dbdesc . "\n"; print $fh_out "$seqid\t" . $dbacc . "\t" . $dbdesc . "\n";
$h_count{$dbname}->{$dbacc} = 0 unless defined $h_count{$dbname}->{$dbacc}; $h_count{$dbname}->{$dbacc} = {'count' => 0, 'desc' => $dbdesc} unless defined $h_count{$dbname}->{$dbacc};
$h_count{$dbname}->{$dbacc}++; $h_count{$dbname}->{$dbacc}->{'count'}++;
} }
$fh_out->close; $fh_out->close;
} }
...@@ -350,11 +353,59 @@ sub BuildIprscanDBTables ...@@ -350,11 +353,59 @@ sub BuildIprscanDBTables
my $fh_out = &GetStreamOut(">$outdir/$code.iprscan.$suffix.$dbname.count.xls"); my $fh_out = &GetStreamOut(">$outdir/$code.iprscan.$suffix.$dbname.count.xls");
foreach my $dbacc (sort {$rh_local->{$b} <=> $rh_local->{$a}} keys %{$rh_local}) foreach my $dbacc (sort {$rh_local->{$b} <=> $rh_local->{$a}} keys %{$rh_local})
{ {
print $fh_out "$dbacc\t" . $rh_local->{$dbacc} . "\n"; print $fh_out "$dbacc\t" . $rh_local->{$dbacc}->{'desc'} . "\t" . $rh_local->{$dbacc}->{'count'} . "\n";
} }
$fh_out->close; $fh_out->close;
} }
&__BuildIprscanDBJSdata(\%h_count,$code, $outdir, $suffix);
return; return;
} }
sub __BuildIprscanDBJSdata
{
my ($rh_count,$code, $outdir, $suffix) = @_;
if (scalar (keys %{$rh_count}) > 0)
{
my @a_json_data = ();
foreach my $dbname (sort keys %{$rh_count})
{
my $rh_data = {'title' => $dbname, 'data' => [], 'path' => "$code.iprscan.$suffix.$dbname.xls"} ;
my $rh_local = $rh_count->{$dbname};
foreach my $dbacc (sort {$rh_local->{$b}->{'count'} <=> $rh_local->{$a}->{'count'}} keys %{$rh_local})
{
push (@{$rh_data->{'data'}}, { 'name' => $dbacc, 'count' => $rh_local->{$dbacc}->{'count'}, 'desc' => $rh_local->{$dbacc}->{'desc'}});
}
push (@a_json_data, $rh_data);
}
my $fh_out = &GetStreamOut(">$outdir/$code.iprscan.$suffix.count.js");
print $fh_out 'var data = ' . to_json (\@a_json_data) . ';';
$fh_out->close;
my $o_pp = New ParamParser("$FindBin::RealBin/../../site/cfg/site.cfg");
my $root_url = $o_pp->Get('portal_web_server') . '/' . $o_pp->Get('portal_http_root');
my $fh_html_template = &GetStreamIn("$FindBin::RealBin/../../web/templates/barplots/index.html");
my $fh_html_out = &GetStreamOut("$outdir/$code.iprscan.$suffix.html");
while (my $line = <$fh_html_template>)
{
$line =~ s/data.js/$code.iprscan.$suffix.count.js/;
$line =~ s/%ROOT_URL%/$root_url/g;
print $fh_html_out $line;
}
$fh_html_out->close;
$fh_html_template->close;
copy("$FindBin::RealBin/../../web/templates/barplots/plot.js","$outdir/plot.js");
}
return;
}
1; 1;
...@@ -15,9 +15,10 @@ sub ExtractSpecificAndOrthologousProteins ...@@ -15,9 +15,10 @@ sub ExtractSpecificAndOrthologousProteins
{ {
my ($rh_orthomcl, $rh_species, $outdir) = @_; my ($rh_orthomcl, $rh_species, $outdir) = @_;
my %h_inparalogs = ();
#my %h_specific = %{$rh_species}; &Log("INFO - ExtractSpecificAndOrthologousProteins");
my %h_inparalogs = ();
my $rh_specific = {}; my $rh_specific = {};
...@@ -57,26 +58,6 @@ sub ExtractSpecificAndOrthologousProteins ...@@ -57,26 +58,6 @@ sub ExtractSpecificAndOrthologousProteins
return; return;
} }
sub __DeleteSequencesFromGroupId
{
my ($rh_orthomcl, $rh_specific, $groupid) = @_;
foreach my $code (keys %{$rh_orthomcl->{$groupid}})
{
foreach my $seqid (@{$rh_orthomcl->{$groupid}->{$code}})
{
if (!defined $rh_specific->{$code}->{$seqid})
{
&Log("WARNING - __DeleteSequencesFromGroupId - $seqid not defined in $code sequence file");
}
else
{
delete $rh_specific->{$code}->{$seqid};
}
}
}
return;
}
sub IsOrthologousGroup sub IsOrthologousGroup
{ {
my ($rh_orthomcl, $groupid) = @_; my ($rh_orthomcl, $groupid) = @_;
......
...@@ -98,6 +98,7 @@ sub BuildSummaryFile ...@@ -98,6 +98,7 @@ sub BuildSummaryFile
{ {
my ($rh_analysis_params, $outdir) = @_; my ($rh_analysis_params, $outdir) = @_;
unshift (@A_OUTPUT_DATA, {'directory' => 'input_data', 'description' => 'Input data'});
foreach my $rh_output_data (@A_OUTPUT_DATA) foreach my $rh_output_data (@A_OUTPUT_DATA)
{ {
my $directory = $outdir . '/' . $rh_output_data->{'directory'}; my $directory = $outdir . '/' . $rh_output_data->{'directory'};
...@@ -116,7 +117,9 @@ sub BuildSummaryFile ...@@ -116,7 +117,9 @@ sub BuildSummaryFile
$message = &Cat("$directory/README"); $message = &Cat("$directory/README");
} }
my @a_files = `cd $directory; find -type f | grep -v 'error\|success\|README'`; my $cmd = "cd $directory; find -type f | grep -v -E 'error\|success\|README\|.js\|.count.xls\|.iprscan.*.xls'";
&Log("CMD - $cmd");
my @a_files = `$cmd`;
chomp @a_files; chomp @a_files;
$rh_output_data->{'status'} = $status; $rh_output_data->{'status'} = $status;
...@@ -124,6 +127,8 @@ sub BuildSummaryFile ...@@ -124,6 +127,8 @@ sub BuildSummaryFile
$rh_output_data->{'files'} = \@a_files; $rh_output_data->{'files'} = \@a_files;
} }
my %h_data = ('analysis' => $rh_analysis_params, 'results' => \@A_OUTPUT_DATA); my %h_data = ('analysis' => $rh_analysis_params, 'results' => \@A_OUTPUT_DATA);
my $fh_out = &GetStreamOut("$outdir/results.json"); my $fh_out = &GetStreamOut("$outdir/results.json");
...@@ -144,7 +149,7 @@ sub CopyInputDataIntoOutdir ...@@ -144,7 +149,7 @@ sub CopyInputDataIntoOutdir
{ {
my ($rh_analysis_params, $rh_species, $outdir) = @_; my ($rh_analysis_params, $rh_species, $outdir) = @_;
mkdir "$outdir/input_data"; mkdir "$outdir/input_data";
mkdir "$outdir/input_data/proteomes"; mkdir "$outdir/input_data/proteomes";
my $rh_proteomes = $rh_analysis_params->{'proteomes'}; my $rh_proteomes = $rh_analysis_params->{'proteomes'};
...@@ -167,6 +172,7 @@ sub CopyInputDataIntoOutdir ...@@ -167,6 +172,7 @@ sub CopyInputDataIntoOutdir
} }
} }
mkdir "$outdir/orthomcl_output/"; mkdir "$outdir/orthomcl_output/";
copy("$WORKDIR/orthomcl.out", "$outdir/orthomcl_output/"); copy("$WORKDIR/orthomcl.out", "$outdir/orthomcl_output/");
$rh_analysis_params->{'orthomcl'}->{'outfile'} = "./orthomcl_output/orthomcl.out"; $rh_analysis_params->{'orthomcl'}->{'outfile'} = "./orthomcl_output/orthomcl.out";
...@@ -174,4 +180,38 @@ sub CopyInputDataIntoOutdir ...@@ -174,4 +180,38 @@ sub CopyInputDataIntoOutdir
} }
=head3 function __DeleteSequencesFromGroupId
Title : __DeleteSequencesFromGroupId
Usage : &__DeleteSequencesFromGroupId($outdir,\%ListGroupByCode)
Prerequisite : none
Function : Keep only specific protein for each proteome
Returns : none
Args : hash ref of orthomcl groups,
Globals : none
=cut
sub __DeleteSequencesFromGroupId
{
my ($rh_orthomcl, $rh_specific, $groupid) = @_;
foreach my $code (keys %{$rh_orthomcl->{$groupid}})
{
foreach my $seqid (@{$rh_orthomcl->{$groupid}->{$code}})
{
if (!defined $rh_specific->{$code}->{$seqid})
{
&Log("WARNING - __DeleteSequencesFromGroupId - $seqid not defined in $code sequence file");
}
else
{
delete $rh_specific->{$code}->{$seqid};
}
}
}
return;
}
1; 1;
...@@ -116,7 +116,7 @@ Ext ...@@ -116,7 +116,7 @@ Ext
'value' : this 'value' : this
.createLink( .createLink(
json.analysis.orthomcl.outfile, json.analysis.orthomcl.outfile,
url_base+"/orthomcl_output") url_base)
}, },
{ {
'key' : 'Version', 'key' : 'Version',
......
...@@ -19,7 +19,7 @@ Ext.define('BP.view.grid.V_ListAnalyses', { ...@@ -19,7 +19,7 @@ Ext.define('BP.view.grid.V_ListAnalyses', {
dockedItems : [ { dockedItems : [ {
xtype : 'toolbar', xtype : 'toolbar',
items : [ '<-', { items : [ {
iconCls: 'icon-reload', iconCls: 'icon-reload',
text : 'Reload', text : 'Reload',
action : 'reload' action : 'reload'
...@@ -92,4 +92,4 @@ Ext.define('BP.view.grid.V_ListAnalyses', { ...@@ -92,4 +92,4 @@ Ext.define('BP.view.grid.V_ListAnalyses', {
] ]
}); });
\ No newline at end of file
...@@ -11,4 +11,4 @@ Ext.define('BP.view.panel.V_Home', { ...@@ -11,4 +11,4 @@ Ext.define('BP.view.panel.V_Home', {
url: 'home.html', url: 'home.html',
autoLoad: true autoLoad: true
} }
}); });
\ No newline at end of file
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
<link rel="stylesheet" type="text/css" <link rel="stylesheet" type="text/css"
href="../../js/ext/extjs/resources/css/ext-all.css"> href="%ROOT_URL%/web/js/ext/extjs/resources/css/ext-all.css">
<link rel="stylesheet" type="text/css" <link rel="stylesheet" type="text/css"
href="../../resources/css/banner.css"> href="%ROOT_URL%/web/resources/css/banner.css">
<link rel="stylesheet" type="text/css" <link rel="stylesheet" type="text/css"
href="../../resources/css/custom.css"> href="%ROOT_URL%/web/resources/css/custom.css">
<link rel="stylesheet" type="text/css" <link rel="stylesheet" type="text/css"
href="../../resources/icons/icons.css"> href="%ROOT_URL%/web/resources/icons/icons.css">
<script type="text/javascript" src="../../js/ext/extjs/ext-all.js"></script> <script type="text/javascript" src="%ROOT_URL%/web/js/ext/extjs/ext-all.js"></script>
<script type="text/javascript" src="data.js"></script> <script type="text/javascript" src="data.js"></script>
<script type="text/javascript" src="plot.js"></script> <script type="text/javascript" src="plot.js"></script>
...@@ -24,4 +24,4 @@ ...@@ -24,4 +24,4 @@
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -148,4 +148,4 @@ Ext ...@@ -148,4 +148,4 @@ Ext
}); });
}); });
\ No newline at end of file
Markdown is supported
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