ArrayList<Ion> ions = ionsMap.get(subType);
if (ions == null) {
ions = new ArrayList<Ion>();
ionsMap.put(subType, ions);
}
<BUG>for (ArrayList<NeutralLoss> losses : neutralLossesCombinations) {

ions.add(new TagFragmentIon(subType, aa, subaa, rewindMass + Atom.C.getMonoisotopicMass() + 2 * Atom.O.getMonoisotopicMass() - getLossesMass(losses), losses, gap));
}</BUG>
subType = TagFragmentIon.Y_ION;

ArrayList<Ion> ions = ionsMap.get(subType);
if (ions == null) {
ions = new ArrayList<Ion>();
ions.add(immoniumIon);
ionsMap.put(subType, ions);
}
ionsMap = result.get(Ion.IonType.RELATED_ION.index);
if (ionsMap == null) {
ionsMap = new HashMap<Integer, ArrayList<Ion>>();
result.put(Ion.IonType.RELATED_ION.index, ionsMap);
}
ArrayList<RelatedIon> relatedIons = RelatedIon.getRelatedIons(aminoAcid);
for (RelatedIon tempRelated : relatedIons) {
subType = tempRelated.getSubType();
