From 4bba04a569170cb8ff4930981b029180b250ce2c Mon Sep 17 00:00:00 2001 From: Lukas Mueller Date: Mon, 21 Oct 2024 17:12:28 -0400 Subject: [PATCH 1/9] add photo traits to the BrAPI trait export. --- lib/CXGN/BrAPI/v2/Scales.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/CXGN/BrAPI/v2/Scales.pm b/lib/CXGN/BrAPI/v2/Scales.pm index c19d3130c1..a7b60e8759 100644 --- a/lib/CXGN/BrAPI/v2/Scales.pm +++ b/lib/CXGN/BrAPI/v2/Scales.pm @@ -432,15 +432,16 @@ sub _format_data_type { if ($value) { my %formats = ( "categorical" => "Ordinal", - "numeric" => "Numerical", - "qualitative" => "Nominal", - "numerical" => "Numerical", - "nominal" => "Nominal", + "numeric" => "Numerical", + "qualitative" => "Nominal", + "numerical" => "Numerical", + "nominal" => "Nominal", "code" => "Code", "date" => "Date" , "duration" => "Duration", "ordinal" => "Ordinal", - "text"=> "Text", + "text" => "Text", + "photo" => "Photo", ); $dataType = $formats{lc $value} ? $formats{lc $value} : $dataType; From c605dbe6aaddcd06842c231747d458ca24fbf361 Mon Sep 17 00:00:00 2001 From: Lukas Mueller Date: Mon, 21 Oct 2024 17:54:03 -0400 Subject: [PATCH 2/9] add is_variable accessor. --- lib/CXGN/Cvterm.pm | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/CXGN/Cvterm.pm b/lib/CXGN/Cvterm.pm index 83b55e879d..6631fdbd0c 100644 --- a/lib/CXGN/Cvterm.pm +++ b/lib/CXGN/Cvterm.pm @@ -138,7 +138,11 @@ has 'accession' => ( is => 'rw', ); - +has 'is_variable' => ( + isa => 'Bool', + is => 'rw', + default => sub { return 0; }, + ); ######################################### @@ -149,6 +153,19 @@ sub BUILD { my $cvterm; if ($self->cvterm_id){ $cvterm = $self->schema()->resultset("Cv::Cvterm")->find({ cvterm_id => $self->cvterm_id() }); + + if ($cvterm) { + my $cvterm_rel_rs = $self->schema()->resultset("Cv::CvtermRelationship")->search( { subject_id => $self->cvterm_id }); + # require at least one parent to have a variable_of type + # + while (my $row = $cvterm_rel_rs->next()) { + #print STDERR "ROW TYPE: ".$row->type()->name()."\n"; + if (uc($row->type()->name) eq uc('variable_of')) { + $self->is_variable(1); + } + } + + } } elsif ($self->accession ) { my ($db_name, $dbxref_accession) = split "\:", $self->accession; @@ -185,12 +202,6 @@ sub BUILD { return $self; } - - - - - - =head2 function get_image_ids Synopsis: my @images = $self->get_image_ids() From f8d1703d5eae692a2565c4a341c4ff879086afd0 Mon Sep 17 00:00:00 2001 From: Lukas Mueller Date: Mon, 21 Oct 2024 17:54:32 -0400 Subject: [PATCH 3/9] remove deprecated class. --- lib/SGN/Controller/Cvterm.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/SGN/Controller/Cvterm.pm b/lib/SGN/Controller/Cvterm.pm index a28017ce75..ce4d36dfdc 100644 --- a/lib/SGN/Controller/Cvterm.pm +++ b/lib/SGN/Controller/Cvterm.pm @@ -1,7 +1,7 @@ package SGN::Controller::Cvterm; -use CXGN::Chado::Cvterm; #DEPRECATE this !! +#use CXGN::Chado::Cvterm; #DEPRECATE this !! use CXGN::Cvterm; use Moose; From 91ae9bfae8d8f34d3c33777efa775b83263eb797 Mon Sep 17 00:00:00 2001 From: Lukas Mueller Date: Mon, 21 Oct 2024 17:55:13 -0400 Subject: [PATCH 4/9] if a variable is displayed, show trait properties section, otherwise do not. --- mason/chado/cvterm.mas | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mason/chado/cvterm.mas b/mason/chado/cvterm.mas index 2c167ab785..d4f2a6e030 100644 --- a/mason/chado/cvterm.mas +++ b/mason/chado/cvterm.mas @@ -47,6 +47,7 @@ my $db_name = $cvterm->db->name; my $accession = $cvterm->accession; my $cvterm_name = $cvterm->name; my $definition = $cvterm->definition; +my $is_variable = $cvterm->is_variable; my $comment = '' ;#$cvterm->comment; #$stockref->{props} (hash of arrayrefs of cvtermprops. Keys = prop name, value = prop value) my $editable_cvterm_props_string = $cvtermref->{editable_cvterm_props}; @@ -165,6 +166,7 @@ my $edit_privs = $curator ; % my $props_subtitle = $edit_privs ? "[Add...]" : "[Add]"; +% if ($is_variable) { <&| /page/info_section.mas, title => "Trait Properties" , collapsible=> 1, is_subsection => 1, subtitle=>$props_subtitle &> <& /chado/cvtermprops.mas, cv_name => 'trait_property', @@ -176,11 +178,17 @@ my $edit_privs = $curator ; editable => \@editable_cvterm_props &> -

Add this term to a list

+% } +% else { + <&| /page/info_section.mas, title => "Trait Properties" , collapsible=> 1, is_collapsed => 1, is_subsection => 1, &> + No properties for traits. Trait properties can be set for variables only. + + +%} -<&| /page/info_section.mas, title=>"Add to list", collapsible=>1, collapsed=>1 &> +<&| /page/info_section.mas, title=>"Add this term to a list", collapsible=>1, collapsed=>1 &>
LOAD...
From 514093a109643134c0ea734d878cf0de0301ce5b Mon Sep 17 00:00:00 2001 From: Lukas Mueller Date: Mon, 21 Oct 2024 21:22:15 -0400 Subject: [PATCH 5/9] fix bizarre request by linter. --- lib/SGN/Controller/Cvterm.pm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/SGN/Controller/Cvterm.pm b/lib/SGN/Controller/Cvterm.pm index ce4d36dfdc..26ed24f1e3 100644 --- a/lib/SGN/Controller/Cvterm.pm +++ b/lib/SGN/Controller/Cvterm.pm @@ -35,13 +35,14 @@ sub view_cvterm : Chained('get_cvterm') PathPart('view') Args(0) { my $cvterm_id = $cvterm ? $cvterm->cvterm_id : undef ; my $bcs_cvterm = $cvterm->cvterm; - + + my ($person_id, $user_role, $curator, $submitter, $sequencer); my $logged_user = $c->user; - my $person_id = $logged_user->get_object->get_sp_person_id if $logged_user; - my $user_role = 1 if $logged_user; - my $curator = $logged_user->check_roles('curator') if $logged_user; - my $submitter = $logged_user->check_roles('submitter') if $logged_user; - my $sequencer = $logged_user->check_roles('sequencer') if $logged_user; + $person_id = $logged_user->get_object->get_sp_person_id if $logged_user; + $user_role = 1 if $logged_user; + $curator = $logged_user->check_roles('curator') if $logged_user; + $submitter = $logged_user->check_roles('submitter') if $logged_user; + $sequencer = $logged_user->check_roles('sequencer') if $logged_user; my $props = $self->_cvtermprops($cvterm); my $editable_cvterm_props = "trait_format,trait_default_value,trait_minimum,trait_maximum,trait_details,trait_categories"; From 042f72f9f51c9d6726cb8d6bc9bd168f8c34f360 Mon Sep 17 00:00:00 2001 From: Lukas Mueller Date: Mon, 21 Oct 2024 21:26:20 -0400 Subject: [PATCH 6/9] change the title of the Trait Properties section to Variable Properties. --- mason/chado/cvterm.mas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mason/chado/cvterm.mas b/mason/chado/cvterm.mas index d4f2a6e030..5d12be4204 100644 --- a/mason/chado/cvterm.mas +++ b/mason/chado/cvterm.mas @@ -167,7 +167,7 @@ my $edit_privs = $curator ; % my $props_subtitle = $edit_privs ? "[Add...]" : "[Add]"; % if ($is_variable) { -<&| /page/info_section.mas, title => "Trait Properties" , collapsible=> 1, is_subsection => 1, subtitle=>$props_subtitle &> +<&| /page/info_section.mas, title => "Variable Properties" , collapsible=> 1, is_subsection => 1, subtitle=>$props_subtitle &> <& /chado/cvtermprops.mas, cv_name => 'trait_property', cvterm_id =>$cvterm_id, @@ -180,8 +180,8 @@ my $edit_privs = $curator ; % } % else { - <&| /page/info_section.mas, title => "Trait Properties" , collapsible=> 1, is_collapsed => 1, is_subsection => 1, &> - No properties for traits. Trait properties can be set for variables only. + <&| /page/info_section.mas, title => "Variable Properties" , collapsible=> 1, is_collapsed => 1, is_subsection => 1, &> + No properties for traits. Variable properties can be set for variables only. %} From 558583125c90051c4b6f1383d5fcc97bb8d34d9e Mon Sep 17 00:00:00 2001 From: Lukas Mueller Date: Mon, 21 Oct 2024 21:30:14 -0400 Subject: [PATCH 7/9] according to lint, remove undef in return. --- lib/SGN/Controller/Cvterm.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/SGN/Controller/Cvterm.pm b/lib/SGN/Controller/Cvterm.pm index 26ed24f1e3..b690ba5468 100644 --- a/lib/SGN/Controller/Cvterm.pm +++ b/lib/SGN/Controller/Cvterm.pm @@ -100,7 +100,7 @@ sub _cvtermprops { my $properties ; if ($cvterm) { my $bcs_cvterm = $cvterm->cvterm; - if (!$bcs_cvterm) { return undef ; } + if (!$bcs_cvterm) { return; } my $cvtermprops = $bcs_cvterm->search_related("cvtermprops"); while ( my $prop = $cvtermprops->next ) { push @{ $properties->{$prop->type->name} } , $prop->value ; From d07bc8669f6d33e7e06076ef9ed6aa6727c33622 Mon Sep 17 00:00:00 2001 From: Lukas Mueller Date: Mon, 21 Oct 2024 21:50:33 -0400 Subject: [PATCH 8/9] also add multicat while we are at it... --- lib/CXGN/BrAPI/v2/Scales.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/CXGN/BrAPI/v2/Scales.pm b/lib/CXGN/BrAPI/v2/Scales.pm index a7b60e8759..b3b0eb30de 100644 --- a/lib/CXGN/BrAPI/v2/Scales.pm +++ b/lib/CXGN/BrAPI/v2/Scales.pm @@ -442,6 +442,7 @@ sub _format_data_type { "ordinal" => "Ordinal", "text" => "Text", "photo" => "Photo", + "multicat" => "Multicat", ); $dataType = $formats{lc $value} ? $formats{lc $value} : $dataType; From ad957588f82a2b77f3ee73ee2778f29f189e30df Mon Sep 17 00:00:00 2001 From: Lukas Mueller Date: Wed, 23 Oct 2024 14:26:31 -0400 Subject: [PATCH 9/9] remove variable attribute section for traits. --- mason/chado/cvterm.mas | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mason/chado/cvterm.mas b/mason/chado/cvterm.mas index 5d12be4204..cf78b3d0bf 100644 --- a/mason/chado/cvterm.mas +++ b/mason/chado/cvterm.mas @@ -180,9 +180,7 @@ my $edit_privs = $curator ; % } % else { - <&| /page/info_section.mas, title => "Variable Properties" , collapsible=> 1, is_collapsed => 1, is_subsection => 1, &> - No properties for traits. Variable properties can be set for variables only. - + %}