diff --git a/mGAP/resources/etls/prime-seq.xml b/mGAP/resources/etls/prime-seq.xml index fac13fa81..da78c21a3 100644 --- a/mGAP/resources/etls/prime-seq.xml +++ b/mGAP/resources/etls/prime-seq.xml @@ -87,6 +87,7 @@ dbSnpId jbrowseId variantTable + gtf/DataFileUrl liftedVcfId/dataid/DataFileUrl liftedVcfId/name liftedVcfId/library_id/name diff --git a/mGAP/resources/views/geneSearch.html b/mGAP/resources/views/geneSearch.html index 389feec3a..7aaa583a2 100644 --- a/mGAP/resources/views/geneSearch.html +++ b/mGAP/resources/views/geneSearch.html @@ -136,7 +136,7 @@ } this.searchNames(loc).then(function (loc, callee) { - var url = loc.location ? loc.location.ref + ':' + loc.location.start + '..' + loc.location.end : null; + var url = loc && loc.location ? loc.location.ref + ':' + loc.location.start + '..' + loc.location.end : null; if (!loc) { alert('Coordinates not found for this location.'); diff --git a/mGAP/src/org/labkey/mgap/mGAPController.java b/mGAP/src/org/labkey/mgap/mGAPController.java index f7a503094..c1acc246e 100644 --- a/mGAP/src/org/labkey/mgap/mGAPController.java +++ b/mGAP/src/org/labkey/mgap/mGAPController.java @@ -478,47 +478,69 @@ public void setRequestIds(int[] requestIds) } } + private static Map getReleaseRow(User u, ReleaseForm form, Errors errors) + { + TableInfo ti = DbSchema.get(mGAPSchema.NAME, DbSchemaType.Module).getTable(mGAPSchema.TABLE_VARIANT_CATALOG_RELEASES); + Map row = new TableSelector(ti, new SimpleFilter(FieldKey.fromString("rowId"), form.getReleaseId()), null).getMap(); + if (row == null) + { + errors.reject(ERROR_MSG, "Unknown release: " + form.getReleaseId()); + return null; + } + + Container rowContainer = ContainerManager.getForId((String)row.get("container")); + if (rowContainer == null) + { + errors.reject(ERROR_MSG, "Unknown row container: " + form.getReleaseId()); + return null; + } + else if (!rowContainer.hasPermission(u, ReadPermission.class)) + { + throw new UnauthorizedException("Cannot read the folder: " + rowContainer.getPath()); + } + + return row; + } + + private static SequenceOutputFile getOutputFile(Map row, ReleaseForm form, Errors errors) + { + SequenceOutputFile so = SequenceOutputFile.getForId((Integer)row.get("vcfId")); + if (so == null) + { + errors.reject(ERROR_MSG, "Unknown VCF file ID: " + form.getReleaseId()); + return null; + } + else if (so.getFile() == null || !so.getFile().exists()) + { + errors.reject(ERROR_MSG, "VCF file does not exist: " + (so.getFile() == null ? form.getReleaseId() : so.getFile().getPath())); + return null; + } + + return so; + } + @RequiresPermission(ReadPermission.class) @IgnoresTermsOfUse public static class DownloadBundleAction extends ExportAction { public void export(DownloadBundleForm form, HttpServletResponse response, BindException errors) throws Exception { - TableInfo ti = DbSchema.get(mGAPSchema.NAME, DbSchemaType.Module).getTable(mGAPSchema.TABLE_VARIANT_CATALOG_RELEASES); - Map row = new TableSelector(ti, new SimpleFilter(FieldKey.fromString("rowId"), form.getReleaseId()), null).getMap(); - if (row == null) + Map row = getReleaseRow(getUser(), form, errors); + if (errors.hasErrors()) { - errors.reject(ERROR_MSG, "Unknown release: " + form.getReleaseId()); return; } - Container rowContainer = ContainerManager.getForId((String)row.get("container")); - if (rowContainer == null) + SequenceOutputFile so = getOutputFile(row, form, errors); + if (errors.hasErrors()) { - errors.reject(ERROR_MSG, "Unknown row container: " + form.getReleaseId()); return; } - else if (!rowContainer.hasPermission(getUser(), ReadPermission.class)) - { - throw new UnauthorizedException("Cannot read the folder: " + rowContainer.getPath()); - } Set toZip = new HashSet<>(); String zipName = "mGap_VariantCatalog_v" + FileUtil.makeLegalName((String)row.get("version")); zipName = zipName.replaceAll(" ", "_"); - SequenceOutputFile so = SequenceOutputFile.getForId((Integer)row.get("vcfId")); - if (so == null) - { - errors.reject(ERROR_MSG, "Unknown VCF file ID: " + form.getReleaseId()); - return; - } - else if (so.getFile() == null || !so.getFile().exists()) - { - errors.reject(ERROR_MSG, "VCF file does not exist: " + (so.getFile() == null ? form.getReleaseId() : so.getFile().getPath())); - return; - } - toZip.add(so.getFile()); toZip.add(new File(so.getFile().getPath() + ".tbi")); @@ -558,10 +580,9 @@ else if (so.getFile() == null || !so.getFile().exists()) } } - public static class DownloadBundleForm + public static class ReleaseForm { private Integer _releaseId; - private Boolean _includeGenome; public Integer getReleaseId() { @@ -572,6 +593,11 @@ public void setReleaseId(Integer releaseId) { _releaseId = releaseId; } + } + + public static class DownloadBundleForm extends ReleaseForm + { + private Boolean _includeGenome; public Boolean getIncludeGenome() { diff --git a/mGAP/src/org/labkey/mgap/pipeline/AnnotationStep.java b/mGAP/src/org/labkey/mgap/pipeline/AnnotationStep.java index 81de881c4..1b1e7cd1e 100644 --- a/mGAP/src/org/labkey/mgap/pipeline/AnnotationStep.java +++ b/mGAP/src/org/labkey/mgap/pipeline/AnnotationStep.java @@ -439,6 +439,7 @@ private File runCassandra(File liftedToGRCh37, File finalOutput, VariantProcessi } output.addIntermediateFile(liftedToGRCh37Unzipped); + output.addIntermediateFile(new File(liftedToGRCh37Unzipped.getPath() + ".idx")); output.addIntermediateFile(liftedToGRCh37UnzippedDone); cassRunner.execute(liftedToGRCh37Unzipped, finalOutput, extraArgs); diff --git a/tcrdb/resources/web/tcrdb/panel/PoolImportPanel.js b/tcrdb/resources/web/tcrdb/panel/PoolImportPanel.js index 9ca81d1ba..fc4a4dbf8 100644 --- a/tcrdb/resources/web/tcrdb/panel/PoolImportPanel.js +++ b/tcrdb/resources/web/tcrdb/panel/PoolImportPanel.js @@ -1008,7 +1008,7 @@ Ext4.define('TCRdb.panel.PoolImportPanel', { }, getStimKey: function(data){ - return [data.stimId, data.animalId, data.stim, data.treatment, data.tissue].join('|'); + return [data.stimId, data.animalId, data.stim, data.treatment, data.tissue, (Ext4.isDate(data.sampleDate) ? Ext4.Date.format(data.sampleDate, 'Y-m-d') : data.sampleDate)].join('|'); }, getSortKey: function(data){ diff --git a/tcrdb/src/org/labkey/tcrdb/TCRdbTableCustomizer.java b/tcrdb/src/org/labkey/tcrdb/TCRdbTableCustomizer.java index 9f83d0776..9c7059a83 100644 --- a/tcrdb/src/org/labkey/tcrdb/TCRdbTableCustomizer.java +++ b/tcrdb/src/org/labkey/tcrdb/TCRdbTableCustomizer.java @@ -101,6 +101,7 @@ private void customizeCdnas(AbstractTableInfo ti) private void customizeSorts(AbstractTableInfo ti) { LDKService.get().applyNaturalSort(ti, "plateId"); + LDKService.get().applyNaturalSort(ti, "hto"); String name = "numLibraries"; if (ti.getColumn(name) == null) diff --git a/tcrdb/src/org/labkey/tcrdb/pipeline/CellRangerSeuratHandler.java b/tcrdb/src/org/labkey/tcrdb/pipeline/CellRangerSeuratHandler.java index b6df86985..7d1fd5930 100644 --- a/tcrdb/src/org/labkey/tcrdb/pipeline/CellRangerSeuratHandler.java +++ b/tcrdb/src/org/labkey/tcrdb/pipeline/CellRangerSeuratHandler.java @@ -415,7 +415,7 @@ public void processFilesRemote(List inputFiles, JobContext c IOUtil.copyFile(gtfFile, gtfCopy); ctx.getFileManager().addIntermediateFile(gtfCopy); - writer.println("gtfFile <- " + gtfCopy.getName()); + writer.println("gtfFile <- '" + gtfCopy.getName() + "'"); String mergeMethod = StringUtils.trimToNull(ctx.getParams().optString("mergeMethod")); mergeMethod = mergeMethod == null ? "NULL" : "'" + mergeMethod + "'";