Search in sources :

Example 11 with Experiment

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

the class Dtos method to.

public static Submission to(@Nonnull SubmissionDto dto) {
    Submission to = new Submission();
    setLong(to::setId, dto.getId(), false);
    setString(to::setAccession, dto.getAccession());
    setString(to::setAlias, dto.getAlias());
    to.setCompleted(dto.isCompleted());
    setDate(to::setCreationDate, dto.getCreationDate());
    setString(to::setDescription, dto.getDescription());
    setDate(to::setSubmissionDate, dto.getSubmittedDate());
    setString(to::setTitle, dto.getTitle());
    to.setVerified(dto.isVerified());
    if (dto.getExperimentIds() != null && !dto.getExperimentIds().isEmpty()) {
        to.setExperiments(dto.getExperimentIds().stream().map(id -> {
            Experiment exp = new Experiment();
            exp.setId(id);
            return exp;
        }).collect(Collectors.toSet()));
    }
    return to;
}
Also used : Submission(uk.ac.bbsrc.tgac.miso.core.data.Submission) Experiment(uk.ac.bbsrc.tgac.miso.core.data.Experiment) 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)

Example 12 with Experiment

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

the class Dtos method to.

public static Experiment to(@Nonnull ExperimentDto dto) {
    Experiment to = new Experiment();
    setLong(to::setId, dto.getId(), false);
    setString(to::setAccession, dto.getAccession());
    to.setAlias(dto.getAlias());
    to.setDescription(dto.getDescription());
    setString(to::setName, dto.getName());
    to.setLibrary(to(dto.getLibrary()));
    to.setInstrumentModel(to(dto.getInstrumentModel()));
    to.setRunPartitions(dto.getPartitions().stream().map(rpDto -> {
        RunPartition rpTo = new RunPartition();
        rpTo.setExperiment(to);
        rpTo.setPartition(to(rpDto.getPartition()));
        rpTo.setRun(PlatformType.get(rpDto.getRun().getPlatformType()).createRun());
        rpTo.getRun().setId(rpDto.getRun().getId());
        return rpTo;
    }).collect(Collectors.toList()));
    to.setStudy(to(dto.getStudy()));
    to.setTitle(dto.getTitle());
    return to;
}
Also used : Experiment(uk.ac.bbsrc.tgac.miso.core.data.Experiment) RunPartition(uk.ac.bbsrc.tgac.miso.core.data.Experiment.RunPartition) 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)

Example 13 with Experiment

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

the class HibernateExperimentDaoIT method testUpdate.

@Test
public void testUpdate() throws Exception {
    long id = 4L;
    String newAlias = "New Alias";
    Experiment original = (Experiment) currentSession().get(Experiment.class, id);
    assertNotEquals(newAlias, original.getAlias());
    original.setAlias(newAlias);
    dao.save(original);
    clearSession();
    Experiment saved = (Experiment) currentSession().get(Experiment.class, id);
    assertEquals(newAlias, saved.getAlias());
}
Also used : Experiment(uk.ac.bbsrc.tgac.miso.core.data.Experiment) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Example 14 with Experiment

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

the class HibernateExperimentDaoIT method testCreate.

/**
 * Test method for {@link uk.ac.bbsrc.tgac.miso.persistence.impl.HibernateExperimentDao#save(uk.ac.bbsrc.tgac.miso.core.data.Experiment)}
 * .
 *
 * @throws IOException
 * @throws MisoNamingException
 */
@Test
public void testCreate() throws IOException, MisoNamingException {
    String name = "TEMPORARY_XXX";
    Experiment experiment = new Experiment();
    experiment.setName(name);
    InstrumentModel model = (InstrumentModel) currentSession().get(InstrumentModel.class, 16L);
    experiment.setInstrumentModel(model);
    User user = (User) currentSession().get(UserImpl.class, 1L);
    user.setId(1L);
    experiment.setChangeDetails(user);
    experiment.setTitle("Title");
    long savedId = dao.save(experiment);
    clearSession();
    Experiment saved = (Experiment) currentSession().get(Experiment.class, savedId);
    assertNotNull(saved);
    assertEquals(name, saved.getName());
}
Also used : User(com.eaglegenomics.simlims.core.User) Experiment(uk.ac.bbsrc.tgac.miso.core.data.Experiment) UserImpl(uk.ac.bbsrc.tgac.miso.core.data.impl.UserImpl) InstrumentModel(uk.ac.bbsrc.tgac.miso.core.data.InstrumentModel) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Example 15 with Experiment

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

the class HibernateExperimentDaoIT method testGetUsage.

@Test
public void testGetUsage() throws Exception {
    Experiment experiment = (Experiment) currentSession().get(Experiment.class, 1L);
    assertEquals(2L, dao.getUsage(experiment));
}
Also used : Experiment(uk.ac.bbsrc.tgac.miso.core.data.Experiment) AbstractDAOTest(uk.ac.bbsrc.tgac.miso.AbstractDAOTest) Test(org.junit.Test)

Aggregations

Experiment (uk.ac.bbsrc.tgac.miso.core.data.Experiment)17 IOException (java.io.IOException)5 Criteria (org.hibernate.Criteria)5 RunPartition (uk.ac.bbsrc.tgac.miso.core.data.Experiment.RunPartition)5 Collectors (java.util.stream.Collectors)3 Stream (java.util.stream.Stream)3 Test (org.junit.Test)3 Autowired (org.springframework.beans.factory.annotation.Autowired)3 Controller (org.springframework.stereotype.Controller)3 GetMapping (org.springframework.web.bind.annotation.GetMapping)3 PathVariable (org.springframework.web.bind.annotation.PathVariable)3 PostMapping (org.springframework.web.bind.annotation.PostMapping)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)3 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)3 IlluminaNotificationDto (ca.on.oicr.gsi.runscanner.dto.IlluminaNotificationDto)2 NotificationDto (ca.on.oicr.gsi.runscanner.dto.NotificationDto)2 OxfordNanoporeNotificationDto (ca.on.oicr.gsi.runscanner.dto.OxfordNanoporeNotificationDto)2 User (com.eaglegenomics.simlims.core.User)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2