Package com.compomics.util.experiment.identification

Examples of com.compomics.util.experiment.identification.Advocate


                            } else {
                                writer.write(", ");
                            }
                        }
                        Integer advocateId = advocatesIds.get(i);
                        Advocate advocate = Advocate.getAdvocate(advocateId);
                        writer.write(advocate.getName());
                    }
                    break;
                case algorithms_versions:
                    advocatesIds = projectDetails.getIdentificationAlgorithms();
                    HashMap<String, ArrayList<String>> versions = projectDetails.getAlgorithmNameToVersionsMap();
                    Collections.sort(advocatesIds);
                    for (int i = 0; i < advocatesIds.size(); i++) {
                        if (i > 0) {
                            if (i == advocatesIds.size() - 1) {
                                writer.write(" and ");
                            } else {
                                writer.write(", ");
                            }
                        }
                        Integer advocateId = advocatesIds.get(i);
                        Advocate advocate = Advocate.getAdvocate(advocateId);
                        String advocateName = advocate.getName();
                        writer.write(advocateName + " (");
                        ArrayList<String> algorithmVersions = versions.get(advocateName);
                        if (algorithmVersions == null || algorithmVersions.isEmpty()) {
                            writer.write("unknown version)");
                        } else {
View Full Code Here


                        text += " and ";
                    } else {
                        text += ", ";
                    }
                }
                Advocate advocate = Advocate.getAdvocate(searchEngines.get(i));
                String ref = advocate.getPmid();
                if (ref == null) {
                    ref = "add reference here";
                }
                text += advocate.getName() + " ";

                ArrayList<String> versions = algorithmToVersionMap.get(advocate.getName());

                if (versions == null || versions.isEmpty()) {
                    text += "version [add version here]";
                } else if (versions.size() == 1) {
                    if (versions.get(0) != null) {
View Full Code Here

                                    throw new IllegalArgumentException("More than one amino acid can be targeted by the modification " + ptm + ", tag duplication required.");
                                }
                                int aaIndex = aa - 1;
                                aminoAcidPattern.setTargeted(aaIndex, aaAtTarget);
                            } else {
                                Advocate notImplemented = Advocate.getAdvocate(advocateId);
                                if (notImplemented == null) {
                                    throw new IllegalArgumentException("Advocate of id " + advocateId + " not recognized.");
                                }
                                throw new IllegalArgumentException("PTM mapping not implemented for " + Advocate.getAdvocate(advocateId).getName() + ".");
                            }
                        }
                    }
                }
            } else if (tagComponent instanceof AminoAcidSequence) {

                AminoAcidSequence aminoAcidSequence = (AminoAcidSequence) tagComponent;

                for (int aa : aminoAcidSequence.getModificationIndexes()) {
                    for (ModificationMatch modificationMatch : aminoAcidSequence.getModificationsAt(aa)) {
                        if (modificationMatch.isVariable()) {
                            if (advocateId == Advocate.pepnovo.getIndex()) {
                                String pepnovoPtmName = modificationMatch.getTheoreticPtm();
                                PepnovoParameters pepnovoParameters = (PepnovoParameters) searchParameters.getIdentificationAlgorithmParameter(advocateId);
                                String utilitiesPtmName = pepnovoParameters.getUtilitiesPtmName(pepnovoPtmName);
                                if (utilitiesPtmName == null) {
                                    throw new IllegalArgumentException("PepNovo+ PTM " + pepnovoPtmName + " not recognized.");
                                }
                                modificationMatch.setTheoreticPtm(utilitiesPtmName);
                            } else if (advocateId == Advocate.direcTag.getIndex()) {
                                Integer directagIndex = new Integer(modificationMatch.getTheoreticPtm());
                                String utilitiesPtmName = searchParameters.getModificationProfile().getVariableModifications().get(directagIndex);
                                if (utilitiesPtmName == null) {
                                    throw new IllegalArgumentException("DirecTag PTM " + directagIndex + " not recognized.");
                                }
                                modificationMatch.setTheoreticPtm(utilitiesPtmName);
                                PTM ptm = ptmFactory.getPTM(utilitiesPtmName);
                                ArrayList<Character> aaAtTarget = ptm.getPattern().getAminoAcidsAtTarget();
                                if (aaAtTarget.size() > 1) {
                                    throw new IllegalArgumentException("More than one amino acid can be targeted by the modification " + ptm + ", tag duplication required.");
                                }
                                int aaIndex = aa - 1;
                                aminoAcidSequence.setAaAtIndex(aaIndex, aaAtTarget.get(0));
                            } else {
                                Advocate notImplemented = Advocate.getAdvocate(advocateId);
                                if (notImplemented == null) {
                                    throw new IllegalArgumentException("Advocate of id " + advocateId + " not recognized.");
                                }
                                throw new IllegalArgumentException("PTM mapping not implemented for " + Advocate.getAdvocate(advocateId).getName() + ".");
                            }
View Full Code Here

            backwardCompatibilityFix();
        }
        ArrayList<Integer> result = new ArrayList<Integer>();
        for (HashMap<String, ArrayList<String>> advocateVersions : identificationAlgorithms.values()) {
            for (String advocateName : advocateVersions.keySet()) {
                Advocate advocate = Advocate.getAdvocate(advocateName);
                if (advocate == null) {
                    throw new IllegalArgumentException("Identification algorithm " + advocateName + " not recognized.");
                }
                int advocateId = advocate.getIndex();
                if (!result.contains(advocateId)) {
                    result.add(advocateId);
                }
            }
        }
View Full Code Here

            try {
                IdfileReader idFileReader = idFileReaderFactory.getFileReader(idFile);
                identificationAlgorithms.put(idFileName, idFileReader.getSoftwareVersions());
            } catch (Exception e) {
                // File was moved, use the extension to map it manually
                Advocate advocate = Advocate.getAdvocateFromFile(idFileName);
                if (advocate != null) {
                    HashMap<String, ArrayList<String>> algorithms = new HashMap<String, ArrayList<String>>();
                    if (advocate == Advocate.omssa) {
                        ArrayList<String> versions = new ArrayList<String>();
                        versions.add("2.1.9");
                        algorithms.put(advocate.getName(), versions);
                    } else {
                        algorithms.put(advocate.getName(), new ArrayList<String>());
                    }
                    identificationAlgorithms.put(idFileName, algorithms);
                } else {
                    throw new IllegalArgumentException("The algorithm used to generate " + idFileName + " could not be recognized.");
                }
View Full Code Here

TOP

Related Classes of com.compomics.util.experiment.identification.Advocate

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.