Skip to content

Commit

Permalink
Update annotation extensions when changing gene ID
Browse files Browse the repository at this point in the history
  • Loading branch information
jseager7 committed Apr 12, 2024
1 parent e880a8c commit 9bd6476
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions lib/Canto/Track/TrackUtil.pm
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,36 @@ sub change_gene_id
$allele->update();
}
}

my $annotation_rs = $cursdb->resultset('Annotation');

while (defined (my $annotation = $annotation_rs->next())) {
my $data = $annotation->data();
my $changed = 0;

my $extension = $data->{extension};

if (defined $extension) {
map {
my $orPart = $_;
map {
my $andPart = $_;
if ($andPart->{rangeType} && $andPart->{rangeType} eq 'Gene') {
if ($andPart->{rangeValue} eq $from_id) {
$andPart->{rangeValue} = $to_id;
$andPart->{rangeDisplayName} = $new_name;
$changed = 1;
}
}
} @$orPart;
} @$extension;
}

if ($changed) {
$annotation->data($data);
$annotation->update();
}
}
};

Canto::Track::curs_map($self->config(), $track_schema, $proc);
Expand Down

0 comments on commit 9bd6476

Please sign in to comment.