Search in sources :

Example 21 with ReferenceFile

use of ca.corefacility.bioinformatics.irida.model.project.ReferenceFile in project irida by phac-nml.

the class DatabaseSetupGalaxyITService method setupPairSubmissionInDatabase.

/**
 * Sets up an {@link AnalysisSubmission} with a set of
 * {@link SequenceFilePair}s that have already been setup with samples.
 *
 * @param sequenceFilePairs
 *            The set of {@link SequenceFilePair}s to submit.
 * @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 setupPairSubmissionInDatabase(Set<SequencingObject> sequenceFilePairs, Path referenceFilePath, UUID iridaWorkflowId) {
    ReferenceFile referenceFile = referenceFileRepository.save(new ReferenceFile(referenceFilePath));
    AnalysisSubmission submission = AnalysisSubmission.builder(iridaWorkflowId).name("paired analysis").inputFiles(sequenceFilePairs).referenceFile(referenceFile).build();
    analysisSubmissionService.create(submission);
    return analysisSubmissionRepository.findOne(submission.getId());
}
Also used : ReferenceFile(ca.corefacility.bioinformatics.irida.model.project.ReferenceFile) AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission)

Example 22 with ReferenceFile

use of ca.corefacility.bioinformatics.irida.model.project.ReferenceFile in project irida by phac-nml.

the class DatabaseSetupGalaxyITService method setupSubmissionInDatabase.

/**
 * Sets up an AnalysisSubmission and saves all dependencies in database.
 * Saves with the given {@link AnalysisState}
 *
 * @param sampleId          The id of the sample to associate with the given sequence
 *                          file.
 * @param sequenceFilePath  The path to an input sequence file for this test.
 * @param referenceFilePath The path to an input reference file for this test.
 * @param iridaWorkflowId   The id of an irida workflow.
 * @param state             {@link AnalysisState} of the workflow
 * @param updateSamples     whether to run the sampleUpdater for this analysis
 * @return An {@link AnalysisSubmission} which has been saved to the
 * database.
 */
public AnalysisSubmission setupSubmissionInDatabase(long sampleId, Path sequenceFilePath, Path referenceFilePath, UUID iridaWorkflowId, AnalysisState state, boolean updateSamples) {
    SingleEndSequenceFile sequencingObject = (SingleEndSequenceFile) setupSequencingObjectInDatabase(sampleId, sequenceFilePath).get(0);
    waitForFilesToSettle(sequencingObject);
    sequencingObject = (SingleEndSequenceFile) sequencingObjectService.read(sequencingObject.getId());
    ReferenceFile referenceFile = referenceFileRepository.save(new ReferenceFile(referenceFilePath));
    AnalysisSubmission submission = AnalysisSubmission.builder(iridaWorkflowId).name("my analysis").inputFiles(Sets.newHashSet(sequencingObject)).referenceFile(referenceFile).updateSamples(updateSamples).build();
    submission.setAnalysisState(state);
    analysisSubmissionService.create(submission);
    return analysisSubmissionRepository.findOne(submission.getId());
}
Also used : ReferenceFile(ca.corefacility.bioinformatics.irida.model.project.ReferenceFile) AnalysisSubmission(ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission) SingleEndSequenceFile(ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)

Example 23 with ReferenceFile

use of ca.corefacility.bioinformatics.irida.model.project.ReferenceFile in project irida by phac-nml.

the class ProjectServiceImplIT method testRemoveReferenceFileFromProject.

@Test
@WithMockUser(username = "admin", roles = "ADMIN")
public void testRemoveReferenceFileFromProject() {
    Project p = projectService.read(1L);
    ReferenceFile f = referenceFileService.read(1L);
    projectService.removeReferenceFileFromProject(p, f);
    Collection<Join<Project, ReferenceFile>> files = referenceFileService.getReferenceFilesForProject(p);
    assertTrue("No reference files should be assigned to project.", files.isEmpty());
}
Also used : Project(ca.corefacility.bioinformatics.irida.model.project.Project) ReferenceFile(ca.corefacility.bioinformatics.irida.model.project.ReferenceFile) RelatedProjectJoin(ca.corefacility.bioinformatics.irida.model.joins.impl.RelatedProjectJoin) Join(ca.corefacility.bioinformatics.irida.model.joins.Join) ProjectSampleJoin(ca.corefacility.bioinformatics.irida.model.joins.impl.ProjectSampleJoin) ProjectAnalysisSubmissionJoin(ca.corefacility.bioinformatics.irida.model.workflow.submission.ProjectAnalysisSubmissionJoin) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 24 with ReferenceFile

use of ca.corefacility.bioinformatics.irida.model.project.ReferenceFile in project irida by phac-nml.

the class ProjectServiceImplIT method testRemoveReferenceFileFromProjectExceptions.

@Test(expected = EntityNotFoundException.class)
@WithMockUser(username = "admin", roles = "ADMIN")
public void testRemoveReferenceFileFromProjectExceptions() {
    Project p = projectService.read(1L);
    ReferenceFile f = referenceFileService.read(2L);
    projectService.removeReferenceFileFromProject(p, f);
}
Also used : Project(ca.corefacility.bioinformatics.irida.model.project.Project) ReferenceFile(ca.corefacility.bioinformatics.irida.model.project.ReferenceFile) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Example 25 with ReferenceFile

use of ca.corefacility.bioinformatics.irida.model.project.ReferenceFile in project irida by phac-nml.

the class ReferenceFileServiceImplIT method testDeleteReferenceFile.

@Test
@WithMockUser(username = "fbristow", roles = "USER")
public void testDeleteReferenceFile() {
    Project p = projectService.read(1L);
    List<Join<Project, ReferenceFile>> prs = referenceFileService.getReferenceFilesForProject(p);
    assertEquals("Wrong number of reference files for project.", 1, prs.size());
    ReferenceFile rf = prs.iterator().next().getObject();
    assertEquals("Wrong reference file attached to project.", Long.valueOf(1), rf.getId());
    referenceFileService.delete(rf.getId());
    p = projectService.read(1L);
    prs = referenceFileService.getReferenceFilesForProject(p);
    assertEquals("No more reference files should be in the project.", 0, prs.size());
}
Also used : Project(ca.corefacility.bioinformatics.irida.model.project.Project) ReferenceFile(ca.corefacility.bioinformatics.irida.model.project.ReferenceFile) Join(ca.corefacility.bioinformatics.irida.model.joins.Join) WithMockUser(org.springframework.security.test.context.support.WithMockUser) Test(org.junit.Test)

Aggregations

ReferenceFile (ca.corefacility.bioinformatics.irida.model.project.ReferenceFile)30 Project (ca.corefacility.bioinformatics.irida.model.project.Project)15 Test (org.junit.Test)12 AnalysisSubmission (ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission)10 Path (java.nio.file.Path)10 WithMockUser (org.springframework.security.test.context.support.WithMockUser)9 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)6 Join (ca.corefacility.bioinformatics.irida.model.joins.Join)5 SequenceFilePair (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair)5 Sample (ca.corefacility.bioinformatics.irida.model.sample.Sample)4 SingleEndSequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile)4 SequencingObject (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject)3 IridaWorkflowDescription (ca.corefacility.bioinformatics.irida.model.workflow.description.IridaWorkflowDescription)3 ProjectAnalysisSubmissionJoin (ca.corefacility.bioinformatics.irida.model.workflow.submission.ProjectAnalysisSubmissionJoin)3 ImmutableMap (com.google.common.collect.ImmutableMap)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)3 UnsupportedReferenceFileContentError (ca.corefacility.bioinformatics.irida.exceptions.UnsupportedReferenceFileContentError)2