Package uk.ac.bbsrc.tgac.miso.core.data.impl

Examples of uk.ac.bbsrc.tgac.miso.core.data.impl.SequencerPartitionContainerImpl


                    String ptpId = ptp.getElementsByTagName("id").item(0).getTextContent();

                    if (fs.isEmpty()) {
                      if (ptp.getElementsByTagName("padLayout").getLength() > 0 && ptp.getElementsByTagName("padLayout").item(0) != null) {
                        int numPartitions = Integer.parseInt(ptp.getElementsByTagName("padLayout").item(0).getTextContent().split("_")[0]);
                        SequencerPartitionContainer f = new SequencerPartitionContainerImpl();
                        if (f.getPlatformType() == null && r.getPlatformType() != null) {
                          f.setPlatformType(r.getPlatformType());
                        }
                        else {
                          f.setPlatformType(PlatformType.LS454);
                        }
                        f.setPartitionLimit(numPartitions);
                        f.initEmptyPartitions();
                        f.setIdentificationBarcode(ptpId);

                        log.debug("\\_ Created new SequencerPartitionContainer with "+f.getPartitions().size()+" partitions");
                        ((RunImpl)r).addSequencerPartitionContainer(f);
                      }
                    }
                    else {
                      SequencerPartitionContainer f = fs.iterator().next();
                      log.debug("\\_ Got SequencerPartitionContainer " + f.getId());
                      if (f.getPlatformType() == null && r.getPlatformType() != null) {
                        f.setPlatformType(r.getPlatformType());
                      }
                      else {
                        f.setPlatformType(PlatformType.LS454);
                      }
                      if (f.getIdentificationBarcode() == null || "".equals(f.getIdentificationBarcode())) {
                        f.setIdentificationBarcode(ptpId);
                        long flowId = requestManager.saveSequencerPartitionContainer(f);
                        f.setId(flowId);
                      }
                    }
                  }
                  catch (ParserConfigurationException e) {
                    log.error(e.getMessage());
View Full Code Here


                    //more than one flowcell hit to this barcode
                    log.warn(r.getAlias() + ":: More than one partition container has this barcode. Cannot automatically link to a pre-existing barcode.");
                  }
                }
                else {
                  SequencerPartitionContainer<SequencerPoolPartition> f = new SequencerPartitionContainerImpl();
                  f.setSecurityProfile(r.getSecurityProfile());
                  if (f.getPlatformType() == null && r.getPlatformType() != null) {
                    f.setPlatformType(r.getPlatformType());
                  }
                  else {
                    f.setPlatformType(PlatformType.ILLUMINA);
                  }
                  if (run.has("laneCount")) {
                    f.setPartitionLimit(run.getInt("laneCount"));
                  }
                  else {
                    if (r.getSequencerReference().getPlatform().getInstrumentModel().contains("MiSeq")) {
                      f.setPartitionLimit(1);
                    }
                  }

                  f.initEmptyPartitions();
                  f.setIdentificationBarcode(run.getString("containerId"));
                  ((RunImpl)r).addSequencerPartitionContainer(f);
                }
              }
            }
            else {
              SequencerPartitionContainer<SequencerPoolPartition> f = fs.iterator().next();
              f.setSecurityProfile(r.getSecurityProfile());
              if (f.getPlatformType() == null && r.getPlatformType() != null) {
                f.setPlatformType(r.getPlatformType());
              }
              else {
                f.setPlatformType(PlatformType.ILLUMINA);
              }

              if (f.getPartitions().isEmpty()) {
                //log.info("No partitions found for run " + r.getName() + " (container "+f.getContainerId()+")");
                if (run.has("laneCount")) {
                  f.setPartitionLimit(run.getInt("laneCount"));
                }
                else {
                  if (r.getSequencerReference().getPlatform().getInstrumentModel().contains("MiSeq")) {
                    f.setPartitionLimit(1);
                  }
                }
                f.initEmptyPartitions();
              }
              else {
                //log.info("Got "+f.getPartitions().size()+" partitions for run " + r.getName() + " (container "+f.getContainerId()+")");
                if (r.getSequencerReference().getPlatform().getInstrumentModel().contains("MiSeq")) {
                  if (f.getPartitions().size() != 1) {
                    log.warn(f.getName()+":: WARNING - number of partitions found ("+f.getPartitions().size()+") doesn't match usual number of MiSeq partitions (1)");
                  }
                }
                else if (r.getSequencerReference().getPlatform().getInstrumentModel().contains("2500")) {
                  if (f.getPartitions().size() != 2 && f.getPartitions().size() != 8) {
                    log.warn(f.getName()+":: WARNING - number of partitions found ("+f.getPartitions().size()+") doesn't match usual number of HiSeq 2500 partitions (2/8)");
                  }
                }
                else {
                  if (f.getPartitions().size() != 8) {
                    log.warn(f.getName()+":: WARNING - number of partitions found ("+f.getPartitions().size()+") doesn't match usual number of GA/HiSeq partitions (8)");
                    log.warn("Attempting fix...");
                    Map<Integer, Partition> parts = new HashMap<Integer, Partition>();
                    Partition notNullPart = f.getPartitions().get(0);
                    long notNullPartID = notNullPart.getId();
                    int notNullPartNum = notNullPart.getPartitionNumber();

                    for (int i = 1; i < 9; i++) {
                      parts.put(i, null);
                    }

                    for (Partition p : f.getPartitions()) {
                      parts.put(p.getPartitionNumber(), p);
                    }

                    for (Integer num : parts.keySet()) {
                      if (parts.get(num) == null) {
                        long newId = (notNullPartID-notNullPartNum)+num;
                        log.info("Inserting partition at "+num+" with ID "+ newId);
                        SequencerPoolPartition p = new PartitionImpl();
                        p.setSequencerPartitionContainer(f);
                        p.setId(newId);
                        p.setPartitionNumber(num);
                        p.setSecurityProfile(f.getSecurityProfile());
                        ((SequencerPartitionContainerImpl)f).addPartition(p);
                      }
                    }

                    log.info(f.getName()+":: partitions now ("+f.getPartitions().size()+")");
                  }
                }
              }

              if (f.getIdentificationBarcode() == null || "".equals(f.getIdentificationBarcode())) {
                if (run.has("containerId") && !"".equals(run.getString("containerId"))) {
                  //log.info("Updating container barcode for container "+f.getContainerId()+" (" + r.getName() + ")");
                  f.setIdentificationBarcode(run.getString("containerId"));
                  //requestManager.saveSequencerPartitionContainer(f);
                }
              }
            }
View Full Code Here

                      }
                    }
                    else {
                      if (run.has("cells")) {
                        JSONArray cells = run.getJSONArray("cells");
                        SequencerPartitionContainer f = new SequencerPartitionContainerImpl();
                        f.setPartitionLimit(cells.size());
                        f.initEmptyPartitions();
                        if (run.has("plateId") && !"".equals(run.getString("plateId"))) {
                          f.setIdentificationBarcode(run.getString("plateId"));
                        }
                        if (f.getPlatformType() == null && r.getPlatformType() != null) {
                          f.setPlatformType(r.getPlatformType());
                        }
                        else {
                          f.setPlatformType(PlatformType.PACBIO);
                        }
                        f.setRun(r);
                        log.info("\\_ Created new container with "+f.getPartitions().size()+" partitions");
                        long flowId = requestManager.saveSequencerPartitionContainer(f);
                        f.setId(flowId);
                        ((RunImpl)r).addSequencerPartitionContainer(f);
                        //TODO match up samples to libraries and pools?
                        /*
                        for (JSONObject obj : (Iterable<JSONObject>)cells) {
                          int cellindex = obj.getInt("index");
                          String sample = obj.getString("sample");

                          SequencerPoolPartition p = f.getPartitionAt(cellindex);
                          if (p.getPool() == null) {
                            Pool pool = new PoolImpl();

                          }
                        }
                        */
                      }
                    }
                  }
                }
                else {
                  SequencerPartitionContainer f = fs.iterator().next();
                  f.setSecurityProfile(r.getSecurityProfile());
                  if (f.getPlatformType() == null && r.getPlatformType() != null) {
                    f.setPlatformType(r.getPlatformType());
                  }
                  else {
                    f.setPlatformType(PlatformType.PACBIO);
                  }
                  if (f.getIdentificationBarcode() == null || "".equals(f.getIdentificationBarcode())) {
                    if (run.has("plateId") && !"".equals(run.getString("plateId"))) {
                      f.setIdentificationBarcode(run.getString("plateId"));
                      requestManager.saveSequencerPartitionContainer(f);
                    }
                  }
                }

View Full Code Here

                      ((RunImpl)r).addSequencerPartitionContainer(lf);
                    }
                  }
                  else {
                    log.debug("No containers linked to run " + r.getId() + ": creating...");
                    SequencerPartitionContainer f = new SequencerPartitionContainerImpl();
                    f.setSecurityProfile(r.getSecurityProfile());
                    f.initEmptyPartitions();
                    f.setIdentificationBarcode(run.getString("containerNum"));
                    if (f.getPlatformType() == null && r.getPlatformType() != null) {
                      f.setPlatformType(r.getPlatformType());
                    }
                    else {
                      f.setPlatformType(PlatformType.SOLID);
                    }
                    //f.setPaired(r.getPairedEnd());
                    ((RunImpl)r).addSequencerPartitionContainer(f);
                  }
                }
              }
              else {
                SequencerPartitionContainer f = fs.iterator().next();
                log.debug("Got container " + f.getId());

                if (f.getSecurityProfile() == null) {
                  f.setSecurityProfile(r.getSecurityProfile());
                }

                if (f.getPlatformType() == null && r.getPlatformType() != null) {
                  f.setPlatformType(r.getPlatformType());
                }
                else {
                  f.setPlatformType(PlatformType.SOLID);
                }

                if (run.has("containerId") && !"".equals(run.getString("containerId"))) {
                  f.setIdentificationBarcode(run.getString("containerId"));
                }

                long flowId = requestManager.saveSequencerPartitionContainer(f);
                f.setId(flowId);
              }

              updatedRuns.put(r.getAlias(), r);
              runsToSave.add(r);
            }
View Full Code Here

TOP

Related Classes of uk.ac.bbsrc.tgac.miso.core.data.impl.SequencerPartitionContainerImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.