Skip to content

Commit 3b14293

Browse files
authored
Merge pull request #286 from LabKey/fb_merge_25.11_to_develop
Merge discvr-25.11 to develop
2 parents 0fcf465 + 64a0a31 commit 3b14293

File tree

22 files changed

+131
-47
lines changed

22 files changed

+131
-47
lines changed

GenotypeAssays/resources/views/bulkHaplotype.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<script type="text/javascript" nonce="<%=scriptNonce%>">
22

33
Ext4.onReady(function () {
4-
var analysisIds = LABKEY.ActionURL.getParameter('analysisIds');
4+
var analysisId = LABKEY.ActionURL.getParameter('analysisId');
55

6-
if (!analysisIds) {
7-
alert('Must Provide At Least One Analysis Id');
6+
if (!analysisId) {
7+
alert('Must Provide An Analysis Id');
88
return;
99
}
1010

@@ -15,7 +15,7 @@
1515
title: 'Haplotype Matches',
1616
items: [{
1717
xtype: 'genotypeassays-haplotypepanel',
18-
analysisIds: analysisIds.split(';'),
18+
analysisIds: analysisId,
1919
showCheckBoxes: true
2020
}]
2121
}).render(webpart.wrapperDivId);

GenotypeAssays/resources/views/sbtReview.html

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,15 @@
155155
allowHeaderLock: false,
156156
schemaName: 'sequenceanalysis',
157157
queryName: 'alignment_summary_grouped',
158-
//viewName: 'With Haplotype Matches',
158+
viewName: 'With Haplotype Matches',
159159
//sort: '-percent',
160160
containerPath: Laboratory.Utils.getQueryContainerPath(),
161-
filterArray: [LABKEY.Filter.create('analysis_id', analysisId, LABKEY.Filter.Types.EQUAL)],
162161
removeableFilters: [
163162
LABKEY.Filter.create('percent_from_locus', 0.25, LABKEY.Filter.Types.GTE)
164163
],
164+
parameters: {
165+
AnalysisId: analysisId
166+
},
165167
scope: this,
166168
success: this.onDataRegionLoad
167169
})
@@ -173,15 +175,17 @@
173175
allowHeaderLock: false,
174176
schemaName: 'sequenceanalysis',
175177
queryName: 'alignment_summary_by_lineage',
176-
//viewName: 'With Haplotype Matches',
178+
viewName: 'With Haplotype Matches',
177179
sort: '-percent',
178180
containerPath: Laboratory.Utils.getQueryContainerPath(),
179-
filterArray: [LABKEY.Filter.create('analysis_id', analysisId, LABKEY.Filter.Types.EQUAL)],
180181
removeableFilters: [
181182
LABKEY.Filter.create('percent_from_locus', 0.25, LABKEY.Filter.Types.GTE),
182183
LABKEY.Filter.create('total_reads', 5, LABKEY.Filter.Types.GT),
183184
LABKEY.Filter.create('totalLineages', 1, LABKEY.Filter.Types.EQUAL)
184185
],
186+
parameters: {
187+
AnalysisId: analysisId
188+
},
185189
scope: this,
186190
success: this.onDataRegionLoad
187191
})
@@ -191,7 +195,7 @@
191195
title: 'Haplotype Matches',
192196
items: [{
193197
xtype: 'genotypeassays-haplotypepanel',
194-
analysisIds: [analysisId]
198+
analysisId: [analysisId]
195199
}]
196200
},{
197201
xtype: 'ldk-querypanel',

GenotypeAssays/resources/web/genotypeassays/buttons.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@ GenotypeAssays.buttons = new function(){
2121
return;
2222
}
2323

24+
if (checked.length !== 1) {
25+
alert('Only one row at a time can be selected');
26+
return;
27+
}
28+
2429
var newForm = Ext4.DomHelper.append(document.getElementsByTagName('body')[0],
2530
'<form method="POST" action="' + LABKEY.ActionURL.buildURL("genotypeassays", "bulkHaplotype", null) + '">' +
26-
'<input type="hidden" name="analysisIds" value="' + Ext4.htmlEncode(checked.join(';')) + '" />' +
31+
'<input type="hidden" name="analysisId" value="' + Ext4.htmlEncode(checked[0]) + '" />' +
2732
'</form>');
2833
newForm.submit();
2934
}

GenotypeAssays/resources/web/genotypeassays/panel/HaplotypePanel.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Ext4.define('GenotypeAssays.panel.HaplotypePanel', {
22
extend: 'Ext.panel.Panel',
33
alias: 'widget.genotypeassays-haplotypepanel',
4-
analysisIds: null,
4+
analysisId: null,
55
showCheckBoxes: false,
66

77
initComponent: function(){
@@ -266,10 +266,11 @@ Ext4.define('GenotypeAssays.panel.HaplotypePanel', {
266266
}
267267
}, this);
268268

269-
Ext4.Msg.confirm('Publish Selected?', 'You have chosen to published the following haplotypes:<br><br>' + (haplotypeNames.length > 8 ? 'Too many to display' : haplotypeNames.join('<br>')) + '<br><br>Continue?', function (val) {
269+
Ext4.Msg.confirm('Publish Selected?', 'You have chosen to publish the following haplotypes:<br><br>' + (haplotypeNames.length > 8 ? 'Too many to display' : haplotypeNames.join('<br>')) + '<br><br>Continue?', function (val) {
270270
if (val == 'yes') {
271271
Ext4.create('GenotypeAssays.window.PublishResultsWindow', {
272272
actionName: 'cacheHaplotypes',
273+
analysisId: this.analysisId,
273274
json: json
274275
}).show();
275276
}
@@ -460,10 +461,12 @@ Ext4.define('GenotypeAssays.panel.HaplotypePanel', {
460461
schemaName: 'sequenceanalysis',
461462
queryName: 'alignment_summary_by_lineage',
462463
columns: 'analysis_id,analysis_id/readset,analysis_id/readset/subjectId,lineages,loci,total,total_reads,percent,total_reads_from_locus,percent_from_locus',
464+
parameters: {
465+
AnalysisId: this.analysisId
466+
},
463467
apiVersion: 13.2,
464468
scope: this,
465469
filterArray: [
466-
LABKEY.Filter.create('analysis_id', this.analysisIds.join(';'), LABKEY.Filter.Types.IN),
467470
LABKEY.Filter.create('percent_from_locus', minPct || 0, LABKEY.Filter.Types.GTE)
468471
],
469472
failure: LDK.Utils.getErrorCallback(),
@@ -502,9 +505,9 @@ Ext4.define('GenotypeAssays.panel.HaplotypePanel', {
502505
sort: 'analysis_id',
503506
apiVersion: 13.2,
504507
scope: this,
505-
filterArray: [
506-
LABKEY.Filter.create('analysis_id', this.analysisIds.join(';'), LABKEY.Filter.Types.IN)
507-
],
508+
parameters: {
509+
AnalysisId: this.analysisId
510+
},
508511
failure: LDK.Utils.getErrorCallback(),
509512
success: function(results){
510513
this.lineageToAlleleMap = {};

GenotypeAssays/resources/web/genotypeassays/window/PublishResultsWindow.js

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,20 @@ Ext4.define('GenotypeAssays.window.PublishResultsWindow', {
1111
return;
1212
}
1313

14+
const analysisId = dr.getParameters()?.AnalysisId;
15+
if (!analysisId) {
16+
Ext4.Msg.alert('Error', 'Error: unable to find analysisId. This should not occur.');
17+
LDK.Assert.assertNotEmpty('Unable to find AnalysisId parameter from the DataRegion in PublishResultsWindow');
18+
19+
return;
20+
}
21+
1422
Ext4.create('GenotypeAssays.window.PublishResultsWindow', {
1523
dataRegionName: dataRegionName,
24+
analysisId: analysisId,
1625
actionName: 'cacheAnalyses'
1726
}).show();
1827
}
19-
20-
// haplotypeButtonHandler: function(dataRegionName){
21-
// var dr = LABKEY.DataRegions[dataRegionName];
22-
// LDK.Assert.assertNotEmpty('Unable to find dataregion in PublishResultsWindow', dr);
23-
//
24-
// if (!dr.getChecked().length) {
25-
// Ext4.Msg.alert('Error', 'No rows selected');
26-
// return;
27-
// }
28-
//
29-
// Ext4.create('GenotypeAssays.window.PublishResultsWindow', {
30-
// dataRegionName: dataRegionName,
31-
// actionName: 'cacheHaplotypes'
32-
// }).show();
33-
// }
3428
},
3529

3630
initComponent: function(){
@@ -122,6 +116,7 @@ Ext4.define('GenotypeAssays.window.PublishResultsWindow', {
122116
scope: this,
123117
jsonData: {
124118
alleleNames: alleleNames,
119+
analysisId: this.analysisId,
125120
json: Ext4.encode(this.json),
126121
protocolId: protocol
127122
},

GenotypeAssays/src/org/labkey/genotypeassays/GenotypeAssaysController.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public ApiResponse execute(CacheAnalysesForm form, BindException errors)
133133
}
134134

135135
String[] alleleNames = Arrays.stream(form.getAlleleNames()).map(StringEscapeUtils::unescapeHtml4).toArray(String[]::new);
136-
Pair<List<Long>, List<Long>> ret = GenotypeAssaysManager.get().cacheAnalyses(getViewContext(), protocol, alleleNames);
136+
Pair<List<Long>, List<Long>> ret = GenotypeAssaysManager.get().cacheAnalyses(getViewContext(), form.getAnalysisId(), protocol, alleleNames);
137137
resultProperties.put("runsCreated", ret.first);
138138
resultProperties.put("runsDeleted", ret.second);
139139
}
@@ -159,6 +159,7 @@ public static class CacheAnalysesForm
159159
{
160160
private String[] _alleleNames;
161161
private String _json;
162+
private int _analysisId;
162163
private int _protocolId;
163164

164165
public String[] getAlleleNames()
@@ -190,6 +191,16 @@ public void setJson(String json)
190191
{
191192
_json = json;
192193
}
194+
195+
public int getAnalysisId()
196+
{
197+
return _analysisId;
198+
}
199+
200+
public void setAnalysisId(int analysisId)
201+
{
202+
_analysisId = analysisId;
203+
}
193204
}
194205

195206
@RequiresPermission(UpdatePermission.class)

GenotypeAssays/src/org/labkey/genotypeassays/GenotypeAssaysManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ public static GenotypeAssaysManager get()
9090
return _instance;
9191
}
9292

93-
94-
public Pair<List<Long>, List<Long>> cacheAnalyses(final ViewContext ctx, final ExpProtocol protocol, String[] pks) throws IllegalArgumentException
93+
public Pair<List<Long>, List<Long>> cacheAnalyses(final ViewContext ctx, final int analysisId, final ExpProtocol protocol, String[] pks) throws IllegalArgumentException
9594
{
9695
final User u = ctx.getUser();
9796
final List<Long> runsCreated = new ArrayList<>();
@@ -126,6 +125,8 @@ public Pair<List<Long>, List<Long>> cacheAnalyses(final ViewContext ctx, final E
126125

127126
AtomicInteger records = new AtomicInteger();
128127
TableSelector tsAlignments = new TableSelector(tableAlignments, cols.values(), new SimpleFilter(FieldKey.fromString("key"), Arrays.asList(pks), CompareType.IN), null);
128+
tsAlignments.setNamedParameters(Map.of("AnalysisId", analysisId));
129+
129130
tsAlignments.forEach(new Selector.ForEachBlock<ResultSet>()
130131
{
131132
@Override
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
SELECT
2+
d.Id,
3+
d.date,
4+
d.gender,
5+
d.species,
6+
d.geographic_origin,
7+
d.birth,
8+
d.death,
9+
d.calculated_status,
10+
d.Id.parents.dam as dam,
11+
d.Id.parents.sire as sire
12+
13+
FROM study.demographics d
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<templateSchema sourceSchemaName="study" xmlns="http://labkey.org/data/xml/externalSchema" xmlns:cv="http://labkey.org/data/xml/queryCustomView">
2+
<tables>
3+
<tableName>exportedDemographics</tableName>
4+
</tables>
5+
<metadata>
6+
<tables xmlns="http://labkey.org/data/xml">
7+
<table tableName="exportedDemographics" tableDbType="NOT_IN_DB">
8+
<tableTitle>Demographics</tableTitle>
9+
</table>
10+
</tables>
11+
</metadata>
12+
</templateSchema>

mGAP/resources/queries/mGAP/subjectsSource.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ SELECT
1212
d.status as status,
1313
m.subjectname as originalId,
1414
p1.externalAlias as sire,
15-
coalesce(s.Id.parents.sire, d.sire) as originalSire,
15+
coalesce(s.sire, d.sire) as originalSire,
1616
p2.externalAlias as dam,
17-
coalesce(s.Id.parents.dam, d.dam) as originalDam,
17+
coalesce(s.dam, d.dam) as originalDam,
1818

1919
FROM mgap.animalMapping m
20-
LEFT JOIN "/Internal/PMR/".study.demographics s ON (m.subjectname = s.Id)
20+
LEFT JOIN PMR_Data.exportedDemographics s ON (m.subjectname = s.Id)
2121
LEFT JOIN mgap.demographics d ON (m.subjectname = d.subjectname)
22-
LEFT JOIN mgap.animalMapping p1 ON (p1.subjectname = coalesce(s.Id.parents.sire, d.sire))
23-
LEFT JOIN mgap.animalMapping p2 ON (p2.subjectname = coalesce(s.Id.parents.dam, d.dam))
22+
LEFT JOIN mgap.animalMapping p1 ON (p1.subjectname = coalesce(s.sire, d.sire))
23+
LEFT JOIN mgap.animalMapping p2 ON (p2.subjectname = coalesce(s.dam, d.dam))
2424
WHERE (s.Id IS NOT NULL OR d.subjectname IS NOT NULL)

0 commit comments

Comments
 (0)