Skip to content

Commit 45b657d

Browse files
authored
Merge pull request #174 from LabKey/fb_merge_23.3_to_develop
Merge discvr-23.3 to develop
2 parents 42c3bbb + 96b25fb commit 45b657d

File tree

10 files changed

+243
-5
lines changed

10 files changed

+243
-5
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<customView xmlns="http://labkey.org/data/xml/queryCustomView" canOverride="true">
2+
<columns>
3+
<column name="category"/>
4+
<column name="label"/>
5+
<column name="description"/>
6+
<column name="datasource"/>
7+
</columns>
8+
<sorts>
9+
<sort column="category" descending="false"/>
10+
<sort column="label" descending="false"/>
11+
</sorts>
12+
</customView>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
CREATE TABLE mGAP.annotations (
2+
rowid serial,
3+
category varchar(1000),
4+
label varchar(500),
5+
datasource varchar(500),
6+
datatype varchar(500),
7+
datanumber varchar(500),
8+
infoKey varchar(100),
9+
url varchar(4000),
10+
dataurl varchar(4000),
11+
description varchar(4000),
12+
13+
container entityid,
14+
created timestamp,
15+
createdby userid,
16+
modified timestamp,
17+
modifiedby userid,
18+
19+
CONSTRAINT PK_annotations PRIMARY KEY (rowid)
20+
);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
CREATE TABLE mGAP.annotations (
2+
rowid int identity(1,1),
3+
category varchar(1000),
4+
label varchar(500),
5+
datasource varchar(500),
6+
datatype varchar(500),
7+
datanumber varchar(500),
8+
infoKey varchar(100),
9+
url varchar(4000),
10+
dataurl varchar(4000),
11+
description varchar(4000),
12+
13+
container entityid,
14+
created datetime,
15+
createdby userid,
16+
modified datetime,
17+
modifiedby userid,
18+
19+
CONSTRAINT PK_annotations PRIMARY KEY (rowid)
20+
);

mGAP/resources/schemas/mgap.xml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,4 +1140,80 @@
11401140
</column>
11411141
</columns>
11421142
</table>
1143+
<table tableName="annotations" tableDbType="TABLE" useColumnOrder="true">
1144+
<javaCustomizer class="org.labkey.ldk.query.DefaultTableCustomizer" />
1145+
<pkColumnName>rowid</pkColumnName>
1146+
<tableTitle>Variant Annotations</tableTitle>
1147+
<auditLogging>DETAILED</auditLogging>
1148+
<columns>
1149+
<column columnName="rowid">
1150+
<isAutoInc>true</isAutoInc>
1151+
<shownInInsertView>false</shownInInsertView>
1152+
<shownInUpdateView>false</shownInUpdateView>
1153+
<isUserEditable>false</isUserEditable>
1154+
<columnTitle>Row Id</columnTitle>
1155+
</column>
1156+
<column columnName="category">
1157+
<columnTitle>Category</columnTitle>
1158+
<nullable>true</nullable>
1159+
</column>
1160+
<column columnName="label">
1161+
<columnTitle>Annotation Name</columnTitle>
1162+
<nullable>true</nullable>
1163+
</column>
1164+
<column columnName="dataSource">
1165+
<columnTitle>Data Source</columnTitle>
1166+
<nullable>true</nullable>
1167+
<url>${url}</url>
1168+
</column>
1169+
<column columnName="infoKey">
1170+
<columnTitle>INFO Key</columnTitle>
1171+
<nullable>true</nullable>
1172+
<isHidden>true</isHidden>
1173+
</column>
1174+
<column columnName="dataType">
1175+
<columnTitle>Data Type</columnTitle>
1176+
<isHidden>true</isHidden>
1177+
</column>
1178+
<column columnName="dataNumber">
1179+
<columnTitle>Data Number</columnTitle>
1180+
<isHidden>true</isHidden>
1181+
</column>
1182+
<column columnName="url">
1183+
<columnTitle>Website URL</columnTitle>
1184+
<isHidden>true</isHidden>
1185+
</column>
1186+
<column columnName="dataurl">
1187+
<columnTitle>Data URL</columnTitle>
1188+
<isHidden>true</isHidden>
1189+
</column>
1190+
<column columnName="description">
1191+
<columnTitle>Description</columnTitle>
1192+
<inputType>textarea</inputType>
1193+
</column>
1194+
<column columnName="container">
1195+
<isHidden>true</isHidden>
1196+
</column>
1197+
<column columnName="createdby">
1198+
<isHidden>true</isHidden>
1199+
</column>
1200+
<column columnName="created">
1201+
<isUserEditable>false</isUserEditable>
1202+
<shownInInsertView>false</shownInInsertView>
1203+
<shownInUpdateView>false</shownInUpdateView>
1204+
<nullable>true</nullable>
1205+
<isHidden>true</isHidden>
1206+
</column>
1207+
<column columnName="modifiedby">
1208+
<isHidden>true</isHidden>
1209+
</column>
1210+
<column columnName="modified">
1211+
<isUserEditable>false</isUserEditable>
1212+
<shownInInsertView>false</shownInInsertView>
1213+
<shownInUpdateView>false</shownInUpdateView>
1214+
<nullable>true</nullable>
1215+
<isHidden>true</isHidden>
1216+
</column>
1217+
</columns>
1218+
</table>
11431219
</tables>

mGAP/resources/views/admin.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@
2222
xtype: 'ldk-linkbutton',
2323
text: 'Manage JBrowse Tracks',
2424
href: LABKEY.ActionURL.buildURL('query', 'executeQuery', null, {schemaName: 'mgap', queryName: 'releaseTracks'})
25+
},{
26+
xtype: 'ldk-linkbutton',
27+
text: 'Manage Annotations',
28+
href: LABKEY.ActionURL.buildURL('query', 'executeQuery', null, {schemaName: 'mgap', queryName: 'annotations'})
29+
},{
30+
xtype: 'ldk-linkbutton',
31+
text: 'Manage Genetic Measurements',
32+
href: LABKEY.ActionURL.buildURL('query', 'executeQuery', null, {schemaName: 'mgap', queryName: 'geneticMeasurements'})
2533
}]
2634
});
2735

mGAP/src/org/labkey/mgap/mGAPController.java

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package org.labkey.mgap;
1818

19+
import au.com.bytecode.opencsv.CSVReader;
1920
import htsjdk.samtools.util.CloseableIterator;
2021
import htsjdk.variant.variantcontext.VariantContext;
2122
import htsjdk.variant.vcf.VCFFileReader;
@@ -51,9 +52,11 @@
5152
import org.labkey.api.query.BatchValidationException;
5253
import org.labkey.api.query.DetailsURL;
5354
import org.labkey.api.query.FieldKey;
55+
import org.labkey.api.query.QueryAction;
5456
import org.labkey.api.query.QueryService;
5557
import org.labkey.api.query.QueryUpdateService;
5658
import org.labkey.api.query.UserSchema;
59+
import org.labkey.api.reader.Readers;
5760
import org.labkey.api.security.AuthenticationManager;
5861
import org.labkey.api.security.Group;
5962
import org.labkey.api.security.GroupManager;
@@ -99,6 +102,7 @@
99102
import java.io.File;
100103
import java.io.FileInputStream;
101104
import java.io.InputStream;
105+
import java.net.URL;
102106
import java.util.ArrayList;
103107
import java.util.Arrays;
104108
import java.util.Collection;
@@ -1045,4 +1049,78 @@ public Collection<String> getTracks(Container target, String jbrowseSession, Str
10451049
return ret;
10461050
}
10471051
}
1052+
1053+
@RequiresPermission(AdminPermission.class)
1054+
public static class UpdateAnnotationsAction extends ConfirmAction<Object>
1055+
{
1056+
@Override
1057+
public ModelAndView getConfirmView(Object o, BindException errors) throws Exception
1058+
{
1059+
setTitle("Update Annotation Table");
1060+
1061+
HtmlView view = new HtmlView("This will update the annotation table using the VariantAnnotation github repo. Do you want to continue?");
1062+
return view;
1063+
}
1064+
1065+
@Override
1066+
public boolean handlePost(Object o, BindException errors) throws Exception
1067+
{
1068+
List<Map<String, Object>> toAdd = new ArrayList<>();
1069+
1070+
final URL url = new URL("https://raw.githubusercontent.com/bimberlabinternal/VariantAnnotation/master/fieldConfig.txt");
1071+
try (CSVReader reader = new CSVReader(Readers.getReader(url.openStream()), '\t'))
1072+
{
1073+
String[] line;
1074+
List<String> header = null;
1075+
int idx = 0;
1076+
while ((line = reader.readNext()) != null)
1077+
{
1078+
idx++;
1079+
if (idx == 1)
1080+
{
1081+
header = Arrays.asList(line);
1082+
continue;
1083+
}
1084+
1085+
Map<String, Object> row = new CaseInsensitiveHashMap<>();
1086+
1087+
row.put("category", line[header.indexOf("Category")]);
1088+
row.put("label", line[header.indexOf("Label")]);
1089+
row.put("dataSource", line[header.indexOf("DataSource")]);
1090+
row.put("infoKey", line[header.indexOf("ID")]);
1091+
row.put("dataType", line[header.indexOf("Type")]);
1092+
row.put("dataNumber", line[header.indexOf("Number")]);
1093+
row.put("description", line[header.indexOf("Description")]);
1094+
row.put("url", line[header.indexOf("URL")]);
1095+
1096+
toAdd.add(row);
1097+
}
1098+
}
1099+
1100+
UserSchema us = QueryService.get().getUserSchema(getUser(), getContainer(), mGAPSchema.NAME);
1101+
TableInfo ti = us.getTable(mGAPSchema.TABLE_VARIANT_ANNOTATIONS);
1102+
ti.getUpdateService().truncateRows(getUser(), getContainer(), null, null);
1103+
1104+
BatchValidationException bve = new BatchValidationException();
1105+
ti.getUpdateService().insertRows(getUser(), getContainer(), toAdd, bve, null, null);
1106+
if (bve.hasErrors())
1107+
{
1108+
throw bve;
1109+
}
1110+
1111+
return true;
1112+
}
1113+
1114+
@Override
1115+
public void validateCommand(Object o, Errors errors)
1116+
{
1117+
1118+
}
1119+
1120+
@Override
1121+
public @NotNull URLHelper getSuccessURL(Object o)
1122+
{
1123+
return QueryService.get().urlFor(getUser(), getContainer(), QueryAction.executeQuery, mGAPSchema.NAME, mGAPSchema.TABLE_VARIANT_ANNOTATIONS);
1124+
}
1125+
}
10481126
}

mGAP/src/org/labkey/mgap/mGAPModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public String getName()
6666
@Override
6767
public Double getSchemaVersion()
6868
{
69-
return 16.64;
69+
return 16.65;
7070
}
7171

7272
@Override

mGAP/src/org/labkey/mgap/mGAPSchema.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public class mGAPSchema
2727
public static final String TABLE_ANIMAL_MAPPING = "animalMapping";
2828
public static final String TABLE_USER_REQUESTS = "userRequests";
2929
public static final String TABLE_VARIANT_CATALOG_RELEASES = "variantCatalogReleases";
30+
public static final String TABLE_VARIANT_ANNOTATIONS = "annotations";
3031
public static final String TABLE_RELEASE_STATS = "releaseStats";
3132
public static final String TABLE_VARIANT_TABLE = "variantList";
3233
public static final String TABLE_RELEASE_TRACKS = "releaseTracks";

mGAP/src/org/labkey/mgap/pipeline/AnnotationStep.java

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,11 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno
157157
}
158158

159159
boolean useFuncotator = getProvider().getParameterByName("useFuncotator").extractValue(getPipelineCtx().getJob(), getProvider(), getStepIdx(), Boolean.class, false);
160-
File funcotatorSourceDir = new File(PipelineJobService.get().getAppProperties().getToolsDirectory(), "funcotatorDataSource");
161-
if (useFuncotator && !funcotatorSourceDir.exists())
160+
File funcotatorSourceDir = null;
161+
if (useFuncotator)
162162
{
163-
throw new PipelineJobException("Unable to find file: " + funcotatorSourceDir.getPath());
163+
// this will throw if not found
164+
funcotatorSourceDir = getFuncotatorSource();
164165
}
165166

166167
getPipelineCtx().getLogger().info("processing file: " + inputVCF.getName());
@@ -596,4 +597,26 @@ public static void findChainFile(int sourceGenome, int targetGenome, SequenceAna
596597
support.cacheExpData(data);
597598
support.cacheObject(CHAIN_FILE, chainId);
598599
}
600+
601+
private File getFuncotatorSource()
602+
{
603+
File ret;
604+
605+
String path = PipelineJobService.get().getConfigProperties().getSoftwarePackagePath("FUNCOTATOR_DATA_SOURCE");
606+
if (path != null)
607+
{
608+
ret = new File(path);
609+
}
610+
else
611+
{
612+
ret = new File(PipelineJobService.get().getAppProperties().getToolsDirectory(), "VariantAnnotation");
613+
}
614+
615+
if (!ret.exists())
616+
{
617+
throw new IllegalArgumentException("Unable to find funcotator source: " + ret.getPath());
618+
}
619+
620+
return ret;
621+
}
599622
}

mcc/test/src/org/labkey/test/tests/mcc/MccTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ private void doRequestFormTestWithFailure() throws Exception
829829
assertElementNotPresent(getButton("Submit"));
830830
assertElementNotPresent(getButton("Approve Request"));
831831

832-
stopImpersonating();
832+
stopImpersonating(false);
833833
}
834834

835835
private FormElement getFormElementByName(String name)

0 commit comments

Comments
 (0)