All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.biojava.nbio.structure.io.ChargeAdder Maven / Gradle / Ivy

There is a newer version: 7.2.2
Show newest version
/*
 *                  BioJava development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the individual
 * authors.  These should be listed in @author doc comments.
 *
 * For more information on the BioJava project and its aims,
 * or to join the biojava-l mailing list, visit the home page
 * at:
 *
 *      http://www.biojava.org/
 *
 * Created on Jan. 22, 2016
 *
 */
package org.biojava.nbio.structure.io;

import java.util.List;

import org.biojava.nbio.structure.Atom;
import org.biojava.nbio.structure.Chain;
import org.biojava.nbio.structure.Group;
import org.biojava.nbio.structure.Structure;
import org.biojava.nbio.structure.io.mmcif.ChemCompGroupFactory;
import org.biojava.nbio.structure.io.mmcif.model.ChemComp;
import org.biojava.nbio.structure.io.mmcif.model.ChemCompAtom;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ChargeAdder {

	private static final Logger logger = LoggerFactory.getLogger(ChargeAdder.class);

	private Structure structure;

	public ChargeAdder(Structure structure) {
		this.structure = structure;
	}

	public void addCharges() {
		// Only adds charges to the first MODEL
		for(Chain c: structure.getChains()){
			for(Group g: c.getAtomGroups()){
				ChemComp thisChemComp = ChemCompGroupFactory.getChemComp(g.getPDBName());
				List chemAtoms = thisChemComp.getAtoms();
				List protAtoms = g.getAtoms();
				if(protAtoms.size()!=chemAtoms.size()){
					continue;
				}
				for(int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy