Skip to content

Commit db9998b

Browse files
committed
Fix merge conflicts
2 parents e15f7af + 79c3f50 commit db9998b

22 files changed

+1308
-1046
lines changed

elispot_assay/test/src/org/labkey/test/tests/external/labModules/ELISPOT_AssayTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ private void createPlateTemplate()
177177
String originalID = TEMPLATE_DATA[1][1];
178178
TEMPLATE_DATA[1][1] = "";
179179

180+
// Debug client date parsing
181+
String clientFormattedString = (String)executeScript("return Ext4.Date.format(LDK.ConvertUtils.parseDate('2012-02-09'), 'Y-m-d');");
182+
assertEquals("Incorrect date parsing", clientFormattedString, "2012-02-09");
183+
180184
_helper.addRecordsToAssayTemplate(TEMPLATE_DATA, expectedCols);
181185

182186
waitForElement(_helper.getAssayWell("A1", LabModuleHelper.UNKNOWN_COLOR), WAIT_FOR_PAGE);

mGAP/resources/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<clientDependencies>
2626
<dependency path="mGAP/mgap.css"/>
2727
<dependency path="internal/jQuery"/>
28-
<dependency path="https://cdn.plot.ly/plotly-latest.min.js"/>
28+
<dependency path="https://cdn.plot.ly/plotly-3.0.1.min.js"/>
2929
<dependency path="mGAP/Utils.js"/>
3030
</clientDependencies>
3131
</module>

mGAP/resources/views/admin.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
xtype: 'ldk-linkbutton',
1919
text: 'Manage Genomes',
2020
href: LABKEY.ActionURL.buildURL('query', 'executeQuery', null, {schemaName: 'sequenceanalysis', queryName: 'reference_libraries'})
21+
},{
22+
xtype: 'ldk-linkbutton',
23+
text: 'Manage Sequence Outputs',
24+
href: LABKEY.ActionURL.buildURL('query', 'executeQuery', null, {schemaName: 'sequenceanalysis', queryName: 'outputfiles'})
2125
},{
2226
xtype: 'ldk-linkbutton',
2327
text: 'Manage JBrowse Tracks',

mGAP/resources/views/annotation.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
})(jQuery);
1919
</script>
2020

21-
<div style="float: none;">
21+
<div style="float: none;margin-bottom: 20px;">
2222
<div style="float: left; border: 10px; padding-right: 20px;width:40%; text-align: justify" >
2323
Assigning significance to genetics variants is often a challenge, and this is particularly problematic for model organisms like macaques,
2424
which have few sources of genomic annotations, relative to human or mouse.
@@ -34,7 +34,6 @@
3434
<li><a href="http://database.liulab.science/dbNSFP#intro">dbNSFP: Functional Predictions and Annotations for Human Non-synonymous and Splice Site SNVs</a></li>
3535
<li><a href="https://pcingola.github.io/SnpEff/se_introduction/">SnpEff: variant annotation and effect prediction tool</a></li>
3636
<li><a href="https://github.com/bimberlabinternal/VariantAnnotation/tree/master">VariantAnnotation: a custom Funcotator-compatible set of annotation sources</a></li>
37-
3837
</ul>
3938
</div>
4039
<div>

mGAP/resources/views/overview.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ <h4><span style="text-decoration: underline;">Structural Variant Catalog:</span>
4646
We have released a draft dataset with structural variants generated from PacBio sequencing of 44 Rhesus macaques. These data complement the short variant catalog by detecting categories of variants not readily accomplished with short read Illumina data.
4747
<br>
4848
<ul style="padding-top: 10px;">
49-
<li>Use the <a class="mgap-link" href="<%=contextPath%><%=containerPath%>/mGap-genomeBrowser.view?activeTracks=mGAP Structural Variants 1.0&location=11:6,936,982..7,002,783">Genome Browser</a> to view and search structural variant data</li>
49+
<li>Use the <a class="mgap-link" href="<%=contextPath%><%=containerPath%>/mGap-genomeBrowser.view?nhpSpecies=Rhesus macaque&activeTracks=mGAP Structural Variants 1.0&location=11:6,936,982..7,002,783">Genome Browser</a> to view and search structural variant data</li>
5050
</ul>
5151

5252
<h4><span style="text-decoration: underline;">NHP Models of Human Disease:</span> <img style="vertical-align: sub" width="40px" src="<%=contextPath%>/mgap/images/phenotypes.png" alt="Phenotypes"></h4>

mGAP/resources/views/overview.view.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<dependencies>
66
<dependency path="ldk.context"/>
77
<dependency path="internal/jQuery"/>
8-
<dependency path="https://cdn.plot.ly/plotly-latest.min.js"/>
8+
<dependency path="https://cdn.plot.ly/plotly-3.0.1.min.js"/>
99
<dependency path="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"/>
1010
<dependency path="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css"/>
1111
<dependency path="https://kit.fontawesome.com/d2fb21907d.js"/>

mGAP/resources/views/quickLinks.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
'<li><a href="' + LABKEY.ActionURL.buildURL('mgap', 'variantList', null) + '">Predicted Damaging Variants</a></li>' +
1919
(jbrowseId ? '<li><a href="' + LABKEY.ActionURL.buildURL('jbrowse', 'browser', null, {database: jbrowseId}) + '">Genome Browser (Macaque)</a></li>' : '') +
2020
(humanJbrowseId ? '<li><a href="' + LABKEY.ActionURL.buildURL('jbrowse', 'browser', null, {database: humanJbrowseId}) + '">Genome Browser (Human)</a></li>' : '') +
21-
(releaseHasLuceneIndex ? '<li><a href="' + LABKEY.ActionURL.buildURL('mgap', 'genomeBrowser', null, {target: 'variantSearch'}) + '">Full-text Variant Search (BETA)</a></li>' : '') +
21+
(releaseHasLuceneIndex ? '<li><a href="' + LABKEY.ActionURL.buildURL('mgap', 'genomeBrowser', null, {target: 'variantSearch'}) + '">Full-text Variant Search</a></li>' : '') +
2222
'</ul>'
2323
);
2424
}

mGAP/resources/views/releaseNotes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<h4>Release 3.0:</h4>
22
<ul>
33
<li>This release involves a major change in the processing of variants. All prior releases omitted variants in complex or repetitive regions. We originally excluded these because genotypes can be less accurate; however, we made this change because some repetitive regions overlap coding regions and can contain valuable information. This also results in a significant increase in the total number of variants.</a></li>
4-
<li>This is the first release to include a second species. The dataset now contains both Rhesus macaques and Japanese macaques (which are separated into a separate track).</li>
4+
<li>This is the first release to include a second species. The dataset now contains both Rhesus macaques and Japanese macaques (which are separated into a separate VCF / browser track).</li>
55
</ul>
66

77
<h4>Release 2.5:</h4>

mGAP/src/org/labkey/mgap/columnTransforms/AbstractVariantTransform.java

Lines changed: 116 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package org.labkey.mgap.columnTransforms;
22

33
import org.apache.commons.lang3.StringUtils;
4+
import org.jetbrains.annotations.Nullable;
5+
import org.junit.Assert;
6+
import org.junit.Test;
47
import org.labkey.api.collections.CaseInsensitiveHashMap;
58
import org.labkey.api.data.Results;
69
import org.labkey.api.data.Selector;
@@ -24,7 +27,10 @@
2427
import org.labkey.mgap.mGAPManager;
2528

2629
import java.io.File;
30+
import java.io.IOException;
2731
import java.net.URI;
32+
import java.nio.file.Files;
33+
import java.nio.file.Path;
2834
import java.sql.SQLException;
2935
import java.util.Date;
3036
import java.util.HashMap;
@@ -112,51 +118,60 @@ protected Integer getOrCreateOutputFile(Object dataFileUrl, Object folderName, S
112118
File f = new File(uri);
113119
if (!f.exists())
114120
{
115-
getStatusLogger().error("File not found: " + uri);
116-
return null;
117-
}
118-
else
119-
{
120-
File subDir = getLocalSubdir(folderName);
121-
File localCopy = doFileCopy(f, subDir, name);
122-
123-
//first create the ExpData
124-
ExpData d = ExperimentService.get().getExpDataByURL(localCopy, getContainerUser().getContainer());
125-
if (d == null)
126-
{
127-
d = ExperimentService.get().createData(getContainerUser().getContainer(), new DataType("Variant Catalog"));
128-
d.setDataFileURI(localCopy.toURI());
129-
d.setName(localCopy.getName());
130-
d.save(getContainerUser().getUser());
131-
}
132-
133-
//then the outputfile
134-
TableSelector ts = new TableSelector(getOutputFilesTableInfo(), PageFlowUtil.set("rowid"), new SimpleFilter(FieldKey.fromString("dataId"), d.getRowId()), null);
135-
if (ts.exists())
121+
if (!EtlQueueManager.get().isFileInQueue(getContainerUser().getContainer(), f))
136122
{
137-
getStatusLogger().info("existing record found for outputfile: " + d.getDataFileUrl());
138-
return ts.getObject(Integer.class);
123+
getStatusLogger().error("File not found: " + uri);
124+
return null;
139125
}
140126
else
141127
{
142-
Map<String, Object> row = new CaseInsensitiveHashMap<>();
143-
row.put("category", getOutputFileCategory());
144-
row.put("dataid", d.getRowId());
145-
row.put("name", name == null ? "mGAP Variants, Version: " + getInputValue("version") : name);
146-
row.put("description", getDescription());
147-
row.put("library_id", getLibraryId());
148-
row.put("container", getContainerUser().getContainer().getId());
149-
row.put("created", new Date());
150-
row.put("createdby", getContainerUser().getUser().getUserId());
151-
row.put("modified", new Date());
152-
row.put("modifiedby", getContainerUser().getUser().getUserId());
153-
154-
List<Map<String, Object>> rows = getOutputFilesTableInfo().getUpdateService().insertRows(getContainerUser().getUser(), getContainerUser().getContainer(), List.of(row), new BatchValidationException(), null, new HashMap<>());
155-
getStatusLogger().info("created outputfile: " + rows.get(0).get("rowid"));
156-
157-
return (Integer)rows.get(0).get("rowid");
128+
getStatusLogger().debug("File is in ETL queue: " + f.getPath());
158129
}
159130
}
131+
132+
File subDir = getLocalSubdir(folderName);
133+
File localCopy = doFileCopy(f, subDir, name);
134+
if (localCopy == null)
135+
{
136+
// TODO
137+
}
138+
139+
//first create the ExpData
140+
ExpData d = ExperimentService.get().getExpDataByURL(localCopy, getContainerUser().getContainer());
141+
if (d == null)
142+
{
143+
d = ExperimentService.get().createData(getContainerUser().getContainer(), new DataType("Variant Catalog"));
144+
d.setDataFileURI(localCopy.toURI());
145+
d.setName(localCopy.getName());
146+
d.save(getContainerUser().getUser());
147+
}
148+
149+
//then the outputfile
150+
TableSelector ts = new TableSelector(getOutputFilesTableInfo(), PageFlowUtil.set("rowid"), new SimpleFilter(FieldKey.fromString("dataId"), d.getRowId()), null);
151+
if (ts.exists())
152+
{
153+
getStatusLogger().info("existing record found for outputfile: " + d.getDataFileUrl());
154+
return ts.getObject(Integer.class);
155+
}
156+
else
157+
{
158+
Map<String, Object> row = new CaseInsensitiveHashMap<>();
159+
row.put("category", getOutputFileCategory());
160+
row.put("dataid", d.getRowId());
161+
row.put("name", name == null ? "mGAP Variants, Version: " + getInputValue("version") : name);
162+
row.put("description", getDescription());
163+
row.put("library_id", getLibraryId());
164+
row.put("container", getContainerUser().getContainer().getId());
165+
row.put("created", new Date());
166+
row.put("createdby", getContainerUser().getUser().getUserId());
167+
row.put("modified", new Date());
168+
row.put("modifiedby", getContainerUser().getUser().getUserId());
169+
170+
List<Map<String, Object>> rows = getOutputFilesTableInfo().getUpdateService().insertRows(getContainerUser().getUser(), getContainerUser().getContainer(), List.of(row), new BatchValidationException(), null, new HashMap<>());
171+
getStatusLogger().info("created outputfile: " + rows.get(0).get("rowid"));
172+
173+
return (Integer)rows.get(0).get("rowid");
174+
}
160175
}
161176
catch (Exception e)
162177
{
@@ -190,12 +205,22 @@ protected File getLocalSubdir(Object folderName) throws PipelineJobException
190205
return subdir;
191206
}
192207

193-
protected File doFileCopy(File f, File subdir, String name) throws PipelineJobException
208+
protected File doFileCopy(File f, File subdir, @Nullable String name) throws PipelineJobException
194209
{
195-
getStatusLogger().info("preparing to copy file: " + f.getPath());
210+
getStatusLogger().info("preparing to copy file: " + f.getPath() + ", with name: " + name);
211+
if (f.getName().equals("write.lock"))
212+
{
213+
return LuceneIndexTransform.doLuceneCopy(f, subdir, name, getStatusLogger(), getContainerUser().getContainer());
214+
}
196215

197216
//Copy file locally, plus index if exists:
198217
File localCopy = new File(subdir, name == null || f.getName().startsWith("mGap.v") ? f.getName() : FileUtil.makeLegalName(name).replaceAll(" ", "_") + ".vcf.gz");
218+
if (f.equals(localCopy))
219+
{
220+
getStatusLogger().debug("Attempting to copy file that is already a child of the target: " + f.getPath(), new Exception());
221+
return localCopy;
222+
}
223+
199224
boolean doCopy = true;
200225
if (localCopy.exists())
201226
{
@@ -206,15 +231,47 @@ protected File doFileCopy(File f, File subdir, String name) throws PipelineJobEx
206231
}
207232
else
208233
{
209-
getStatusLogger().info("source file has been modified, deleting copy and re-syncing");
210-
localCopy.delete();
234+
getStatusLogger().info("source file has been modified, deleting copy and re-syncing: " + localCopy.getPath());
235+
try
236+
{
237+
Files.delete(localCopy.toPath());
238+
if (localCopy.exists())
239+
{
240+
throw new PipelineJobException("Unable to delete file: " + localCopy.getPath());
241+
}
242+
}
243+
catch (IOException e)
244+
{
245+
throw new PipelineJobException("Unable to delete file: " + localCopy.getPath(), e);
246+
}
211247
}
212248
}
249+
else
250+
{
251+
getStatusLogger().info("existing file not found: " + localCopy.getPath());
252+
}
213253

214254
if (doCopy)
215255
{
216-
getStatusLogger().info("queueing file copy: " + localCopy.getPath());
217-
EtlQueueManager.get().queueFileCopy(getContainerUser().getContainer(), f, localCopy);
256+
getStatusLogger().info("Creating symlink: " + f.getPath() + " / " + localCopy.getPath());
257+
try
258+
{
259+
if (!Files.isReadable(f.toPath()))
260+
{
261+
throw new PipelineJobException("Unable to read file: " + f.getPath());
262+
}
263+
264+
if (localCopy.exists())
265+
{
266+
throw new PipelineJobException("File should have been deleted: " + localCopy.getPath());
267+
}
268+
269+
Files.createSymbolicLink(localCopy.toPath(), f.toPath());
270+
}
271+
catch (IOException e)
272+
{
273+
throw new PipelineJobException("Failed to create symlink: " + localCopy.getPath(), e);
274+
}
218275
}
219276

220277
File index = new File(f.getPath() + ".tbi");
@@ -223,14 +280,25 @@ protected File doFileCopy(File f, File subdir, String name) throws PipelineJobEx
223280
File indexLocal = new File(localCopy.getPath() + ".tbi");
224281
if (doCopy && indexLocal.exists())
225282
{
226-
getStatusLogger().info("deleting local copy of index since file was re-copied");
283+
getStatusLogger().info("deleting local copy of index since file will be re-copied: " + indexLocal.getPath());
227284
indexLocal.delete();
228285
}
229286

230287
if (!indexLocal.exists())
231288
{
232-
getStatusLogger().info("queueing copy of index: " + indexLocal.getPath());
233-
EtlQueueManager.get().queueFileCopy(getContainerUser().getContainer(), index, indexLocal);
289+
getStatusLogger().info("Creating symlink copy of VCF index: " + index.getPath() + " / " + indexLocal.getPath());
290+
try
291+
{
292+
Files.createSymbolicLink(indexLocal.toPath(), index.toPath());
293+
}
294+
catch (IOException e)
295+
{
296+
getStatusLogger().error("Failed to create symlink: " + indexLocal.getPath(), e);
297+
}
298+
}
299+
else
300+
{
301+
getStatusLogger().info("Local index already exists: " + indexLocal.getPath());
234302
}
235303
}
236304

0 commit comments

Comments
 (0)