Search in sources :

Example 1 with LS454Run

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

the class Dtos method getPlatformRunDto.

private static RunDto getPlatformRunDto(@Nonnull Run from) {
    if (from instanceof IlluminaRun) {
        IlluminaRunDto dto = new IlluminaRunDto();
        IlluminaRun illuminaRun = (IlluminaRun) from;
        setString(dto::setWorkflowType, maybeGetProperty(illuminaRun.getWorkflowType(), IlluminaWorkflowType::getRawValue));
        dto.setNumCycles(illuminaRun.getNumCycles());
        dto.setCalledCycles(illuminaRun.getCallCycle());
        dto.setImagedCycles(illuminaRun.getImgCycle());
        dto.setScoredCycles(illuminaRun.getScoreCycle());
        dto.setPairedEnd(illuminaRun.getPairedEnd());
        setString(dto::setBasesMask, illuminaRun.getRunBasesMask());
        return dto;
    } else if (from instanceof IonTorrentRun) {
        return new IonTorrentRunDto();
    } else if (from instanceof LS454Run) {
        Ls454RunDto dto = new Ls454RunDto();
        LS454Run ls454Run = (LS454Run) from;
        dto.setCycles(ls454Run.getCycles());
        dto.setPairedEnd(ls454Run.getPairedEnd());
        return dto;
    } else if (from instanceof SolidRun) {
        SolidRunDto dto = new SolidRunDto();
        SolidRun solidRun = (SolidRun) from;
        dto.setPairedEnd(solidRun.getPairedEnd());
        return dto;
    } else if (from instanceof OxfordNanoporeRun) {
        OxfordNanoporeRunDto dto = new OxfordNanoporeRunDto();
        OxfordNanoporeRun ontRun = (OxfordNanoporeRun) from;
        setString(dto::setMinKnowVersion, ontRun.getMinKnowVersion());
        setString(dto::setProtocolVersion, ontRun.getProtocolVersion());
        return dto;
    } else if (from instanceof PacBioRun) {
        return new PacBioRunDto();
    } else {
        throw new IllegalArgumentException("Unknown run type");
    }
}
Also used : IonTorrentRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IonTorrentRunDto) LS454Run(uk.ac.bbsrc.tgac.miso.core.data.LS454Run) OxfordNanoporeRun(uk.ac.bbsrc.tgac.miso.core.data.OxfordNanoporeRun) SolidRunDto(uk.ac.bbsrc.tgac.miso.dto.run.SolidRunDto) OxfordNanoporeRunDto(uk.ac.bbsrc.tgac.miso.dto.run.OxfordNanoporeRunDto) IlluminaRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto) PacBioRun(uk.ac.bbsrc.tgac.miso.core.data.PacBioRun) IonTorrentRun(uk.ac.bbsrc.tgac.miso.core.data.IonTorrentRun) SolidRun(uk.ac.bbsrc.tgac.miso.core.data.SolidRun) IlluminaRun(uk.ac.bbsrc.tgac.miso.core.data.IlluminaRun) Ls454RunDto(uk.ac.bbsrc.tgac.miso.dto.run.Ls454RunDto) PacBioRunDto(uk.ac.bbsrc.tgac.miso.dto.run.PacBioRunDto)

Example 2 with LS454Run

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

the class DefaultRunService method processNotification.

@Override
public boolean processNotification(Run source, int laneCount, String containerModel, String containerSerialNumber, String sequencerName, Predicate<SequencingParameters> filterParameters, GetLaneContents getLaneContents, String positionName) throws IOException, MisoNamingException {
    User user = userService.getByLoginName("notification");
    final Run target;
    Run runFromDb = runDao.getByAlias(source.getAlias());
    boolean isNew;
    if (runFromDb == null) {
        target = source.getPlatformType().createRun();
        target.setAlias(source.getAlias());
        isNew = true;
    } else {
        target = runFromDb;
        if (source.getPlatformType() != target.getPlatformType()) {
            throw new IllegalStateException("Run scanner detected a run from " + source.getPlatformType().name() + " and there is a save run from " + target.getPlatformType().name());
        }
        isNew = false;
    }
    target.setLastModifier(user);
    boolean isMutated = false;
    isMutated |= updateMetricsFromNotification(source, target);
    isMutated |= updateField(source.getFilePath(), target.getFilePath(), target::setFilePath);
    isMutated |= updateField(source.getStartDate(), target.getStartDate(), target::setStartDate);
    final Instrument sequencer = instrumentService.getByName(sequencerName);
    if (sequencer == null) {
        throw new IllegalArgumentException("No such sequencer: " + sequencerName);
    }
    target.setSequencer(sequencer);
    SequencingContainerModel model = containerModelService.find(sequencer.getInstrumentModel(), containerModel, laneCount);
    if (model == null) {
        throw new IllegalArgumentException("Could not find container or fallback for parameters: model=" + containerModel + ", lanes=" + laneCount);
    }
    if (model.isFallback() && isNew) {
        log.info("Could not find container model with model=" + containerModel + " and lanes=" + laneCount + " for run " + source.getAlias() + "; used fallback container model instead.");
    }
    isMutated |= updateContainerFromNotification(target, user, model, containerSerialNumber, getLaneContents, positionName);
    isMutated |= updateHealthFromNotification(source, target, user);
    isMutated |= updateSequencingKitFromNotification(target, source.getSequencingKit());
    isMutated |= updateDataManglingPolicyFromNotification(target, source.getDataManglingPolicy(), user);
    switch(source.getPlatformType()) {
        case ILLUMINA:
            isMutated |= updateIlluminaRunFromNotification((IlluminaRun) source, (IlluminaRun) target);
            break;
        case LS454:
            isMutated |= updateField(((LS454Run) source).getCycles(), ((LS454Run) target).getCycles(), ((LS454Run) target)::setCycles);
            isMutated |= updateField(source.getPairedEnd(), target.getPairedEnd(), target::setPairedEnd);
            break;
        case OXFORDNANOPORE:
            isMutated |= updateField(((OxfordNanoporeRun) source).getMinKnowVersion(), ((OxfordNanoporeRun) target).getMinKnowVersion(), ((OxfordNanoporeRun) target)::setMinKnowVersion);
            isMutated |= updateField(((OxfordNanoporeRun) source).getProtocolVersion(), ((OxfordNanoporeRun) target).getProtocolVersion(), ((OxfordNanoporeRun) target)::setProtocolVersion);
            break;
        case IONTORRENT:
        case PACBIO:
        case SOLID:
            // Nothing to do
            break;
        default:
            throw new NotImplementedException();
    }
    isMutated |= updateSequencingParameters(target, user, filterParameters, sequencer);
    if (isNew) {
        create(target);
    } else if (isMutated) {
        update(target);
    }
    return isNew;
}
Also used : LS454Run(uk.ac.bbsrc.tgac.miso.core.data.LS454Run) SequencingContainerModel(uk.ac.bbsrc.tgac.miso.core.data.impl.SequencingContainerModel) User(com.eaglegenomics.simlims.core.User) OxfordNanoporeRun(uk.ac.bbsrc.tgac.miso.core.data.OxfordNanoporeRun) NotImplementedException(org.apache.commons.lang.NotImplementedException) Instrument(uk.ac.bbsrc.tgac.miso.core.data.Instrument) OxfordNanoporeRun(uk.ac.bbsrc.tgac.miso.core.data.OxfordNanoporeRun) IlluminaRun(uk.ac.bbsrc.tgac.miso.core.data.IlluminaRun) SolidRun(uk.ac.bbsrc.tgac.miso.core.data.SolidRun) Run(uk.ac.bbsrc.tgac.miso.core.data.Run) LS454Run(uk.ac.bbsrc.tgac.miso.core.data.LS454Run) IlluminaRun(uk.ac.bbsrc.tgac.miso.core.data.IlluminaRun)

Example 3 with LS454Run

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

the class Dtos method getPlatformRun.

private static Run getPlatformRun(RunDto from) {
    if (from instanceof IlluminaRunDto) {
        IlluminaRun run = new IlluminaRun();
        IlluminaRunDto illuminaDto = (IlluminaRunDto) from;
        setObject(run::setWorkflowType, illuminaDto.getWorkflowType(), wf -> IlluminaWorkflowType.get(wf));
        run.setNumCycles(illuminaDto.getNumCycles());
        run.setCallCycle(illuminaDto.getCalledCycles());
        run.setImgCycle(illuminaDto.getImagedCycles());
        run.setScoreCycle(illuminaDto.getScoredCycles());
        run.setPairedEnd(illuminaDto.getPairedEnd());
        setString(run::setRunBasesMask, illuminaDto.getBasesMask());
        return run;
    } else if (from instanceof IonTorrentRunDto) {
        return new IonTorrentRun();
    } else if (from instanceof Ls454RunDto) {
        LS454Run run = new LS454Run();
        Ls454RunDto ls454Dto = (Ls454RunDto) from;
        run.setCycles(ls454Dto.getCycles());
        run.setPairedEnd(ls454Dto.getPairedEnd());
        return run;
    } else if (from instanceof SolidRunDto) {
        SolidRun run = new SolidRun();
        SolidRunDto solidDto = (SolidRunDto) from;
        run.setPairedEnd(solidDto.getPairedEnd());
        return run;
    } else if (from instanceof OxfordNanoporeRunDto) {
        OxfordNanoporeRun run = new OxfordNanoporeRun();
        OxfordNanoporeRunDto ontDto = (OxfordNanoporeRunDto) from;
        setString(run::setMinKnowVersion, ontDto.getMinKnowVersion());
        setString(run::setProtocolVersion, ontDto.getProtocolVersion());
        return run;
    } else if (from instanceof PacBioRunDto) {
        return new PacBioRun();
    } else {
        throw new IllegalArgumentException("Unknown run type");
    }
}
Also used : IonTorrentRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IonTorrentRunDto) LS454Run(uk.ac.bbsrc.tgac.miso.core.data.LS454Run) OxfordNanoporeRun(uk.ac.bbsrc.tgac.miso.core.data.OxfordNanoporeRun) SolidRunDto(uk.ac.bbsrc.tgac.miso.dto.run.SolidRunDto) OxfordNanoporeRunDto(uk.ac.bbsrc.tgac.miso.dto.run.OxfordNanoporeRunDto) IlluminaRunDto(uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto) PacBioRun(uk.ac.bbsrc.tgac.miso.core.data.PacBioRun) IonTorrentRun(uk.ac.bbsrc.tgac.miso.core.data.IonTorrentRun) SolidRun(uk.ac.bbsrc.tgac.miso.core.data.SolidRun) IlluminaRun(uk.ac.bbsrc.tgac.miso.core.data.IlluminaRun) Ls454RunDto(uk.ac.bbsrc.tgac.miso.dto.run.Ls454RunDto) PacBioRunDto(uk.ac.bbsrc.tgac.miso.dto.run.PacBioRunDto)

Aggregations

IlluminaRun (uk.ac.bbsrc.tgac.miso.core.data.IlluminaRun)3 LS454Run (uk.ac.bbsrc.tgac.miso.core.data.LS454Run)3 OxfordNanoporeRun (uk.ac.bbsrc.tgac.miso.core.data.OxfordNanoporeRun)3 SolidRun (uk.ac.bbsrc.tgac.miso.core.data.SolidRun)3 IonTorrentRun (uk.ac.bbsrc.tgac.miso.core.data.IonTorrentRun)2 PacBioRun (uk.ac.bbsrc.tgac.miso.core.data.PacBioRun)2 IlluminaRunDto (uk.ac.bbsrc.tgac.miso.dto.run.IlluminaRunDto)2 IonTorrentRunDto (uk.ac.bbsrc.tgac.miso.dto.run.IonTorrentRunDto)2 Ls454RunDto (uk.ac.bbsrc.tgac.miso.dto.run.Ls454RunDto)2 OxfordNanoporeRunDto (uk.ac.bbsrc.tgac.miso.dto.run.OxfordNanoporeRunDto)2 PacBioRunDto (uk.ac.bbsrc.tgac.miso.dto.run.PacBioRunDto)2 SolidRunDto (uk.ac.bbsrc.tgac.miso.dto.run.SolidRunDto)2 User (com.eaglegenomics.simlims.core.User)1 NotImplementedException (org.apache.commons.lang.NotImplementedException)1 Instrument (uk.ac.bbsrc.tgac.miso.core.data.Instrument)1 Run (uk.ac.bbsrc.tgac.miso.core.data.Run)1 SequencingContainerModel (uk.ac.bbsrc.tgac.miso.core.data.impl.SequencingContainerModel)1