Changeset 4506


Ignore:
Timestamp:
Aug 13, 2013, 2:20:17 PM (10 years ago)
Author:
Fredrik Levander
Message:

Fixes #812. Querying only for distinct score types with at least one not null value for combined fdr. Ignoring Proteios score type.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/api/core/conf/common-queries.xml

    r4475 r4506  
    158158    </description>
    159159  </query>
     160 
     161    <query id="GET_UNIQUE_SCORE_TYPES_IN_HITS_FOR_PROJECT_WITH_FDR" type="HQL">
     162    <sql>
     163      SELECT DISTINCT h.scoreType
     164      FROM HitData h
     165      WHERE h.project = :project
     166      AND h.combinedFDR IS NOT NULL
     167      ORDER by h.scoreType
     168    </sql>
     169    <description>
     170      Load all distinct (unique) score types in the Hits table for a project
     171    </description>
     172  </query>
    160173
    161174  <query id="GET_UNIQUE_PLATEIDS_IN_HITS_FOR_PROJECT" type="HQL">
  • trunk/api/core/src/org/proteios/core/Hit.java

    r4472 r4506  
    5151      .getHibernateSession(),
    5252      "GET_UNIQUE_SCORE_TYPES_IN_HITS_FOR_PROJECT");
     53    query.setEntity("project", project.getData());
     54    return query.list();
     55  }
     56
     57  @SuppressWarnings("unchecked")
     58  // Retrieve unique score types with combined FDR not null.
     59  public static List<String> getUniqueScoreTypesWithCombinedFDR(Project project, DbControl dc)
     60  {
     61    org.hibernate.Query query = HibernateUtil.getPredefinedQuery(dc
     62      .getHibernateSession(),
     63      "GET_UNIQUE_SCORE_TYPES_IN_HITS_FOR_PROJECT_WITH_FDR");
    5364    query.setEntity("project", project.getData());
    5465    return query.list();
  • trunk/plugin/src/org/proteios/plugins/PrideExportPlugin.java

    r4497 r4506  
    502502        }
    503503        project = (Project) job.getValue("project");
    504         // Check if an alternative spectrum file in mzML format exists in directory
     504        // Check if an alternative spectrum file in mzML format exists
     505        // in directory
    505506        File mzMLFile = fetchAlternativeSpectrumFile(factory,
    506507          peakListFile, ".mzML");
     
    508509        if (mzMLFile == null)
    509510        {
    510           // Check if an alternative spectrum file in mzML format exists in project
     511          // Check if an alternative spectrum file in mzML format
     512          // exists in project
    511513          mzMLFile = fetchAlternativeSpectrumFileInProject(factory,
    512514            peakListFile, ".mzML");
     
    516518        if (mzMLFile != null)
    517519        {
    518           log.debug("mzMLFile path = " + mzMLFile.getPath().toString());
     520          log.debug("mzMLFile path = " + mzMLFile.getPath()
     521            .toString());
    519522          retrieveInstrumentFromMZML(mzMLFile);
    520523        }
     
    606609   * @param factory ItemFactory The ItemFactory to use.
    607610   * @param spectrumFile File The input spectrum file.
    608    * @param alternativeFileExtension String File extension for alternative spectrum file.
     611   * @param alternativeFileExtension String File extension for alternative
     612   *        spectrum file.
    609613   * @return File The alternative spectrum file, if found.
    610614   */
     
    650654
    651655  /**
    652    * Fetches an alternative spectrum file in project. The alternative
    653    * spectrum file is assumed to already exist, and have the same base name
    654    * as the original spectrum file, but with specified file extension.
    655    * If several files with the same name exist in the project, the
    656    * first found is returned. Returns null if no file can be found.
     656   * Fetches an alternative spectrum file in project. The alternative spectrum
     657   * file is assumed to already exist, and have the same base name as the
     658   * original spectrum file, but with specified file extension. If several
     659   * files with the same name exist in the project, the first found is
     660   * returned. Returns null if no file can be found.
    657661   *
    658662   * @param factory ItemFactory The ItemFactory to use.
    659663   * @param spectrumFile File The input spectrum file.
    660    * @param alternativeFileExtension String File extension for alternative spectrum file.
     664   * @param alternativeFileExtension String File extension for alternative
     665   *        spectrum file.
    661666   * @return File The alternative spectrum file, if found.
    662667   */
     
    678683    {
    679684      // Remove part after and including last dot
    680       spectrumFileBasename = spectrumFilename.substring(0,
    681         lastDotIndex);
     685      spectrumFileBasename = spectrumFilename.substring(0, lastDotIndex);
    682686    }
    683687    String alternativeSpectrumFilename = spectrumFileBasename + alternativeFileExtension;
     
    690694    fileQuery.include(Include.IN_PROJECT);
    691695    ItemResultList<File> alternativeSpectrumFileList = fileQuery.list(dc);
    692     log.debug("alternativeSpectrumFileList.size() = " + alternativeSpectrumFileList.size());
     696    log.debug("alternativeSpectrumFileList.size() = " + alternativeSpectrumFileList
     697      .size());
    693698    // Get first file in project
    694699    File alternativeSpectrumFile = null;
     
    17791784        List<String> usedScoreTypeList = fetchUsedScoreTypeList(dc);
    17801785        log.debug("usedScoreTypeList = " + usedScoreTypeList);
    1781         if (usedScoreTypeList != null && usedScoreTypeList.size() > 0)
    1782         {
    1783           scoreType = new String(
    1784             "Proteios SE, combination of " + usedScoreTypeList
    1785               .get(0));
    1786           for (int i = 1; i < usedScoreTypeList.size(); i++)
     1786        if (usedScoreTypeList != null)
     1787        {
     1788          if (usedScoreTypeList.size() > 1)
    17871789          {
    1788             // Get separator for middle elements
    1789             String separator = new String(", ");
    1790             // Get separator for last element
    1791             if (i == (usedScoreTypeList.size() - 1))
     1790            scoreType = new String(
     1791              "Proteios SE, combination of " + usedScoreTypeList
     1792                .get(0));
     1793            for (int i = 1; i < usedScoreTypeList.size(); i++)
    17921794            {
    1793               separator = new String(" and ");
     1795              // Get separator for middle elements
     1796              String separator = new String(", ");
     1797              // Get separator for last element
     1798              if (i == (usedScoreTypeList.size() - 1))
     1799              {
     1800                separator = new String(" and ");
     1801              }
     1802              scoreType = scoreType + separator + usedScoreTypeList
     1803                .get(i);
    17941804            }
    1795             scoreType = scoreType + separator + usedScoreTypeList
    1796               .get(i);
     1805          }
     1806          else if (usedScoreTypeList.size() == 1)
     1807          {
     1808            scoreType = usedScoreTypeList.get(0);
    17971809          }
    17981810        }
     
    18731885  {
    18741886    // Get score types from Hit query
    1875     List<String> scoreTypeList = Hit.getUniqueScoreTypes(project, dc);
     1887    List<String> scoreTypeList = Hit.getUniqueScoreTypesWithCombinedFDR(project, dc);
    18761888    log.debug("scoreTypeList = " + scoreTypeList);
    18771889    List<String> usedScoreTypeList = new ArrayList<String>();
     
    18891901        // Skip "Proteios Protein" score types, as these hits are
    18901902        // already combined
    1891         if (scoreType.equals("Proteios Protein"))
     1903        if (scoreType.startsWith("Proteios"))
    18921904        {
    18931905          continue;
Note: See TracChangeset for help on using the changeset viewer.