Skip to content

Commit

Permalink
Remove the exogenous_promoter field
Browse files Browse the repository at this point in the history
Merge the contents of exogenous_promoter into the promoter_gene field.

Refs #2823
  • Loading branch information
kimrutherford committed Apr 17, 2024
1 parent 96a71c1 commit d0d3fb8
Show file tree
Hide file tree
Showing 31 changed files with 34 additions and 100 deletions.
2 changes: 1 addition & 1 deletion Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ requires 'Exception::Class' => 1.40;
requires 'Class::Container' => 0.12;
requires 'Config::Any' => 0.27;
requires 'DBD::Pg';
requires 'DBD::SQLite' => 1.50;
requires 'DBD::SQLite' => 1.74;
requires 'DBIx::Class' => 0.082840;
requires 'DBIx::Class::ResultClass::HashRefInflator';
requires 'DBIx::Class::ResultSet::Data::Pageset' => 0.06;
Expand Down
2 changes: 1 addition & 1 deletion canto.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ canto_url: https://curation.pombase.org/

app_version: v1819

schema_version: 35
schema_version: 36

## Set this to create a Canto instance for a particular organism. If not set,
## Canto will be in multi-organism mode and the multi_organism_mode will be set.
Expand Down
Binary file modified db_templates/curs_db_template.sqlite3
Binary file not shown.
Binary file modified db_templates/ontology_index_dir/segments
Binary file not shown.
Binary file modified db_templates/track_db_template.sqlite3
Binary file not shown.
1 change: 0 additions & 1 deletion etc/curs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ CREATE TABLE allele (
name text,
comment text,
promoter_gene text,
exogenous_promoter text,
gene integer REFERENCES gene(gene_id)
);

Expand Down
10 changes: 2 additions & 8 deletions lib/Canto/Curs/AlleleManager.pm
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ sub allele_from_json
my $description = $json_allele->{description};
my $expression = $json_allele->{expression};
my $promoter_gene = $json_allele->{promoter_gene};
my $exogenous_promoter = $json_allele->{exogenous_promoter};
my $allele_type = $json_allele->{type};
my $gene_id = $json_allele->{gene_id};
my $comment = $json_allele->{comment};
Expand All @@ -194,8 +193,7 @@ sub allele_from_json

if ($allele) {
if (($expression // '') eq ($allele->expression() // '') and
($promoter_gene // '') eq ($allele->promoter_gene() // '') and
($exogenous_promoter // '') eq ($allele->exogenous_promoter() // '')) {
($promoter_gene // '') eq ($allele->promoter_gene() // '')) {
return $allele;
} else {
# fall through and find another allele that matches, or create
Expand Down Expand Up @@ -254,8 +252,7 @@ sub allele_from_json
if (($allele->name() // '') eq ($name // '') &&
($allele->description() // '') eq ($description // '') &&
($allele->expression() // '') eq ($expression // '') &&
($allele->promoter_gene() // '') eq ($promoter_gene // '') &&
($allele->exogenous_promoter() // '') eq ($exogenous_promoter // '')) {
($allele->promoter_gene() // '') eq ($promoter_gene // '')) {
set_allele_synonyms($schema, $allele, \@allele_synonyms);

return $allele;
Expand Down Expand Up @@ -300,7 +297,6 @@ sub allele_from_json
comment => $comment || undef,
expression => $expression || undef,
promoter_gene => $promoter_gene || undef,
exogenous_promoter => $exogenous_promoter || undef,
);

if ($allele_type =~ /_/) {
Expand Down Expand Up @@ -344,7 +340,6 @@ sub create_simple_allele
my $name = shift;
my $description = shift;
my $promoter_gene = shift;
my $exogenous_promoter = shift;
my $gene = shift;
my $synonyms = shift;

Expand All @@ -354,7 +349,6 @@ sub create_simple_allele
name => $name || undef,
description => $description || undef,
promoter_gene => $promoter_gene || undef,
exogenous_promoter => $exogenous_promoter || undef,
);

if ($allele_type !~ /^aberration/) {
Expand Down
7 changes: 2 additions & 5 deletions lib/Canto/Curs/GenotypeManager.pm
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,16 @@ sub allele_hashes_in_config_order
my $a_type = $a->{type};
my $a_expression = $a->{expression};
my $a_promoter_gene = $a->{promoter_gene};
my $a_exogenous_promoter = $a->{exogenous_promoter};

my $b_name = $b->{name};
my $b_description = $b->{description};
my $b_type = $b->{type};
my $b_expression = $b->{expression};
my $b_promoter_gene = $b->{promoter_gene};
my $b_exogenous_promoter = $b->{exogenous_promoter};

"$a_name-$a_description-$a_type-$a_expression-$a_promoter_gene-$a_exogenous_promoter"
"$a_name-$a_description-$a_type-$a_expression-$a_promoter_gene"
cmp
"$b_name-$b_description-$b_type-$b_expression-$b_promoter_gene-$b_exogenous_promoter"
"$b_name-$b_description-$b_type-$b_expression-$b_promoter_gene"
} else {
$res;
}
Expand Down Expand Up @@ -174,7 +172,6 @@ sub _allele_string_from_json
$ret{type} = $allele->type() // 'UNKNOWN';
$ret{expression} = $allele->expression() // 'UNKNOWN';
$ret{promoter_gene} = $allele->promoter_gene() // 'UNKNOWN';
$ret{exogenous_promoter} = $allele->exogenous_promoter() // 'UNKNOWN';

$ret{allele} = $allele;

Expand Down
3 changes: 0 additions & 3 deletions lib/Canto/Curs/Serialise.pm
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,6 @@ sub _get_genotype_loci
if ($allele->promoter_gene()) {
$ret_hash{promoter_gene} = $allele->promoter_gene();
}
if ($allele->exogenous_promoter()) {
$ret_hash{exogenous_promoter} = $allele->exogenous_promoter();
}

my $locus = $allele_genotype->diploid();

Expand Down
1 change: 0 additions & 1 deletion lib/Canto/Curs/ServiceUtils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,6 @@ sub _allele_details_hash
comment => $allele->comment(),
allele_id => $allele->allele_id(),
promoter_gene => $allele->promoter_gene(),
exogenous_promoter => $allele->exogenous_promoter(),
synonyms => \@synonyms_list,
notes => \%notes,
);
Expand Down
15 changes: 2 additions & 13 deletions lib/Canto/CursDB/Allele.pm
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ __PACKAGE__->table("allele");
data_type: 'text'
is_nullable: 1
=head2 exogenous_promoter
data_type: 'text'
is_nullable: 1
=head2 gene
data_type: 'integer'
Expand All @@ -97,8 +92,6 @@ __PACKAGE__->add_columns(
{ data_type => "text", is_nullable => 1 },
"promoter_gene",
{ data_type => "text", is_nullable => 1 },
"exogenous_promoter",
{ data_type => "text", is_nullable => 1 },
"gene",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
);
Expand Down Expand Up @@ -197,8 +190,8 @@ __PACKAGE__->belongs_to(
);


# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-06-14 20:50:03
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tiJPC9Xx1sQThu4sXAHr4w
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2024-04-17 18:07:24
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gIvlsUbVFK03pbSUaAW5MQ

__PACKAGE__->many_to_many('genotypes' => 'allele_genotypes',
'genotype');
Expand Down Expand Up @@ -248,10 +241,6 @@ sub long_identifier
$ret .= '{promoter:' . $self->promoter_gene() . '}';
}

if ($self->exogenous_promoter()) {
$ret .= '{exogenous_promoter:' . $self->exogenous_promoter() . '}';
}

return $ret;
}

Expand Down
20 changes: 20 additions & 0 deletions lib/Canto/DBUpgrade.pm
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,26 @@ CREATE TABLE genotype_interaction_with_phenotype (

Canto::Track::curs_map($config, $track_schema, $update_proc);
},

36 => sub {
my $config = shift;
my $track_schema = shift;

my $dbh = $track_schema->storage()->dbh();

my $update_proc = sub {
my $curs = shift;
my $curs_schema = shift;

my $curs_dbh = $curs_schema->storage()->dbh();

$curs_dbh->do("UPDATE allele SET promoter_gene = exogenous_promoter, exogenous_promoter = NULL WHERE exogenous_promoter IS NOT NULL;");
$curs_dbh->do("ALTER TABLE allele DROP COLUMN exogenous_promoter;");
0 };

Canto::Track::curs_map($config, $track_schema, $update_proc);
},

);

sub upgrade_to
Expand Down
40 changes: 2 additions & 38 deletions root/static/js/canto-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -4121,15 +4121,14 @@ var alleleEditDialogCtrl =
$scope.alleleData.description = $scope.alleleData.description || '';
$scope.alleleData.type = $scope.alleleData.type || '';
$scope.alleleData.expression = $scope.alleleData.expression || '';
$scope.alleleData.promoter_gene = $scope.alleleData.promoter_gene || '';
$scope.alleleData.evidence = $scope.alleleData.evidence || '';
$scope.alleleData.synonyms = $scope.alleleData.synonyms || [];
$scope.alleleData.existingSynonyms = [];
$scope.alleleData.newSynonyms = [];
$scope.genes = null;
$scope.promoterSelect = 'none';

$scope.data = {
promoterGeneId: null,
newSynonymsString: '',
alleleGene: null,
organismShortDisplayName: null,
Expand Down Expand Up @@ -4197,11 +4196,6 @@ var alleleEditDialogCtrl =

$.map($scope.genes,
(gene) => {
if (typeof($scope.alleleData.promoter_gene) != 'undefined') {
if (gene.primary_identifier == $scope.alleleData.promoter_gene) {
$scope.data.promoterGeneId = gene.gene_id;
}
}
if (gene.primary_identifier == $scope.alleleData.gene_systematic_id) {
$scope.data.alleleGene = gene;
if (gene && gene.organism && gene.organism.full_name) {
Expand All @@ -4211,13 +4205,6 @@ var alleleEditDialogCtrl =
}
});

if ($scope.data.promoterGeneId) {
$scope.promoterSelect = 'gene';
} else {
if ($scope.alleleData.exogenous_promoter) {
$scope.promoterSelect = 'exogenous';
}
}
}).catch(function (err) {
toaster.pop('note', "couldn't read the gene list from the server");
});
Expand Down Expand Up @@ -4470,28 +4457,6 @@ var alleleEditDialogCtrl =
$scope.okInProgress = true;
splitSynonymsForStoring($scope.alleleData, $scope.data.newSynonymsString);
copyObject($scope.alleleData, args.allele);
if ($scope.data.promoterGeneId == null) {
args.allele.promoter_gene = null;
} else {
$.map($scope.genes,
(gene) => {
if (gene.gene_id == $scope.data.promoterGeneId) {
args.allele.promoter_gene = gene.primary_identifier;
}
});
}

if ($scope.showPromoterOpts()) {
if ($scope.promoterSelect != 'gene') {
delete args.allele.promoter_gene;
}
if ($scope.promoterSelect != 'exogenous') {
delete args.allele.exogenous_promoter;
}
} else {
delete args.allele.promoter_gene;
delete args.allele.exogenous_promoter;
}

var strainName = null;
if ($scope.strainData.selectedStrain) {
Expand Down Expand Up @@ -5070,8 +5035,7 @@ var genotypeEdit =
allele1.gene_id === allele2.gene_id &&
(allele1.expression || '') === (allele2.expression || '') &&
(allele1.name || '') === (allele2.name || '') &&
(allele1.promoter_gene || '') === (allele2.promoter_gene || '') &&
(allele1.exogenous_promoter || '') === (allele2.exogenous_promoter || '');
(allele1.promoter_gene || '') === (allele2.promoter_gene || '');
};

$scope.findExistingAllele = function (alleleData) {
Expand Down
23 changes: 2 additions & 21 deletions root/static/ng_templates/allele_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -236,27 +236,8 @@ <h4 class="modal-title">
</table>

<div class="curs-allele-promoter ng-cloak" ng-show="showPromoterOpts()">
Promoter:
<div>
<input id="promoter-none" type="radio" value="none" ng-model="promoterSelect">
<label for="promoter-none">Unspecified</label>
</div>
<div>
<input id="promoter-gene" type="radio" value="gene" ng-model="promoterSelect">
<label for="promoter-gene">Promoter swap
<span ng-if="data.organismShortDisplayName">({{data.organismShortDisplayName}})</span></label>
<feature-chooser
ng-if="genes && promoterSelect == 'gene'"
feature-type="gene" features="genes"
feature-editable="true"
chosen-feature-id="data.promoterGeneId"></feature-chooser>
<a ng-if="promoterSelect == 'gene'" ng-click="openSingleGeneAddDialog()">Add another gene</a>
</div>
<div>
<input id="promoter-exogenous" type="radio" value="exogenous" ng-model="promoterSelect">
<label for="promoter-exogenous">Exogenous gene promoter</label>
<input type="text" ng-if="promoterSelect == 'exogenous'" ng-model="alleleData.exogenous_promoter"/>
</div>
<label for="gene-promoter">Promoter (optional)</label>
<input id="gene-promoter" type="text" ng-model="alleleData.promoter_gene">
</div>

<div class="modal-footer">
Expand Down
4 changes: 0 additions & 4 deletions t/80_curs_service_utils.t
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,6 @@ cmp_deeply($allele_res,
'gene_systematic_id' => 'SPAC27D7.13c',
'synonyms' => [],
'notes' => {},
'exogenous_promoter' => undef,
'promoter_gene' => undef,
},
{
Expand All @@ -1087,7 +1086,6 @@ cmp_deeply($allele_res,
'notes' => {
'note_test_key' => 'note_test_value',
},
'exogenous_promoter' => undef,
'promoter_gene' => undef,
},
{
Expand Down Expand Up @@ -1134,7 +1132,6 @@ my $expected_genotype_detail_res =
'synonyms' => [],
'comment' => undef,
'notes' => {},
'exogenous_promoter' => undef,
'promoter_gene' => undef,
},
{
Expand All @@ -1152,7 +1149,6 @@ my $expected_genotype_detail_res =
'synonyms' => [],
'comment' => undef,
'notes' => {},
'exogenous_promoter' => undef,
'promoter_gene' => undef,
},
],
Expand Down
4 changes: 2 additions & 2 deletions t/85_allele_manager.t
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ is ($no_name_allele_check->allele_id(), $no_name_allele->allele_id());


$allele_manager->create_simple_allele('test_uniquename', 'unknown', 'some_name',
'some_description', undef, undef,
'some_description', undef,
$SPBC1826_01c, []);

my $new_simple_allele = $curs_schema->resultset('Allele')
Expand All @@ -105,7 +105,7 @@ is ($new_simple_allele->gene()->primary_identifier(), 'SPBC1826.01c');

$allele_manager->create_simple_allele('test_aberration_uniquename', 'aberration',
'some_aberration_name',
'some_aberration_description', undef, undef,
'some_aberration_description', undef,
undef, []);

my $new_aberration = $curs_schema->resultset('Allele')
Expand Down
2 changes: 0 additions & 2 deletions t/90_curs_controller_service.t
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ test_psgi $app, sub {
'comment' => undef,
'synonyms' => [],
'notes' => {},
'exogenous_promoter' => undef,
'promoter_gene' => undef,
},
{
Expand All @@ -115,7 +114,6 @@ test_psgi $app, sub {
'comment' => undef,
'synonyms' => [],
'notes' => {},
'exogenous_promoter' => undef,
'promoter_gene' => undef,
}
],
Expand Down
Binary file modified t/data/curs_aaaa0001.sqlite3
Binary file not shown.
Binary file modified t/data/curs_aaaa0002.sqlite3
Binary file not shown.
Binary file modified t/data/curs_aaaa0003.sqlite3
Binary file not shown.
Binary file modified t/data/curs_aaaa0004.sqlite3
Binary file not shown.
Binary file modified t/data/curs_aaaa0005.sqlite3
Binary file not shown.
Binary file modified t/data/curs_aaaa0006.sqlite3
Binary file not shown.
Binary file modified t/data/curs_aaaa0007.sqlite3
Binary file not shown.
Binary file modified t/data/ontology_index/segments
Binary file not shown.
Binary file modified t/data/track_0_curs_test_template.sqlite3
Binary file not shown.
Binary file modified t/data/track_1_curs_test_template.sqlite3
Binary file not shown.
Binary file modified t/data/track_3_curs_test_template.sqlite3
Binary file not shown.
Binary file modified t/data/track_curs_annotations_1_test_template.sqlite3
Binary file not shown.
Binary file modified t/data/track_curs_annotations_2_test_template.sqlite3
Binary file not shown.
Binary file modified t/data/track_empty_db_test_template.sqlite3
Binary file not shown.

0 comments on commit d0d3fb8

Please sign in to comment.