Skip to content

Commit

Permalink
exclude sequencings without limdids
Browse files Browse the repository at this point in the history
  • Loading branch information
grapigeau committed Oct 3, 2024
1 parent 0a8df4e commit bde6663
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@
@JsonDeserialize(builder = ShesmuSequencing.Builder.class)
public class ShesmuSequencing {

private final String name;
private final MetricCategory test;
private final String test;
private final MetricCategory type;
private final Set<ShesmuSample> limsIds;
private final boolean complete;


private ShesmuSequencing(Builder builder) {
this.name = requireNonNull(builder.name);
this.test = requireNonNull(builder.test);
this.type = requireNonNull(builder.type);
this.limsIds = unmodifiableSet(requireNonNull(builder.limsIds));
this.complete = requireNonNull(builder.complete);
}


public String getName() {
return name;
public String getTest() {
return test;
}

public MetricCategory getTest() {
return test;
public MetricCategory getType() {
return type;
}

public Set<ShesmuSample> getLimsIds() {
Expand All @@ -49,26 +49,22 @@ public Boolean isComplete() {
@JsonPOJOBuilder(withPrefix = "")
public static class Builder {

private String name;
private String test;
private Set<ShesmuSample> limsIds;
private MetricCategory test;
private MetricCategory type;
private boolean complete;




public ShesmuSequencing build() {
return new ShesmuSequencing(this);
}


public Builder name(String name) {
this.name = name;
public Builder test(String test) {
this.test = test;
return this;
}

public Builder test(MetricCategory test) {
this.test = test;
public Builder type(MetricCategory type) {
this.type = type;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,8 @@ private static void assertShesmuSampleEqual(ShesmuSample one, ShesmuSample two)
}

private static void assertShesmuTestEqual(ShesmuSequencing one, ShesmuSequencing two) {
assertEquals(one.getName(), two.getName());
assertEquals(one.getTest(), two.getTest());
assertEquals(one.getType(), two.getType());
assertEquals(one.isComplete(), two.isComplete());
assertEquals(one.getLimsIds().size(), two.getLimsIds().size());
assertShesmuSampleEqual(one.getLimsIds().iterator().next(), two.getLimsIds().iterator().next());
Expand Down Expand Up @@ -821,10 +821,10 @@ private static ShesmuDetailedCase makeShesmuDetailedCase() {
.supplemental(false)
.build());
sequencing.add(new ShesmuSequencing.Builder()
.name("Some Test")
.test("Some Test")
.limsIds(limsIds)
.complete(true)
.test(MetricCategory.LIBRARY_QUALIFICATION)
.type(MetricCategory.LIBRARY_QUALIFICATION)
.build());

return new ShesmuDetailedCase.Builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,27 @@ public Set<ShesmuDetailedCase> getShesmuDetailedCases() {

private Set<ShesmuSequencing> getSequencingForShesmuCase(Case kase){

Set<ShesmuSequencing> sTests = new HashSet<>();
Set<ShesmuSequencing> sequencings = new HashSet<>();
final long reqId = kase.getRequisition().getId();

for (Test test : kase.getTests()) {

sTests.add(makeShesmuSequencing(test.getFullDepthSequencings(), MetricCategory.FULL_DEPTH_SEQUENCING, reqId, test.getName()));
sTests.add(makeShesmuSequencing(test.getLibraryQualifications(), MetricCategory.LIBRARY_QUALIFICATION, reqId, test.getName()));

List<Sample> fullDepthSeqs = test.getFullDepthSequencings();
if (fullDepthSeqs != null && !fullDepthSeqs.isEmpty()) {
sequencings.add(makeShesmuSequencing(fullDepthSeqs, MetricCategory.FULL_DEPTH_SEQUENCING, reqId, test.getName()));
}
List<Sample> libraryQuals = test.getLibraryQualifications();
if (libraryQuals != null && !libraryQuals.isEmpty()) {
sequencings.add(makeShesmuSequencing(libraryQuals, MetricCategory.LIBRARY_QUALIFICATION, reqId, test.getName()));
}
};

return sTests;
return sequencings;
}

private ShesmuSequencing makeShesmuSequencing(List<Sample> samples, MetricCategory type, long reqId, String name){

var lims = new HashSet<ShesmuSample>();
Set<ShesmuSample> shesmuSamples = new HashSet<>();

boolean hasPassed = false;
boolean hasWaiting = false;
Expand All @@ -161,20 +166,19 @@ private ShesmuSequencing makeShesmuSequencing(List<Sample> samples, MetricCatego
}

if (!(sample.getRun() == null && type.equals(MetricCategory.LIBRARY_QUALIFICATION))) {
lims.add(new ShesmuSample.Builder()
shesmuSamples.add(new ShesmuSample.Builder()
.id(sample.getId())
.supplemental(!Objects.equals(sample.getRequisitionId(), reqId))
.build());
}
}

return new ShesmuSequencing.Builder()
.name(name)
.limsIds(lims)
.test(name)
.limsIds(shesmuSamples)
.complete((hasPassed && !hasWaiting))
.test(type)
.type(type)
.build();

}

private Set<String> getLimsIusIdsForShesmu(Case kase) {
Expand Down

0 comments on commit bde6663

Please sign in to comment.