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

se.lth.immun.chem.PeptideFragment Maven / Gradle / Ivy

Go to download

Library for general purpose in silico chemistry, mainly intended for mass spectrometry proteomics computations.

There is a newer version: 1.3.3
Show newest version
package se.lth.immun.chem;

public class PeptideFragment implements IMolecule {

	public EPeptideFragment		fragmentType;
	public int					ordinal;
	public double				mass;
	public Peptide 				peptide;
	
	public PeptideFragment(EPeptideFragment fragmentType, int ordinal, double mass, Peptide peptide) {
		this.fragmentType = fragmentType;
		this.ordinal = ordinal;
		this.mass = mass;
		this.peptide = peptide;
	}

	public ElementComposition getComposition() {
		return null;
	}
	public double monoisotopicMass() { return mass; }
	
	public boolean same(PeptideFragment pf) {
		return ordinal == pf.ordinal && fragmentType == pf.fragmentType;
	}
	
	public String toString() {
		return "PF("+fragmentType.type + ordinal+", m="+mass+")";
	}

	private IsotopeDistribution _dist = null;
	public IsotopeDistribution getIsotopeDistribution() {
		if (_dist == null) {
			_dist = new IsotopeDistribution();
			if (fragmentType == EPeptideFragment.b) {
				for (int i = 0; i < ordinal; i++)
					_dist.add(peptide.aminoAcids[i].getIsotopeDistribution());
			} else if (fragmentType == EPeptideFragment.y) {
				for (int i = 0; i < ordinal; i++)
					_dist.add(peptide.aminoAcids[peptide.aminoAcids.length - i - 1].getIsotopeDistribution());
			}
		}
		return _dist;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy