コード例 #1
0
  /**
   * Writes a the shortest paths of a list of virtual cross-links into a PDB formated file.
   *
   * @param pathFileName - String object holding the path to the PDB file to be written.
   * @param crossLinkList - List of cross-link objects holding each the the shortest path
   */
  public final void writeSASDpdbFile(final String pathFileName, final CrossLinkList crossLinkList) {
    StringBuffer content = new StringBuffer();
    for (CrossLink crossLink : crossLinkList) {
      if (crossLink.getPath() != null) {
        Atom atom1 = crossLink.getPreAtom();
        Atom atom2 = crossLink.getPostAtom();
        String distName =
            crossLink.getIndex()
                + "_"
                + this.decFormat.format(crossLink.getSolventPathDistance())
                + "_"
                + atom1.getResidueName().trim()
                + ""
                + atom1.getResidueNumber()
                + ""
                + atom1.getChainId()
                + "-"
                + atom2.getResidueName().trim()
                + ""
                + atom2.getResidueNumber()
                + ""
                + atom2.getChainId()
                + "_solventPath";

        content.append("HEADER " + distName + Constants.LINE_SEPERATOR);
        content.append(crossLink.getPath().toString(crossLink.getIndex()));
        content.append("END" + Constants.LINE_SEPERATOR);
      }
    }
    WriteFile file = new WriteFile();
    file.setFile(pathFileName);
    file.write(content.toString());
  }
コード例 #2
0
  /**
   * Returns a string representation of the PyMol commands to name and place dashes between
   * cross-linked amino acids.
   *
   * @param crossLinkList - CrossLinkList object holding all cross-links found for a protein
   *     complex.
   * @return String object with PyMol commands.
   */
  private String getEuclideanDistancePyMolCommands(final CrossLinkList crossLinkList) {
    StringBuffer output = new StringBuffer();
    String infile = CrossLinkParameter.getParameter(Parameter.INFILE_PATH);
    String nl = Constants.LINE_SEPERATOR;

    String infileWithoutExtension =
        new File(infile).getName().substring(0, new File(infile).getName().lastIndexOf('.'));

    for (CrossLink crossLink : crossLinkList) {
      Atom atom1 = crossLink.getPreAtom();
      Atom atom2 = crossLink.getPostAtom();

      if (atom1.getChainId() != '_') {
        output.append(
            "create chain"
                + atom1.getChainId()
                + ", chain "
                + atom1.getChainId()
                + " and "
                + infileWithoutExtension
                + nl);
      }
      if (atom2.getChainId() != '_') {
        output.append(
            "create chain"
                + atom2.getChainId()
                + ", chain "
                + atom2.getChainId()
                + " and "
                + infileWithoutExtension
                + nl);
      }
      String selection1 =
          "resn "
              + atom1.getResidueName().trim()
              + " and resi "
              + atom1.getResidueNumber()
              + " and chain "
              + atom1.getChainId()
              + " and name "
              + atom1.getName().trim()
              + " and "
              + infileWithoutExtension;
      if (atom1.getAlternativeLocation() != ' ') {
        selection1 += " and alt " + atom1.getAlternativeLocation();
      }
      String selection2 =
          "resn "
              + atom2.getResidueName().trim()
              + " and resi "
              + atom2.getResidueNumber()
              + " and chain "
              + atom2.getChainId()
              + " and name "
              + atom1.getName().trim()
              + " and "
              + infileWithoutExtension;
      if (atom2.getAlternativeLocation() != ' ') {
        selection2 += " and alt " + atom2.getAlternativeLocation();
      }

      String distName = crossLink.getIndex() + "_";
      if (Boolean.parseBoolean(
          CrossLinkParameter.getParameter(Parameter.DO_SOLVENT_PATH_DISTANCE))) {
        distName += this.decFormat.format(crossLink.getSolventPathDistance()) + "_";
      } else {
        distName += this.decFormat.format(crossLink.getEuclideanDistance()) + "_";
      }

      distName +=
          atom1.getResidueName().trim()
              + ""
              + atom1.getResidueNumber()
              + ""
              + atom1.getChainId()
              + atom1.getName().trim();
      if (atom1.getAlternativeLocation() != ' ') {
        distName += atom1.getAlternativeLocation();
      }
      distName +=
          "-"
              + atom2.getResidueName().trim()
              + ""
              + atom2.getResidueNumber()
              + ""
              + atom2.getChainId()
              + atom2.getName().trim();
      if (atom2.getAlternativeLocation() != ' ') {
        distName += atom2.getAlternativeLocation();
      }

      output.append("select pk1, " + selection1 + nl);
      output.append("select pk2, " + selection2 + nl);
      output.append("show spheres, pk1" + nl);
      output.append("show spheres, pk2" + nl);
      output.append("distance \"" + distName + "\"" + nl);
      //            output.append("cmd.color(\"red\", \"" + distName + "\")" + nl);
    }
    output.append("delete pk1" + nl);
    output.append("delete pk2" + nl);

    return output.toString();
  }