示例#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
  /**
   * Checks whether a second cross-link has the same residue name and residue number.
   *
   * @param crossLink - CrossLink object to be compared to this CrossLink object.
   * @return {@code TRUE} if both CrossLink object are equal in homology, {@code FALSE} otherwise.
   */
  public final boolean equalsInHomolog(final CrossLink crossLink) {
    Atom preAtom1 = this.getPreAtom();
    Atom postAtom1 = this.getPostAtom();
    Atom preAtom2 = crossLink.getPreAtom();
    Atom postAtom2 = crossLink.getPostAtom();

    String residueId1 = preAtom1.getResidueName() + "#" + preAtom1.getResidueNumber();
    String residueId2 = postAtom1.getResidueName() + "#" + postAtom1.getResidueNumber();
    String residueId3 = preAtom2.getResidueName() + "#" + preAtom2.getResidueNumber();
    String residueId4 = postAtom2.getResidueName() + "#" + postAtom2.getResidueNumber();
    if ((residueId1.equals(residueId3) && residueId2.equals(residueId4))
        || (residueId2.equals(residueId3) && residueId1.equals(residueId4))) {
      return true;
    }
    return false;
  }
示例#3
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();
  }