public JSONObject plateElementsDataTable(HttpSession session, JSONObject json) { if (json.has("plateId")) { try { JSONObject j = new JSONObject(); JSONArray jsonArray = new JSONArray(); long plateId = json.getLong("plateId"); Plate<? extends List<? extends Plateable>, ? extends Plateable> plate = requestManager.getPlateById(plateId); if (plate != null) { for (Plateable p : plate.getElements()) { if (p instanceof Library) { Library l = (Library) p; String strategyName = "No barcode"; StringBuilder seqbuilder = new StringBuilder(); if (!l.getTagBarcodes().isEmpty()) { int count = 1; Collection<TagBarcode> barcodes = l.getTagBarcodes().values(); for (TagBarcode tb : barcodes) { strategyName = tb.getStrategyName(); seqbuilder.append(tb.getSequence()); if (l.getTagBarcodes().values().size() > 1 && count < l.getTagBarcodes().values().size()) { seqbuilder.append("-"); } count++; } } else { log.info("No tag barcodes!"); } jsonArray.add( "['" + l.getName() + "','" + l.getAlias() + "','" + strategyName + "','" + seqbuilder.toString() + "','" + "<a href=\"/miso/library/" + l.getId() + "\"><span class=\"ui-icon ui-icon-pencil\"></span></a>" + "']"); } } } j.put("elementsArray", jsonArray); return j; } catch (IOException e) { log.debug("Failed", e); return JSONUtils.SimpleJSONError("Failed: " + e.getMessage()); } } else { return JSONUtils.SimpleJSONError("No plates to show"); } }
@Override public Set<File> generateFilePath(SequencerPoolPartition partition, Dilution l) throws SubmissionException { Pool<? extends Poolable> pool = partition.getPool(); if (pool != null) { if (pool.getExperiments() != null) { Collection<Experiment> experiments = pool.getExperiments(); Experiment experiment = experiments.iterator().next(); StringBuilder filePath = new StringBuilder(); if (!"".equals(basePath)) { filePath.append( partition.getSequencerPartitionContainer().getRun().getFilePath() + "/Data/Intensities/BaseCalls/PAP/Project_" + experiment.getStudy().getProject().getAlias() + "/Sample_" + l.getLibrary().getName() + "/" + l.getLibrary().getName()); } else { filePath.append( basePath + "/" + experiment.getStudy().getProject().getAlias() + "/Sample_" + l.getLibrary().getName() + "/" + l.getLibrary().getName()); } if (l.getLibrary().getTagBarcodes() != null && !l.getLibrary().getTagBarcodes().isEmpty()) { filePath.append("_"); for (TagBarcode tb : l.getLibrary().getTagBarcodes().values()) { filePath.append(tb.getSequence()); } } filePath.append("_L00" + partition.getPartitionNumber() + "*.fastq.gz"); Set<File> files = new HashSet<File>(); files.add(new File(filePath.toString())); return files; } else { throw new SubmissionException("partition.getPool=null!"); } } else { throw new SubmissionException("Collection of experiments is empty"); } }