Search in sources :

Example 1 with PoolQcControlRun

use of uk.ac.bbsrc.tgac.miso.core.data.qc.PoolQcControlRun in project miso-lims by miso-lims.

the class DefaultQualityControlService method saveControlRuns.

private void saveControlRuns(long savedId, QC from, QcTargetStore handler) throws IOException {
    QC to = get(from.getEntity().getQcTarget(), from.getId());
    List<QcControlRun> toDelete = new ArrayList<>();
    for (QcControlRun toControl : to.getControls()) {
        if (!toControl.isSaved()) {
            // newly created QC
            continue;
        }
        QcControlRun fromControl = from.getControls().stream().filter(fc -> fc.getId() == toControl.getId()).findFirst().orElse(null);
        if (fromControl == null) {
            toDelete.add(toControl);
        } else {
            toControl.setControl(fromControl.getControl());
            toControl.setLot(fromControl.getLot());
            toControl.setQcPassed(fromControl.isQcPassed());
            handler.updateControlRun(toControl);
        }
    }
    for (QcControlRun control : toDelete) {
        handler.deleteControlRun(control);
    }
    for (QcControlRun fromControl : from.getControls()) {
        if (!fromControl.isSaved()) {
            switch(to.getType().getQcTarget()) {
                case Container:
                    ((ContainerQcControlRun) fromControl).setQc((ContainerQC) to);
                    break;
                case Library:
                    ((LibraryQcControlRun) fromControl).setQc((LibraryQC) to);
                    break;
                case Pool:
                    ((PoolQcControlRun) fromControl).setQc((PoolQC) to);
                    break;
                case Sample:
                    ((SampleQcControlRun) fromControl).setQc((SampleQC) to);
                    break;
                default:
                    throw new IllegalArgumentException("Unhandled QC target: " + to.getType().getQcTarget());
            }
            handler.createControlRun(fromControl);
        }
    }
}
Also used : ContainerQC(uk.ac.bbsrc.tgac.miso.core.data.qc.ContainerQC) LibraryQC(uk.ac.bbsrc.tgac.miso.core.data.qc.LibraryQC) QC(uk.ac.bbsrc.tgac.miso.core.data.qc.QC) SampleQC(uk.ac.bbsrc.tgac.miso.core.data.qc.SampleQC) PoolQC(uk.ac.bbsrc.tgac.miso.core.data.qc.PoolQC) PoolQcControlRun(uk.ac.bbsrc.tgac.miso.core.data.qc.PoolQcControlRun) SampleQcControlRun(uk.ac.bbsrc.tgac.miso.core.data.qc.SampleQcControlRun) QcControlRun(uk.ac.bbsrc.tgac.miso.core.data.qc.QcControlRun) PoolQcControlRun(uk.ac.bbsrc.tgac.miso.core.data.qc.PoolQcControlRun) LibraryQcControlRun(uk.ac.bbsrc.tgac.miso.core.data.qc.LibraryQcControlRun) ContainerQcControlRun(uk.ac.bbsrc.tgac.miso.core.data.qc.ContainerQcControlRun) SampleQcControlRun(uk.ac.bbsrc.tgac.miso.core.data.qc.SampleQcControlRun) ArrayList(java.util.ArrayList) LibraryQcControlRun(uk.ac.bbsrc.tgac.miso.core.data.qc.LibraryQcControlRun) ContainerQcControlRun(uk.ac.bbsrc.tgac.miso.core.data.qc.ContainerQcControlRun)

Example 2 with PoolQcControlRun

use of uk.ac.bbsrc.tgac.miso.core.data.qc.PoolQcControlRun in project miso-lims by miso-lims.

the class Dtos method addQcControlRuns.

private static void addQcControlRuns(@Nonnull Collection<QcControlRunDto> list, QC qc, QcTarget qcTarget) {
    if (list == null) {
        return;
    }
    for (QcControlRunDto from : list) {
        QcControlRun to = null;
        switch(qcTarget) {
            case Container:
                ContainerQcControlRun containerQcControlRun = new ContainerQcControlRun();
                containerQcControlRun.setQc((ContainerQC) qc);
                ((ContainerQC) qc).getControls().add(containerQcControlRun);
                to = containerQcControlRun;
                break;
            case Library:
                LibraryQcControlRun libraryQcControlRun = new LibraryQcControlRun();
                libraryQcControlRun.setQc((LibraryQC) qc);
                ((LibraryQC) qc).getControls().add(libraryQcControlRun);
                to = libraryQcControlRun;
                break;
            case Pool:
                PoolQcControlRun poolQcControlRun = new PoolQcControlRun();
                poolQcControlRun.setQc((PoolQC) qc);
                ((PoolQC) qc).getControls().add(poolQcControlRun);
                to = poolQcControlRun;
                break;
            case Run:
                throw new IllegalArgumentException("Unhandled QC target: Run");
            case Sample:
                SampleQcControlRun sampleQcControlRun = new SampleQcControlRun();
                sampleQcControlRun.setQc((SampleQC) qc);
                ((SampleQC) qc).getControls().add(sampleQcControlRun);
                to = sampleQcControlRun;
                break;
            default:
                throw new IllegalArgumentException("Unhandled QC target: " + qcTarget == null ? "null" : qcTarget.getLabel());
        }
        setLong(to::setId, from.getId(), false);
        setObject(to::setControl, QcControl::new, from.getControlId());
        setString(to::setLot, from.getLot());
        setBoolean(to::setQcPassed, from.getQcPassed(), false);
    }
}
Also used : QcControl(uk.ac.bbsrc.tgac.miso.core.data.qc.QcControl) PoolQcControlRun(uk.ac.bbsrc.tgac.miso.core.data.qc.PoolQcControlRun) QcControlRun(uk.ac.bbsrc.tgac.miso.core.data.qc.QcControlRun) LibraryQcControlRun(uk.ac.bbsrc.tgac.miso.core.data.qc.LibraryQcControlRun) SampleQcControlRun(uk.ac.bbsrc.tgac.miso.core.data.qc.SampleQcControlRun) PoolQcControlRun(uk.ac.bbsrc.tgac.miso.core.data.qc.PoolQcControlRun) ContainerQcControlRun(uk.ac.bbsrc.tgac.miso.core.data.qc.ContainerQcControlRun) SampleQcControlRun(uk.ac.bbsrc.tgac.miso.core.data.qc.SampleQcControlRun) LibraryQcControlRun(uk.ac.bbsrc.tgac.miso.core.data.qc.LibraryQcControlRun) IonTorrentRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IonTorrentRunDto) QcHierarchyNodeDto(uk.ac.bbsrc.tgac.miso.dto.dashi.QcHierarchyNodeDto) RunPositionDto(uk.ac.bbsrc.tgac.miso.dto.run.RunPositionDto) PacBioRunDto(uk.ac.bbsrc.tgac.miso.dto.run.PacBioRunDto) Ls454RunDto(uk.ac.bbsrc.tgac.miso.dto.run.Ls454RunDto) IlluminaNotificationDto(ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto) OxfordNanoporeRunDto(uk.ac.bbsrc.tgac.miso.dto.run.OxfordNanoporeRunDto) IlluminaRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto) NotificationDto(ca.on.oicr.gsi.runscanner.dto.NotificationDto) OxfordNanoporeNotificationDto(ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto) RunDto(uk.ac.bbsrc.tgac.miso.dto.run.RunDto) SolidRunDto(uk.ac.bbsrc.tgac.miso.dto.run.SolidRunDto) OrderAliquotDto(uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto) ContainerQcControlRun(uk.ac.bbsrc.tgac.miso.core.data.qc.ContainerQcControlRun)

Example 3 with PoolQcControlRun

use of uk.ac.bbsrc.tgac.miso.core.data.qc.PoolQcControlRun in project miso-lims by miso-lims.

the class HibernatePoolQcDaoIT method makeControlRun.

@Override
protected QcControlRun makeControlRun(PoolQC qc) {
    PoolQcControlRun controlRun = new PoolQcControlRun();
    controlRun.setQc(qc);
    return controlRun;
}
Also used : PoolQcControlRun(uk.ac.bbsrc.tgac.miso.core.data.qc.PoolQcControlRun)

Aggregations

PoolQcControlRun (uk.ac.bbsrc.tgac.miso.core.data.qc.PoolQcControlRun)3 ContainerQcControlRun (uk.ac.bbsrc.tgac.miso.core.data.qc.ContainerQcControlRun)2 LibraryQcControlRun (uk.ac.bbsrc.tgac.miso.core.data.qc.LibraryQcControlRun)2 QcControlRun (uk.ac.bbsrc.tgac.miso.core.data.qc.QcControlRun)2 SampleQcControlRun (uk.ac.bbsrc.tgac.miso.core.data.qc.SampleQcControlRun)2 IlluminaNotificationDto (ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto)1 NotificationDto (ca.on.oicr.gsi.runscanner.dto.NotificationDto)1 OxfordNanoporeNotificationDto (ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto)1 ArrayList (java.util.ArrayList)1 ContainerQC (uk.ac.bbsrc.tgac.miso.core.data.qc.ContainerQC)1 LibraryQC (uk.ac.bbsrc.tgac.miso.core.data.qc.LibraryQC)1 PoolQC (uk.ac.bbsrc.tgac.miso.core.data.qc.PoolQC)1 QC (uk.ac.bbsrc.tgac.miso.core.data.qc.QC)1 QcControl (uk.ac.bbsrc.tgac.miso.core.data.qc.QcControl)1 SampleQC (uk.ac.bbsrc.tgac.miso.core.data.qc.SampleQC)1 OrderAliquotDto (uk.ac.bbsrc.tgac.miso.dto.PoolOrderDto.OrderAliquotDto)1 QcHierarchyNodeDto (uk.ac.bbsrc.tgac.miso.dto.dashi.QcHierarchyNodeDto)1 IlluminaRunDto (uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto)1 IonTorrentRunDto (uk.ac.bbsrc.tgac.miso.dto.run.IonTorrentRunDto)1 Ls454RunDto (uk.ac.bbsrc.tgac.miso.dto.run.Ls454RunDto)1