From 12366e055cdd4d8dd508de109fae751eb3984240 Mon Sep 17 00:00:00 2001 From: steve-fischer-200 Date: Sun, 25 Jan 2026 12:58:15 -0500 Subject: [PATCH] postgres and partitions --- .../CannedQuery/ElementNamesWithMetaData.pm | 33 ++++++++++--------- Model/lib/perl/CannedQuery/MultiProfile.pm | 12 ++++--- .../lib/perl/CannedQuery/PathwayGeneraData.pm | 7 ++-- .../CannedQuery/PhenotypeRankedNthNames.pm | 5 ++- .../PhenotypeRankedNthSourceIdNames.pm | 5 ++- .../CannedQuery/PhenotypeRankedNthValues.pm | 5 ++- Model/lib/perl/CannedQuery/Profile.pm | 6 +++- Model/lib/perl/CannedQuery/ProfileByEC.pm | 3 +- .../CannedQuery/ProfileForOligoFromGene.pm | 10 ++++-- Model/lib/perl/CannedQuery/ProfileSet.pm | 9 +++-- .../perl/CannedQuery/RankedNthRatioValues.pm | 6 ++-- Model/lib/perl/CannedQuery/SenseAntisense.pm | 4 ++- Model/lib/perl/CannedQuery/SenseAntisenseX.pm | 4 ++- Model/lib/perl/CannedQuery/SenseAntisenseY.pm | 4 ++- Model/lib/perl/CannedQuery/UDProfileValues.pm | 4 +++ 15 files changed, 78 insertions(+), 39 deletions(-) diff --git a/Model/lib/perl/CannedQuery/ElementNamesWithMetaData.pm b/Model/lib/perl/CannedQuery/ElementNamesWithMetaData.pm index 564cc5759..676ef1468 100644 --- a/Model/lib/perl/CannedQuery/ElementNamesWithMetaData.pm +++ b/Model/lib/perl/CannedQuery/ElementNamesWithMetaData.pm @@ -55,21 +55,24 @@ sub init { $Self->setSql(<>\' - AND s.profile_type = \'<>\' - --AND m1.study_name(+) = s.study_name - and m1.PAN_ID(+) = s.PROTOCOL_APP_NODE_ID - and m1.property_source_id(+) = \'$facet1\' - --AND m2.study_name(+) = s.study_name - and m2.PAN_ID(+) = s.PROTOCOL_APP_NODE_ID - and m2.property_source_id(+) = \'<>\' - ORDER BY s.node_order_num -) ps +SELECT DISTINCT + s.protocol_app_node_name AS name, + s.NODE_ORDER_NUM, + m1.string_value AS facet, + m2.string_value AS contXAxis +FROM apidbtuning.ProfileSamples s +LEFT JOIN apidbtuning.metadata m1 + ON m1.PAN_ID = s.PROTOCOL_APP_NODE_ID + AND m1.property_source_id = '$facet1' + --AND m1.study_name = s.study_name +LEFT JOIN apidbtuning.metadata m2 + ON m2.PAN_ID = s.PROTOCOL_APP_NODE_ID + AND m2.property_source_id = '<>' + --AND m2.study_name = s.study_name +WHERE s.study_name = '<>' + AND s.profile_type = '<>' +ORDER BY s.node_order_num; + Sql diff --git a/Model/lib/perl/CannedQuery/MultiProfile.pm b/Model/lib/perl/CannedQuery/MultiProfile.pm index a92224a7b..a137367bf 100644 --- a/Model/lib/perl/CannedQuery/MultiProfile.pm +++ b/Model/lib/perl/CannedQuery/MultiProfile.pm @@ -46,19 +46,21 @@ sub init { $Self->SUPER::init($Args); - $Self->setCollated(1); + $Self->setCollated(1); - $Self->setId ( $Args->{Id } ); - $Self->setProfileSet ( $Args->{ProfileSet } ); + $Self->setId ( $Args->{Id } ); + $Self->setOrgAbbrev($Args->{OrgAbbrev}); + $Self->setProfileSet ( $Args->{ProfileSet } ); $Self->setSql(<>) AND p.profile_set_id = ps.profile_set_id AND ps.name = '<>' +AND p.org_abbrev = '<>' Sql return $Self; @@ -72,6 +74,8 @@ sub setId { $_[0]->{'Id' } = $_[1]; $_[0] } sub getProfileSet { $_[0]->{'ProfileSet' } } sub setProfileSet { $_[0]->{'ProfileSet' } = $_[1]; $_[0] } +sub getOrgAbbrev { $_[0]->{'OrgAbbrev' } } +sub setOrgAbbrev { $_[0]->{'OrgAbbrev' } = $_[1]; $_[0] } # ======================================================================== # --------------------------- Support Methods ---------------------------- # ======================================================================== diff --git a/Model/lib/perl/CannedQuery/PathwayGeneraData.pm b/Model/lib/perl/CannedQuery/PathwayGeneraData.pm index f6b91a829..11cf6e378 100644 --- a/Model/lib/perl/CannedQuery/PathwayGeneraData.pm +++ b/Model/lib/perl/CannedQuery/PathwayGeneraData.pm @@ -31,11 +31,10 @@ from (select distinct genus from dots.AaSequenceEnzymeClass asec, sres.EnzymeClass ec where ec.enzyme_class_id = asec.enzyme_class_id and ec.ec_number LIKE REPLACE(REPLACE(REPLACE(REPLACE(lower('<>'),' ',''),'-', '%'),'*','%'),'any','%') - ) ec, - ( + ) ec + RIGHT JOIN ( <> - ) orgs -where orgs.genus = ec.genus (+) + ) orgs ON orgs.genus = ec.genus order by orgs.o asc Sql diff --git a/Model/lib/perl/CannedQuery/PhenotypeRankedNthNames.pm b/Model/lib/perl/CannedQuery/PhenotypeRankedNthNames.pm index ad9b7107e..ef15640e0 100644 --- a/Model/lib/perl/CannedQuery/PhenotypeRankedNthNames.pm +++ b/Model/lib/perl/CannedQuery/PhenotypeRankedNthNames.pm @@ -14,6 +14,7 @@ sub init { $Self->SUPER::init($Args); $Self->setId($Args->{Id}); + $Self->setOrgAbbrev($Args->{OrgAbbrev}); $Self->setSourceIdValueQuery($Args->{SourceIdValueQuery}); $Self->setN($Args->{N}); @@ -31,7 +32,7 @@ select t.value, rownum rn, source_id from (select source_id, value from dat order by value) t ) where ('<>' = 'ALL' AND (rn = 1 or rn = (select ct.m from ct) or mod(rn, round((select ct.m from ct)/<>,0)) = 0)) - OR '<>' = source_id + OR ('<>' = source_id and '<>' = org_abbrev) Sql return $Self; @@ -47,6 +48,8 @@ sub getSourceIdValueQuery{ $_[0]->{_SourceIdValueQuery} } sub setN { $_[0]->{_n} = $_[1] } sub getN { $_[0]->{_n} } +sub getOrgAbbrev { $_[0]->{'OrgAbbrev' } } +sub setOrgAbbrev { $_[0]->{'OrgAbbrev' } = $_[1]; $_[0] } sub prepareDictionary { my $Self = shift; diff --git a/Model/lib/perl/CannedQuery/PhenotypeRankedNthSourceIdNames.pm b/Model/lib/perl/CannedQuery/PhenotypeRankedNthSourceIdNames.pm index ab7bca5ec..c6e9728e0 100644 --- a/Model/lib/perl/CannedQuery/PhenotypeRankedNthSourceIdNames.pm +++ b/Model/lib/perl/CannedQuery/PhenotypeRankedNthSourceIdNames.pm @@ -14,6 +14,7 @@ sub init { $Self->SUPER::init($Args); $Self->setId($Args->{Id}); + $Self->setOrgAbbrev($Args->{OrgAbbrev}); $Self->setSourceIdValueQuery($Args->{SourceIdValueQuery}); $Self->setN($Args->{N}); @@ -31,7 +32,7 @@ select t.value, rownum rn, source_id from (select source_id, value from dat order by value) t ) where ('<>' = 'ALL' AND (rn = 1 or rn = (select ct.m from ct) or mod(rn, round((select ct.m from ct)/<>,0)) = 0)) - OR '<>' = source_id + OR ('<>' = source_id and '<>' = org_abbrev) Sql return $Self; @@ -47,6 +48,8 @@ sub getSourceIdValueQuery{ $_[0]->{_SourceIdValueQuery} } sub setN { $_[0]->{_n} = $_[1] } sub getN { $_[0]->{_n} } +sub getOrgAbbrev { $_[0]->{'OrgAbbrev' } } +sub setOrgAbbrev { $_[0]->{'OrgAbbrev' } = $_[1]; $_[0] } sub prepareDictionary { my $Self = shift; diff --git a/Model/lib/perl/CannedQuery/PhenotypeRankedNthValues.pm b/Model/lib/perl/CannedQuery/PhenotypeRankedNthValues.pm index 0d0033a71..53856936e 100644 --- a/Model/lib/perl/CannedQuery/PhenotypeRankedNthValues.pm +++ b/Model/lib/perl/CannedQuery/PhenotypeRankedNthValues.pm @@ -14,6 +14,7 @@ sub init { $Self->SUPER::init($Args); $Self->setId($Args->{Id}); + $Self->setOrgAbbrev($Args->{OrgAbbrev}); $Self->setSourceIdValueQuery($Args->{SourceIdValueQuery}); $Self->setN($Args->{N}); @@ -31,7 +32,7 @@ select t.value, rownum rn, source_id from (select source_id, value from dat order by value) t ) where ('<>' = 'ALL' AND (rn = 1 or rn = (select ct.m from ct) or mod(rn, round((select ct.m from ct)/<>,0)) = 0)) - OR '<>' = source_id + OR ('<>' = source_id AND '<>' = org_abbrev) Sql return $Self; @@ -47,6 +48,8 @@ sub getSourceIdValueQuery{ $_[0]->{_SourceIdValueQuery} } sub setN { $_[0]->{_n} = $_[1] } sub getN { $_[0]->{_n} } +sub getOrgAbbrev { $_[0]->{'OrgAbbrev' } } +sub setOrgAbbrev { $_[0]->{'OrgAbbrev' } = $_[1]; $_[0] } sub prepareDictionary { my $Self = shift; diff --git a/Model/lib/perl/CannedQuery/Profile.pm b/Model/lib/perl/CannedQuery/Profile.pm index fd74d4105..c8feda0f7 100644 --- a/Model/lib/perl/CannedQuery/Profile.pm +++ b/Model/lib/perl/CannedQuery/Profile.pm @@ -55,10 +55,11 @@ sub init { $Self->setSql(<{'Id' } } sub setId { $_[0]->{'Id' } = $_[1]; $_[0] } +sub getOrgAbbrev { $_[0]->{'OrgAbbrev' } } +sub setOrgAbbrev { $_[0]->{'OrgAbbrev' } = $_[1]; $_[0] } + sub getSecondaryId { $_[0]->{'SecondaryId' } } sub setSecondaryId { $_[0]->{'SecondaryId' } = $_[1]; $_[0] } diff --git a/Model/lib/perl/CannedQuery/ProfileByEC.pm b/Model/lib/perl/CannedQuery/ProfileByEC.pm index 5985b23fb..9c8507e75 100644 --- a/Model/lib/perl/CannedQuery/ProfileByEC.pm +++ b/Model/lib/perl/CannedQuery/ProfileByEC.pm @@ -13,7 +13,7 @@ sub init { $Self->setSql(<SUPER::init($Args); - $Self->setId ( $Args->{Id } ); - $Self->setProfileSet ( $Args->{ProfileSet } ); + $Self->setId ( $Args->{Id } ); + $Self->setProfileSet ( $Args->{ProfileSet } ); + $Self->setOrgAbbrev($Args->{OrgAbbrev}); $Self->setSql(<{'Id' } = $_[1]; $_[0] } sub getProfileSet { $_[0]->{'ProfileSet' } } sub setProfileSet { $_[0]->{'ProfileSet' } = $_[1]; $_[0] } +sub getOrgAbbrev { $_[0]->{'OrgAbbrev' } } +sub setOrgAbbrev { $_[0]->{'OrgAbbrev' } = $_[1]; $_[0] } # ======================================================================== # --------------------------- Support Methods ---------------------------- # ======================================================================== diff --git a/Model/lib/perl/CannedQuery/ProfileSet.pm b/Model/lib/perl/CannedQuery/ProfileSet.pm index bf4901a62..423d1d380 100644 --- a/Model/lib/perl/CannedQuery/ProfileSet.pm +++ b/Model/lib/perl/CannedQuery/ProfileSet.pm @@ -43,15 +43,17 @@ sub init { $Self->setCollated(1); - $Self->setProfileSet ( $Args->{ProfileSet } ); + $Self->setOrgAbbrev($Args->{OrgAbbrev}); + $Self->setProfileSet ( $Args->{ProfileSet } ); $Self->setSql(<{'Id' } } sub setId { $_[0]->{'Id' } = $_[1]; $_[0] } - +sub getOrgAbbrev { $_[0]->{'OrgAbbrev' } } +sub setOrgAbbrev { $_[0]->{'OrgAbbrev' } = $_[1]; $_[0] } sub getProfileSet { $_[0]->{'ProfileSet' } } sub setProfileSet { $_[0]->{'ProfileSet' } = $_[1]; $_[0] } diff --git a/Model/lib/perl/CannedQuery/RankedNthRatioValues.pm b/Model/lib/perl/CannedQuery/RankedNthRatioValues.pm index baac4c2c3..d1d291706 100644 --- a/Model/lib/perl/CannedQuery/RankedNthRatioValues.pm +++ b/Model/lib/perl/CannedQuery/RankedNthRatioValues.pm @@ -14,6 +14,7 @@ sub init { $Self->SUPER::init($Args); $Self->setId($Args->{Id}); + $Self->setOrgAbbrev($Args->{OrgAbbrev}); $Self->setSourceIdValueQuery($Args->{SourceIdValueQuery}); $Self->setN($Args->{N}); @@ -31,7 +32,7 @@ select t.value, rownum rn, source_id, num, denom from (select source_id, value, num, denom from dat order by value) t ) where ('<>' = 'ALL' AND (rn = 1 or rn = (select ct.m from ct) or mod(rn, round((select ct.m from ct)/<>,0)) = 0)) - OR '<>' = source_id + OR ('<>' = source_id and '<>' = org_abbrev) Sql return $Self; @@ -40,7 +41,8 @@ Sql sub getId { $_[0]->{'Id' } } sub setId { $_[0]->{'Id' } = $_[1]; $_[0] } - +sub getOrgAbbrev { $_[0]->{'OrgAbbrev' } } +sub setOrgAbbrev { $_[0]->{'OrgAbbrev' } = $_[1]; $_[0] } sub setSourceIdValueQuery { $_[0]->{_SourceIdValueQuery} = $_[1] } sub getSourceIdValueQuery{ $_[0]->{_SourceIdValueQuery} } diff --git a/Model/lib/perl/CannedQuery/SenseAntisense.pm b/Model/lib/perl/CannedQuery/SenseAntisense.pm index e61e6af10..afa2b4aef 100644 --- a/Model/lib/perl/CannedQuery/SenseAntisense.pm +++ b/Model/lib/perl/CannedQuery/SenseAntisense.pm @@ -13,6 +13,7 @@ sub init { $Self->setProfileSetId($Args->{ProfileSetId}); $Self->setId($Args->{Id}); + $Self->setOrgAbbrev($Args->{OrgAbbrev}); $Self->setAntisenseFloor($Args->{AntisenseFloor}); return $Self; @@ -24,7 +25,8 @@ sub getId { $_[0]->{'Id' } } sub setId { $_[0]->{'Id' } = $_[1]; $_[0] } sub getAntisenseFloor { $_[0]->{'AntisenseFloor' } } sub setAntisenseFloor { $_[0]->{'AntisenseFloor' } = $_[1]; $_[0] } - +sub getOrgAbbrev { $_[0]->{'OrgAbbrev' } } +sub setOrgAbbrev { $_[0]->{'OrgAbbrev' } = $_[1]; $_[0] } sub prepareDictionary { my $Self = shift; diff --git a/Model/lib/perl/CannedQuery/SenseAntisenseX.pm b/Model/lib/perl/CannedQuery/SenseAntisenseX.pm index 8900635b5..2153829cf 100644 --- a/Model/lib/perl/CannedQuery/SenseAntisenseX.pm +++ b/Model/lib/perl/CannedQuery/SenseAntisenseX.pm @@ -21,6 +21,7 @@ with comp as (select ps.node_order_num,ps.protocol_app_node_name,na.value and ps.profile_type = 'values' and ps.protocol_app_node_id = na.protocol_app_node_id and na.na_feature_id = ga.na_feature_id + and ga.org_abbrev ='<>' and ga.source_id='<>') , ref as (select ps.node_order_num,ps.protocol_app_node_name,na.value from apidbtuning.ProfileSamples ps @@ -30,7 +31,8 @@ with comp as (select ps.node_order_num,ps.protocol_app_node_name,na.value and ps.profile_type = 'values' and ps.protocol_app_node_id = na.protocol_app_node_id and na.na_feature_id = ga.na_feature_id - and ga.source_id='<>') + and ga.org_abbrev ='<>' + and ga.source_id='<>') select CONTXAXIS, NAME, ROW_NUMBER() OVER (order by NAME) as element_order from ( select ref.protocol_app_node_name || '->' || comp.protocol_app_node_name as NAME diff --git a/Model/lib/perl/CannedQuery/SenseAntisenseY.pm b/Model/lib/perl/CannedQuery/SenseAntisenseY.pm index d0004b1f7..d06de7fea 100644 --- a/Model/lib/perl/CannedQuery/SenseAntisenseY.pm +++ b/Model/lib/perl/CannedQuery/SenseAntisenseY.pm @@ -21,6 +21,7 @@ with comp as (select ps.node_order_num,ps.protocol_app_node_name,na.value and ps.profile_type = 'values' and ps.protocol_app_node_id = na.protocol_app_node_id and na.na_feature_id = ga.na_feature_id + and ga.org_abbrev ='<>' and ga.source_id='<>') , ref as (select ps.node_order_num,ps.protocol_app_node_name,na.value from apidbtuning.ProfileSamples ps @@ -30,7 +31,8 @@ with comp as (select ps.node_order_num,ps.protocol_app_node_name,na.value and ps.profile_type = 'values' and ps.protocol_app_node_id = na.protocol_app_node_id and na.na_feature_id = ga.na_feature_id - and ga.source_id='<>') + and ga.org_abbrev ='<>' + and ga.source_id='<>') select value, ROW_NUMBER() OVER (order by name) as element_order from ( select ref.protocol_app_node_name || '->' || comp.protocol_app_node_name as name diff --git a/Model/lib/perl/CannedQuery/UDProfileValues.pm b/Model/lib/perl/CannedQuery/UDProfileValues.pm index e453e5e53..409a22e20 100644 --- a/Model/lib/perl/CannedQuery/UDProfileValues.pm +++ b/Model/lib/perl/CannedQuery/UDProfileValues.pm @@ -12,6 +12,7 @@ sub init { $Self->SUPER::init($Args); $Self->setId($Args->{Id}); + $Self->setOrgAbbrev($Args->{OrgAbbrev}); $Self->setProfileSetId($Args->{ProfileSetId}); $Self->setSql(<{'Id' } = $_[1]; $_[0] } sub getProfileSetId { $_[0]->{'ProfileSetId' } } sub setProfileSetId { $_[0]->{'ProfileSetId' } = $_[1]; $_[0] } +sub getOrgAbbrev { $_[0]->{'OrgAbbrev' } } +sub setOrgAbbrev { $_[0]->{'OrgAbbrev' } = $_[1]; $_[0] } sub prepareDictionary { my $Self = shift;