Commit eb8e31df authored by Guillaume Jimenez's avatar Guillaume Jimenez

Only keep latest alignment

parent 18455673
......@@ -10,6 +10,7 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import utsw.bicf.nucliavault.clarity.api.utils.TypeUtils;
import utsw.bicf.nucliavault.controller.serialization.DataTableFilter;
import utsw.bicf.nucliavault.controller.serialization.PassableValue;
import utsw.bicf.nucliavault.controller.serialization.ToolTip;
......@@ -155,6 +156,7 @@ public class SampleDetailsTableSummary extends Summary<SampleDetailsTable>{
data = filterFailedSamples(data);
}
data = filterSomatic(data, dataFilters);
data = filterMultipleAlignments(data);
return data;
}
......@@ -250,6 +252,24 @@ public class SampleDetailsTableSummary extends Summary<SampleDetailsTable>{
return filteredData.stream().collect(Collectors.toList());
}
private static List<SampleDetailsTable> filterMultipleAlignments(List<SampleDetailsTable> data) throws IllegalArgumentException, IllegalAccessException {
Map<Integer, SampleDetailsTable> sdBySampleId = new HashMap<Integer, SampleDetailsTable>();
for (SampleDetailsTable sample : data) {
SampleDetailsTable previousSD = sdBySampleId.get(sample.getSampleId());
if (previousSD == null) {
sdBySampleId.put(sample.getSampleId(), sample);
}
else if (sample.getAlignDate() != null && previousSD.getAlignDate() != null && !sample.getAlignDate().equals("") && !previousSD.getAlignDate().equals("")) {
LocalDate sampleDate = LocalDate.parse(sample.getAlignDate(), TypeUtils.monthFormatter);
LocalDate previousSDDate = LocalDate.parse(previousSD.getAlignDate(), TypeUtils.monthFormatter);
if (sampleDate.isAfter(previousSDDate)) {
sdBySampleId.put(sample.getSampleId(), sample);
}
}
}
return sdBySampleId.values().stream().collect(Collectors.toList());
}
@Override
public void initializeHeaders() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment