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

Examples of uk.ac.bbsrc.tgac.miso.core.data.type.PlatformType


    DateFormat df = new SimpleDateFormat("dd/mm/yyyy");

    String alias = json.getString("alias");
    Double concentration = json.getDouble("concentration");
    PlatformType platformType = PlatformType.get(json.getString("platformType"));

    StringBuilder sb = new StringBuilder();
    List<Integer> ids  = JSONArray.fromObject(json.getString("dilutions"));

    List<PoolQC> pqcs = new ArrayList<PoolQC>();
    JSONArray qcs = JSONArray.fromObject(json.get("qcs"));
    for (JSONObject q : (Iterable<JSONObject>) qcs) {
      PoolQC s = dataObjectFactory.getPoolQC();

      try {
        s.setResults(Double.valueOf(q.getString("poolQcResults")));
        s.setQcCreator(SecurityContextHolder.getContext().getAuthentication().getName());
        s.setQcDate(df.parse(q.getString("poolQcDate")));
        s.setQcType(requestManager.getPoolQcTypeById(q.getLong("poolQcType")));
      }
      catch (IOException e) {
        e.printStackTrace();
        return JSONUtils.SimpleJSONError("Failed: " + e.getMessage());
      }
      catch (ParseException e) {
        e.printStackTrace();
        return JSONUtils.SimpleJSONError("Failed: " + e.getMessage());
      }
      pqcs.add(s);
    }

    if (ids.size() > 0 && platformType != null && concentration != null) {
      try {
        User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());

        List<Dilution> dils = new ArrayList<Dilution>();
        for (Integer id : ids) {
          dils.add(requestManager.getDilutionByIdAndPlatform(id.longValue(), platformType));
        }

        boolean barcodeCollision = false;
        if (dils.size() > 1) {
          for (Dilution d1 : dils) {
            if (d1 != null) {
              for (Dilution d2 : dils) {
                if (d2 != null && !d1.equals(d2)) {
                  if (!d1.getLibrary().getTagBarcodes().isEmpty() && !d2.getLibrary().getTagBarcodes().isEmpty()) {
                    if (d1.getLibrary().getTagBarcodes().equals(d2.getLibrary().getTagBarcodes())) {
                      barcodeCollision = true;
                    }
                  }
                }
              }
            }
          }
        }

        if (!barcodeCollision) {

          Pool pool;
          //TODO special type of pool for LibraryDilutions that will go on to be emPCRed as a whole
          if (dils.get(0) instanceof LibraryDilution &&
              (platformType.equals(PlatformType.SOLID) || platformType.equals(PlatformType.LS454))) {
            pool = dataObjectFactory.getEmPCRPool(platformType, user);
          }
          else {
            pool = dataObjectFactory.getPoolOfType(platformType, user);
          }
View Full Code Here


    return JSONUtils.JSONObjectResponse("html", sb.toString());
  }

  public JSONObject populateDilutions(HttpSession session, JSONObject json) {
    Long projectId = json.getLong("projectId");
    PlatformType platformType = PlatformType.get(json.getString("platformType"));
    try {
      StringBuilder b = new StringBuilder();

      JSONArray a = new JSONArray();
      List<Dilution> dls = new ArrayList<Dilution>(requestManager.listAllDilutionsByProjectAndPlatform(projectId, platformType));
View Full Code Here

          log.debug("Cache hit on map for Run " + id);
          return (Run)element.getObjectValue();
        }
      }

      PlatformType platformtype = PlatformType.get(rs.getString("platformType"));
      Run r = dataObjectFactory.getRunOfType(platformtype);
      r.setId(id);
      r.setAlias(rs.getString("alias"));
      r.setAccession(rs.getString("accession"));
      r.setName(rs.getString("name"));
View Full Code Here

        Map<String, Object> responseMap = new HashMap<String, Object>();
        runId = Long.parseLong(json.getString("runId"));
        Run storedRun = requestManager.getRunById(runId);
        String storedPlatformType = storedRun.getPlatformType().getKey();

        PlatformType newPt = PlatformType.get(newRuntype);
        if (newPt != null) {
          log.info("STORED: " + newRuntype + " :: " + storedPlatformType);
          if (!newRuntype.equals(storedPlatformType)) {
            run = dataObjectFactory.getRunOfType(newPt, user);
            run.setId(storedRun.getId());
          }
          else {
            run = storedRun;
          }

          session.setAttribute("run_" + cId, run);
          responseMap.put("partitions", getPlatformRunOptions(run));
          StringBuilder srb = new StringBuilder();
          srb.append("<select name='sequencer' id='sequencerReference' onchange='Run.ui.populateRunOptions(this);'>");
          srb.append("<option value='0' selected='selected'>Please select...</option>");
          for (SequencerReference sr : requestManager.listSequencerReferencesByPlatformType(newPt)) {
            srb.append("<option value='" + sr.getId() + "'>" + sr.getName() + " (" + sr.getPlatform().getInstrumentModel() + ")</option>");
          }
          srb.append("</select>");
          responseMap.put("sequencers", srb.toString());
        }
        else {
          return JSONUtils.SimpleJSONError("Unrecognised PlatformType");
        }
        return JSONUtils.JSONObjectResponse(responseMap);
      }
      else {
        //new run
        Map<String, Object> responseMap = new HashMap<String, Object>();

        PlatformType newPt = PlatformType.get(newRuntype);
        if (newPt != null) {
          StringBuilder srb = new StringBuilder();
          srb.append("<select name='sequencer' id='sequencerReference' onchange='Run.ui.populateRunOptions(this);'>");
          srb.append("<option value='0' selected='selected'>Please select...</option>");
          for (SequencerReference sr : requestManager.listSequencerReferencesByPlatformType(newPt)) {
View Full Code Here

  public JSONObject populateRunOptions(HttpSession session, JSONObject json) {
    Long sequencerReferenceId = json.getLong("sequencerReference");
    String cId = json.getString("run_cId");
    try {
      SequencerReference sr = requestManager.getSequencerReferenceById(sequencerReferenceId);
      PlatformType pt = sr.getPlatform().getPlatformType();
      Map<String, Object> responseMap = new HashMap<String, Object>();
      User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());

      Run run = dataObjectFactory.getRunOfType(pt, user);
      run.setSequencerReference(sr);
View Full Code Here

  }

  public JSONObject changeContainer(HttpSession session, JSONObject json) {
    if (json.has("platform")) {
      String platform = json.getString("platform");
      PlatformType pt = PlatformType.get(platform);
      if (pt != null) {
        if (pt.equals(PlatformType.ILLUMINA)) {
          return changeIlluminaContainer(session, json);
        }
        else if (pt.equals(PlatformType.LS454)) {
          return changeLS454Container(session, json);
        }
        else if (pt.equals(PlatformType.SOLID)) {
          return changeSolidContainer(session, json);
        }
        else if (pt.equals(PlatformType.IONTORRENT)) {
          return null;
        }
        else if (pt.equals(PlatformType.PACBIO)) {
          return changePacBioContainer(session, json);
        }
        else {
          return JSONUtils.SimpleJSONError("Unrecognised platform type: " + platform);
        }
View Full Code Here

  }

  public JSONObject changeChamber(HttpSession session, JSONObject json) {
    if (json.has("platform")) {
      String platform = json.getString("platform");
      PlatformType pt = PlatformType.get(platform);
      if (pt != null) {
        if (pt.equals(PlatformType.LS454)) {
          return changeLS454Chamber(session, json);
        }
        else if (pt.equals(PlatformType.SOLID)) {
          return changeSolidChamber(session, json);
        }
        else if (pt.equals(PlatformType.PACBIO)) {
          return changePacBioChamber(session, json);
        }
        else {
          return JSONUtils.SimpleJSONError("Unrecognised platform type: " + platform);
        }
View Full Code Here

          barcode = new String(Base64.decodeBase64(barcode));
        }
      }

      if (json.has("platform") && !"".equals(json.getString("platform"))) {
        PlatformType pt = PlatformType.get(json.getString("platform"));
        if (pt != null) {
          p = requestManager.getPoolByBarcode(barcode, pt);
        }
        else {
          p = requestManager.getPoolByBarcode(barcode);
View Full Code Here

    try {
      if (json.has("platformId") && !"".equals(json.getString("platformId"))) {
        Long platformId = json.getLong("platformId");
        Platform platform = requestManager.getPlatformById(platformId);
        if (platform != null) {
          PlatformType pt = platform.getPlatformType();
          List<Pool<? extends Poolable>> pools = new ArrayList<Pool<? extends Poolable>>(requestManager.listAllPoolsByPlatform(pt));
          //Collections.sort(pools, Collections.<Pool<? extends Poolable>>reverseOrder());
          Collections.sort(pools);
          for (Pool p : pools) {
            a.append("<div bind='"+p.getId()+"' onMouseOver='this.className=\"dashboardhighlight\"' onMouseOut='this.className=\"dashboard\"' class='dashboard' style='position:relative' ");
View Full Code Here

    return JSONUtils.JSONObjectResponse("html", b.toString());
  }

  public JSONObject changePlatformType(HttpSession session, JSONObject json) {
    String newContainerType = json.getString("platformtype");
    PlatformType pt = PlatformType.get(newContainerType);
    String cId = json.getString("container_cId");
    try {
      User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());

      Map<String, Object> responseMap = new HashMap<String, Object>();
View Full Code Here

TOP

Related Classes of uk.ac.bbsrc.tgac.miso.core.data.type.PlatformType

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.