Skip to content

Commit

Permalink
Check for "from" and "to" Iwhen changing genes ID
Browse files Browse the repository at this point in the history
In --change-gene-id we use a GeneLookup adaptor to check that the "to"
and "from" IDs are available in the main database.

Refs #2677
  • Loading branch information
kimrutherford committed Apr 8, 2024
1 parent 725e2ee commit dbaf807
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/Canto/Track/TrackUtil.pm
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,20 @@ sub change_gene_id
my $from_id = shift;
my $to_id = shift;

my $gene_lookup = Canto::Track::get_adaptor($self->config(), 'gene');

my $from_id_lookup_result = $gene_lookup->lookup([$from_id]);

if (@{$from_id_lookup_result->{found}} == 0) {
die qq|no gene found in the database for "from" ID $from_id\n|;
}

my $to_id_lookup_result = $gene_lookup->lookup([$to_id]);

if (@{$to_id_lookup_result->{found}} == 0) {
die qq|no gene found in the database for "to" ID $to_id\n|;
}

my $track_schema = $self->schema();

my $proc = sub {
Expand Down

0 comments on commit dbaf807

Please sign in to comment.