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

WIP: Create samples from sequence run #1321

Draft
wants to merge 49 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
4029aba
creating the new create samples page
ksierks Jun 6, 2022
4ae35b0
Merge branch 'development' into create-samples-from-sequence-run
ksierks Jun 7, 2022
1fa43bf
playing with react-dnd
ksierks Jun 9, 2022
34de15b
adding a conditon to canDrop
ksierks Jun 9, 2022
47ea1e3
refactoring
ksierks Jun 9, 2022
545c79b
working on the sequencing files within a sample card
ksierks Jun 15, 2022
3889466
Merge branch 'development' into create-samples-from-sequence-run
ksierks Jun 15, 2022
0529854
adding remove sample functionality
ksierks Jun 15, 2022
2cf1017
adding drop restrictions
ksierks Jun 15, 2022
00f9906
fixing admin routing
ksierks Jun 20, 2022
63acb7f
adding avatar
ksierks Jun 20, 2022
503942d
starting to add a shadow on hover
ksierks Jun 20, 2022
acbf97d
working on shadow
ksierks Jun 21, 2022
968e1b3
updating sequence file names in required-data.sql
ksierks Jun 21, 2022
9f62c24
setting samples on page load
ksierks Jun 21, 2022
5ba415d
working on adding a list of file pairs within a sample
ksierks Jun 24, 2022
1397957
Merge branch 'development' into create-samples-from-sequence-run
ksierks Jun 24, 2022
cb49c86
removing the pair from the pair list if it's empty
ksierks Jun 24, 2022
e7f714b
starting to refactor
ksierks Jun 24, 2022
b0e3a0d
working on routing
ksierks Jun 27, 2022
5b43e5b
fixing can drop for sequencing run list
ksierks Jun 27, 2022
84c4388
Merge branch 'development' into create-samples-from-sequence-run
ksierks Jun 29, 2022
de210e3
adding scrolling
ksierks Jun 29, 2022
b9e31ab
renaming deleteSample
ksierks Jun 29, 2022
59731c5
adding a background color to the list on isover
ksierks Jun 29, 2022
692f5c0
adding remove icon to file in sample card
ksierks Jun 29, 2022
f84df5f
fixing flex for skeleton
ksierks Jun 29, 2022
9eacc6b
some css changes
ksierks Jul 4, 2022
4cb6d74
Merge branch 'development' into create-samples-from-sequence-run
ksierks Jul 4, 2022
2b5fdf5
starting modal
ksierks Jul 5, 2022
fdc2cdb
working on retrieving projects
ksierks Jul 7, 2022
717e456
working on displaying projects
ksierks Jul 8, 2022
6ee2394
working on retrieving samples
ksierks Jul 12, 2022
cc8f773
removing organism from modal
ksierks Jul 13, 2022
252f8f8
fixing urls in samplesApi
ksierks Jul 13, 2022
c5370d2
Merge branch 'development' into create-samples-from-sequence-run
ksierks Jul 14, 2022
7be3b49
fixing urls in samplesApi
ksierks Jul 14, 2022
a2f4023
working on sample name validation
ksierks Jul 14, 2022
6888caa
working on validating sample name
ksierks Jul 15, 2022
6e248bd
working on creating sample
ksierks Jul 15, 2022
cf3c162
fixing populating samples in modal
ksierks Jul 25, 2022
8bfa715
Merge branch 'development' into create-samples-from-sequence-run
ksierks Jul 25, 2022
8903c38
displaying project id in sample card
ksierks Jul 26, 2022
bd23eb1
setting up create sample functionality
ksierks Jul 27, 2022
53898eb
working on create samples functionality
ksierks Jul 28, 2022
79b6c15
fix broken test
ksierks Aug 2, 2022
d396bf9
adding missing i18n
ksierks Aug 3, 2022
7c7ac6c
adding fast5 to required-data.sql
ksierks Aug 3, 2022
8809a86
adding restrictions to disallow creating pairs for fast5
ksierks Aug 3, 2022
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 @@ -79,6 +79,15 @@ public Page<Project> findManageableProjectsByName(final @Param("projectName") St
@Query("FROM Project p WHERE p.remoteStatus != NULL")
public List<Project> getRemoteProjects();

/**
* Get a list of all {@link Project}s for a {@link User}
*
* @param user the user account to load projects for
* @return a list of {@link Project}s
*/
@Query("FROM Project p WHERE " + PROJECT_MANAGER_PERMISSION)
public List<Project> getProjectsForUser(final @Param("forUser") User user);

/**
* Get a count of all {@link Project}s created within time period
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ public ResponseEntity<SampleNameValidationResponse> validateNewSampleName(@Reque
return uiProjectSampleService.validateNewSampleName(name, projectId, locale);
}

/**
* Get a drop-down list of samples for a project
*
* @param projectId Identifier for the current project
* @return a list of sample names
*/
@RequestMapping("/dropdown")
public ResponseEntity<AjaxResponse> getSampleNamesAndIdsForProject(@PathVariable Long projectId) {
return ResponseEntity.ok(uiSampleService.getSampleNamesAndIdsForProject(projectId));
}

/**
* Create a new sample within a project
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package ca.corefacility.bioinformatics.irida.ria.web.ajax.projects.dto;

/**
* Model for UI to represent a project list item.
*/
public class SampleNameListItemModel {
private Long id;
private String name;

public SampleNameListItemModel(Long id, String name) {
this.id = id;
this.name = name;
}

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package ca.corefacility.bioinformatics.irida.ria.web.ajax.projects.dto;

import java.util.List;

import ca.corefacility.bioinformatics.irida.ria.web.ajax.dto.ajax.AjaxResponse;

/**
* Return a list of samples.
*/
public class SampleNameListResponse extends AjaxResponse {

private List<SampleNameListItemModel> samples;

public SampleNameListResponse(List<SampleNameListItemModel> samples) {
this.samples = samples;
}

public List<SampleNameListItemModel> getSamples() {
return samples;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,29 @@ public ProjectsAjaxController(UIProjectsService UIProjectsService, MessageSource
* Create a new project.
*
* @param request {@link CreateProjectRequest} containing the name for the project and any other details
* @param locale {@link Locale} for the currently logged-in user
* @param locale {@link Locale} for the currently logged-in user
* @return Response will contain the created project identifier, or an error message
*/
@PostMapping("/new")
public AjaxResponse createNewProject(@RequestBody CreateProjectRequest request, Locale locale) {
try {
return new AjaxCreateItemSuccessResponse(projectsService.createProject(request));
} catch (Exception e) {
return new AjaxErrorResponse(messageSource.getMessage("server.CreateProject.error", new Object[]{}, locale));
return new AjaxErrorResponse(
messageSource.getMessage("server.CreateProject.error", new Object[] {}, locale));
}
}

/**
* Handle request for getting a list of projects for a user
*
* @return {@link List} of {@link Project}s
*/
@RequestMapping("/names")
public ResponseEntity<AjaxResponse> getProjectNamesForUser() {
return ResponseEntity.ok(projectsService.getProjectNameForUser());
}

/**
* Handle request for getting a filtered and sorted list of projects for a user or administrator
*
Expand All @@ -73,13 +84,6 @@ public ResponseEntity<List<Role>> getProjectRoles(Locale locale) {
return ResponseEntity.ok(projectsService.getProjectRoles(locale));
}

/**
* Get a list of projects that the user can share sample to.
*
* @param currentId Current project identifier
* @return {@link List} of {@link Project}s
*/

/**
* Get a list of projects that the user can share sample to.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package ca.corefacility.bioinformatics.irida.ria.web.projects.dto;

/**
* Model for UI to represent a project list item.
*/
public class ProjectNameListItemModel {
private Long id;
private String name;

public ProjectNameListItemModel(Long id, String name) {
this.id = id;
this.name = name;
}

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package ca.corefacility.bioinformatics.irida.ria.web.projects.dto;

import java.util.List;

import ca.corefacility.bioinformatics.irida.ria.web.ajax.dto.ajax.AjaxResponse;

/**
* Return a list of projects.
*/
public class ProjectNameListResponse extends AjaxResponse {

private List<ProjectNameListItemModel> projects;

public ProjectNameListResponse(List<ProjectNameListItemModel> projects) {
this.projects = projects;
}

public List<ProjectNameListItemModel> getProjects() {
return projects;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@

import ca.corefacility.bioinformatics.irida.model.run.SequencingRun;
import ca.corefacility.bioinformatics.irida.ria.web.models.tables.TableResponse;
import ca.corefacility.bioinformatics.irida.ria.web.sequencingRuns.dto.SequenceFileDetails;
import ca.corefacility.bioinformatics.irida.ria.web.sequencingRuns.dto.SequencingRunDetails;
import ca.corefacility.bioinformatics.irida.ria.web.sequencingRuns.dto.SequencingRunModel;
import ca.corefacility.bioinformatics.irida.ria.web.sequencingRuns.dto.SequencingRunsListRequest;
import ca.corefacility.bioinformatics.irida.ria.web.sequencingRuns.dto.*;
import ca.corefacility.bioinformatics.irida.ria.web.services.UISequencingRunService;

/**
Expand Down Expand Up @@ -76,6 +73,17 @@ public TableResponse<SequencingRunModel> listSequencingRuns(
return service.listSequencingRuns(sequencingRunsListRequest, locale);
}

/**
* Update or create new samples with sequence files
*
* @param request - details about the samples
* @return a success message
*/
@PostMapping("/samples")
public ResponseEntity<String> createSamples(@RequestBody CreateSampleRequest request) {
return ResponseEntity.ok(service.createSamples(request));
}

/**
* Delete a sequencing run.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package ca.corefacility.bioinformatics.irida.ria.web.sequencingRuns.dto;

import java.util.List;

/**
* UI request to update or create new samples.
*/
public class CreateSampleRequest {

private List<SampleModel> samples;

public CreateSampleRequest() {
}

public CreateSampleRequest(List<SampleModel> samples) {
this.samples = samples;
}

public List<SampleModel> getSamples() {
return samples;
}

public void setSamples(List<SampleModel> samples) {
this.samples = samples;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package ca.corefacility.bioinformatics.irida.ria.web.sequencingRuns.dto;

import java.util.List;

/**
* Represents a sample on the UI sequencing run create samples page.
*/
public class SampleModel {
private Long projectId;
private Long sampleId;
private String sampleName;
private List<SequenceFilePairModel> pairs;

public SampleModel() {
}

public SampleModel(Long projectId, Long sampleId, String sampleName, List<SequenceFilePairModel> pairs) {
this.projectId = projectId;
this.sampleId = sampleId;
this.sampleName = sampleName;
this.pairs = pairs;
}

public Long getProjectId() {
return projectId;
}

public void setProjectId(Long projectId) {
this.projectId = projectId;
}

public Long getSampleId() {
return sampleId;
}

public void setSampleId(Long sampleId) {
this.sampleId = sampleId;
}

public String getSampleName() {
return sampleName;
}

public void setSampleName(String sampleName) {
this.sampleName = sampleName;
}

public List<SequenceFilePairModel> getPairs() {
return pairs;
}

public void setPairs(List<SequenceFilePairModel> pairs) {
this.pairs = pairs;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@
public class SequenceFileDetails implements Comparable<SequenceFileDetails> {
private Long id;
private Long sequencingObjectId;
private String sequencingObjectType;
private String fileName;
private String fileSize;

public SequenceFileDetails(SequenceFile file, Long sequencingObjectId) {
public SequenceFileDetails() {
}

public SequenceFileDetails(SequenceFile file, Long sequencingObjectId, String sequencingObjectType) {
this.id = file.getId();
this.sequencingObjectId = sequencingObjectId;
this.sequencingObjectType = sequencingObjectType;
this.fileName = file.getFileName();
this.fileSize = file.getFileSize();
}
Expand All @@ -29,6 +34,10 @@ public Long getSequencingObjectId() {
return sequencingObjectId;
}

public String getSequencingObjectType() {
return sequencingObjectType;
}

public String getFileName() {
return fileName;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package ca.corefacility.bioinformatics.irida.ria.web.sequencingRuns.dto;

import ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile;

/**
* Represents a {@link SequenceFile} on the UI sequencing run create samples page.
*/
public class SequenceFilePairModel {

private SequenceFileDetails forward;

private SequenceFileDetails reverse;

public SequenceFilePairModel() {
}

public SequenceFilePairModel(SequenceFileDetails forward, SequenceFileDetails reverse) {
this.forward = forward;
this.reverse = reverse;
}

public SequenceFileDetails getForward() {
return forward;
}

public void setForward(SequenceFileDetails forward) {
this.forward = forward;
}

public SequenceFileDetails getReverse() {
return reverse;
}

public void setReverse(SequenceFileDetails reverse) {
this.reverse = reverse;
}
}

Loading