Skip to content

Commit

Permalink
check config and deflate attribute before to write it
Browse files Browse the repository at this point in the history
  • Loading branch information
Juke34 committed Dec 3, 2024
1 parent 50844cf commit b926af2
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions lib/AGAT/BioperlGFF.pm
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ package AGAT::BioperlGFF;
use vars qw($HAS_HTML_ENTITIES);
use strict;

use AGAT::OmniscientTool;
use AGAT::AGAT;
use Bio::Seq::SeqFactory;
use Bio::LocatableSeq;
use Bio::SeqFeature::Generic;
Expand Down Expand Up @@ -699,6 +701,28 @@ sub write_feature {
$self->_print($line);
}
$self->{'_first'} = 0;

# deflate multi-values attribute if asked by config
if ($AGAT::AGAT::CONFIG->{'deflate_attribute'}){
foreach my $feature ( @features ) {
my @list_tags= $feature->get_all_tags();
foreach my $tag (@list_tags){
my @tag_values = $feature->get_tag_values($tag);
if ($#tag_values >= 1){
my $tag_counter=-1;
foreach my $tag_value (@tag_values){
$tag_counter++;
if ($tag_counter == 0){
create_or_replace_tag($feature, $tag , $tag_value);
} else {
create_or_replace_tag($feature, $tag."_".$tag_counter , $tag_value);
}
}
}
}
}
}

foreach my $feature ( @features ) {
$self->_print($self->gxf_string($feature)."\n");
}
Expand Down

0 comments on commit b926af2

Please sign in to comment.