Return a String representing the 2 molecules of this interface in PDB format.
If the molecule ids (i.e. chain ids) are the same for both molecules, then the second
one will be replaced by the next letter in alphabet (or A for Z)
@return
182572
public String toPDB() {

		String molecId1 = getMoleculeIds().getFirst();
		String molecId2 = getMoleculeIds().getSecond();

		if (molecId2.equals(molecId1)) {
			// if both chains are named equally we want to still named them differently in the output pdb file
			// so that molecular viewers can handle properly the 2 chains as separate entities
			char letter = molecId1.charAt(0);
			if (letter!='Z' && letter!='z') {
				molecId2 = Character.toString((char)(letter+1)); // i.e. next letter in alphabet
			} else {
				molecId2 = Character.toString((char)(letter-25)); //i.e. 'A' or 'a'
			}
		}

		StringBuilder sb = new StringBuilder();
		for (Atom atom:this.molecules.getFirst()) {
			sb.append(FileConvert.toPDB(atom, molecId1));
		}
		sb.append("TER");
		sb.append(System.getProperty("line.separator"));
		for (Atom atom:this.molecules.getSecond()) {
			sb.append(FileConvert.toPDB(atom,molecId2));
		}
		sb.append("TER");
		sb.append(System.getProperty("line.separator"));
		sb.append("END");
		sb.append(System.getProperty("line.separator"));
		return sb.toString();
	}
151523
def molecules2symbols(molecules, add_hydrogen=True):
    
    symbols = sorted(
        list(set(
            ase.symbols.string2symbols(''.join(
                map(
                    lambda _x:
                    ''.join(ase.symbols.string2symbols(_x)), molecules)
            ))
        )),
        key=lambda _y: ase.data.atomic_numbers[_y])

    if add_hydrogen and 'H' not in symbols:
        symbols.insert(0, 'H')

    return symbols
838486
private String printPDBConnections(){

		StringBuilder str = new StringBuilder();

		for (Chain c:structure.getChains()) {
			for (Group g:c.getAtomGroups()) {
				for (Atom a:g.getAtoms()) {
					if (a.getBonds()!=null) {
						for (Bond b:a.getBonds()) {				//7890123456789012345678901234567890123456789012345678901234567890
							str.append(String.format("CONECT%5d%5d                                                                "+newline, b.getAtomA().getPDBserial(), b.getAtomB().getPDBserial()));
						}
					}
				}
			}
		}

		return str.toString();
	}
16542
public static String getPDBLegend() {
		StringBuilder s = new StringBuilder();
		s.append("</pre></div>");
		s.append("          <div class=\"subText\">");
		s.append("          <b>Legend:</b>");
		s.append("          <span class=\"m\">Green</span> - identical residues |");
		s.append("          <span class=\"sm\">Pink</span> - similar residues | ");
		s.append("          <span class=\"qg\">Blue</span> - sequence mismatch |");
		s.append("          <span class=\"dm\">Brown</span> - insertion/deletion |");
		s.append("      </div>");
		s.append(String.format("%n"));
		return s.toString();
	}
44709
public IAtom getNextPlacedHeavyAtomWithUnplacedAliphaticNeighbour(IAtomContainer molecule) {
        Iterator<IBond> bonds = molecule.bonds().iterator();
        while (bonds.hasNext()) {
            IBond bond = bonds.next();
            IAtom atom0 = bond.getBegin();
            IAtom atom1 = bond.getEnd();
            if (atom0.getFlag(CDKConstants.ISPLACED) && !(atom1.getFlag(CDKConstants.ISPLACED))) {
                if (isAliphaticHeavyAtom(atom1) && isHeavyAtom(atom0)) {
                    return atom0;
                }
            }
            if (atom1.getFlag(CDKConstants.ISPLACED) && !(atom0.getFlag(CDKConstants.ISPLACED))) {
                if (isAliphaticHeavyAtom(atom0) && isHeavyAtom(atom1)) {
                    return atom1;
                }
            }
        }
        return null;
    }
395304
public String nextGroup() {
    int currentPosition = this.position;

    do {
      char currentCharacter = this.characters[currentPosition];
      if (currentCharacter == '[') {
        currentPosition = NucleotideParser.getMatchingBracketPosition(this.characters, currentPosition, '[', ']');
      } else if (currentCharacter == '(') {
        currentPosition = NucleotideParser.getMatchingBracketPosition(this.characters, currentPosition, '(', ')');
      } else if (currentCharacter != '.') {
        currentPosition++;
      }

      if (currentPosition < 0) {
        currentPosition = this.characters.length;
      }

    } while ((currentPosition < this.characters.length)
        && (this.characters[currentPosition] != '.'));

    String token = this.notationString.substring(this.position, currentPosition);

    this.position = currentPosition + 1;

    return token;
  }
400316
public static Character getOneLetterCode(ChemComp cc, ChemicalComponentDictionary dictionary){
		if ( cc.getResidueType() == ResidueType.nonPolymer )
			return null;

		if ( cc.isStandard())
			return cc.getOne_letter_code().charAt(0);

		ChemComp parent = dictionary.getParent(cc);
		if ( parent == null){
			//System.err.println("parent is null " + cc);
			return cc.getOne_letter_code().charAt(0);
		}
		PolymerType poly = cc.getPolymerType();
		if (( poly == PolymerType.peptide) || ( poly == PolymerType.dpeptide)){
			Character c = getAminoOneLetter(parent.getId());
			if ( c == null)
				c = UNKNOWN_ONE_LETTER_CODE;
			return c;
		}
		if ( poly == PolymerType.dna){
			Character c = getDNAOneLetter(parent.getId());
			if (c == null)
				c = UNKNOWN_NUCLEOTIDE;
			return c;

		}
		return cc.getMon_nstd_parent_comp_id().charAt(0);
	}
1000613
public void loadFromDirectAccess(){
		String pdbId = "1A4W";

		StructureProvider pdbreader = new MMCIFFileReader();

		try {
			Structure s = pdbreader.getStructureById(pdbId);

			System.out.println("Getting chain H of 1A4W");

			List<Chain> hs = s.getNonPolyChainsByPDB("H");

			Chain h = hs.get(0);
			List<Group> ligands = h.getAtomGroups();

			System.out.println("These ligands have been found in chain " + h.getName());

			for (Group l:ligands){
				System.out.println(l);
			}

			System.out.println("Accessing QWE directly: ");
			Group qwe = s.getNonPolyChainsByPDB("H").get(2).getGroupByPDB(new ResidueNumber("H",373,null));

			System.out.println(qwe.getChemComp());

			System.out.println(h.getSeqResSequence());
			System.out.println(h.getAtomSequence());
			System.out.println(h.getAtomGroups(GroupType.HETATM));

			System.out.println("Entities: " + s.getEntityInfos());

		} catch (Exception e) {
			e.printStackTrace();
		}


	}
406492
private IBond getNextBondWithUnplacedRingAtom() {
        for (IBond bond : molecule.bonds()) {
            IAtom beg = bond.getBegin();
            IAtom end = bond.getEnd();
            if (beg.getPoint2d() != null && end.getPoint2d() != null) {
                if (end.getFlag(CDKConstants.ISPLACED) && !beg.getFlag(CDKConstants.ISPLACED) && beg.isInRing()) {
                    return bond;
                }
                if (beg.getFlag(CDKConstants.ISPLACED) && !end.getFlag(CDKConstants.ISPLACED) && end.isInRing()) {
                    return bond;
                }
            }
        }
        return null;
    }
1327400
function() {
    // check if we have at least one atom, if not return null
    if (this._currChain === null) {
      return null;
    }
    var chain = null;
    var i;
    for (i = 0; i < this._sheets.length; ++i) {
      var sheet = this._sheets[i];
      chain = this._structure.chain(sheet.chainName);
      if (chain) {
        chain.assignSS(sheet.first, sheet.last, 'E');
      }
    }
    for (i = 0; i < this._helices.length; ++i) {
      var helix = this._helices[i];
      chain = this._structure.chain(helix.chainName);
      if (chain) {
        chain.assignSS(helix.first, helix.last, 'H');
      }
    }
    this._structure.setAssemblies(this._remark350Reader.assemblies());
    if (this._options.conectRecords) {
      this._assignBondsFromConectRecords(this._structure);
    }
    this._structure.deriveConnectivity();
    console.log('imported', this._structure.chains().length, 'chain(s),',
                this._structure.residueCount(), 'residue(s)');
    var result = this._structure;
    this._structure = new mol.Mol();
    this._currChain =  null;
    this._currRes = null;
    this._currAtom = null;
    this._rosettaMode = false;
    return result;
  }
173804
public String getSignature() {
        final StringBuilder builder = new StringBuilder("(");
        parameters.forEach(builder::append);
        return builder.append(')').append(returnType).toString();
    }
917502
@Override
    public boolean hasNext() {
        if (!nextAvailableIsKnown) {
            hasNext = false;

            // now try to parse the next Molecule
            try {

                final String line = input.readLine();

                if (line == null) {
                    nextAvailableIsKnown = true;
                    return false;
                }

                hasNext = true;
                final String suffix = suffix(line);

                nextMolecule = readSmiles(line);
                nextMolecule.setTitle(suffix);

            } catch (Exception exception) {
                logger.error("Unexpected problem: ", exception.getMessage());
                logger.debug(exception);
                hasNext = false;
            }
            if (!hasNext) nextMolecule = null;
            nextAvailableIsKnown = true;
        }
        return hasNext;
    }
519719
public String getOemName() {
        StringBuilder b = new StringBuilder(8);
        
        for (int i = 0; i < 8; i++) {
            int v = get8(0x3 + i);
            if (v == 0) break;
            b.append((char) v);
        }
        
        return b.toString();
    }
1112990
private static String getPDBString(boolean web, char c1, char c2, boolean similar, String m, String sm, String dm,
			String qg) {
		if (c1 == c2)
			return web ? "<span class=\"m\">" + m + "</span>" : m;
		else if (similar)
			return web ? "<span class=\"sm\">" + sm + "</span>" : sm;
		else if (c1 == '-' || c2 == '-')
			return web ? "<span class=\"dm\">" + dm + "</span>" : dm;
		else
			return web ? "<span class=\"qg\">" + qg + "</span>" : qg;
	}
155720
public String toQueryString() {
        StringBuilder sb = new StringBuilder();
        boolean firstParam = true;
        for (int i = 0; i < params.length; i++) {
            if (params[i] == null) {
                i++;
                continue;
            }

            boolean even = i % 2 == 0;
            if (even) {
                if (!firstParam) {
                    sb.append("&");
                }
            }
            sb.append(params[i]);
            firstParam = false;
            if (even) {
                sb.append('=');
            }
        }
        return sb.toString();
    }
1214695
def get_chain_mapping(self, pdb_name1, pdb_name2):
        ''''''
        raise Exception('Implement. Map pdb_namex to its equivalence class, call get_representative_chain_mapping, and something something.')
        pprint.pprint(self.chain_mapping)

        d = {}
        for pdb1_chain_id, matched_chain_list in self.chain_mapping[(pdb_name1, pdb_name2)].iteritems():
            d[pdb1_chain_id] = matched_chain_list.get_related_chains_ids(pdb_name2)
        return d
352499
def get_pdb_sets(self):
        ''''''

        assert(self.id != None)

        data = []
        for pdb_set in self.pdb_sets:

            pdb_set_record = dict(
                PPComplexID = self.id,
                SetNumber = pdb_set['set_number'],
                IsComplex = pdb_set['is_complex'],
                Notes = pdb_set['notes'],
            )

            chain_records = []
            for side, chain_details in sorted(pdb_set['chains'].iteritems()):
                chain_records.append(dict(
                    PPComplexID = self.id,
                    SetNumber = pdb_set['set_number'],
                    Side = side,
                    ChainIndex = chain_details['chain_index'],
                    PDBFileID = chain_details['pdb_file_id'],
                    Chain = chain_details['chain_id'],
                    NMRModel = chain_details['nmr_model'],
                ))

            data.append(dict(pdb_set = pdb_set_record, chain_records = chain_records))

        return data