Changeset 1410 for plugins


Ignore:
Timestamp:
Oct 19, 2011, 10:34:42 AM (11 years ago)
Author:
Nicklas Nordborg
Message:

References #331: Updates required for BASE 3 support

The code compiles and installs. The only exception is the qQuantileNormalizer which uses the BioAssaySetExporter. This exporter has been removed in BASE 3 so this export needs to be re-implemented.

Location:
plugins/base2/net.sf.basedb.normalizers/trunk
Files:
3 added
1 deleted
8 edited
5 copied

Legend:

Unmodified
Added
Removed
  • plugins/base2/net.sf.basedb.normalizers/trunk

    • Property svn:ignore
      •  

        old new  
        1 .classpath
        2 .project
        31dist
        42package
  • plugins/base2/net.sf.basedb.normalizers/trunk/INSTALL

    r1295 r1410  
    3232== Requirements ==
    3333
    34  1. BASE 2.17.0 or later.
    35  2. (Optional) The qQuantile normalization requires a C++ standards
    36     compliant compiler and the yat library available at
    37     http://dev.thep.lu.se/yat. The package can be used without the
    38     qQuantile normalization algorithm, simply de-select the plug-in
    39     when making BASE aware of the plug-ins.
    40 
     34 1. BASE 3.0.0 or later.
    4135
    4236== Installation/Upgrade ==
     
    5246    must also copy the jar file to a location the job agents has
    5347    access to.
    54     [[br]][[br]]
    55     If you are upgrading and not want to install new plugins or
    56     configurations - go to step 7, otherwise continue with the next step.
    5748 3. Log in to BASE as an administrator and run the plug-in
    58     auto-installation wizard by going to ''Administrate -> Plugins ->
    59     Definitions'' and click on the 'New' button.
    60  4. Select the 'Automatically' option.
    61  5. The auto-detection should find plug-ins for the algorithms listed
    62     below. You should change the 'Install' value to 'yes' for those
    63     which should be installed.
    64      * Average normalization
    65      * qQuantile normalization
    66      * Quantile Normalization
    67     Do ''NOT'' select qQuantile if you do not plan to build the
    68     underlying binary (step 8 below).
    69  6. Finish the installation wizard.
    70  7. Done. The normalization plug-ins are now installed.
    71 
    72  8. (Optional step) Building the qQuantile binary. Unpack the
    73     qqn-version.tar.gz file and change direcotry to
    74     qqn-version. Follow the instructions in the README file included
    75     in the qQN package. Remember to copy file bin/qQN to the same
    76     location as the normalization jar files.
     49    auto-installation wizard by going to ''Administrate->Plug-ins &
     50    Extensions->Overview'' and click on the 'Install/uninstall' button.
     51 4. Select to 'Install' the normalization-plugins.jar and then click
     52    on 'Next'.
     53 5. Done. The normalization plug-ins are now installed.
    7754
    7855Make sure that the job agents have access to the same
    7956normalization-plugins.jar file as the Tomcat web server. If the job
    8057agents are not running from the same BASE installation directory, you
    81 may need to copy the files to a proper location. We recommend that you
    82 always put the normalization-plugins.jar inside the BASE server
    83 plug-in directory as defiend by `plugins.dir` in the `base.config`
    84 configuration file. If you do, BASE will automatically find the JAR
    85 file in job agents. Otherwise, you may have to configure the JAR path
    86 manually for each job agent.
     58may need to copy the files to a proper location.
  • plugins/base2/net.sf.basedb.normalizers/trunk/RELEASE

    r949 r1410  
    1414   
    1515    In build.xml: <property name="version" value="A.B" />
     16      <property name="version" value="A.B" />
     17      <property name="depend.base-version" value="X.Y.Z" />
     18     
     19    Run `ant update-version`. This should put the version
     20    numbers in a lot of files, including, Normalizations.java
     21    and META-INF/extensions.xml.
    1622
    1723 3. Make sure that the code compiles and can be packed.
     
    566212. Update the version numbers.
    5763 
    58     In build.xml: <property name="version" value="A.(B+1)pre" />
    59     Commit the change to subversion:
     64    In build.xml: <property name="version" value="A.(B+1)-dev" />
     65    Run `ant update-version` and commit the changes to
     66    subversion: 'Preparing for future release A.B+1'.
    6067     
    61     'Preparing for future release A.B+1'.
    62      
  • plugins/base2/net.sf.basedb.normalizers/trunk/build.xml

    r1295 r1410  
    5555
    5656  <!-- variables used --> 
    57   <property name="name" value="normalization-plugins" /> 
    58   <property name="src" value="src" />
     57  <property name="name" value="normalization-plugins" /> 
     58  <property name="version" value="1.1-dev"  description="Version number of the package" />
     59  <property name="src" value="src" />
    5960  <property name="build" value="build" description="Location of build class files"/> 
    6061  <property name="dist" value="dist" description="Location where jar-file are created"/>
     
    6263  <property name="package" location="package" description="Directory where packaged distribution files are created"/>
    6364  <property name="javac.arg" value="-Xlint:unchecked" />
    64   <property name="javac.source" value="1.5" />
    65   <property name="javac.target" value="1.5" />
     65  <property name="javac.source" value="1.6" />
     66  <property name="javac.target" value="1.6" />
    6667  <property name="javac.encoding" value="UTF-8" />
    67 
    68   <property name="depend.BASEjars"
    69     value="http://base2.thep.lu.se/base/jars/2.17.0"
    70     description="The location of the BASE core JARs that we depend on"
     68  <property name="depend.base-version"
     69    value="3.0.0"
     70    description="The BASE version that this project depends on."
    7171  />
     72  <property name="depend.jars"
     73    value="http://base2.thep.lu.se/base/jars/${depend.base-version}"
     74    description="The location of the BASE core JARs that this project depends on."
     75  />
     76
    7277  <property name="depend.PluginUtilityLocation"
    7378    value="http://baseplugins.thep.lu.se/attachment/wiki/net.sf.basedb.pluginutilties"
     
    8085            value="PluginUtilities-${PluginUtilityVersion}" />
    8186 
    82   <!-- Package variables to be used in normalizers.properties file -->
    83   <property name="version" value="1.1pre" description="Version number of the package" />
    84   <property name="url" value="http://baseplugins.thep.lu.se/wiki/net.sf.basedb.normalizers"
    85     description="The url to this plug-in's web-page" />
    86   <property name="copyright" value="2009 The BASE 2 development team" description="Copyright text" />
    87   <property name="email" value="basedb-users@lists.sourceforge.net" description="Email address to get in contact with the developer" />
    88  
     87
    8988  <!-- set up classpath for compiling -->
    9089  <path id="classpath">
     
    124123    depends="clean,build,manifest"
    125124    >
     125    <copy file="lib/${PluginUtilitiesBase}/${PluginUtilitiesBase}.jar"
     126          tofile="${build}/lib/PluginUtilities.jar" />
    126127    <jar
    127128      jarfile="${dist}/${jar}"
     
    132133      <fileset dir="." includes="README*,license.txt,INSTALL" />
    133134    </copy>
    134     <copy file="lib/${PluginUtilitiesBase}/${PluginUtilitiesBase}.jar"
    135           tofile="${dist}/PluginUtilities.jar" />
    136135  </target>
    137136
     
    142141    <manifest file="${build}/META-INF/MANIFEST.MF">
    143142      <attribute name="Built-By" value="${user.name}"/>
    144       <attribute name="Class-Path" value="PluginUtilities.jar"/>
     143      <attribute name="Class-Path" value="lib/PluginUtilities.jar"/>
    145144    </manifest>
    146145  </target>
     
    213212      source="${javac.source}"
    214213      target="${javac.target}"
     214      includeantruntime="false"
    215215      >
    216216      <compilerarg value="${javac.arg}" />
     
    219219      <fileset dir="." includes="META-INF/*" />
    220220    </copy>
    221     <replace token="%%plugins.jar%%" value="${jar}" file="${build}/META-INF/base-plugins.xml" />
    222 
    223     <!-- Write package properties to normalizers.properties file -->
    224     <echo file="${build}/normalizers.properties">version: ${version}${line.separator}</echo>
    225     <echo append="true" file="${build}/normalizers.properties">url: ${url}${line.separator}</echo>
    226     <echo append="true" file="${build}/normalizers.properties">email: ${email}${line.separator}</echo>
    227     <echo append="true" file="${build}/normalizers.properties">copyright: ${copyright}${line.separator}</echo>
    228    
     221   
     222  </target>
     223 
     224  <target name="update-version">
     225    <echo>Setting version to: ${version}</echo>
     226   
     227    <echo>Normalizations.java</echo>
     228    <replaceregexp
     229      file="${src}/net/sf/basedb/normalizers/Normalizations.java"
     230      match="public static final String VERSION = &#34;.*&#34;;"
     231      replace="public static final String VERSION = &#34;${version}&#34;;"
     232      encoding="UTF-8"
     233    />
     234   
     235    <echo>extensions.xml</echo>
     236    <replaceregexp
     237      file="META-INF/extensions.xml"
     238      match="&lt;version&gt;.*&lt;/version&gt;"
     239      replace="&lt;version&gt;${version}&lt;/version&gt;"
     240      encoding="UTF-8"
     241    />
     242    <replaceregexp
     243      file="META-INF/extensions.xml"
     244      match="&lt;min-base-version&gt;.*&lt;/min-base-version&gt;"
     245      replace="&lt;min-base-version&gt;${depend.base-version}&lt;/min-base-version&gt;"
     246      encoding="UTF-8"
     247    />
     248    <echo>Don't forget to commit the changes to the subversion repository!</echo>
    229249  </target>
    230250 
    231251  <target
    232252    name="checkjar"
    233     description="Checks that the BASE2Core.jar, BASE2CorePlugins.jar,
     253    description="Checks that the BASE JAR files,
    234254    and appropriate PluginUtilities jar file exists."
    235255    >
    236256    <available classname="net.sf.basedb.core.Application"
    237       classpathref="classpath" property="base2core" />
     257      classpathref="classpath" property="base-core" />
    238258    <available classname="net.sf.basedb.plugins.ReporterFlatFileImporter"
    239       classpathref="classpath" property="base2coreplugins" />
     259      classpathref="classpath" property="base-coreplugins" />
    240260    <available classname="net.sf.basedb.plugins.AbstractRunBinaryPlugin"
    241261      classpathref="classpath"
    242262      classpath="lib/${PluginUtilitiesBase}/${PluginUtilitiesBase}.jar"
    243263      property="pluginutilities" />
    244     <fail unless="base2core" message="Can't find BASE2Core.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
    245     <fail unless="base2coreplugins" message="Can't find BASE2CorePlugins.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
     264    <fail unless="base-core" message="Can't find base-core-${depend.base-version}.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
     265    <fail unless="base-coreplugins" message="Can't find base-coreplugins-${depend.base-version}.jar in ./lib/compile. Try 'ant download-lib' to download the missing file." />
    246266    <fail unless="pluginutilities" message="Can't find PluginUtilities jar file ./lib. Try 'ant download-lib' to download the missing file." />
    247     <echo>Found BASE2Core.jar, BASE2WSClient.jar, and PluginUtilities jar file</echo>
     267    <echo>Found all required jar files</echo>
    248268  </target>
    249269
     
    266286    name="download-lib"
    267287    depends="download-message, download-pluginutilities"
    268     description="Download BASE2Core.jar and BASE2CorePlugins.jar."
     288    description="Download BASE JAR files"
    269289    >
    270290    <download
    271       location="${depend.BASEjars}"
    272       file="BASE2Core.jar"
     291      location="${depend.jars}"
     292      file="base-core-${depend.base-version}.jar"
    273293      destdir="lib/compile"
    274       tofile="BASE2Core.jar"
     294      tofile="base-core-${depend.base-version}.jar"
    275295    />
    276296    <download
    277       location="${depend.BASEjars}"
    278       file="BASE2CorePlugins.jar"
     297      location="${depend.jars}"
     298      file="base-coreplugins-${depend.base-version}.jar"
    279299      destdir="lib/compile"
    280       tofile="BASE2CorePlugins.jar"
     300      tofile="base-coreplugins-${depend.base-version}.jar"
    281301    />
    282302  </target>
     
    289309more of the below variables
    290310
    291 'depend.BASEjars': the URL to download BASE core jar
     311'depend.jars': the URL to download BASE core jar
    292312        files from.
    293313
  • plugins/base2/net.sf.basedb.normalizers/trunk/lib/compile

    • Property svn:ignore
      •  

        old new  
        1 BASE2Core.jar
        2 BASE2CorePlugins.jar
         1*.jar
  • plugins/base2/net.sf.basedb.normalizers/trunk/lib/compile/readme.txt

    r1186 r1410  
    1 NOTE! Before compiling this code, you need to put a copy of the
    2 BASE2Core.jar and BASE2CorePlugins.jar files in this directory.
     1NOTE! Before compiling this code, you need to place a
     2copy of the following files in this directory. You may
     3issue the command 'ant download-lib' from the project
     4root directory to download those files automatically.
    35
    4 These jar-files can be downloaded by running <ant download-lib>.
     6 * base-core-3.x.jar
     7 * base-coreplugins-3.x.jar
     8
  • plugins/base2/net.sf.basedb.normalizers/trunk/src/net/sf/basedb/normalizers/Normalizations.java

    r947 r1410  
    2525package net.sf.basedb.normalizers;
    2626
    27 import java.io.IOException;
    28 import java.io.InputStream;
    29 import java.net.URL;
    30 import java.util.Properties;
    31 
    3227
    3328/**
     
    3631 
    3732 */
    38 public class Normalizations
     33public final class Normalizations
    3934{
    4035  /**
    41     URL where more information about this package can be found
    42    */
    43   private static String url;
     36    The current version of this package.
     37  */
     38  public static final String VERSION = "1.1-dev";
    4439 
    45   /**
    46     Copyright of this package
    47    */
    48   private static String copyright = "The BASE 2 development team";
    49  
    50   /**
    51     Email address to use for support and to get more information.
    52    */
    53   private static String email = "basedb-users@lists.sourceforge.net";
    54  
    55   /**
    56     The current version of this package
    57    */
    58   private static String package_version;
    59  
    60   static
    61   {
    62     try
    63     {
    64       URL baseConfig = Normalizations.class.getResource("/normalizers.properties");
    65       InputStream is = baseConfig == null ? null : baseConfig.openStream();
    66       if (is != null)
    67       {
    68         Properties config = new Properties();
    69         config.load(is);
    70         is.close();
    71        
    72         package_version = config.getProperty("version");
    73         url = config.getProperty("url");
    74         copyright = config.getProperty("copyright");
    75         email = config.getProperty("email");
    76       }
    77     }
    78     catch (IOException ex)
    79     {}
    80   }
    81  
    82   public static String getVersion()
    83   {
    84     return package_version;   
    85   }
    86 
    87   public static String getUrl()
    88   {
    89     return url;
    90   }
    91 
    92   public static String getCopyright()
    93   {
    94     return copyright;
    95   }
    96 
    97   public static String getEmail()
    98   {
    99     return email;
    100   }
    10140}
  • plugins/base2/net.sf.basedb.normalizers/trunk/src/net/sf/basedb/plugins/AbstractNormalizationPlugin.java

    r1406 r1410  
    8181    Expression used to get data from channel 1
    8282  */
    83   protected Expression ch1 = Dynamic.column(VirtualColumn.channel(1));
     83  protected Expression ch1 = Dynamic.column(VirtualColumn.channelIntensity(1));
    8484 
    8585  /**
    8686    Expression used to get data from channel 2
    8787   */
    88   protected Expression ch2 = Dynamic.column(VirtualColumn.channel(2)); 
     88  protected Expression ch2 = Dynamic.column(VirtualColumn.channelIntensity(2));
    8989 
    9090  /**
     
    124124    if (noOfChannels == 1)
    125125    {
    126       intensityRestriction = Restrictions.gt(Dynamic.column(VirtualColumn.channel(1)), Expressions.aFloat(minIntensity));
     126      intensityRestriction = Restrictions.gt(Dynamic.column(VirtualColumn.channelIntensity(1)), Expressions.aFloat(minIntensity));
    127127    }
    128128    else
     
    131131      for (int i=0; i<noOfChannels; i++)
    132132      {
    133         restrictions[i] = Restrictions.gt(Dynamic.column(VirtualColumn.channel(i+1)), Expressions.aFloat(minIntensity));
     133        restrictions[i] = Restrictions.gt(Dynamic.column(VirtualColumn.channelIntensity(i+1)), Expressions.aFloat(minIntensity));
    134134      }
    135135      intensityRestriction = Restrictions.and(restrictions);
     
    170170      The list will be empty if the given assay doesn't have any spots.
    171171   */
    172   @SuppressWarnings("unchecked")
    173172  protected  List<AbstractSpotData> getSpots(DbControl dc, BioAssay assay, DynamicSpotQuery query, int channels)
    174173  {
  • plugins/base2/net.sf.basedb.normalizers/trunk/src/net/sf/basedb/plugins/AbstractSpotData.java

    r1406 r1410  
    3333  implements Normalizable, Comparable<T>
    3434{
     35  @Override
    3536  public abstract int compareTo(T o);
    3637 
  • plugins/base2/net.sf.basedb.normalizers/trunk/src/net/sf/basedb/plugins/AverageNormalization.java

    r1406 r1410  
    4242import net.sf.basedb.core.Type;
    4343import net.sf.basedb.core.VirtualColumn;
    44 import net.sf.basedb.core.plugin.About;
    45 import net.sf.basedb.core.plugin.AboutImpl;
    4644import net.sf.basedb.core.plugin.GuiContext;
    4745import net.sf.basedb.core.plugin.InteractivePlugin;
     
    5957import net.sf.basedb.core.signal.SignalTarget;
    6058import net.sf.basedb.core.signal.ThreadSignalHandler;
    61 import net.sf.basedb.normalizers.Normalizations;
    6259import net.sf.basedb.util.Values;
    6360
     
    126123  );
    127124     
    128   /*
    129     Information about this plug-in
    130    */
    131   private static final About about = new AboutImpl
    132   (
    133     "Average normalization",
    134 
    135     "This plug-in scales the expression values for an assay with a " +
    136     "factor, ''S'', equal to the ratio of either i) the geometric mean " +
    137     "of the expression values of all spots in the bioassay set divided " +
    138     "by the assay average, or ii) a user defined value divided by the " +
    139     "assay average.\n\n" +
    140     "The new expression values will become ''S'' times the original " +
    141     "expression value.\n\n" +
    142     "Background subtraction and proper filtration have to be done before " +
    143     "running this plug-in.\n\n" +
    144     "1-channel or 2-channel are supported\n\n" +
    145     "This plug-in is part of the BASE normalizers package.",
    146     Normalizations.getVersion(),
    147     Normalizations.getCopyright(),
    148     null,
    149     Normalizations.getEmail(),
    150     Normalizations.getUrl()
    151   );
    152  
    153125  /*
    154126    The lower limit of the spot-intensities to include in the normalization.
     
    266238    @see net.sf.basedb.core.plugin.Plugin
    267239  */
    268   @Override
    269   public About getAbout()
    270   {
    271     return about;
    272   }
    273240  @Override
    274241  public boolean supportsConfigurations()
     
    427394    // Create Transformation
    428395    Transformation t = source.newTransformation(job);
    429     t.setName(about.getName());
     396    t.setName("Average normalization");
    430397    dc.saveItem(t);
    431398   
     
    459426      for (BioAssay assay : assays)
    460427      {
    461         checkInterrupted();
     428        ThreadSignalHandler.checkInterrupted();
    462429       
    463430        float scaleFactor = 1;
     
    476443        while (it.hasNext())
    477444        {
    478           checkInterrupted();
     445          ThreadSignalHandler.checkInterrupted();
    479446          SqlResult r = it.next();
    480447          switch (noOfChannels)
  • plugins/base2/net.sf.basedb.normalizers/trunk/src/net/sf/basedb/plugins/QuantileNormalization.java

    r1406 r1410  
    3737import net.sf.basedb.core.Transformation;
    3838import net.sf.basedb.core.VirtualColumn;
    39 import net.sf.basedb.core.plugin.About;
    40 import net.sf.basedb.core.plugin.AboutImpl;
    4139import net.sf.basedb.core.plugin.GuiContext;
    4240import net.sf.basedb.core.plugin.InteractivePlugin;
     
    4947import net.sf.basedb.core.signal.SignalTarget;
    5048import net.sf.basedb.core.signal.ThreadSignalHandler;
    51 import net.sf.basedb.normalizers.Normalizations;
    5249import net.sf.basedb.util.Values;
    5350
     
    9794  private ThreadSignalHandler signalHandler;
    9895 
    99   /**
    100     Holds information about this plug-in
    101    */
    102   private final static About about = new AboutImpl
    103   (
    104     "Quantile normalization",
    105     "In quantile normalization each assay data is sorted in ascending " +
    106     "expression value order and added to a matrix as columns. The matrix " +
    107     "rows will contain mixed probes (also known as reporters or genes) " +
    108     "decided by their rank. For each row in the matrix, the expression " +
    109     "values are replaced with the row average value. Finally, each assay " +
    110     "is reordered into its original order to retain a standard " +
    111     "expression matrix were each row represents one probe. Assays are " +
    112     "not mixed.\n\n" +
    113     "Background subtraction and proper filtration should be done on the " +
    114     "bioassay set before running this plug-in. The bioassay set must not " +
    115     "contain any missing values.\n\n" +
    116     "1-channel or 2-channel are supported\n\n" +
    117     "This plug-in is part of the BASE normalizers package.",
    118     Normalizations.getVersion(),
    119     Normalizations.getCopyright(),
    120     null,
    121     Normalizations.getEmail(),
    122     Normalizations.getUrl()
    123   );
    12496
    12597  /*
     
    12799    @see net.sf.basedb.core.plugin.Plugin
    128100   */
    129   @Override
    130   public About getAbout()
    131   {
    132     return about;
    133   }
    134101  @Override
    135102  public boolean supportsConfigurations()
     
    353320    for (BioAssay assay : assays)
    354321    {
    355       checkInterrupted();
     322      ThreadSignalHandler.checkInterrupted();
    356323     
    357324      // Control that the number of spots per assay is the same in all assays
     
    409376      // Create Transformation
    410377      Transformation t = source.newTransformation(job);
    411       t.setName(about.getName());
     378      t.setName("Quantile normalization");
    412379      dc.saveItem(t);
    413380     
     
    425392      for (BioAssay assay : assays)
    426393      {
    427         checkInterrupted();
     394        ThreadSignalHandler.checkInterrupted();
    428395       
    429396        short columnNo = assay.getDataCubeColumnNo();
  • plugins/base2/net.sf.basedb.normalizers/trunk/src/net/sf/basedb/plugins/RankInvariantNormalization.java

    r1406 r1410  
    4040import net.sf.basedb.core.Type;
    4141import net.sf.basedb.core.VirtualColumn;
    42 import net.sf.basedb.core.plugin.About;
    43 import net.sf.basedb.core.plugin.AboutImpl;
    4442import net.sf.basedb.core.plugin.GuiContext;
    4543import net.sf.basedb.core.plugin.InteractivePlugin;
     
    5452import net.sf.basedb.core.signal.SignalTarget;
    5553import net.sf.basedb.core.signal.ThreadSignalHandler;
    56 import net.sf.basedb.normalizers.Normalizations;
    5754import net.sf.basedb.util.Values;
    5855
     
    7370    implements InteractivePlugin, SignalTarget
    7471{
    75   /*
    76     Information about this plug-in
    77    */
    78   private static final About about = new AboutImpl
    79   (
    80     "Rank invariant normalization",
    81     "The development of this plug-in is still in progress",
    82     Normalizations.getVersion(),
    83     Normalizations.getCopyright(),
    84     null,
    85     Normalizations.getEmail(),
    86     Normalizations.getUrl()
    87   );
    8872 
    8973  private final int lowRank = 50;
     
    166150      @see net.sf.basedb.core.plugin.Plugin
    167151   */
    168   @Override
    169   public About getAbout()
    170   {
    171     return about;
    172   }
    173152  @Override
    174153  public boolean supportsConfigurations()
     
    323302    // Create Transformation
    324303    Transformation t = source.newTransformation(job);
    325     t.setName(about.getName());
     304    t.setName("Rank invariant normalization");
    326305    dc.saveItem(t);
    327306   
     
    469448    Calculates the bisquare weights. The list-parameter must be sorted asc.
    470449   */
    471   @SuppressWarnings("unchecked")
    472450  private static List<Double> getBiSquareWeights(List<? extends AbstractSpotData> sampleGenes, double y1)
    473451  {
     
    509487    x = data point from the input data.
    510488   */
    511   @SuppressWarnings("unchecked")
    512489  private static double[] getNormCoeffs(List<Double> refGenes, List<? extends AbstractSpotData> sampleGenes, List<Double> weights)
    513490  {
  • plugins/base2/net.sf.basedb.normalizers/trunk/src/net/sf/basedb/plugins/qQuantileNormalization.java

    r1177 r1410  
    3434import net.sf.basedb.core.SpotBatcher;
    3535import net.sf.basedb.core.VirtualColumn;
    36 import net.sf.basedb.core.plugin.AboutImpl;
    3736import net.sf.basedb.core.plugin.Permissions;
    3837import net.sf.basedb.core.plugin.Plugin;
     
    4039import net.sf.basedb.core.query.Orders;
    4140import net.sf.basedb.core.query.SqlResult;
    42 import net.sf.basedb.normalizers.Normalizations;
     41import net.sf.basedb.core.signal.ThreadSignalHandler;
    4342import net.sf.basedb.plugins.AbstractRunBinaryPlugin;
    4443
     
    5554
    5655/**
     56  TODO
     57  ---------------------
     58  NOTE! This plug-ins is currently not working
     59  due to BioAssaySetExporter is no longer part
     60  of BASE. See the exportData() method below.
     61  ---------------------
    5762   In q-quantile normalization ...
    5863
     
    7075
    7176    if (debug_output) System.err.println("Initalizing qQuantileNormalization");
    72 
    73     about = new AboutImpl
    74       (
    75         "qQuantile normalization",
    76         "The qQuantile normalization is inspired by the 'Cubic Spline' " +
    77         "normalization in Illumina Beadstudio and the work by Workman et al., " +
    78         "http://www.pubmedcentral.nih.gov/articlerender.fcgi?tool=pubmed&pubmedid=12225587\n\n" +
    79         "In qQuantile normalization, all assays (including the target) are " +
    80         "sorted in increasing intensity. The sorted list of probe intensities " +
    81         "are partitioned into q groups, and each of theses q groups are " +
    82         "adjusted (normalized) with the corresponding target group. After " +
    83         "normalization the intensity distribution of each assay will be " +
    84         "approximately the same as the target distribution. q is calculated " +
    85         "as q=max(10,min(100,target_size/10)). The program will stop if the " +
    86         "number of well defined expression values in the target or any of the " +
    87         "assays in the set is smaller than q.\n\n" +
    88         "The target is defined by selecting a subset of the assays in the " +
    89         "bioassay set, and the target expression values are the medians of " +
    90         "probe intensities over the bioassay set. Probes with no well defined " +
    91         "measurements in the bioassay set are simply ignored in target " +
    92         "calculation.\n\n" +
    93         "Since the normalization calculations are based on geometric means " +
    94         "and performed in log space the intensities must be positive and " +
    95         "larger than 0. Rather than expecting the user of qQuantile " +
    96         "normalization to remove such intensity the underlying algorithm " +
    97         "silently ignores zero and negative intensities.\n\n" +
    98         "The bioassay set to be normalized must be non-logged values since " +
    99         "this plug-in will log all values before performing the " +
    100         "normalization.\n\n" +
    101         "Background subtraction and proper filtration should be done on the " +
    102         "bioassay set before running this plug-in.\n\n" +
    103         "Only 1-channel data is supported\n\n" +
    104         "This plug-in is part of the BASE normalizers package.",
    105         Normalizations.getVersion(),
    106         Normalizations.getCopyright(),
    107         null,
    108         Normalizations.getEmail(),
    109         Normalizations.getUrl()
    110         );
    11177
    11278    minNofChannels=1;
     
    140106    throws IOException
    141107  {
     108    if (true) throw new IOException("Data export is not yet supported in BASE 3");
    142109    if (debug_output) System.err.println("qQN: exportData()");
    143     FileOutputStream os = new FileOutputStream(new File(getExecDirectory(),
    144                                                         data_before));
     110    FileOutputStream os = new FileOutputStream(new File(getExecDirectory(), data_before));
     111    /*
    145112    BioAssaySetExporter base=new BioAssaySetExporter();
    146113    try
     
    152119      e.printStackTrace();
    153120    }
     121    */
    154122
    155123    // creating a reporter meta data file to track the information in
     
    170138    int nof_channels=sourceBAS.getRawDataType().getChannels();
    171139    for (int i=1; i<=nof_channels; ++i)
    172       query.select(Dynamic.select(VirtualColumn.channel(i)));
     140      query.select(Dynamic.select(VirtualColumn.channelIntensity(i)));
    173141    query.order(Orders.asc(Dynamic.column(VirtualColumn.POSITION)));
    174142    query.order(Orders.asc(Dynamic.column(VirtualColumn.COLUMN)));
     
    178146      int[] column_channel=new int[nof_channels];
    179147      for (int i=0; i<nof_channels; ++i)
    180         column_channel[i]=spotData.getIndex(VirtualColumn.channel(i+1).getName());
     148        column_channel[i]=spotData.getIndex(VirtualColumn.channelIntensity(i+1).getName());
    181149
    182150      ArrayList<Short> referenceSelection=new ArrayList<Short>();
     
    226194  }
    227195
    228 
     196  @Override
    229197  protected void runBinary()
    230198    throws InterruptedException, IOException
     
    242210  }
    243211
    244 
     212  @Override
    245213  protected void storeResult(SpotBatcher batcher)
    246214    throws BaseException
     
    281249          throw new BaseException("Data and result file size mismatch");
    282250        int position = Integer.parseInt(inputline);
    283         if (++line%5000 == 0) checkInterrupted();
     251        if (++line%5000 == 0) ThreadSignalHandler.checkInterrupted();
    284252        for (int i=0; i<column.size(); ++i)
    285253        {
Note: See TracChangeset for help on using the changeset viewer.