Commit f49c3ace authored by Sebastien's avatar Sebastien

Error on duplacte fasta ids in a proteome

parent c13a3835
......@@ -296,7 +296,13 @@ sub ParseProteomes
}
my $proteome_file = $rh_proteomes->{$code}->{'fasta'};
my @a_duplicates = &InSpeciesProteomeDuplicateId($proteome_file);
if (scalar @a_duplicates > 0)
{
&Kill("Non unique sequence id in $code proteome:" . join ("\n", @a_duplicates));
}
my %h_fasta = ();
&FastaToHash($proteome_file, \%h_fasta);
$h_species{$code}->{'size'} = scalar(keys %h_fasta);
......@@ -326,6 +332,25 @@ sub ParseProteomes
return (\%h_species, \%h_seqidspeciescode);
}
sub InSpeciesProteomeDuplicateId
{
my $fasta = shift;
my @a_ids = `grep '^>' $fasta | cut -f1 -d ' ' | sort | uniq -c`;
chomp @a_ids;
my @a_duplicates = ();
foreach my $id_count (@a_ids)
{
$id_count =~ s/^\s+//;
my ($count,$id) = split (/\s+/,$id_count);
if ($count > 1)
{
push (@a_duplicates, $id_count);
}
}
return \@a_duplicates;
}
=head2 function ParseHomologyGroupsResults
......
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