Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipeline assembly input #1257

Draft
wants to merge 13 commits into
base: development
Choose a base branch
from
Draft
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 @@ -12,10 +12,6 @@
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.EnableAsync;

import com.github.jmchilton.blend4j.galaxy.JobsClient;
import com.github.jmchilton.blend4j.galaxy.ToolsClient;
import com.google.common.collect.Lists;

import ca.corefacility.bioinformatics.irida.config.services.IridaPluginConfig;
import ca.corefacility.bioinformatics.irida.pipeline.results.AnalysisSubmissionSampleProcessor;
import ca.corefacility.bioinformatics.irida.pipeline.results.impl.AnalysisSubmissionSampleProcessorImpl;
Expand All @@ -28,6 +24,7 @@
import ca.corefacility.bioinformatics.irida.repositories.sample.SampleRepository;
import ca.corefacility.bioinformatics.irida.service.AnalysisService;
import ca.corefacility.bioinformatics.irida.service.AnalysisSubmissionService;
import ca.corefacility.bioinformatics.irida.service.GenomeAssemblyService;
import ca.corefacility.bioinformatics.irida.service.SequencingObjectService;
import ca.corefacility.bioinformatics.irida.service.analysis.execution.AnalysisExecutionService;
import ca.corefacility.bioinformatics.irida.service.analysis.execution.AnalysisExecutionServiceAspect;
Expand All @@ -42,21 +39,23 @@
import ca.corefacility.bioinformatics.irida.service.sample.SampleService;
import ca.corefacility.bioinformatics.irida.service.workflow.IridaWorkflowsService;

import com.github.jmchilton.blend4j.galaxy.JobsClient;
import com.github.jmchilton.blend4j.galaxy.ToolsClient;
import com.google.common.collect.Lists;

/**
* Configuration for an AnalysisExecutionService class.
*
*
*/
@Configuration
@EnableAsync(order = AnalysisExecutionServiceConfig.ASYNC_ORDER)
@Profile({ "dev", "prod", "it", "analysis", "ncbi", "processing", "sync", "web" })
public class AnalysisExecutionServiceConfig {

private static final Logger logger = LoggerFactory.getLogger(AnalysisExecutionServiceConfig.class);

/**
* The order for asynchronous tasks. In particular, defines the order for
* methods in {@link AnalysisExecutionServiceGalaxyAsync}.
* The order for asynchronous tasks. In particular, defines the order for methods in
* {@link AnalysisExecutionServiceGalaxyAsync}.
*/
public static final int ASYNC_ORDER = AnalysisExecutionServiceAspect.ANALYSIS_EXECUTION_ASPECT_ORDER - 1;

Expand All @@ -68,28 +67,31 @@ public class AnalysisExecutionServiceConfig {

@Autowired
private IridaWorkflowsService iridaWorkflowsService;

@Autowired
private AnalysisParameterServiceGalaxy analysisParameterServiceGalaxy;

@Autowired
private GalaxyHistoriesService galaxyHistoriesService;

@Autowired
private GalaxyLibrariesService galaxyLibrariesService;

@Autowired
private GalaxyWorkflowService galaxyWorkflowService;

@Autowired
private SequencingObjectService sequencingObjectService;


@Autowired
private GenomeAssemblyService genomeAssemblyService;

@Autowired
private ToolsClient toolsClient;

@Autowired
private JobsClient jobsClient;

@Autowired
private IridaPluginConfig.IridaPluginList pipelinePlugins;

Expand Down Expand Up @@ -131,7 +133,7 @@ public AnalysisSubmissionSampleProcessor analysisSubmissionSampleProcessor() {

return new AnalysisSubmissionSampleProcessorImpl(sampleRepository, analysisSampleUpdaters);
}

@Lazy
@Bean
public AnalysisExecutionService analysisExecutionService() {
Expand All @@ -143,31 +145,31 @@ public AnalysisExecutionService analysisExecutionService() {
@Bean
public AnalysisExecutionServiceGalaxyAsync analysisExecutionServiceGalaxyAsync() {
return new AnalysisExecutionServiceGalaxyAsync(analysisSubmissionService, analysisService,
galaxyWorkflowService, analysisWorkspaceService(), iridaWorkflowsService, analysisSubmissionSampleProcessor());
galaxyWorkflowService, analysisWorkspaceService(), iridaWorkflowsService,
analysisSubmissionSampleProcessor());
}

@Lazy
@Bean
public AnalysisExecutionServiceGalaxyCleanupAsync analysisExecutionServiceGalaxyCleanupAsync() {
return new AnalysisExecutionServiceGalaxyCleanupAsync(analysisSubmissionService,
galaxyWorkflowService, galaxyHistoriesService, galaxyLibrariesService);
return new AnalysisExecutionServiceGalaxyCleanupAsync(analysisSubmissionService, galaxyWorkflowService,
galaxyHistoriesService, galaxyLibrariesService);
}

@Lazy
@Bean
public AnalysisWorkspaceServiceGalaxy analysisWorkspaceService() {
return new AnalysisWorkspaceServiceGalaxy(galaxyHistoriesService, galaxyWorkflowService,
galaxyLibrariesService, iridaWorkflowsService, analysisCollectionServiceGalaxy(),
analysisProvenanceService(), analysisParameterServiceGalaxy,
sequencingObjectService);
return new AnalysisWorkspaceServiceGalaxy(galaxyHistoriesService, galaxyWorkflowService, galaxyLibrariesService,
iridaWorkflowsService, analysisCollectionServiceGalaxy(), analysisProvenanceService(),
analysisParameterServiceGalaxy, sequencingObjectService, genomeAssemblyService);
}

@Lazy
@Bean
public AnalysisProvenanceServiceGalaxy analysisProvenanceService() {
return new AnalysisProvenanceServiceGalaxy(galaxyHistoriesService, toolsClient, jobsClient);
}

@Lazy
@Bean
public AnalysisCollectionServiceGalaxy analysisCollectionServiceGalaxy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import ca.corefacility.bioinformatics.irida.model.VersionedFileFields;
import ca.corefacility.bioinformatics.irida.model.irida.IridaSequenceFile;
import ca.corefacility.bioinformatics.irida.model.joins.impl.SampleGenomeAssemblyJoin;
import ca.corefacility.bioinformatics.irida.model.workflow.submission.AnalysisSubmission;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.Lists;
Expand Down Expand Up @@ -51,6 +52,9 @@ public abstract class GenomeAssembly extends IridaRepresentationModel
@OneToMany(fetch = FetchType.LAZY, mappedBy = "genomeAssembly")
private List<SampleGenomeAssemblyJoin> sampleGenomeAssemblies;

@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.DETACH, mappedBy = "inputAssemblies")
private List<AnalysisSubmission> analysisSubmissions;

protected GenomeAssembly() {
this.id = null;
this.createdDate = null;
Expand All @@ -64,8 +68,7 @@ public GenomeAssembly(Date createdDate) {

@Override
public String getLabel() {
return getFile().getFileName()
.toString();
return getFile().getFileName().toString();
}

@Override
Expand Down Expand Up @@ -128,8 +131,7 @@ public String getFileSize() {

@Override
public String getFileName() {
return getFile().getFileName()
.toString();
return getFile().getFileName().toString();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
package ca.corefacility.bioinformatics.irida.model.workflow.description;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.*;

import javax.xml.bind.annotation.*;

import ca.corefacility.bioinformatics.irida.model.workflow.analysis.Analysis;
import ca.corefacility.bioinformatics.irida.model.workflow.analysis.type.AnalysisType;
Expand All @@ -19,13 +11,11 @@

/**
* Class providing access to generic information about a workflow.
*
*
*/
@XmlRootElement(name = "iridaWorkflow")
@XmlAccessorType(XmlAccessType.FIELD)
public class IridaWorkflowDescription {

@XmlElement(name = "id")
private UUID id;

Expand All @@ -44,7 +34,7 @@ public class IridaWorkflowDescription {
@XmlElementWrapper(name = "outputs")
@XmlElement(name = "output")
private List<IridaWorkflowOutput> outputs;

@XmlElementWrapper(name = "parameters")
@XmlElement(name = "parameter")
private List<IridaWorkflowParameter> parameters;
Expand All @@ -57,28 +47,19 @@ public IridaWorkflowDescription() {
}

/**
* Generates a new {@link IridaWorkflowDescription} with the given
* information.
* Generates a new {@link IridaWorkflowDescription} with the given information.
*
* @param id
* The {@link UUID} for a workflow.
* @param name
* The name of the workflow.
* @param version
* The version of the workflow.
* @param analysisType
* The class type of the {@link Analysis}.
* @param inputs
* The inputs to the workflow.
* @param outputs
* The outputs to the workflow.
* @param toolRepositories
* The list of tools repositories for this workflow.
* @param parameters
* The valid parameters that can be modified for this workflow.
* @param id The {@link UUID} for a workflow.
* @param name The name of the workflow.
* @param version The version of the workflow.
* @param analysisType The class type of the {@link Analysis}.
* @param inputs The inputs to the workflow.
* @param outputs The outputs to the workflow.
* @param toolRepositories The list of tools repositories for this workflow.
* @param parameters The valid parameters that can be modified for this workflow.
*/
public IridaWorkflowDescription(UUID id, String name, String version,
AnalysisType analysisType, IridaWorkflowInput inputs, List<IridaWorkflowOutput> outputs,
public IridaWorkflowDescription(UUID id, String name, String version, AnalysisType analysisType,
IridaWorkflowInput inputs, List<IridaWorkflowOutput> outputs,
List<IridaWorkflowToolRepository> toolRepositories, List<IridaWorkflowParameter> parameters) {
this.id = id;
this.name = name;
Expand Down Expand Up @@ -129,8 +110,7 @@ public boolean requiresDynamicSource() {
/**
* Whether or not this workflow accepts single sequence files as input.
*
* @return True if this workflow accepts single sequence files, false
* otherwise.
* @return True if this workflow accepts single sequence files, false otherwise.
*/
public boolean acceptsSingleSequenceFiles() {
return inputs.getSequenceReadsSingle().isPresent();
Expand All @@ -139,31 +119,38 @@ public boolean acceptsSingleSequenceFiles() {
/**
* Whether or not this workflow accepts paired sequence files as input.
*
* @return True if this workflow accepts paired sequence files, false
* otherwise.
* @return True if this workflow accepts paired sequence files, false otherwise.
*/
public boolean acceptsPairedSequenceFiles() {
return inputs.getSequenceReadsPaired().isPresent();
}

/**
* Whether or not this workflow accepts genome assemblies as input.
*
* @return True if this workflow accepts genome assemblies, false otherwise.
*/
public boolean acceptsGenomeAssemblies() {
return inputs.getGenomeAssemblies().isPresent();
}

public IridaWorkflowInput getInputs() {
return inputs;
}

public List<IridaWorkflowOutput> getOutputs() {
return outputs;
}

public List<IridaWorkflowParameter> getParameters() {
return parameters;
}

/**
* Gets a {@link Map} representation of the outputs of a workflow, linking
* the output name to the {@link IridaWorkflowOutput} entry.
* Gets a {@link Map} representation of the outputs of a workflow, linking the output name to the
* {@link IridaWorkflowOutput} entry.
*
* @return A {@link Map} linking the output name to the
* {@link IridaWorkflowOutput} entry.
* @return A {@link Map} linking the output name to the {@link IridaWorkflowOutput} entry.
*/
public Map<String, IridaWorkflowOutput> getOutputsMap() {
Map<String, IridaWorkflowOutput> outputsMap = new HashMap<>();
Expand All @@ -182,7 +169,7 @@ public List<IridaWorkflowToolRepository> getToolRepositories() {
public AnalysisType getAnalysisType() {
return analysisType;
}

/**
* Determines if this workflow accepts parameters.
*
Expand Down Expand Up @@ -215,7 +202,7 @@ else if (obj instanceof IridaWorkflowDescription) {

@Override
public String toString() {
return "IridaWorkflowDescription [id=" + id + ", name=" + name + ", version=" + version
+ ", analysisType=" + analysisType + "]";
return "IridaWorkflowDescription [id=" + id + ", name=" + name + ", version=" + version + ", analysisType="
+ analysisType + "]";
}
}
Loading