use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair in project irida by phac-nml.
the class DatabaseSetupGalaxyITService method setupSinglePairSubmissionInDatabaseDifferentSample.
/**
* Sets up an {@link AnalysisSubmission} with a list of paired sequence
* files and a single sequence file under a different sample and saves all
* dependencies in database.
*
* @param sampleIdPaired
* The id of the sample to associate with the paired sequence
* files.
* @param sampleIdSingle
* The id of the sample to associate with the single sequence
* file.
* @param sequenceFilePaths1
* A list of paths for the first part of the pair.
* @param sequenceFilePaths2
* A list of paths for the second part of the pair. The path to
* an input sequence file for this test.
* @param singleSequenceFile
* A single sequence file to add.
* @param referenceFilePath
* The path to an input reference file for this test.
* @param iridaWorkflowId
* The id of an irida workflow.
* @return An {@link AnalysisSubmission} which has been saved to the
* database.
*/
public AnalysisSubmission setupSinglePairSubmissionInDatabaseDifferentSample(long sampleIdPaired, long sampleIdSingle, List<Path> sequenceFilePaths1, List<Path> sequenceFilePaths2, Path singleSequenceFile, Path referenceFilePath, UUID iridaWorkflowId) {
SingleEndSequenceFile singleEndFile = (SingleEndSequenceFile) setupSequencingObjectInDatabase(sampleIdSingle, singleSequenceFile).get(0);
List<SequenceFilePair> sequenceFilePairs = setupSampleSequenceFileInDatabase(sampleIdPaired, sequenceFilePaths1, sequenceFilePaths2);
Set<SequencingObject> inputs = Sets.newHashSet(sequenceFilePairs);
inputs.add(singleEndFile);
ReferenceFile referenceFile = referenceFileRepository.save(new ReferenceFile(referenceFilePath));
AnalysisSubmission submission = AnalysisSubmission.builder(iridaWorkflowId).name("paired analysis").inputFiles(inputs).referenceFile(referenceFile).build();
analysisSubmissionService.create(submission);
return analysisSubmissionRepository.findOne(submission.getId());
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair in project irida by phac-nml.
the class DatabaseSetupGalaxyITService method setupPairSubmissionInDatabase.
/**
* Sets up an {@link AnalysisSubmission} with a list of paired sequence
* files and saves all dependencies in database.
*
* @param iridaWorkflowId The id of an irida workflow.
* @param sampleId The id of the sample to associate with the given sequence
* file.
* @param sequenceFilePaths1 A list of paths for the first part of the pair.
* @param sequenceFilePaths2 A list of paths for the second part of the pair. The path to
* an input sequence file for this test.
* @param referenceFilePath The path to an input reference file for this test.
* @param updateSamples whether to run the sampleUpdater for this analysis
* @return An {@link AnalysisSubmission} which has been saved to the
* database.
*/
public AnalysisSubmission setupPairSubmissionInDatabase(long sampleId, List<Path> sequenceFilePaths1, List<Path> sequenceFilePaths2, Path referenceFilePath, UUID iridaWorkflowId, boolean updateSamples) {
List<SequenceFilePair> sequenceFilePairs = setupSampleSequenceFileInDatabase(sampleId, sequenceFilePaths1, sequenceFilePaths2);
List<SequenceFilePair> settledFiles = new ArrayList<>();
for (final SequenceFilePair f : sequenceFilePairs) {
waitForFilesToSettle(f);
settledFiles.add((SequenceFilePair) sequencingObjectService.read(f.getId()));
}
ReferenceFile referenceFile = referenceFileRepository.save(new ReferenceFile(referenceFilePath));
AnalysisSubmission submission = AnalysisSubmission.builder(iridaWorkflowId).name("paired analysis").inputFiles(Sets.newHashSet(settledFiles)).referenceFile(referenceFile).updateSamples(updateSamples).build();
analysisSubmissionService.create(submission);
return analysisSubmissionRepository.findOne(submission.getId());
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair in project irida by phac-nml.
the class DatabaseSetupGalaxyITService method setupSampleSequenceFileInDatabase.
/**
* Attaches the given sequence file paths as pairs (using parallel lists) to
* a particular sample id.
*
* @param sampleId
* The id of the sample to attach a sequence file to.
* @param sequenceFiles1
* A list of the first part of each pairs to setup.
* @param sequenceFiles2
* A list of the second part of each pairs to setup.
* @return A {@link List} of {@link SequenceFilePair} objects with the given
* sequence file paths attached and saved in the database.
*/
public List<SequenceFilePair> setupSampleSequenceFileInDatabase(long sampleId, List<Path> sequenceFiles1, List<Path> sequenceFiles2) {
checkArgument(sequenceFiles1.size() == sequenceFiles2.size(), "sequenceFiles lists are unequal");
Sample sample = sampleService.read(sampleId);
List<SequenceFilePair> returnedSequenceFilePairs = new ArrayList<>();
for (int i = 0; i < sequenceFiles1.size(); i++) {
SequenceFile sf1 = new SequenceFile(sequenceFiles1.get(i));
SequenceFile sf2 = new SequenceFile(sequenceFiles2.get(i));
SequenceFilePair pair = new SequenceFilePair(sf1, sf2);
sequencingObjectService.createSequencingObjectInSample(pair, sample);
waitForFilesToSettle(pair);
returnedSequenceFilePairs.add((SequenceFilePair) sequencingObjectService.read(pair.getId()));
}
return returnedSequenceFilePairs;
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair in project irida by phac-nml.
the class ProjectSynchronizationServiceTest method testSyncFilesError.
@Test(expected = ProjectSynchronizationException.class)
public void testSyncFilesError() {
Sample sample = new Sample();
SequenceFilePair pair = new SequenceFilePair();
RemoteStatus pairStatus = new RemoteStatus("http://pair", api);
pair.setRemoteStatus(pairStatus);
pair.setId(1L);
when(pairRemoteService.mirrorSequencingObject(pair)).thenReturn(pair);
when(objectService.createSequencingObjectInSample(pair, sample)).thenThrow(new NullPointerException("Bad file"));
syncService.syncSequenceFilePair(pair, sample);
}
use of ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair in project irida by phac-nml.
the class SequencingObjectServiceImplIT method testAddSequenceFilePairAsSequencer.
@Test
@WithMockUser(username = "fbristow", roles = "SEQUENCER")
public void testAddSequenceFilePairAsSequencer() throws IOException {
SequenceFile file1 = createSequenceFile("file1");
SequenceFile file2 = createSequenceFile("file2");
SequenceFilePair sequenceFilePair = new SequenceFilePair(file1, file2);
SequencingObject createSequenceFilePair = objectService.create(sequenceFilePair);
assertTrue(createSequenceFilePair.getFiles().contains(file1));
assertTrue(createSequenceFilePair.getFiles().contains(file2));
}
Aggregations