Commit d5ae8a7f authored by Sebastien Carrere's avatar Sebastien Carrere

Refactorisation pour eviter appels multiples a __DeleteXXXXX . Nouvelle...

Refactorisation pour eviter appels multiples a __DeleteXXXXX . Nouvelle fonction appelee dans le main pour extraire les proteines specifiques.
parent 06d5594f
......@@ -100,9 +100,10 @@ MAIN:
my $rh_orthomcl = &ParseOrthomclResults($rh_analysis_params->{'orthomcl'}->{'outfile'},
$rh_analysis_params->{'orthomcl'}->{'version'});
&ExtractSpecificAndOrthologousProteins($rh_orthomcl, $rh_species, $o_param->Get('outdir'));
&ListGroupAndUniqueForAllProteomes($rh_orthomcl, $rh_species, $o_param->Get('outdir'));
&CreatePanProteome($rh_orthomcl,$rh_species,$rh_analysis_params,$o_param->Get('outdir'));
my $rh_specific_proteins = &GetSpecificProteins($rh_orthomcl,$rh_species);
&ExtractSpecificAndOrthologousProteins($rh_orthomcl, $rh_species,$rh_specific_proteins, $o_param->Get('outdir'));
&ListGroupAndUniqueForAllProteomes($rh_orthomcl, $rh_species,$rh_specific_proteins, $o_param->Get('outdir'));
&CreatePanProteome($rh_orthomcl,$rh_species,$rh_analysis_params,$rh_specific_proteins,$o_param->Get('outdir'));
&CopyInputDataIntoOutdir($rh_analysis_params, $rh_species, $o_param->Get('outdir'));
&BuildSummaryFile($rh_analysis_params, $o_param->Get('outdir'));
......
......@@ -6,18 +6,17 @@
Prerequisite : none
Function : Find for each proteome, the list of all group with a protein of this proteome + unique protein. Priority select seq from ref proteome then longer seq.
Returns : none
Args : hash ref of orthomcl groups, hash ref of species, outdir
Args : hash ref of orthomcl groups, hash ref of species, hash ref of specific proteins, hash ref of analysis parameters,outdir
Globals : none
=cut
sub CreatePanProteome
{
my ($rh_orthomcl, $rh_species, $rh_analysis_params, $outdir) = @_;
my ($rh_orthomcl, $rh_species, $rh_analysis_params,$rh_specific, $outdir) = @_;
&Log("INFO - CreatePanProteome");
my $rh_specific = {};
my $refexist;
my @a_references = ();
my @a_seqs1 = ();
......@@ -34,14 +33,8 @@ sub CreatePanProteome
}
}
foreach my $code (keys %{$rh_species})
{
$rh_specific->{$code} = Storable::dclone($rh_species->{$code}->{'sequences'});
}
foreach my $groupid (keys %{$rh_orthomcl})
{
&__DeleteSequencesFromGroupId($rh_orthomcl, $rh_specific, $groupid);
$refexist = 0;
@a_allseqs1 = ();
......
......@@ -2,18 +2,18 @@
=head2 function ListGroupAndUniqueForAllProteomes
Title : ListGroupAndUniqueForAllProteomes
Usage : &ListGroupAndUniqueForAllProteomes($rh_orthomcl,$rh_species,$o_param->Get('outdir'))
Usage : &ListGroupAndUniqueForAllProteomes($rh_orthomcl,$rh_species,$rh_specific_proteins,$o_param->Get('outdir'))
Prerequisite : none
Function : Find for each proteome, the list of all group with a protein of this proteome + unique protein
Returns : none
Args : hash ref of orthomcl groups, hash ref of species, outdir
Args : hash ref of orthomcl groups, hash ref of species, hash ref of specific proteins, outdir
Globals : none
=cut
sub ListGroupAndUniqueForAllProteomes
{
my ($rh_orthomcl, $rh_species, $outdir) = @_;
my ($rh_orthomcl, $rh_species, $rh_specific, $outdir) = @_;
my %h_list_group_by_code;
my $rh_specific = {};
......@@ -21,13 +21,11 @@ sub ListGroupAndUniqueForAllProteomes
foreach my $code (keys %{$rh_species})
{
$rh_specific->{$code} = Storable::dclone($rh_species->{$code}->{'sequences'});
$h_list_group_by_code{$code} = [];
}
foreach my $groupid (keys %{$rh_orthomcl})
{
&__DeleteSequencesFromGroupId($rh_orthomcl, $rh_specific, $groupid);
foreach my $code (keys %{$rh_orthomcl->{$groupid}})
{
push (@{$h_list_group_by_code{$code}}, $groupid);
......
......@@ -2,7 +2,7 @@
=head2 function ExtractSpecificAndOrthologousProteins
Title : ExtractSpecificProteins
Usage : &ExtractSpecificProteins($rh_orthomcl,$rh_species)
Usage : &ExtractSpecificProteins($rh_orthomcl,$rh_species,$rh_specific_proteins, $outdir)
Prerequisite : none
Function :
Returns :
......@@ -13,19 +13,13 @@
sub ExtractSpecificAndOrthologousProteins
{
my ($rh_orthomcl, $rh_species, $outdir) = @_;
my ($rh_orthomcl, $rh_species,$rh_specific, $outdir) = @_;
&Log("INFO - ExtractSpecificAndOrthologousProteins");
my %h_inparalogs = ();
my $rh_specific = {};
foreach my $code (keys %{$rh_species})
{
$rh_specific->{$code} = Storable::dclone($rh_species->{$code}->{'sequences'});
}
my %h_orthologous = ();
......@@ -48,8 +42,6 @@ sub ExtractSpecificAndOrthologousProteins
}
}
}
&__DeleteSequencesFromGroupId($rh_orthomcl, $rh_specific, $groupid);
}
&PrintSpecificProteinsFiles($outdir, $rh_species, $rh_specific, \%h_inparalogs);
......
......@@ -135,11 +135,11 @@ sub BuildSummaryFile
print $fh_out to_json(\%h_data);
$fh_out->close;
my $fh_out = &GetStreamOut("$outdir/success");
$fh_out = &GetStreamOut("$outdir/success");
print $fh_out "Finished : " . `date "+%Y%m%d %H:%M:%S"`;
$fh_out->close;
my $fh_out = &GetStreamOut("$outdir/title");
$fh_out = &GetStreamOut("$outdir/title");
print $fh_out $rh_analysis_params->{'title'};
$fh_out->close;
......@@ -213,5 +213,34 @@ sub __DeleteSequencesFromGroupId
return;
}
=head3 function GetSpecificProteins
Title : GetSpecificProteins
Usage : $rh_specific = &GetSpecificProteins($rh_orthomcl, $rh_species)
Prerequisite : none
Function : Keep only specific protein for each proteome (proteins not in any orthomcl group, excluding inparalogs)
Returns : hash ref of specific proteins / species
Args : hash ref of orthomcl groups, hash ref of proteomes
Globals : none
=cut
sub GetSpecificProteins
{
my ($rh_orthomcl, $rh_species) = @_;
&Log("INFO - Get Specific proteins i.e. not belonging to any OrthoMCL group");
my %h_specific = ();
foreach my $code (keys %{$rh_species})
{
$h_specific{$code} = Storable::dclone($rh_species->{$code}->{'sequences'});
}
foreach my $groupid (keys %{$rh_orthomcl})
{
&__DeleteSequencesFromGroupId($rh_orthomcl, \%h_specific, $groupid);
}
return \%h_specific;
}
1;
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