Skip to content

Commit

Permalink
when using clean_clone with clean_attributes, remove Parent and trans…
Browse files Browse the repository at this point in the history
…cript_id attributes anyway when it is a level1 feature
  • Loading branch information
Juke34 committed Mar 19, 2024
1 parent 734f8a0 commit 499e5fe
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/AGAT/OmniscientTool.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1269,17 +1269,21 @@ sub clean_clone{
$cloned_feature->source_tag("AGAT");
# clean score
$cloned_feature->score(".");
# new primary tag
$cloned_feature->primary_tag($new_primary_tag) if $new_primary_tag;
# clean attributes
if ($clean_attributes){
my @tags = $cloned_feature->get_all_tags();
foreach my $tag (@tags){
if (lc($tag) ne "id" and lc($tag) ne "parent" and lc($tag) ne "gene_id" and lc($tag) ne "transcript_id"){
if ( lc($tag) ne "id" and lc($tag) ne "parent" and lc($tag) ne "gene_id" and lc($tag) ne "transcript_id" ){
$cloned_feature->remove_tag($tag);
}
if ( (lc($tag) eq "parent" or lc($tag) eq "transcript_id") and exists_keys($omniscient,("other","level","level1", lc($cloned_feature->primary_tag()) ) ) ){ # transcript_id and Parent attributes have to be removed for level1 feature anyway.
$cloned_feature->remove_tag($tag);
}
}
}
# new primary tag
$cloned_feature->primary_tag($new_primary_tag) if $new_primary_tag;

# remove Parent attribute if level1
if ($omniscient){
if ($cloned_feature->has_tag("Parent")){
Expand Down

0 comments on commit 499e5fe

Please sign in to comment.