Package com.compomics.util.experiment.biology

Examples of com.compomics.util.experiment.biology.Ion


                            break;
                        case fragment_subType:
                            writer.write(ionMatch.ion.getSubTypeAsString());
                            break;
                        case fragment_number:
                            Ion ion = ionMatch.ion;
                            if (ion.getType() == Ion.IonType.PEPTIDE_FRAGMENT_ION) {
                                writer.write(((PeptideFragmentIon) ion).getNumber() + "");
                            }
                            break;
                        case fragment_losses:
                            writer.write(ionMatch.ion.getNeutralLossesAsString());
                            break;
                        case fragment_name:
                            ion = ionMatch.ion;
                            String name;
                            if (ion.getType() == Ion.IonType.PEPTIDE_FRAGMENT_ION) {
                                name = ((PeptideFragmentIon) ion).getNameWithNumber();
                            } else {
                                name = ion.getName();
                            }
                            writer.write(name);
                            break;
                        case fragment_charge:
                            writer.write(ionMatch.charge.value + "");
View Full Code Here


                        peptideAssumption.getIdentificationCharge().value,
                        (MSnSpectrum) spectrum, peptide, 0, searchParameters.getFragmentIonAccuracy(), false, true);
                int sequenceLength = peptide.getSequence().length();
                boolean[] aaCoverage = new boolean[sequenceLength];
                for (IonMatch ionMatch : matches) {
                    Ion ion = ionMatch.ion;
                    if (ion instanceof PeptideFragmentIon) {
                        PeptideFragmentIon peptideFragmentIon = (PeptideFragmentIon) ion;
                        int number = peptideFragmentIon.getNumber();
                        aaCoverage[number - 1] = true;
                    }
                }
                double nIons = 0.0;
                for (boolean aa : aaCoverage) {
                    if (aa) {
                        nIons += 1;
                    }
                }
                coverage = 100 * nIons / sequenceLength;
                return coverage + "";
            case longest_amino_acid_sequence_annotated:
                peptide = peptideAssumption.getPeptide();
                matches = peptideSpectrumAnnotator.getSpectrumAnnotation(
                        annotationPreferences.getIonTypes(), annotationPreferences.getNeutralLosses(), annotationPreferences.getValidatedCharges(),
                        peptideAssumption.getIdentificationCharge().value,
                        (MSnSpectrum) SpectrumFactory.getInstance().getSpectrum(spectrumKey), peptide, 0, searchParameters.getFragmentIonAccuracy(), false, true);
                sequence = peptide.getSequence();
                sequenceLength = sequence.length();
                boolean[] coverageForward = new boolean[sequenceLength];
                boolean[] coverageRewind = new boolean[sequenceLength];
                for (IonMatch ionMatch : matches) {
                    Ion ion = ionMatch.ion;
                    if (ion instanceof PeptideFragmentIon) {
                        PeptideFragmentIon peptideFragmentIon = (PeptideFragmentIon) ion;
                        int number = peptideFragmentIon.getNumber();
                        if (peptideFragmentIon.getSubType() == PeptideFragmentIon.A_ION
                                || peptideFragmentIon.getSubType() == PeptideFragmentIon.B_ION
                                || peptideFragmentIon.getSubType() == PeptideFragmentIon.C_ION) {
                            coverageForward[number - 1] = true;
                        } else {
                            coverageRewind[number - 1] = true;
                        }
                    }
                }
                aaCoverage = new boolean[sequenceLength];
                boolean previous = true;
                for (int aaIndex = 0; aaIndex < sequenceLength; aaIndex++) {
                    boolean current = coverageForward[aaIndex];
                    if (current && previous) {
                        aaCoverage[aaIndex] = true;
                    }
                    previous = current;
                }
                previous = true;
                for (int aaIndex = 0; aaIndex < sequenceLength; aaIndex++) {
                    boolean current = coverageRewind[aaIndex];
                    if (current && previous) {
                        aaCoverage[sequenceLength - aaIndex - 1] = true;
                    }
                    previous = current;
                }
                StringBuilder currentTag = new StringBuilder();
                String longestTag = new String();
                for (int aaIndex = 0; aaIndex < sequenceLength; aaIndex++) {
                    if (aaCoverage[aaIndex]) {
                        currentTag.append(sequence.charAt(aaIndex));
                    } else {
                        if (currentTag.length() > longestTag.length()) {
                            longestTag = currentTag.toString();
                        }
                        currentTag = new StringBuilder();
                    }
                }
                if (currentTag.length() > longestTag.length()) {
                    longestTag = currentTag.toString();
                }
                return longestTag;
            case longest_amino_acid_sequence_annotated_single_serie:
                peptide = peptideAssumption.getPeptide();
                matches = peptideSpectrumAnnotator.getSpectrumAnnotation(
                        annotationPreferences.getIonTypes(), annotationPreferences.getNeutralLosses(), annotationPreferences.getValidatedCharges(),
                        peptideAssumption.getIdentificationCharge().value,
                        (MSnSpectrum) SpectrumFactory.getInstance().getSpectrum(spectrumKey), peptide, 0, searchParameters.getFragmentIonAccuracy(), false, true);
                sequence = peptide.getSequence();
                sequenceLength = sequence.length();
                HashMap<Integer, boolean[]> ionCoverage = new HashMap<Integer, boolean[]>(6);
                ionCoverage.put(PeptideFragmentIon.A_ION, new boolean[sequenceLength]);
                ionCoverage.put(PeptideFragmentIon.B_ION, new boolean[sequenceLength]);
                ionCoverage.put(PeptideFragmentIon.C_ION, new boolean[sequenceLength]);
                ionCoverage.put(PeptideFragmentIon.X_ION, new boolean[sequenceLength]);
                ionCoverage.put(PeptideFragmentIon.Y_ION, new boolean[sequenceLength]);
                ionCoverage.put(PeptideFragmentIon.Z_ION, new boolean[sequenceLength]);
                for (IonMatch ionMatch : matches) {
                    if (ionMatch.charge.value == 1) {
                        Ion ion = ionMatch.ion;
                        if (ion instanceof PeptideFragmentIon) {
                            PeptideFragmentIon peptideFragmentIon = (PeptideFragmentIon) ion;
                            int number = peptideFragmentIon.getNumber();
                            if (peptideFragmentIon.getSubType() == PeptideFragmentIon.A_ION && peptideFragmentIon.getNeutralLosses().isEmpty()) {
                                ionCoverage.get(PeptideFragmentIon.A_ION)[number - 1] = true;
                            } else if (peptideFragmentIon.getSubType() == PeptideFragmentIon.B_ION && peptideFragmentIon.getNeutralLosses().isEmpty()) {
                                ionCoverage.get(PeptideFragmentIon.B_ION)[number - 1] = true;
                            } else if (peptideFragmentIon.getSubType() == PeptideFragmentIon.C_ION && peptideFragmentIon.getNeutralLosses().isEmpty()) {
                                ionCoverage.get(PeptideFragmentIon.C_ION)[number - 1] = true;
                            } else if (peptideFragmentIon.getSubType() == PeptideFragmentIon.X_ION && peptideFragmentIon.getNeutralLosses().isEmpty()) {
                                ionCoverage.get(PeptideFragmentIon.X_ION)[number - 1] = true;
                            } else if (peptideFragmentIon.getSubType() == PeptideFragmentIon.Y_ION && peptideFragmentIon.getNeutralLosses().isEmpty()) {
                                ionCoverage.get(PeptideFragmentIon.Y_ION)[number - 1] = true;
                            } else if (peptideFragmentIon.getSubType() == PeptideFragmentIon.Z_ION && peptideFragmentIon.getNeutralLosses().isEmpty()) {
                                ionCoverage.get(PeptideFragmentIon.Z_ION)[number - 1] = true;
                            }
                        }
                    }
                }
                longestTag = new String();
                currentTag = new StringBuilder();
                previous = true;
                for (int aaIndex = 0; aaIndex < sequenceLength; aaIndex++) {
                    boolean current = ionCoverage.get(PeptideFragmentIon.A_ION)[aaIndex];
                    if (current && previous) {
                        currentTag.append(sequence.charAt(aaIndex));
                    } else {
                        if (currentTag.length() > longestTag.length()) {
                            longestTag = currentTag.toString();
                        }
                        currentTag = new StringBuilder();
                    }
                    previous = current;
                }
                if (currentTag.length() > longestTag.length()) {
                    longestTag = currentTag.reverse().toString();
                }
                currentTag = new StringBuilder();
                previous = true;
                for (int aaIndex = 0; aaIndex < sequenceLength; aaIndex++) {
                    boolean current = ionCoverage.get(PeptideFragmentIon.B_ION)[aaIndex];
                    if (current && previous) {
                        currentTag.append(sequence.charAt(aaIndex));
                    } else {
                        if (currentTag.length() > longestTag.length()) {
                            longestTag = currentTag.toString();
                        }
                        currentTag = new StringBuilder();
                    }
                    previous = current;
                }
                if (currentTag.length() > longestTag.length()) {
                    longestTag = currentTag.reverse().toString();
                }
                currentTag = new StringBuilder();
                previous = true;
                for (int aaIndex = 0; aaIndex < sequenceLength; aaIndex++) {
                    boolean current = ionCoverage.get(PeptideFragmentIon.C_ION)[aaIndex];
                    if (current && previous) {
                        currentTag.append(sequence.charAt(aaIndex));
                    } else {
                        if (currentTag.length() > longestTag.length()) {
                            longestTag = currentTag.toString();
                        }
                        currentTag = new StringBuilder();
                    }
                    previous = current;
                }
                if (currentTag.length() > longestTag.length()) {
                    longestTag = currentTag.reverse().toString();
                }
                currentTag = new StringBuilder();
                previous = true;
                for (int aaIndex = 0; aaIndex < sequenceLength; aaIndex++) {
                    boolean current = ionCoverage.get(PeptideFragmentIon.X_ION)[aaIndex];
                    if (current && previous) {
                        currentTag.append(sequence.charAt(sequenceLength - aaIndex - 1));
                    } else {
                        if (currentTag.length() > longestTag.length()) {
                            longestTag = currentTag.reverse().toString();
                        }
                        currentTag = new StringBuilder();
                    }
                    previous = current;
                }
                if (currentTag.length() > longestTag.length()) {
                    longestTag = currentTag.reverse().toString();
                }
                currentTag = new StringBuilder();
                previous = true;
                for (int aaIndex = 0; aaIndex < sequenceLength; aaIndex++) {
                    boolean current = ionCoverage.get(PeptideFragmentIon.Y_ION)[aaIndex];
                    if (current && previous) {
                        currentTag.append(sequence.charAt(sequenceLength - aaIndex - 1));
                    } else {
                        if (currentTag.length() > longestTag.length()) {
                            longestTag = currentTag.reverse().toString();
                        }
                        currentTag = new StringBuilder();
                    }
                    previous = current;
                }
                if (currentTag.length() > longestTag.length()) {
                    longestTag = currentTag.reverse().toString();
                }
                currentTag = new StringBuilder();
                previous = true;
                for (int aaIndex = 0; aaIndex < sequenceLength; aaIndex++) {
                    boolean current = ionCoverage.get(PeptideFragmentIon.Z_ION)[aaIndex];
                    if (current && previous) {
                        currentTag.append(sequence.charAt(sequenceLength - aaIndex - 1));
                    } else {
                        if (currentTag.length() > longestTag.length()) {
                            longestTag = currentTag.reverse().toString();
                        }
                        currentTag = new StringBuilder();
                    }
                    previous = current;
                }
                if (currentTag.length() > longestTag.length()) {
                    longestTag = currentTag.reverse().toString();
                }

                return longestTag;
            case amino_acids_annotated:
                peptide = peptideAssumption.getPeptide();
                spectrum = SpectrumFactory.getInstance().getSpectrum(spectrumKey);
                matches = peptideSpectrumAnnotator.getSpectrumAnnotation(
                        annotationPreferences.getIonTypes(), annotationPreferences.getNeutralLosses(), annotationPreferences.getValidatedCharges(),
                        peptideAssumption.getIdentificationCharge().value,
                        (MSnSpectrum) spectrum, peptide, 0, searchParameters.getFragmentIonAccuracy(), false, true);
                sequence = peptide.getSequence();
                sequenceLength = sequence.length();
                coverageForward = new boolean[sequenceLength];
                coverageRewind = new boolean[sequenceLength];
                for (IonMatch ionMatch : matches) {
                    Ion ion = ionMatch.ion;
                    if (ion instanceof PeptideFragmentIon) {
                        PeptideFragmentIon peptideFragmentIon = (PeptideFragmentIon) ion;
                        int number = peptideFragmentIon.getNumber();
                        if (peptideFragmentIon.getSubType() == PeptideFragmentIon.A_ION
                                || peptideFragmentIon.getSubType() == PeptideFragmentIon.B_ION
View Full Code Here

                                0,
                                annotationPreferences.getFragmentIonAccuracy(),
                                false, annotationPreferences.isHighResolutionAnnotation());
                        int nB = 0, nY = 0;
                        for (IonMatch ionMatch : annotations) {
                            Ion ion = ionMatch.ion;
                            if (ion instanceof TagFragmentIon) {
                                int ionType = ion.getSubType();
                                if (ionType == TagFragmentIon.A_ION
                                        || ionType == TagFragmentIon.B_ION
                                        || ionType == TagFragmentIon.C_ION) {
                                    nB++;
                                } else {
View Full Code Here

TOP

Related Classes of com.compomics.util.experiment.biology.Ion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.