Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove inappropriate tags while create L2 or L1 feature frome low level feature #348

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 30 additions & 11 deletions lib/AGAT/OmniscientI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ sub slurp_gff3_file_JD {
# +-------------------------------------------------------------------------+
my %mRNAGeneLink; #Hast that keep track about link between l2 and l1
my %duplicate;# Hash to store duplicated feature info
my %hashID; # ex %miscCount;# Hash to store any counter. Will be use to create a new uniq ID / %uniqID;# Hash to follow up with an uniq identifier every feature / %uniqIDtoType; # Hash to follow up with an uniq identifier every feature type
my %hashID; # ex %miscCount;# Hash to store any counter. Will be use to create a new uniq ID / %uniqID;# Hash to follow up with an uniq identifier every feature / %uniqIDtoType; # Hash to follow up with an uniq identifier every feature type
my %locusTAG; # Hash to follow up the locus tag met
my %infoSequential;# Hash to store sequential bucket features
my %attachedL2Sequential;# Hash to store links between L2 and l1 within sequential cases
Expand Down Expand Up @@ -1557,17 +1557,26 @@ sub _check_l1_linked_to_l2{

#Deal case where we reconstruct other thing than a gene
my $primary_tag_l1=undef;
if(lc($gene_feature->primary_tag) =~ /match/){ $primary_tag_l1="match"; }
else{ $primary_tag_l1="gene"; }
# use Parent tag as ID
my $oID = $gene_feature->_tag_value('Parent');
create_or_replace_tag($gene_feature, 'ID', $oID); #modify ID to replace by parent value
# remove parent ID because, none.
$gene_feature->remove_tag('Parent');
# change primary tag
if (lc($gene_feature->primary_tag) =~ /match/){
$primary_tag_l1="match";
}else{
$primary_tag_l1="gene";
}
# use Parent tag as ID
my $oID = $gene_feature->_tag_value('Parent');
create_or_replace_tag($gene_feature, 'ID', $oID); #modify ID to replace by parent value
# remove parent ID because, none.
$gene_feature->remove_tag('Parent');
foreach my $tag ('transcript_biotype', 'transcript_id', 'transcript_name', 'transcript_source', 'transcript_support_level', 'transcript_version', 'exon_id', 'exon_number', 'exon_version'){
if ($l1_feature->has_tag($tag)) {
$l1_feature->remove_tag($tag);
Comment on lines +1571 to +1572
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It must be $gene_feature here not $l1_feature

}
}

# change primary tag
$gene_feature->primary_tag($primary_tag_l1);
#check uniqness of the ID
my $new_ID_l1 = _check_uniq_id_feature($hash_omniscient, $hashID, $gene_feature, 'level1');
#check uniqness of the ID
my $new_ID_l1 = _check_uniq_id_feature($hash_omniscient, $hashID, $gene_feature, 'level1');
my $l2_id = $hash_omniscient->{'level2'}{$primary_tag_l2}{$id_l1_checked}[0]->_tag_value('ID');

# Parent ID has same id as l2 feature !! We must modify ParentID
Expand Down Expand Up @@ -1799,11 +1808,21 @@ sub _check_l2_linked_to_l3{
}
$l2_feature->primary_tag($primary_tag_l2); # change primary tag
check_level2_positions($hash_omniscient, $l2_feature); # check start stop if isoforms exists
foreach my $tag ('transcript_biotype', 'transcript_id', 'transcript_name', 'transcript_source', 'transcript_support_level', 'transcript_version', 'exon_id', 'exon_number', 'exon_version'){
if ($l2_feature->has_tag($tag)) {
$l2_feature->remove_tag($tag);
}
}

#fill L1
my $l1_feature=clone($hash_omniscient->{'level3'}{$tag_l3}{$id_l2}[0]);#create a copy of the first mRNA feature;
$l1_feature->frame(".") if ($l1_feature->frame ne "."); # If we clone a CDS there will be a frame information to remove.
$l1_feature->remove_tag('Parent'); # remove parent ID because, none.
foreach my $tag ('transcript_biotype', 'transcript_id', 'transcript_name', 'transcript_source', 'transcript_support_level', 'transcript_version', 'exon_id', 'exon_number', 'exon_version'){
if ($l1_feature->has_tag($tag)) {
$l1_feature->remove_tag($tag);
}
}

#Deal case where we reconstruct other thing than a gene
my $primary_tag_l1=undef;
Expand Down