Examples of SearchParameters


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

            @Override
            public void run() {

                try {
                    // set up the identification parameters
                    SearchParameters prideSearchParameters = new SearchParameters();

                    // set the database
                    prideSearchParameters.setFastaFile(new File(database));

                    // default settings to be used, set the enzyme to trypsin
                    if (searchSettingsProjectFile == null) {
                        prideSearchParameters.setEnzyme(EnzymeFactory.getUtilitiesEnzyme("Trypsin"));
                    }

                    String prideSearchParametersReport = null;
                    ArrayList<File> mgfFiles = new ArrayList<File>();
                    boolean mgfConversionOk = true;
                    Boolean useLocalFiles = null;

                    for (int i = 0; i < allFiles.size() && mgfConversionOk; i++) {

                        String currentFile = allFiles.get(i);
                        String currentFileName = currentFile.substring(currentFile.lastIndexOf("/")).toLowerCase();
                        boolean unzipped = true;

                        if (currentFileName.lastIndexOf(".gz") != -1) {
                            currentFileName = currentFileName.substring(0, currentFileName.lastIndexOf(".gz"));
                            unzipped = false;
                        }
                        if (progressDialog.isRunCanceled()) {
                            progressDialog.setRunFinished();
                            PrideReshakeGUI.this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")));
                            return;
                        }

                        progressDialog.setTitle("Downloading Files (" + (i + 1) + "/" + allFiles.size() + "). Please Wait...");

                        try {
                            currentPrideDataFileUrl = new URL(currentFile);
                            currentZippedPrideDataFile = new File(outputFolder, currentFile.substring(currentFile.lastIndexOf("/")));
                            if (unzipped) {
                                currentPrideDataFile = new File(outputFolder, currentFile.substring(currentFile.lastIndexOf("/")));
                                if (i < selectedSpectrumFiles.size()) {
                                    if (currentFile.toLowerCase().endsWith(".mgf")) {
                                        currentMgfFile = new File(outputFolder, currentFile.substring(currentFile.lastIndexOf("/")));
                                    } else {
                                        currentMgfFile = new File(outputFolder, currentFile.substring(currentFile.lastIndexOf("/"), currentFile.lastIndexOf(".xml")) + ".mgf");
                                    }
                                }
                            } else {
                                currentPrideDataFile = new File(outputFolder, currentFile.substring(currentFile.lastIndexOf("/"), currentFile.lastIndexOf(".gz")));
                                if (i < selectedSpectrumFiles.size()) {
                                    if (currentFile.toLowerCase().endsWith(".mgf.gz")) {
                                        currentMgfFile = new File(outputFolder, currentFile.substring(currentFile.lastIndexOf("/"), currentFile.lastIndexOf(".mgf.gz")) + ".mgf");
                                    } else {
                                        currentMgfFile = new File(outputFolder, currentFile.substring(currentFile.lastIndexOf("/"), currentFile.lastIndexOf(".xml.gz")) + ".mgf");
                                    }
                                }
                            }
                            if (i < selectedSpectrumFiles.size()) {
                                mgfFiles.add(currentMgfFile);
                            }
                        } catch (MalformedURLException ex) {
                            JOptionPane.showMessageDialog(PrideReshakeGUI.this, JOptionEditorPane.getJOptionEditorPane("The file could not be downloaded:<br>"
                                    + ex.getMessage() + ".<br>"
                                    + "Please <a href=\"http://code.google.com/p/peptide-shaker/issues/list\">contact the developers</a>."),
                                    "Download Error", JOptionPane.ERROR_MESSAGE);
                            ex.printStackTrace();
                            currentPrideDataFileUrl = null;
                        } catch (IOException ex) {
                            JOptionPane.showMessageDialog(PrideReshakeGUI.this, JOptionEditorPane.getJOptionEditorPane("The file could not be downloaded:<br>"
                                    + ex.getMessage() + ".<br>"
                                    + "Please <a href=\"http://code.google.com/p/peptide-shaker/issues/list\">contact the developers</a>."),
                                    "Download Error", JOptionPane.ERROR_MESSAGE);
                            ex.printStackTrace();
                            currentPrideDataFileUrl = null;
                        }

                        if (progressDialog.isRunCanceled()) {
                            progressDialog.setRunFinished();
                            PrideReshakeGUI.this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")));
                            return;
                        }

                        if (currentPrideDataFileUrl != null) {

                            if (!new File(peptideShakerGUI.getUtilitiesUserPreferences().getLocalPrideFolder(), currentFileName).exists()) {

                                boolean downloadFile = true;

                                if (currentPrideDataFile.exists()) {

                                    if (useLocalFiles == null) {

                                        int option = JOptionPane.showConfirmDialog(PrideReshakeGUI.this,
                                                "The file \'" + currentPrideDataFile.getName() + "\' already exists locally.\nUse local copy?",
                                                "Use Local File?", JOptionPane.YES_NO_OPTION);

                                        if (allFiles.size() > 1) {
                                            int option2 = JOptionPane.showConfirmDialog(PrideReshakeGUI.this,
                                                    "Do this for all following files?",
                                                    "Use Local Files?", JOptionPane.YES_NO_OPTION);

                                            if (option2 == JOptionPane.YES_OPTION) {
                                                useLocalFiles = (option == JOptionPane.YES_OPTION);
                                            }
                                        }

                                        downloadFile = (option == JOptionPane.NO_OPTION);
                                    } else {
                                        downloadFile = !useLocalFiles;
                                    }
                                }

                                if (downloadFile) {

                                    // download the pride data file
                                    saveUrl(currentZippedPrideDataFile, currentFile, fileSizes.get(i), progressDialog);

                                    // file downloaded, unzip file
                                    progressDialog.setTitle("Unzipping Files (" + (i + 1) + "/" + allFiles.size() + "). Please Wait...");

                                    progressDialog.setPrimaryProgressCounterIndeterminate(true);
                                    if (!unzipped) {
                                        unzipProject();
                                    }
                                }
                            } else {
                                currentPrideDataFile = new File(peptideShakerGUI.getUtilitiesUserPreferences().getLocalPrideFolder(), currentFileName);
                            }

                            if (progressDialog.isRunCanceled()) {
                                progressDialog.setRunFinished();
                                PrideReshakeGUI.this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")));
                                return;
                            }

                            // file unzipped, time to start the conversion to mgf
                            if (i < selectedSpectrumFiles.size()) {
                                if (currentFile.toLowerCase().endsWith(".mgf")
                                        || currentFile.toLowerCase().endsWith(".mgf.gz")) {
                                    // already mgf, no conversion needed
                                } else {
                                    progressDialog.setTitle("Converting Spectrum Data (" + (i + 1) + "/" + allFiles.size() + "). Please Wait...");
                                    mgfConversionOk = convertPrideXmlToMgf();
                                }
                            }

                            if (progressDialog.isRunCanceled()) {
                                progressDialog.setRunFinished();
                                PrideReshakeGUI.this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")));
                                return;
                            }

                            // get the search params from the pride xml or mzid file
                            if (mgfConversionOk) {
                                if (searchSettingsProjectFile != null
                                        && currentFile.equalsIgnoreCase(searchSettingsProjectFile)) {
                                    progressDialog.setTitle("Extracting Search Settings. Please Wait...");

                                    if (currentFile.toLowerCase().endsWith(".xml")
                                            || currentFile.toLowerCase().endsWith(".xml.gz")) {
                                        prideSearchParametersReport = getSearchParams(prideSearchParameters);
                                    } else { // mzid

                                        progressDialog.setPrimaryProgressCounterIndeterminate(true); // @TODO: better display of progress

                                        // convert the parameters from the assay
                                        prideSearchParametersReport = MzIdentMLIdfileSearchParametersConverter.getSearchParameters(currentPrideDataFile, prideSearchParameters, currentSpecies, progressDialog);

                                        // add the ptms from the project/assay
                                        String allPtms;
                                        if (assaysTable.getSelectedRow() != -1) {
                                            allPtms = (String) assaysTable.getValueAt(assaysTable.getSelectedRow(), assaysTable.getColumn("PTMs").getModelIndex());
                                        } else {
                                            allPtms = (String) projectsTable.getValueAt(projectsTable.getSelectedRow(), projectsTable.getColumn("PTMs").getModelIndex());
                                        }

                                        prideSearchParametersReport += convertPtms(allPtms, prideSearchParameters.getModificationProfile());

                                        // save the report to disk
                                        File searchSettingsReportFile = new File(outputFolder, "search_settings_report.html");
                                        String tempReport = "<html>" + prideSearchParametersReport;
                                        tempReport += "<br></html>";
                                        FileWriter fw = new FileWriter(searchSettingsReportFile);
                                        BufferedWriter bw = new BufferedWriter(fw);
                                        bw.write(tempReport);
                                        bw.close();
                                        fw.close();

                                        prideSearchParametersReport += "<br><br>Report saved to <a href=\"" + searchSettingsReportFile.getAbsolutePath() + "\">" + searchSettingsReportFile.getAbsolutePath() + "</a><br>";
                                        prideSearchParametersReport += "<br></html>";
                                        prideSearchParametersReport = "<html>" + prideSearchParametersReport;
                                    }
                                }
                            }
                        } else {
                            mgfConversionOk = false;
                        }
                    }

                    if (mgfConversionOk) {
                        // save the search params
                        prideSearchParameters.setParametersFile(new File(outputFolder, "pride.parameters"));
                        SearchParameters.saveIdentificationParameters(prideSearchParameters, new File(outputFolder, "pride.parameters"));
                    }

                    progressDialog.setRunFinished();
                    PrideReshakeGUI.this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")));
View Full Code Here

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

        annotationPreferences = new AnnotationPreferences();
        spectrumCountingPreferences = new SpectrumCountingPreferences();
        ptmScoringPreferences = new PTMScoringPreferences();
        filterPreferences = new FilterPreferences();
        displayPreferences = new DisplayPreferences();
        searchParameters = new SearchParameters();
        processingPreferences = new ProcessingPreferences();
        genePreferences = new GenePreferences();
        sequenceMatchingPreferences = null;
        idFilter = new IdFilter();
    }
View Full Code Here

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

    /**
     * Set the default preferences.
     */
    public void setDefaultPreferences() {
        searchParameters = new SearchParameters();
        annotationPreferences = new AnnotationPreferences();
        annotationPreferences.setAnnotationLevel(0.75);
        annotationPreferences.useAutomaticAnnotation(true);
        spectrumCountingPreferences = new SpectrumCountingPreferences();
        spectrumCountingPreferences.setSelectedMethod(SpectralCountingMethod.NSAF);
View Full Code Here

Examples of oracle.security.idm.SearchParameters

          if ( createUserRole != null  ) {
              SimpleSearchFilter filter =
                        idStore.getSimpleSearchFilter(RoleProfile.NAME,
                                                      SimpleSearchFilter.TYPE_EQUAL,
                                                      this.createUserRole);
              SearchParameters sp = new SearchParameters(filter,
                                                         SearchParameters.SEARCH_ROLES_ONLY);
              SearchResponse response = idStore.search(sp);
              if (response.hasNext()) {
                Role role = (Role)response.next();
                idStore.getRoleManager().grantRole(role, newUser.getPrincipal());
View Full Code Here

Examples of oracle.security.idm.SearchParameters

    public void searchUser(ActionEvent actionEvent) {
     SimpleSearchFilter filter =
           idStore.getSimpleSearchFilter(UserProfile.NAME,
                                         SimpleSearchFilter.TYPE_EQUAL,
                                         this.searchUser);
          SearchParameters sp = new SearchParameters(filter,
                                                     SearchParameters.SEARCH_USERS_ONLY);
          try {
            SearchResponse response = idStore.search(sp);
            if (response.hasNext()) {
              User user = (User)response.next();
View Full Code Here

Examples of org.alfresco.service.cmr.search.SearchParameters

  public List<CMObject> search(CMFolder folder, String expr, int searchMode) {
    SearchContext sc = new SearchContext();
    sc.setLocation(getPathFromSpaceRef(folder.getNodeRef(), true));
    sc.setText(expr);
    sc.setMode(searchMode);
    SearchParameters sp = new SearchParameters();
    sp.setLanguage(SearchService.LANGUAGE_LUCENE);
    String buildQuery = sc.buildQuery(3);
    sp.setQuery(buildQuery);
    sp.addStore(AlfrescoUtil.getInstance().getStoreRef());
    List<CMObject> model = new ArrayList<CMObject>();
    ResultSet rs = null;
    try {
      rs = serviceRegistry.getSearchService().query(sp);
      for (ResultSetRow row : rs) {
View Full Code Here

Examples of org.alfresco.service.cmr.search.SearchParameters

  private List<CMObject> search(CMFolder folder, String expr, int searchMode) {
    SearchContext sc = new SearchContext();
    sc.setLocation(getPathFromSpaceRef(folder.getNodeRef(), true));
    sc.setText(expr);
    sc.setMode(searchMode);
    SearchParameters sp = new SearchParameters();
    sp.setLanguage(SearchService.LANGUAGE_LUCENE);
    query = sc.buildQuery(3);
    sp.setQuery(query);
    sp.addStore(AlfrescoUtil.getInstance().getStoreRef());
    List<CMObject> model = new ArrayList<CMObject>();
    ResultSet rs = null;
    try {
      rs = serviceRegistry.getSearchService().query(sp);
      for (ResultSetRow row : rs) {
View Full Code Here

Examples of org.alfresco.service.cmr.search.SearchParameters

  public void search(CMFolder folder, String expr, int searchMode) {
    SearchContext sc = new SearchContext();
    sc.setLocation(getPathFromSpaceRef(folder.getNodeRef(), true));
    sc.setText(expr);
    sc.setMode(searchMode);
    SearchParameters sp = new SearchParameters();
    sp.setLanguage(SearchService.LANGUAGE_LUCENE);
    query = sc.buildQuery(3);
    sp.setQuery(query);
    sp.addStore(AlfrescoUtil.getInstance().getStoreRef());
    List<CMObject> model = new ArrayList<CMObject>();
    ResultSet rs = null;
    try {
      rs = serviceRegistry.getSearchService().query(sp);
      for (ResultSetRow row : rs) {
View Full Code Here

Examples of org.apache.derby.impl.store.access.btree.SearchParameters

                // if the 2 don't compare equal, search the btree from the root
                // for the logged row, find the leaf, reset the row for the raw
                // store, and return the new page latched.
               
                // Create the objects needed for the insert.
                SearchParameters sp = new SearchParameters(
                        logged_index_row_template, ScanController.GE,
                        template, open_btree, false);

                control_row.release();
                control_row = null;
View Full Code Here

Examples of org.apache.derby.impl.store.access.btree.SearchParameters

                // if the 2 don't compare equal, search the btree from the root
                // for the logged row, find the leaf, reset the row for the raw
                // store, and return the new page latched.
               
                // Create the objects needed for the insert.
                SearchParameters sp = new SearchParameters(
                        logged_index_row_template, ScanController.GE,
                        template, open_btree, false);

                control_row.release();
                control_row = null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.