Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mGAP/resources/etls/prime-seq.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
<column>dbSnpId</column>
<column>jbrowseId</column>
<column>variantTable</column>
<column>gtf/DataFileUrl</column>
<column>liftedVcfId/dataid/DataFileUrl</column>
<column>liftedVcfId/name</column>
<column>liftedVcfId/library_id/name</column>
Expand Down
2 changes: 1 addition & 1 deletion mGAP/resources/views/geneSearch.html
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand Down
76 changes: 51 additions & 25 deletions mGAP/src/org/labkey/mgap/mGAPController.java
Original file line number Diff line number Diff line change
Expand Up @@ -478,47 +478,69 @@ public void setRequestIds(int[] requestIds)
}
}

private static Map<String, Object> getReleaseRow(User u, ReleaseForm form, Errors errors)
{
TableInfo ti = DbSchema.get(mGAPSchema.NAME, DbSchemaType.Module).getTable(mGAPSchema.TABLE_VARIANT_CATALOG_RELEASES);
Map<String, Object> 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<String, Object> 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<DownloadBundleForm>
{
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<String, Object> row = new TableSelector(ti, new SimpleFilter(FieldKey.fromString("rowId"), form.getReleaseId()), null).getMap();
if (row == null)
Map<String, Object> 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<File> 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"));

Expand Down Expand Up @@ -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()
{
Expand All @@ -572,6 +593,11 @@ public void setReleaseId(Integer releaseId)
{
_releaseId = releaseId;
}
}

public static class DownloadBundleForm extends ReleaseForm
{
private Boolean _includeGenome;

public Boolean getIncludeGenome()
{
Expand Down
1 change: 1 addition & 0 deletions mGAP/src/org/labkey/mgap/pipeline/AnnotationStep.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tcrdb/resources/web/tcrdb/panel/PoolImportPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
1 change: 1 addition & 0 deletions tcrdb/src/org/labkey/tcrdb/TCRdbTableCustomizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ public void processFilesRemote(List<SequenceOutputFile> 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 + "'";
Expand Down