Search in sources :

Example 1 with HDFragmentMolecularFormulaWrapper

use of de.ipbhalle.metfraglib.molecularformula.HDFragmentMolecularFormulaWrapper in project MetFragRelaunched by ipb-halle.

the class HDFragmentMassToPeakMatch method getModifiedFormulaStringOfMatchedFragment.

public String getModifiedFormulaStringOfMatchedFragment(IMolecularStructure precursorMolecule, int index) {
    /*
		 * in case there is a number of variable deuteriums we have to reduce the number of hydrogens
		 */
    BitArrayFragmentMolecularFormula form = (BitArrayFragmentMolecularFormula) this.matchedFragmentsList.getElement(index).getMolecularFormula(precursorMolecule);
    HDFragmentMolecularFormulaWrapper formWrapper = new HDFragmentMolecularFormulaWrapper(form, (byte) (this.getNumberOfDeuteriumsOfMatchedFragment(index) + this.getNumberOfVariableDeuteriumDifferToPeakMass(index)));
    String formula = "[" + formWrapper.toString();
    if (this.getNumberOfHydrogensDifferToPeakMass(index) == 1)
        formula += "+H";
    else if (this.getNumberOfHydrogensDifferToPeakMass(index) > 1)
        formula += "+" + this.getNumberOfHydrogensDifferToPeakMass(index) + "H";
    else if (this.getNumberOfHydrogensDifferToPeakMass(index) == -1)
        formula += "-H";
    else if (this.getNumberOfHydrogensDifferToPeakMass(index) < -1)
        formula += this.getNumberOfHydrogensDifferToPeakMass(index) + "H";
    if (this.getNumberOfDeuteriumDifferToPeakMass(index) == 1)
        formula += "+D";
    else if (this.getNumberOfDeuteriumDifferToPeakMass(index) > 1)
        formula += "+" + (this.getNumberOfDeuteriumDifferToPeakMass(index)) + "D";
    else if (this.getNumberOfDeuteriumDifferToPeakMass(index) == -1)
        formula += "-D";
    else if (this.getNumberOfDeuteriumDifferToPeakMass(index) < -1)
        formula += (this.getNumberOfDeuteriumDifferToPeakMass(index)) + "D";
    formula += "]";
    if (this.getFragmentsAdductTypeIndex(index) != 0) {
        formula += Constants.ADDUCT_NAMES.get(this.getFragmentsAdductTypeIndex(index));
    }
    if (this.isPositiveCharge)
        formula += "+";
    else
        formula += "-";
    return formula;
}
Also used : HDFragmentMolecularFormulaWrapper(de.ipbhalle.metfraglib.molecularformula.HDFragmentMolecularFormulaWrapper) BitArrayFragmentMolecularFormula(de.ipbhalle.metfraglib.molecularformula.BitArrayFragmentMolecularFormula)

Example 2 with HDFragmentMolecularFormulaWrapper

use of de.ipbhalle.metfraglib.molecularformula.HDFragmentMolecularFormulaWrapper in project MetFragRelaunched by ipb-halle.

the class HDFragmentMassToPeakMatch method getModifiedFormulasStringOfBestMatchedFragment.

/**
 */
public String getModifiedFormulasStringOfBestMatchedFragment(IMolecularStructure precursorMolecule) {
    String formulas = "";
    String formula = "";
    BitArrayFragmentMolecularFormula form = (BitArrayFragmentMolecularFormula) this.bestMatchedFragment.getMolecularFormula(precursorMolecule);
    HDFragmentMolecularFormulaWrapper formWrapper = new HDFragmentMolecularFormulaWrapper(form, (byte) (this.numberOfDeuteriumsOfBestFragment + this.variableDeuteriumDifferenceOfBestFragment));
    formula = "[" + form.toString();
    if (this.hydrogenDifferenceOfBestFragment == 1)
        formula += "+H";
    else if (this.hydrogenDifferenceOfBestFragment > 1)
        formula += "+" + this.hydrogenDifferenceOfBestFragment + "H";
    else if (this.hydrogenDifferenceOfBestFragment == -1)
        formula += "-H";
    else if (this.hydrogenDifferenceOfBestFragment < -1)
        formula += this.hydrogenDifferenceOfBestFragment + "H";
    if ((this.deuteriumDifferenceOfBestFragment) == 1)
        formula += "+D";
    else if ((this.deuteriumDifferenceOfBestFragment) > 1)
        formula += "+" + (this.deuteriumDifferenceOfBestFragment) + "D";
    else if ((this.deuteriumDifferenceOfBestFragment) == -1)
        formula += "-D";
    else if ((this.deuteriumDifferenceOfBestFragment) < -1)
        formula += (this.deuteriumDifferenceOfBestFragment) + "D";
    formula += "]";
    if (this.bestMatchedFragmentAdductTypeIndex != 0)
        formula += Constants.ADDUCT_NAMES.get(this.bestMatchedFragmentAdductTypeIndex);
    if (this.isPositiveCharge)
        formula += "+";
    else
        formula += "-";
    formulas = formula;
    for (int i = 0; i < this.matchedFragmentsList.getNumberElements(); i++) {
        formula = "";
        if (this.getNumberOfVariableDeuteriumDifferToPeakMass(i) == 0) {
            formula = "[" + this.matchedFragmentsList.getElement(i).getMolecularFormula(precursorMolecule).toString();
        } else {
            /*
				 * in case there is a number of variable deuteriums we have to reduce the number of hydrogens
				 */
            form = (BitArrayFragmentMolecularFormula) this.matchedFragmentsList.getElement(i).getMolecularFormula(precursorMolecule);
            formWrapper = new HDFragmentMolecularFormulaWrapper(form, (byte) (this.getNumberOfDeuteriumsOfMatchedFragment(i) + this.getNumberOfVariableDeuteriumDifferToPeakMass(i)));
            formula = "[" + formWrapper.toString();
        }
        if (this.getNumberOfHydrogensDifferToPeakMass(i) == 1)
            formula += "+H";
        else if (this.getNumberOfHydrogensDifferToPeakMass(i) > 1)
            formula += "+" + this.getNumberOfHydrogensDifferToPeakMass(i) + "H";
        else if (this.getNumberOfHydrogensDifferToPeakMass(i) == -1)
            formula += "-H";
        else if (this.getNumberOfHydrogensDifferToPeakMass(i) < -1)
            formula += this.getNumberOfHydrogensDifferToPeakMass(i) + "H";
        if (this.getNumberOfDeuteriumDifferToPeakMass(i) == 1)
            formula += "+D";
        else if (this.getNumberOfDeuteriumDifferToPeakMass(i) > 1)
            formula += "+" + (this.getNumberOfDeuteriumDifferToPeakMass(i)) + "D";
        else if (this.getNumberOfDeuteriumDifferToPeakMass(i) == -1)
            formula += "-D";
        else if (this.getNumberOfDeuteriumDifferToPeakMass(i) < -1)
            formula += (this.getNumberOfDeuteriumDifferToPeakMass(i)) + "D";
        formula += "]";
        if (this.getFragmentsAdductTypeIndex(i) != 0) {
            formula += Constants.ADDUCT_NAMES.get(this.getFragmentsAdductTypeIndex(i));
        }
        if (this.isPositiveCharge)
            formula += "+";
        else
            formula += "-";
        formulas += "/" + formula;
    }
    return formulas;
}
Also used : HDFragmentMolecularFormulaWrapper(de.ipbhalle.metfraglib.molecularformula.HDFragmentMolecularFormulaWrapper) BitArrayFragmentMolecularFormula(de.ipbhalle.metfraglib.molecularformula.BitArrayFragmentMolecularFormula)

Example 3 with HDFragmentMolecularFormulaWrapper

use of de.ipbhalle.metfraglib.molecularformula.HDFragmentMolecularFormulaWrapper in project MetFragRelaunched by ipb-halle.

the class HDFragmentMassToPeakMatch method getModifiedFormulaStringOfBestMatchedFragment.

public String getModifiedFormulaStringOfBestMatchedFragment(IMolecularStructure precursorMolecule) {
    String formula = "";
    BitArrayFragmentMolecularFormula form = (BitArrayFragmentMolecularFormula) this.bestMatchedFragment.getMolecularFormula(precursorMolecule);
    HDFragmentMolecularFormulaWrapper formWrapper = new HDFragmentMolecularFormulaWrapper(form, (byte) (this.numberOfDeuteriumsOfBestFragment + this.variableDeuteriumDifferenceOfBestFragment));
    formula = "[" + formWrapper.toString();
    if (this.hydrogenDifferenceOfBestFragment == 1)
        formula += "+H";
    else if (this.hydrogenDifferenceOfBestFragment > 1)
        formula += "+" + this.hydrogenDifferenceOfBestFragment + "H";
    else if (this.hydrogenDifferenceOfBestFragment == -1)
        formula += "-H";
    else if (this.hydrogenDifferenceOfBestFragment < -1)
        formula += this.hydrogenDifferenceOfBestFragment + "H";
    if ((this.deuteriumDifferenceOfBestFragment) == 1)
        formula += "+D";
    else if ((this.deuteriumDifferenceOfBestFragment) > 1)
        formula += "+" + (this.deuteriumDifferenceOfBestFragment) + "D";
    else if ((this.deuteriumDifferenceOfBestFragment) == -1)
        formula += "-D";
    else if ((this.deuteriumDifferenceOfBestFragment) < -1)
        formula += (this.deuteriumDifferenceOfBestFragment) + "D";
    formula += "]";
    if (this.bestMatchedFragmentAdductTypeIndex != 0)
        formula += Constants.ADDUCT_NAMES.get(this.bestMatchedFragmentAdductTypeIndex);
    if (this.isPositiveCharge)
        formula += "+";
    else
        formula += "-";
    return formula;
}
Also used : HDFragmentMolecularFormulaWrapper(de.ipbhalle.metfraglib.molecularformula.HDFragmentMolecularFormulaWrapper) BitArrayFragmentMolecularFormula(de.ipbhalle.metfraglib.molecularformula.BitArrayFragmentMolecularFormula)

Example 4 with HDFragmentMolecularFormulaWrapper

use of de.ipbhalle.metfraglib.molecularformula.HDFragmentMolecularFormulaWrapper in project MetFragRelaunched by ipb-halle.

the class HDTopDownBitArrayFragmentWrapper method getMolecularFormula.

public HDFragmentMolecularFormulaWrapper getMolecularFormula(IMolecularStructure precursorMolecule) throws AtomTypeNotKnownFromInputListException {
    HDTopDownBitArrayPrecursor currentPrecursor = (HDTopDownBitArrayPrecursor) precursorMolecule;
    BitArrayFragmentMolecularFormula formula = new BitArrayFragmentMolecularFormula(currentPrecursor, this.wrappedFragment.getAtomsFastBitArray());
    byte numberDeuteriums = 0;
    for (int i = 0; i < this.wrappedFragment.getAtomsFastBitArray().getSize(); i++) if (this.wrappedFragment.getAtomsFastBitArray().get(i))
        numberDeuteriums += currentPrecursor.getNumberDeuteriumsConnectedToAtomIndex(this.precursorIndex, i);
    return new HDFragmentMolecularFormulaWrapper(formula, numberDeuteriums);
}
Also used : HDFragmentMolecularFormulaWrapper(de.ipbhalle.metfraglib.molecularformula.HDFragmentMolecularFormulaWrapper) BitArrayFragmentMolecularFormula(de.ipbhalle.metfraglib.molecularformula.BitArrayFragmentMolecularFormula) HDTopDownBitArrayPrecursor(de.ipbhalle.metfraglib.precursor.HDTopDownBitArrayPrecursor)

Aggregations

BitArrayFragmentMolecularFormula (de.ipbhalle.metfraglib.molecularformula.BitArrayFragmentMolecularFormula)4 HDFragmentMolecularFormulaWrapper (de.ipbhalle.metfraglib.molecularformula.HDFragmentMolecularFormulaWrapper)4 HDTopDownBitArrayPrecursor (de.ipbhalle.metfraglib.precursor.HDTopDownBitArrayPrecursor)1