Skip to content

Commit

Permalink
Change canto_add.pl to add interactions
Browse files Browse the repository at this point in the history
For cases that aren't possible in the interface.

Refs #2816
  • Loading branch information
kimrutherford committed Mar 26, 2024
1 parent 5ba3c2a commit 9af272f
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions script/canto_add.pl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ BEGIN
my $add_session = 0;
my $add_sessions_from_json = 0;
my $add_organism = 0;
my $add_genotype_interaction = 0;
my $dry_run = 0;
my $do_help = 0;

Expand Down Expand Up @@ -63,6 +64,9 @@ BEGIN
'--sessions-from-json' => sub {
$add_sessions_from_json = 1;
},
'--genotype-interaction' => sub {
$add_genotype_interaction = 1;
},
'--help' => sub {
$do_help = 1;
},
Expand Down Expand Up @@ -106,6 +110,8 @@ sub usage
$0 --sessions-from-json <json_file_name> <curator_email_address> <default_organism_taxonid>
or:
$0 --organism "<genus> <species>" <taxon_id> [<common_name>]
or:
$0 --genotype-interaction <session_id> <interaction_type> <double_mutant_annotation_id> <genotype_a_identifier> <genotype_b_identifier>
Options:
--cvterm - add a cvterm to the database
Expand Down Expand Up @@ -306,3 +312,33 @@ sub usage
print "created ", scalar(@$new_sessions), " sessions\n";
print "updated ", scalar(@$updated_sessions), " sessions\n";
}

if ($add_genotype_interaction) {
if (@ARGV != 5) {
usage (qq{"$opt" needs five arguments});
}
my $session_id = shift;
my $interaction_type = shift;
my $double_mutant_annotation_id = shift;
my $genotype_a_identifier = shift;
my $genotype_b_identifier = shift;

my $curs_schema = Canto::Curs::get_schema_for_key($config, $session_id);

my $genotype_a = $curs_schema->find_with_type('Genotype', {
identifier => $genotype_a_identifier,
});

my $genotype_b = $curs_schema->find_with_type('Genotype', {
identifier => $genotype_b_identifier,
});

my %create_args = (
interaction_type => $interaction_type,
primary_genotype_annotation_id => $double_mutant_annotation_id,
genotype_a_id => $genotype_a->genotype_id(),
genotype_b_id => $genotype_b->genotype_id(),
);

$curs_schema->create_with_type('GenotypeInteraction', \%create_args);
}

0 comments on commit 9af272f

Please sign in to comment.