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

Examples of uk.ac.bbsrc.tgac.miso.core.data.impl.ls454.LS454Pool


            e.printStackTrace();
          }
        }

        if (!runLog.startsWith("ERROR")) {
          Status is = new LS454Status(runLog);
          is.setHealth(ht);
          is.setRunName(runName);

          Run r = null;
          Matcher m = p.matcher(runName);
          if (m.matches()) {
            try {
              is.setInstrumentName(m.group(2));
              r = requestManager.getRunByAlias(runName);
            }
            catch(IOException ioe) {
              log.warn("Cannot find run by this alias. This usually means the run hasn't been previously imported. If attemptRunPopulation is false, processing will not take place for this run!");
            }
          }

          try {
            if (attemptRunPopulation) {
              if (r == null) {
                log.debug("\\_ Saving new run and status: " + is.getRunName());
                r = new LS454Run();
                r.setAlias(run.getString("runName"));
                r.setDescription(m.group(3));
                //TODO check this properly
                r.setPairedEnd(false);

                if (run.has("fullPath")) {
                  r.setFilePath(run.getString("fullPath"));
                }

                is.setInstrumentName(m.group(2));
                r.setStatus(is);

                SequencerReference sr = null;
                if (run.has("sequencerName")) {
                  sr = requestManager.getSequencerReferenceByName(run.getString("sequencerName"));
                }
                if (sr == null) {
                  sr = requestManager.getSequencerReferenceByName(m.group(2));
                }
                if (sr == null) {
                  sr = requestManager.getSequencerReferenceByName(r.getStatus().getInstrumentName());
                }

                if (run.has("completionDate")) {
                  try {
                    is.setCompletionDate(gsLogDateFormat.parse(run.getString("completionDate")));
                  }
                  catch (ParseException e) {
                    log.error(e.getMessage());
                    e.printStackTrace();
                  }
                }

                if (sr != null) {
                  r.setSequencerReference(sr);
                  runsToSave.add(r);
                }
                else {
                  log.error("\\_ Cannot save " + is.getRunName() + ": no sequencer reference available.");
                }
              }
              else {
                log.debug("\\_ Updating existing run and status: " + is.getRunName());

                r.setPlatformType(PlatformType.LS454);

                r.setDescription(m.group(3));
                //TODO check this properly
                r.setPairedEnd(false);

                if (r.getStatus() != null && run.has("status")) {
                  if (!r.getStatus().getHealth().equals(HealthType.Failed) && !r.getStatus().getHealth().equals(HealthType.Completed)) {
                    r.getStatus().setHealth(ht);
                  }
                }
                else {
                  if (run.has("status")) {
                    r.setStatus(is);
                  }
                }

                r.getStatus().setInstrumentName(m.group(2));

                if (r.getSequencerReference() == null) {
                  SequencerReference sr = null;
                  if (run.has("sequencerName")) {
                    sr = requestManager.getSequencerReferenceByName(run.getString("sequencerName"));
                  }
                  if (sr == null) {
                    sr = requestManager.getSequencerReferenceByName(m.group(2));
                  }
                  if (sr == null) {
                    sr = requestManager.getSequencerReferenceByName(r.getStatus().getInstrumentName());
                  }

                  if (sr != null) {
                    r.setSequencerReference(sr);
                  }
                }

                if (run.has("completionDate")) {
                  try {
                    r.getStatus().setCompletionDate(gsLogDateFormat.parse(run.getString("completionDate")));
                  }
                  catch (ParseException e) {
                    log.error(e.getMessage());
                    e.printStackTrace();
                  }
                }

                //update path if changed
                if (run.has("fullPath") && !"".equals(run.getString("fullPath")) && r.getFilePath() != null && !"".equals(r.getFilePath())) {
                  if (!run.getString("fullPath").equals(r.getFilePath())) {
                    log.debug("Updating run file path:" + r.getFilePath() + " -> " + run.getString("fullPath"));
                    r.setFilePath(run.getString("fullPath"));
                  }
                }

                // update status if run isn't completed or failed
                if (!r.getStatus().getHealth().equals(HealthType.Completed) && !r.getStatus().getHealth().equals(HealthType.Failed)) {
                  log.debug("Saving previously saved status: " + is.getRunName() + " (" + r.getStatus().getHealth().getKey() + " -> " + is.getHealth().getKey() + ")");
                  r.setStatus(is);
                }
              }

              if (r.getSequencerReference() != null) {
View Full Code Here

TOP

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

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.