Ejemplo n.º 1
0
  // Added by Fawaz Ghali 13/05/2014 exportProteoAnnotator
  private String proteoAnnotatorLineToString(ProteinAmbiguityGroup pag) {

    String line = "";
    List<UserParam> userParams = pag.getUserParam();
    String countNonA = "";
    String scoreNonA = "";
    String nonAPeptide = "";
    String aGenes = "";
    String qValue = "";
    for (int i = 0; i < userParams.size(); i++) {
      UserParam userParam = userParams.get(i);

      if (userParam.getName().equals("nonAPeptide")) {
        nonAPeptide = userParam.getValue();
      }
    }
    List<CvParam> cvParamList = pag.getCvParam();
    for (int i = 0; i < cvParamList.size(); i++) {
      CvParam cvParam = cvParamList.get(i);
      if (cvParam.getAccession().equals("MS:1002474")) {
        scoreNonA = cvParam.getValue();
      }

      if (cvParam.getAccession().equals("MS:1002475")) {
        countNonA = cvParam.getValue();
      }
      if (cvParam.getAccession().equals("MS:1002373")) {
        qValue = cvParam.getValue();
      }
    }

    List<ProteinDetectionHypothesis> proteinDetectionHypothesisList =
        pag.getProteinDetectionHypothesis();
    for (int i = 0; i < proteinDetectionHypothesisList.size(); i++) {
      ProteinDetectionHypothesis proteinDetectionHypothesis = proteinDetectionHypothesisList.get(i);
      if (proteinDetectionHypothesis.getDBSequenceRef().startsWith("dbseq_generic|A_"))
        aGenes = aGenes + proteinDetectionHypothesis.getDBSequenceRef() + ";";
    }

    line = countNonA + sep + scoreNonA + sep + nonAPeptide + sep + aGenes + sep + qValue;
    return line;
  }
Ejemplo n.º 2
0
  private String pdhToString(ProteinDetectionHypothesis pdh) {
    String pdhString =
        "\""
            + dbSequenceIdHashMap.get(pdh.getDBSequenceRef()).getAccession()
            + "\""
            + sep
            + pdh.isPassThreshold()
            + sep;

    DBSequence dbSeq = dbSequenceIdHashMap.get(pdh.getDBSequenceRef());
    String protDesc = "";

    String protGroupMembership = "";

    if (dbSeq != null) {
      for (CvParam cvParam : dbSeq.getCvParam()) {
        if (cvParam.getAccession().equals("MS:1001088")) { // Protein description

          String description = cvParam.getValue().replaceAll("\"", ""); // remove internal "
          protDesc = "\"" + description + "\"";
        }
      }
    }

    Map<String, String> mapNameToValue = new HashMap<>();

    for (CvParam cvParam : pdh.getCvParam()) {
      if (cvParam.getAccession().equals("MS:1001591")
          || cvParam.getAccession().equals("MS:1001592")
          || cvParam.getAccession().equals("MS:1001593")
          || cvParam.getAccession().equals("MS:1001594")
          || cvParam.getAccession().equals("MS:1001595")
          || cvParam.getAccession().equals("MS:1001596")
          || cvParam.getAccession().equals("MS:1001597")
          || cvParam.getAccession().equals("MS:1001598")
          || cvParam.getAccession().equals("MS:1001599")) { // Protein description
        protGroupMembership = "\"" + cvParam.getName();
        if (cvParam.getValue() != null) {
          protGroupMembership += ":" + cvParam.getValue();
        }
        protGroupMembership += "\"";
      } else {
        mapNameToValue.put(cvParam.getName(), cvParam.getValue());
      }
    }

    for (UserParam userParam : pdh.getUserParam()) {

      mapNameToValue.put(userParam.getName(), userParam.getValue());
    }

    pdhString += protDesc + sep + protGroupMembership + sep;

    // Handle scores
    for (int i = 0; i < columnToProtScoreMap.size(); i++) {
      String score = columnToProtScoreMap.get(i);
      // System.out.println("test2" + score);
      if (mapNameToValue.containsKey(score)) {
        String scoreValue = mapNameToValue.get(score);
        // System.out.println("test3" + scoreValue);
        pdhString += scoreValue + sep;
      } else {
        pdhString += sep;
      }
    }

    return pdhString;
  }