//gets studies and experiments for the project that has been selected
if (json.has("projectId") && !json.get("projectId").equals("")) {
StringBuilder sb = new StringBuilder();
Long projectId = json.getLong("projectId");
Project p = requestManager.getProjectById(projectId);
for (Study s : p.getStudies()) {
Collection<Experiment> experiments = requestManager.listAllExperimentsByStudyId(s.getId());
s.setExperiments(experiments);
}
//gets the runs for the project
List<Run> runs = new ArrayList<Run>(requestManager.listAllRunsByProjectId(projectId));
Collections.sort(runs);
//creates HTML list of runs
if (runs.size() > 0) {
sb.append("<ul id='runList" + projectId + "'>");
for (Run r : runs) {
sb.append("<li>");
sb.append("<a href='/miso/run/" + r.getId() + "'><b>" + r.getName() + "</b> : " + r.getAlias() + "</a>");
sb.append("<input type='hidden' id='RUN_"+r.getId()+"' name='RUN_"+r.getId()+"' value='"+r.getId()+"'/>");
sb.append("<ul>");
//creates HTML list of partition containers for each run
Collection<SequencerPartitionContainer<SequencerPoolPartition>> partitionContainers = requestManager.listSequencerPartitionContainersByRunId(r.getId());
for (SequencerPartitionContainer<SequencerPoolPartition> partitionContainer : partitionContainers) {
sb.append("<li>");
sb.append("<b>" + partitionContainer.getIdentificationBarcode() + "</b> : " + partitionContainer.getId());
sb.append("<ul>");
//creates HTML list of partitions for each partition container
Collection<SequencerPoolPartition> partitions = partitionContainer.getPartitions();
for (SequencerPoolPartition part : partitions) {
// Checks whether the partition was involved in the project.
boolean partitionInvolved = false;
if (part.getPool() != null) {
Collection<Experiment> exps = part.getPool().getExperiments();
List<String> involvedExperiments = new ArrayList<String>();
for (Experiment e : exps) {
if (e.getStudy().getProject().getProjectId().equals(p.getProjectId())) {
involvedExperiments.add(e.getStudy().getProject().getAlias());
partitionInvolved = true;
}
}