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
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.labkey.api.pipeline.RecordedAction;
import org.labkey.api.sequenceanalysis.SequenceOutputFile;
import org.labkey.api.util.Pair;
import org.labkey.vfs.FileSystemLike;

import java.io.BufferedInputStream;
import java.io.File;
Expand Down Expand Up @@ -240,7 +241,7 @@ public static <T extends AbstractResumer> T create(SequenceOutputHandler.JobCont
{
for (File orig : ret.getCopiedInputs().keySet())
{
ctx.getWorkDir().inputFile(orig, ret._copiedInputs.get(orig), false);
ctx.getWorkDir().inputFile(FileSystemLike.wrapFile(orig), FileSystemLike.wrapFile(ret._copiedInputs.get(orig)), false);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.labkey.api.data.ConvertHelper;
import org.labkey.api.pipeline.PipelineJobException;
import org.labkey.api.pipeline.WorkDirectory;
import org.labkey.vfs.FileSystemLike;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -89,7 +90,7 @@ private static boolean verifyOrCreateCachedIndex(PipelineContext ctx, @Nullable
if (doCopy)
{
ctx.getLogger().info("copying index files to work location");
File localSharedDir = new File(wd.getDir(), "Shared");
File localSharedDir = new File(wd.getDir().toNioPathForRead().toFile(), "Shared");
File destination = new File(localSharedDir, localName);
ctx.getLogger().debug(destination.getPath());
File[] files = webserverIndexDir.listFiles();
Expand All @@ -98,7 +99,7 @@ private static boolean verifyOrCreateCachedIndex(PipelineContext ctx, @Nullable
return false;
}

destination = wd.inputFile(webserverIndexDir, destination, true);
destination = wd.inputFile(FileSystemLike.wrapFile(webserverIndexDir), FileSystemLike.wrapFile(destination), true).toNioPathForRead().toFile();
if (output != null && !destination.equals(webserverIndexDir))
{
ctx.getLogger().debug("adding deferred delete file: " + destination.getPath());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.labkey.api.sequenceanalysis.pipeline;

import org.json.JSONObject;
import org.labkey.vfs.FileLike;

import java.io.File;
import java.util.Map;

/**
Expand All @@ -14,5 +14,5 @@ public interface HasJobParams

JSONObject getParameterJson();

File getParametersFile();
FileLike getParametersFile();
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.labkey.api.view.ViewServlet;
import org.labkey.sequenceanalysis.pipeline.ProcessVariantsHandler;
import org.labkey.sequenceanalysis.pipeline.SequenceOutputHandlerJob;
import org.labkey.vfs.FileLike;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.web.bind.annotation.RequestMethod;

Expand Down Expand Up @@ -110,15 +111,15 @@ public void testVariantProcessing() throws Exception
SequenceOutputHandlerJob job = (SequenceOutputHandlerJob)j;

Set<File> extraFiles = new HashSet<>();
extraFiles.add(new File(job.getAnalysisDirectory(), jobName + "." + outputFileId + ".log"));
extraFiles.add(new File(job.getAnalysisDirectory(), "sequenceOutput.json"));
extraFiles.add(new File(job.getAnalysisDirectory(), "sequenceSupport.json.gz"));
extraFiles.add(ProcessVariantsHandler.getPedigreeFile(job.getAnalysisDirectory(), "laboratory.subjects"));
extraFiles.add(new File(job.getAnalysisDirectory(), basename + ".gfiltered.selectVariants.annotated.filtered.vcf.gz"));
extraFiles.add(new File(job.getAnalysisDirectory(), basename + ".gfiltered.selectVariants.annotated.filtered.vcf.gz.tbi"));
extraFiles.add(new File(job.getAnalysisDirectory(), job.getBaseName() + ".pipe.xar.xml"));

verifyFileOutputs(job.getAnalysisDirectory(), extraFiles);
extraFiles.add(job.getAnalysisDirectory().resolveChild(jobName + "." + outputFileId + ".log").toNioPathForRead().toFile());
extraFiles.add(job.getAnalysisDirectory().resolveChild("sequenceOutput.json").toNioPathForRead().toFile());
extraFiles.add(job.getAnalysisDirectory().resolveChild("sequenceSupport.json.gz").toNioPathForRead().toFile());
extraFiles.add(ProcessVariantsHandler.getPedigreeFile(job.getAnalysisDirectory(), "laboratory.subjects").toNioPathForRead().toFile());
extraFiles.add(job.getAnalysisDirectory().resolveChild(basename + ".gfiltered.selectVariants.annotated.filtered.vcf.gz").toNioPathForRead().toFile());
extraFiles.add(job.getAnalysisDirectory().resolveChild(basename + ".gfiltered.selectVariants.annotated.filtered.vcf.gz.tbi").toNioPathForRead().toFile());
extraFiles.add(job.getAnalysisDirectory().resolveChild(job.getBaseName() + ".pipe.xar.xml").toNioPathForRead().toFile());

verifyFileOutputs(job.getAnalysisDirectory().toNioPathForRead().toFile(), extraFiles);

//verify outputfile created:
TableSelector ts = new TableSelector(ti, PageFlowUtil.set("rowid"), new SimpleFilter(FieldKey.fromString("runId/jobid/job"), job.getJobGUID()), null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1876,14 +1876,14 @@ public boolean isSubmitJobToReadsetContainer()
return getJobParameters() != null && getJobParameters().optBoolean("submitJobToReadsetContainer", false);
}

public List<File> getFiles(PipeRoot pr) throws PipelineValidationException
public List<FileLike> getFiles(PipeRoot pr) throws PipelineValidationException
{
if (getJobParameters() == null || getJobParameters().get("inputFiles") == null)
{
return null;
}

List<File> ret = new ArrayList<>();
List<FileLike> ret = new ArrayList<>();
JSONArray inputFiles = getJobParameters().getJSONArray("inputFiles");
String path = getJobParameters().optString("path");
for (JSONObject o : JsonUtil.toJSONObjectList(inputFiles))
Expand All @@ -1900,7 +1900,7 @@ else if (!d.getFile().exists())
throw new PipelineValidationException("Missing file for data: " + o.get("dataId"));
}

ret.add(d.getFile());
ret.add(d.getFileLike());
}
else if (o.has("relPath") || o.has("fileName"))
{
Expand All @@ -1927,7 +1927,7 @@ else if (o.has("relPath") || o.has("fileName"))
throw new PipelineValidationException("Unknown file: " + o.getString("relPath") + " / " + o.getString("fileName"));
}

ret.add(f.toNioPathForRead().toFile());
ret.add(f);
}
else if (o.opt("filePath") != null)
{
Expand Down Expand Up @@ -2145,27 +2145,24 @@ protected void setContentType(HttpServletResponse response)
}

@Override
protected File getTargetFile(String filename) throws IOException
protected FileLike getTargetFile(String filename) throws IOException
{
if (!PipelineService.get().hasValidPipelineRoot(getContainer()))
throw new UploadException("Pipeline root must be configured before uploading FASTA files", HttpServletResponse.SC_NOT_FOUND);

PipeRoot root = PipelineService.get().getPipelineRootSetting(getContainer());

File targetDirectory = root.getRootPath();

return FileUtil.findUniqueFileName(filename, targetDirectory);
return FileUtil.findUniqueFileName(filename, root.getRootFileLike());
}

@Override
public String getResponse(ImportFastaSequencesForm form, Map<String, Pair<File, String>> files)
public String getResponse(ImportFastaSequencesForm form, Map<String, Pair<FileLike, String>> files)
{
JSONObject resp = new JSONObject();
try
{
for (Map.Entry<String, Pair<File, String>> entry : files.entrySet())
for (Map.Entry<String, Pair<FileLike, String>> entry : files.entrySet())
{
File file = entry.getValue().getKey();
File file = entry.getValue().getKey().toNioPathForRead().toFile();

Map<String, String> params = form.getNtParams();
Map<String, Object> libraryParams = form.getLibraryParams();
Expand Down Expand Up @@ -2444,15 +2441,15 @@ protected void setContentType(HttpServletResponse response)
}

@Override
protected File getTargetFile(String filename) throws IOException
protected FileLike getTargetFile(String filename) throws IOException
{
if (!PipelineService.get().hasValidPipelineRoot(getContainer()))
throw new UploadException("Pipeline root must be configured before uploading files", HttpServletResponse.SC_NOT_FOUND);

try
{
FileLike targetDirectory = AssayFileWriter.ensureUploadDirectory(getContainer(), "sequenceOutputs");
return FileUtil.findUniqueFileName(filename, targetDirectory).toNioPathForWrite().toFile();
return FileUtil.findUniqueFileName(filename, targetDirectory);
}
catch (ExperimentException e)
{
Expand All @@ -2461,14 +2458,14 @@ protected File getTargetFile(String filename) throws IOException
}

@Override
public String getResponse(ImportOutputFileForm form, Map<String, Pair<File, String>> files)
public String getResponse(ImportOutputFileForm form, Map<String, Pair<FileLike, String>> files)
{
JSONObject resp = new JSONObject();
try
{
for (Map.Entry<String, Pair<File, String>> entry : files.entrySet())
for (Map.Entry<String, Pair<FileLike, String>> entry : files.entrySet())
{
File file = entry.getValue().getKey();
FileLike file = entry.getValue().getKey();

Map<String, Object> params = new CaseInsensitiveHashMap<>();
params.put("name", form.getName());
Expand Down Expand Up @@ -2577,15 +2574,15 @@ protected void setContentType(HttpServletResponse response)
}

@Override
protected File getTargetFile(String filename) throws IOException
protected FileLike getTargetFile(String filename) throws IOException
{
if (!PipelineService.get().hasValidPipelineRoot(getContainer()))
throw new UploadException("Pipeline root must be configured before uploading files", HttpServletResponse.SC_NOT_FOUND);

try
{
FileLike targetDirectory = AssayFileWriter.ensureUploadDirectory(getContainer());
return FileUtil.findUniqueFileName(filename, targetDirectory).toNioPathForWrite().toFile();
return FileUtil.findUniqueFileName(filename, targetDirectory);
}
catch (ExperimentException e)
{
Expand All @@ -2610,7 +2607,7 @@ public void validateCommand(ImportTrackForm form, Errors errors)
}

@Override
public String getResponse(ImportTrackForm form, Map<String, Pair<File, String>> files) throws UploadException
public String getResponse(ImportTrackForm form, Map<String, Pair<FileLike, String>> files) throws UploadException
{
JSONObject resp = new JSONObject();
if (form.getTrackName() == null || form.getLibraryId() == null)
Expand All @@ -2620,9 +2617,9 @@ public String getResponse(ImportTrackForm form, Map<String, Pair<File, String>>

try
{
for (Map.Entry<String, Pair<File, String>> entry : files.entrySet())
for (Map.Entry<String, Pair<FileLike, String>> entry : files.entrySet())
{
File file = entry.getValue().getKey();
File file = entry.getValue().getKey().toNioPathForRead().toFile();

try
{
Expand Down Expand Up @@ -2742,15 +2739,15 @@ protected void setContentType(HttpServletResponse response)
}

@Override
protected File getTargetFile(String filename) throws IOException
protected FileLike getTargetFile(String filename) throws IOException
{
if (!PipelineService.get().hasValidPipelineRoot(getContainer()))
throw new UploadException("Pipeline root must be configured before uploading files", HttpServletResponse.SC_NOT_FOUND);

try
{
FileLike targetDirectory = AssayFileWriter.ensureUploadDirectory(getContainer());
return FileUtil.findUniqueFileName(filename, targetDirectory).toNioPathForWrite().toFile();
return FileUtil.findUniqueFileName(filename, targetDirectory);
}
catch (ExperimentException e)
{
Expand All @@ -2759,14 +2756,14 @@ protected File getTargetFile(String filename) throws IOException
}

@Override
public String getResponse(ImportChainFileForm form, Map<String, Pair<File, String>> files)
public String getResponse(ImportChainFileForm form, Map<String, Pair<FileLike, String>> files)
{
JSONObject resp = new JSONObject();
try
{
for (Map.Entry<String, Pair<File, String>> entry : files.entrySet())
for (Map.Entry<String, Pair<FileLike, String>> entry : files.entrySet())
{
File file = entry.getValue().getKey();
File file = entry.getValue().getKey().toNioPathForRead().toFile();

if (form.getGenomeId1() == null || form.getGenomeId2() == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ public void barcodeTest() throws Exception

private File getBaseDir(PipelineJob job)
{
return ((SequenceJob)job).getAnalysisDirectory();
return ((SequenceJob)job).getAnalysisDirectory().toNioPathForRead().toFile();
}

/**
Expand Down Expand Up @@ -1489,7 +1489,7 @@ protected void validateAlignmentJob(Set<PipelineJob> jobs, Collection<String> ad
protected void validateAlignmentJob(Set<PipelineJob> jobs, Collection<String> additionalFiles, SequenceReadsetImpl rs, Integer aligned, Integer unaligned, boolean includeRefFiles) throws Exception
{
SequenceAlignmentJob job = getAlignmentJob(jobs, rs);
File basedir = job.getAnalysisDirectory();
File basedir = job.getAnalysisDirectory().toNioPathForRead().toFile();
String outDir = SequenceTaskHelper.getUnzippedBaseName(rs.getReadDataImpl().get(0).getFile1());

Set<File> expectedOutputs = new HashSet<>();
Expand Down Expand Up @@ -2982,7 +2982,7 @@ public void testBismarkWithSavedLibraryAndAdapters() throws Exception
//job1Files.add("paired1/Alignment/TestReadset1.insertsize.metrics");
//job1Files.add("paired1/Alignment/TestReadset1.insertsize.metrics.pdf");

File basedir1 = getAlignmentJob(jobs, _readsets.get(0)).getAnalysisDirectory();
File basedir1 = getAlignmentJob(jobs, _readsets.get(0)).getAnalysisDirectory().toNioPathForRead().toFile();
addOptionalFile(job1Files, basedir1, "paired1/Alignment/CpG_OB_TestReadset1.txt.gz");
addOptionalFile(job1Files, basedir1, "paired1/Alignment/CpG_OT_TestReadset1.txt.gz");
addOptionalFile(job1Files, basedir1, "paired1/Alignment/Non_CpG_OB_TestReadset1.bam.txt.gz");
Expand All @@ -3008,7 +3008,7 @@ public void testBismarkWithSavedLibraryAndAdapters() throws Exception
//job2Files.add("paired3/Alignment/TestReadset2.summary.metrics");
//job2Files.add("paired3/Alignment/TestReadset2.insertsize.metrics");

File basedir2 = getAlignmentJob(jobs, _readsets.get(1)).getAnalysisDirectory();
File basedir2 = getAlignmentJob(jobs, _readsets.get(1)).getAnalysisDirectory().toNioPathForRead().toFile();
addOptionalFile(job2Files, basedir2, "paired3/Alignment/CpG_OB_TestReadset2.txt.gz");
addOptionalFile(job2Files, basedir2, "paired3/Alignment/CpG_OT_TestReadset2.txt.gz");
addOptionalFile(job2Files, basedir2, "paired3/Alignment/Non_CpG_OB_TestReadset2.bam.txt.gz");
Expand All @@ -3032,7 +3032,7 @@ public void testBismarkWithSavedLibraryAndAdapters() throws Exception
//job3Files.add("paired4/Alignment/TestReadset3.summary.metrics");
//job3Files.add("paired4/Alignment/TestReadset3.insertsize.metrics");

File basedir3 = getAlignmentJob(jobs, _readsets.get(2)).getAnalysisDirectory();
File basedir3 = getAlignmentJob(jobs, _readsets.get(2)).getAnalysisDirectory().toNioPathForRead().toFile();
addOptionalFile(job3Files, basedir3, "paired4/Alignment/CpG_OB_TestReadset3.txt.gz");
addOptionalFile(job3Files, basedir3, "paired4/Alignment/CpG_OT_TestReadset3.txt.gz");
addOptionalFile(job3Files, basedir3, "paired4/Alignment/Non_CpG_OB_TestReadset3.bam.txt.gz");
Expand Down Expand Up @@ -3109,7 +3109,7 @@ public void testBismarkWithSavedLibraryAdaptersAndDelete() throws Exception
job1Files.add("paired1/Alignment/TestReadset1.insertsize.metrics");
job1Files.add("paired1/Alignment/TestReadset1.insertsize.metrics.pdf");

File basedir1 = getAlignmentJob(jobs, _readsets.get(0)).getAnalysisDirectory();
File basedir1 = getAlignmentJob(jobs, _readsets.get(0)).getAnalysisDirectory().toNioPathForRead().toFile();
addOptionalFile(job1Files, basedir1, "paired1/Alignment/CpG_OB_TestReadset1.txt.gz");
addOptionalFile(job1Files, basedir1, "paired1/Alignment/CpG_OT_TestReadset1.txt.gz");
addOptionalFile(job1Files, basedir1, "paired1/Alignment/Non_CpG_OB_TestReadset1.bam.txt.gz");
Expand All @@ -3132,7 +3132,7 @@ public void testBismarkWithSavedLibraryAdaptersAndDelete() throws Exception
job2Files.add("paired3/Alignment/TestReadset2.summary.metrics");
//job2Files.add("paired3/Alignment/TestReadset2.insertsize.metrics");

File basedir2 = getAlignmentJob(jobs, _readsets.get(1)).getAnalysisDirectory();
File basedir2 = getAlignmentJob(jobs, _readsets.get(1)).getAnalysisDirectory().toNioPathForRead().toFile();
addOptionalFile(job2Files, basedir2, "paired3/Alignment/CpG_OB_TestReadset2.txt.gz");
addOptionalFile(job2Files, basedir2, "paired3/Alignment/CpG_OT_TestReadset2.txt.gz");
addOptionalFile(job2Files, basedir2, "paired3/Alignment/Non_CpG_OB_TestReadset2.bam.txt.gz");
Expand All @@ -3154,7 +3154,7 @@ public void testBismarkWithSavedLibraryAdaptersAndDelete() throws Exception
job3Files.add("paired4/Alignment/TestReadset3.summary.metrics");
//job3Files.add("paired4/Alignment/TestReadset3.insertsize.metrics");

File basedir3 = getAlignmentJob(jobs, _readsets.get(2)).getAnalysisDirectory();
File basedir3 = getAlignmentJob(jobs, _readsets.get(2)).getAnalysisDirectory().toNioPathForRead().toFile();
addOptionalFile(job3Files, basedir3, "paired4/Alignment/CpG_OB_TestReadset3.txt.gz");
addOptionalFile(job3Files, basedir3, "paired4/Alignment/CpG_OT_TestReadset3.txt.gz");
addOptionalFile(job3Files, basedir3, "paired4/Alignment/Non_CpG_OB_TestReadset3.bam.txt.gz");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ public List<File> getSequenceJobInputFiles(PipelineJob job)
return null;
}

return ((SequenceJob) job).getInputFiles();
return ((SequenceJob) job).getInputFiles().stream().map(f -> f.toNioPathForRead().toFile()).toList();
}

@Override
Expand Down
Loading