From e18856a038a96f4878aac957e62af33a2689dcfa Mon Sep 17 00:00:00 2001 From: bbimber Date: Mon, 14 Sep 2020 15:55:43 -0700 Subject: [PATCH 1/5] Fix R syntax --- .../src/org/labkey/tcrdb/pipeline/CellRangerSeuratHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcrdb/src/org/labkey/tcrdb/pipeline/CellRangerSeuratHandler.java b/tcrdb/src/org/labkey/tcrdb/pipeline/CellRangerSeuratHandler.java index c904e4df6..7d49bd571 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 + "'"; From 51b57c9f120b74aee4a7e6f28d6568f5b8965e83 Mon Sep 17 00:00:00 2001 From: bbimber Date: Thu, 24 Sep 2020 09:46:05 -0700 Subject: [PATCH 2/5] Track more intermediate files --- mGAP/src/org/labkey/mgap/pipeline/AnnotationStep.java | 1 + 1 file changed, 1 insertion(+) 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); From f814ca14e3b69382529bc0c893e4dc1d20922dd0 Mon Sep 17 00:00:00 2001 From: bbimber Date: Fri, 25 Sep 2020 06:51:26 -0700 Subject: [PATCH 3/5] Minor cleanup in mGAP controller --- mGAP/resources/etls/prime-seq.xml | 1 + mGAP/resources/views/geneSearch.html | 2 +- mGAP/src/org/labkey/mgap/mGAPController.java | 76 +++++++++++++------- 3 files changed, 53 insertions(+), 26 deletions(-) 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 4a03532a3..9185d89ab 100644 --- a/mGAP/src/org/labkey/mgap/mGAPController.java +++ b/mGAP/src/org/labkey/mgap/mGAPController.java @@ -477,47 +477,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")); @@ -557,10 +579,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() { @@ -571,6 +592,11 @@ public void setReleaseId(Integer releaseId) { _releaseId = releaseId; } + } + + public static class DownloadBundleForm extends ReleaseForm + { + private Boolean _includeGenome; public Boolean getIncludeGenome() { From eb5c23fe457a7f1bf51f7930673d87bf3c7b1eb1 Mon Sep 17 00:00:00 2001 From: bbimber Date: Mon, 28 Sep 2020 11:23:10 -0700 Subject: [PATCH 4/5] Bugfix cDNA import when multiple sample dates present --- tcrdb/resources/web/tcrdb/panel/PoolImportPanel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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){ From 2a0f2cb9840e3edbb0b2d1785b6c6262702cfe02 Mon Sep 17 00:00:00 2001 From: bbimber Date: Mon, 28 Sep 2020 12:01:10 -0700 Subject: [PATCH 5/5] Add natural sort to hto column --- tcrdb/src/org/labkey/tcrdb/TCRdbTableCustomizer.java | 1 + 1 file changed, 1 insertion(+) 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)