Skip to content

Commit 62d9375

Browse files
committed
Add action to manually create ExpData for file
1 parent c876525 commit 62d9375

File tree

2 files changed

+76
-2
lines changed

2 files changed

+76
-2
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisController.java

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5293,4 +5293,62 @@ public void setDoNotRequireSra(boolean doNotRequireSra)
52935293
_doNotRequireSra = doNotRequireSra;
52945294
}
52955295
}
5296+
5297+
@RequiresSiteAdmin
5298+
public static class CreateExpDataForFileAction extends ConfirmAction<CreateExpDataForFileForm>
5299+
{
5300+
@Override
5301+
public void validateCommand(CreateExpDataForFileForm form, Errors errors)
5302+
{
5303+
5304+
}
5305+
5306+
@Override
5307+
public URLHelper getSuccessURL(CreateExpDataForFileForm form)
5308+
{
5309+
return getContainer().getStartURL(getUser());
5310+
}
5311+
5312+
@Override
5313+
public ModelAndView getConfirmView(CreateExpDataForFileForm form, BindException errors) throws Exception
5314+
{
5315+
return new HtmlView(HtmlString.unsafe("This will create a new ExpData with a DataFileUrl pointing to the provided URI. This should be a full URI, such as file:///my/path/myFile.txt." +
5316+
"<br><br>" +
5317+
"<label>DataFileUrl </label><input name=\"dataFileUrl\" value = \"" + HtmlString.of(form.getDataFileUrl()) + "\"><br>"));
5318+
}
5319+
5320+
@Override
5321+
public boolean handlePost(CreateExpDataForFileForm form, BindException errors) throws Exception
5322+
{
5323+
URI newUri = URI.create(form.getDataFileUrl());
5324+
File f = new File(newUri);
5325+
if (!f.exists())
5326+
{
5327+
throw new PipelineJobException("Missing file: " + form.getDataFileUrl());
5328+
}
5329+
5330+
DataType dataType = new DataType("File");
5331+
5332+
ExpData d = ExperimentService.get().createData(getContainer(), dataType, f.getName());
5333+
d.setDataFileURI(newUri);
5334+
d.save(getUser());
5335+
5336+
return true;
5337+
}
5338+
}
5339+
5340+
public static class CreateExpDataForFileForm
5341+
{
5342+
private String _dataFileUrl;
5343+
5344+
public String getDataFileUrl()
5345+
{
5346+
return _dataFileUrl;
5347+
}
5348+
5349+
public void setDataFileUrl(String dataFileUrl)
5350+
{
5351+
_dataFileUrl = dataFileUrl;
5352+
}
5353+
}
52965354
}

singlecell/src/org/labkey/singlecell/run/CellRangerVDJWrapper.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import au.com.bytecode.opencsv.CSVReader;
44
import org.apache.commons.io.FileUtils;
55
import org.apache.commons.lang3.StringUtils;
6-
import org.apache.commons.lang3.stream.IntStreams;
76
import org.apache.logging.log4j.Logger;
87
import org.jetbrains.annotations.Nullable;
98
import org.json.JSONObject;
@@ -524,9 +523,26 @@ private File processOutputsForType(String sampleId, Readset rs, ReferenceGenome
524523
{
525524
throw new PipelineJobException("Unable to find file: " + outputVloupe.getPath());
526525
}
526+
else
527+
{
528+
if (isPrimaryDir)
529+
{
530+
try
531+
{
532+
533+
getPipelineCtx().getLogger().debug("Creating empty vloupe file as placeholder: " + outputVloupe.getPath());
534+
FileUtils.touch(outputVloupe);
535+
}
536+
catch (IOException e)
537+
{
538+
throw new PipelineJobException(e);
539+
}
540+
}
541+
}
527542
}
543+
528544
// NOTE: only tag the vloupe file for a/b:
529-
else if (isPrimaryDir)
545+
if (isPrimaryDir)
530546
{
531547
String versionString = "Version: " + getWrapper().getVersionString();
532548
output.addSequenceOutput(outputVloupe, rs.getName() + " 10x VLoupe", VLOUPE_CATEGORY, rs.getRowId(), null, referenceGenome.getGenomeId(), versionString);

0 commit comments

Comments
 (0)