/** * Given an experiment, we see for each condition if a new growth medium is associated to the cell * line, and if new media are found, these are added to the medium binding list. * * @param experiment */ public void addNewMedia(Experiment experiment) { for (PlateCondition plateCondition : experiment.getPlateConditionList()) { CellLine cellLine = plateCondition.getCellLine(); String medium = cellLine.getGrowthMedium(); if (!mediumBindingList.contains(medium)) { mediumBindingList.add(medium); } } }
/** * this method assigns values for each new condition, from the previously created 8and set-up) one * * @param newCondition */ private void initNewCondition(PlateCondition newCondition) { PlateCondition previousCondition = plateConditionBindingList.get(previousConditionIndex); // set the name newCondition.setName("Condition " + ++conditionIndex); // set the cell line (the same as the previous condition) CellLine cellLine = previousCondition.getCellLine(); CellLine newCellLine = new CellLine( cellLine.getSeedingTime(), cellLine.getSeedingDensity(), cellLine.getGrowthMedium(), cellLine.getSerumConcentration(), cellLine.getCellLineType(), cellLine.getSerum()); newCondition.setCellLine(newCellLine); newCellLine.setPlateCondition(newCondition); // set assay medium (another object, but with the same parameters as previous condition) String medium = mediumBindingList.get( treatmentsController.getTreatmentsPanel().getAssayMediumComboBox().getSelectedIndex()); String serum = serumBindingList.get( treatmentsController.getTreatmentsPanel().getSerumComboBox().getSelectedIndex()); Double serumConcentration = Double.parseDouble( treatmentsController.getTreatmentsPanel().getSerumConcentrationTextField().getText()); Double volume = Double.parseDouble( treatmentsController.getTreatmentsPanel().getMediumVolumeTextField().getText()); AssayMedium assayMedium = new AssayMedium(medium, serum, serumConcentration, volume); newCondition.setAssayMedium(assayMedium); assayMedium.setPlateCondition(newCondition); // set assay and ecm (get the values according to the last selected ones) Ecm ecm = new Ecm(); Assay assay = null; BottomMatrix bottomMatrix = null; // need to set different values according to matrix dimension: 2D or 3D or 2.5D switch (assayEcmController .getMatrixDimensionBindingList() .get(setupConditionsPanel.getEcmDimensionComboBox().getSelectedIndex()) .getDimension()) { case "2D": // set assay assay = assayEcmController .getAssay2DBindingList() .get(assayEcmController.getAssayEcm2DPanel().getAssayComboBox().getSelectedIndex()); // 2D matrix: set ecm 2D fields ecm.setEcmComposition( assayEcmController .getEcm2DCompositionBindingList() .get( assayEcmController .getAssayEcm2DPanel() .getCompositionComboBox() .getSelectedIndex())); ecm.setConcentration( Double.parseDouble( assayEcmController.getAssayEcm2DPanel().getConcentrationTextField().getText())); ecm.setVolume( Double.parseDouble( assayEcmController.getAssayEcm2DPanel().getVolumeTextField().getText())); ecm.setCoatingTime( assayEcmController.getAssayEcm2DPanel().getCoatingTimeTextField().getText()); ecm.setCoatingTemperature( assayEcmController.getAssayEcm2DPanel().getCoatingTemperatureTextField().getText()); ecm.setVolumeUnit(assayEcmController.getAssayEcm2DPanel().getVolumeUnitLabel().getText()); ecm.setConcentrationUnit( assayEcmController .getAssayEcm2DPanel() .getConcentrationUnitOfMeasure() .getSelectedItem() .toString()); break; case "3D": // set assay assay = assayEcmController .getAssay3DBindingList() .get(assayEcmController.getAssayEcm3DPanel().getAssayComboBox().getSelectedIndex()); // 3D matrix: set ecm 3D fields ecm.setEcmComposition( assayEcmController .getEcm3DCompositionBindingList() .get( assayEcmController .getAssayEcm3DPanel() .getCompositionComboBox() .getSelectedIndex())); ecm.setEcmDensity( assayEcmController .getEcmDensityBindingList() .get( assayEcmController .getAssayEcm3DPanel() .getDensityComboBox() .getSelectedIndex())); // bottom matrix bottomMatrix = assayEcmController .getBottomMatrixBindingList() .get( assayEcmController .getAssayEcm3DPanel() .getBottomMatrixTypeComboBox() .getSelectedIndex()); ecm.setBottomMatrix(bottomMatrix); switch (bottomMatrix.getType()) { case "gel": // both top and bottom matrix volumes String text = assayEcmController.getAssayEcm3DPanel().getTopMatrixVolumeTextField().getText(); if (!text.isEmpty()) { ecm.setTopMatrixVolume(Double.parseDouble(text)); } else { ecm.setTopMatrixVolume(40.0); } ecm.setBottomMatrixVolume( Double.parseDouble( assayEcmController .getAssayEcm3DPanel() .getBottomMatrixVolumeTextField() .getText())); break; case "thin gel coating": // top matrix but no bottom matrix volume ecm.setTopMatrixVolume( Double.parseDouble( assayEcmController .getAssayEcm3DPanel() .getTopMatrixVolumeTextField() .getText())); break; } ecm.setPolymerisationTime( assayEcmController.getAssayEcm3DPanel().getPolymerizationTimeTextField().getText()); ecm.setPolymerisationTemperature( assayEcmController .getAssayEcm3DPanel() .getPolymerizationTemperatureTextField() .getText()); ecm.setPolymerisationPh( assayEcmController .getPolymerisationPhBindingList() .get( assayEcmController .getAssayEcm3DPanel() .getPolymerizationPhComboBox() .getSelectedIndex())); break; case "2.5D": // set assay assay = assayEcmController .getAssay25DBindingList() .get( assayEcmController.getAssayEcm25DPanel().getAssayComboBox().getSelectedIndex()); // 3D matrix: set ecm 2.5D fields ecm.setEcmComposition( assayEcmController .getEcm25DCompositionBindingList() .get( assayEcmController .getAssayEcm25DPanel() .getCompositionComboBox() .getSelectedIndex())); ecm.setEcmDensity( assayEcmController .getEcmDensityBindingList() .get( assayEcmController .getAssayEcm25DPanel() .getDensityComboBox() .getSelectedIndex())); // bottom matrix bottomMatrix = assayEcmController .getBottomMatrixBindingList() .get( assayEcmController .getAssayEcm25DPanel() .getBottomMatrixTypeComboBox() .getSelectedIndex()); ecm.setBottomMatrix(bottomMatrix); switch (bottomMatrix.getType()) { case "gel": // bottom matrix volume ecm.setBottomMatrixVolume( Double.parseDouble( assayEcmController .getAssayEcm25DPanel() .getBottomMatrixVolumeTextField() .getText())); break; } ecm.setPolymerisationTime( assayEcmController.getAssayEcm25DPanel().getPolymerizationTimeTextField().getText()); ecm.setPolymerisationTemperature( assayEcmController .getAssayEcm25DPanel() .getPolymerizationTemperatureTextField() .getText()); ecm.setPolymerisationPh( assayEcmController .getPolymerisationPhBindingList() .get( assayEcmController .getAssayEcm25DPanel() .getPolymerizationPhComboBox() .getSelectedIndex())); break; } newCondition.setAssay(assay); newCondition.setEcm(ecm); // create new treatment with same parameters as ones from previous condition List<Treatment> treatmentList = new ArrayList<>(); ObservableList<Treatment> treatmentBindingList = treatmentsController.getTreatmentBindingList(); for (Treatment treatment : treatmentBindingList) { Double concentration = treatment.getConcentration(); String concentrationUnit = treatment.getConcentrationUnit(); String timing = treatment.getTiming(); String drugSolvent = treatment.getDrugSolvent(); Double drugSolventConcentration = treatment.getDrugSolventConcentration(); TreatmentType treatmentType = treatment.getTreatmentType(); Treatment newTreatment = new Treatment( concentration, concentrationUnit, timing, drugSolvent, drugSolventConcentration, treatmentType); newTreatment.setPlateCondition(newCondition); treatmentList.add(newTreatment); } newCondition.setTreatmentList(treatmentList); // set an empty collection of wells (wells are not recalled from previous condition) List<Well> wellList = new ArrayList<>(); newCondition.setWellList(wellList); }