Skip to content

Commit

Permalink
Load allele comments when importing JSON
Browse files Browse the repository at this point in the history
Refs #1779
  • Loading branch information
kimrutherford committed May 23, 2019
1 parent 0ace6b3 commit 9127b53
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/Canto/Track/LoadUtil.pm
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,7 @@ sub create_sessions_from_json

my $type = $allele_details->{type} || 'other';
my $name = $allele_details->{name} || undef;
my $comment = $allele_details->{comment} || undef;
my $description = $allele_details->{description} || undef;
my $synonyms = $allele_details->{synonyms};
my @args = ($allele_uniquename, $type, $name, $description, $gene, $synonyms);
Expand All @@ -958,6 +959,7 @@ sub create_sessions_from_json
allele_display_name => lc $allele_object->display_name(),
gene_display_name => lc $gene_display_name,
identifier => "genotype-$allele_uniquename",
comment => $comment,
taxonid => $default_organism_taxonid,
};
}
Expand All @@ -971,7 +973,8 @@ sub create_sessions_from_json
for my $genotype_details (@genotype_details) {
$genotype_manager->make_genotype(undef, undef, [$genotype_details->{allele}],
$genotype_details->{taxonid},
$genotype_details->{identifier});
$genotype_details->{identifier}, undef,
$genotype_details->{comment});
}
}

Expand Down
4 changes: 3 additions & 1 deletion t/60_load_util.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use strict;
use warnings;
use Test::More tests => 15;
use Test::More tests => 16;
use Test::Exception;

use Canto::TestUtil;
Expand Down Expand Up @@ -52,6 +52,8 @@ is($FBal0119310_allele->description(), 'description of FBal0119310');
my $genotype_FBal0119310 =
$created_cursdb->resultset('Genotype')->find({ identifier => "genotype-FBal0119310" });

is($genotype_FBal0119310->comment(), 'comment on FBal0119310');

my $FBal0119310_genotype_allele = ($genotype_FBal0119310->alleles()->all())[0];
is ($FBal0119310_genotype_allele->allele_id(), $FBal0119310_allele->allele_id());

Expand Down
1 change: 1 addition & 0 deletions t/data/sessions_from_json_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"type": "other",
"name": "Dmel\\Cdk2_UAS.Tag:MYC",
"description": "description of FBal0119310",
"comment": "comment on FBal0119310",
"synonyms": ["UAS-Cdk2-myc", "UAS-Cdk2"]
},
"FBal0064432": {
Expand Down

0 comments on commit 9127b53

Please sign in to comment.