Changeset 266


Ignore:
Timestamp:
May 7, 2007, 9:18:49 AM (15 years ago)
Author:
Peter Johansson
Message:

initial check-in of PLIER refs #45

Location:
trunk/se/lu/thep/affymetrix
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/se/lu/thep/affymetrix/Makefile

    r192 r266  
    33# ======================================================================
    44# Copyright (C) 2006 Jari Häkkinen
     5# Copyright (C) 2007 Peter Johansson
    56#
    67# This file is part of RMAExpress plug-in for BASE,
     
    4647# 'make dist' with optional BASEROOT or BASECORE will create binary
    4748# distribution and source distribution packages with corresponding
    48 # md5sum files. NOTE if make dist fails you MUST do 'make
    49 # versionunfix' to recover the RMAExpress.java to its previous
    50 # state. If you fail to do this, the java file will become slightly
    51 # corrupt. This is because 'make dist' will actually use 'sed' to
    52 # replace strings in the source with the version number below.
     49# md5sum files.
    5350#
    5451
    55 VERSION = 0.5
     52VERSION = pre0.6
     53
     54SRCDIR = .src
     55TOPDIR = ../../../..
    5656
    5757# Prefix for where to install the plug-in. This is normally the path
     
    6767PLUGINDIR ?= $(BASEROOT)/$(RELPLUGINDIR)
    6868
    69 JAR  = RMAExpress.jar
     69JAVA = RMAExpress.java Plier.java
     70CLASS = $(JAVA:.java=.class)
     71JAR  = affymetrix.jar
    7072
    7173# Files to include in binary distributions
    72 BINDISTFILES = AUTHORS ChangeLog COPYING INSTALL Makefile README RMAExpress.jar
     74BINDISTFILES = AUTHORS ChangeLog COPYING INSTALL Makefile README $(JAR)
    7375# Binary package name
    74 BINPACKAGEFILE = base_rmaexpress_plugin-$(VERSION)
     76BINPACKAGEFILE = base_affymetrix_plugin-$(VERSION)
    7577# Files to include in binary distributions
    76 SRCDISTFILES = AUTHORS ChangeLog COPYING INSTALL Makefile README RMAExpress.java
     78SRCDISTFILES = AUTHORS ChangeLog COPYING INSTALL Makefile README $(JAVA)
    7779# Binary package name
    78 SRCPACKAGEFILE = base_rmaexpress_plugin-$(VERSION)-src
     80SRCPACKAGEFILE = $(BINPACKAGEFILE)-src
    7981
    80 all: $(JAR)
     82all: $(SRCDIR) $(JAR)
    8183
    82 clean:; @(rm -rf $(JAR) *.class *~ \
     84clean:; @(rm -rf *.jar *.class *~ $(SRCDIR)\
    8385  $(BINPACKAGEFILE) $(BINPACKAGEFILE).tar.gz $(BINPACKAGEFILE).tar.gz.MD5 \
    84   $(SRCPACKAGEFILE) $(SRCPACKAGEFILE).tar.gz $(SRCPACKAGEFILE).tar.gz.MD5 )
     86  $(SRCPACKAGEFILE) $(SRCPACKAGEFILE).tar.gz $(SRCPACKAGEFILE).tar.gz.MD5 ) 
    8587
    86 dist: clean versionfix $(JAR) versionunfix
     88dist: clean $(JAR)
    8789  @echo Creating dist files
    8890  @mkdir $(BINPACKAGEFILE)
     
    9597  @md5sum $(SRCPACKAGEFILE).tar.gz > $(SRCPACKAGEFILE).tar.gz.MD5
    9698
    97 .PHONY: install
    98 install: $(JAR)
    99   mkdirhier $(PLUGINDIR)
    100   cp -p RMAExpress.jar $(PLUGINDIR)
     99.PHONY: all clean dist install install-precompiled
     100
     101install: $(JAR) install-precompiled
    101102
    102103install-precompiled:
    103   mkdirhier $(PLUGINDIR)
    104   cp -p RMAExpress.jar $(PLUGINDIR)
     104  @install -d $(PLUGINDIR)
     105  install -p $(JAR) $(PLUGINDIR)
    105106
    106 $(JAR): RMAExpress.class
     107$(JAR): $(CLASS)
    107108  @echo Creating $(JAR)
    108   @( cd ../../../.. ; \
     109  @( cd $(TOPDIR) ; \
    109110    jar cf se/lu/thep/affymetrix/$(JAR) se/lu/thep/affymetrix/*.class )
    110111
    111 versionfix:;
    112   @mv RMAExpress.java RMAExpress.java_orig
    113   @sed ''s/MAKESUBSTOFVERSIONNUMBER/$(VERSION)/'' \
    114       RMAExpress.java_orig > RMAExpress.java
     112$(SRCDIR)/%.java: %.java Makefile
     113  @sed -e 's/@version.*/@version $(VERSION)/' \
     114  "$<" > "$@"; \
    115115
    116 versionunfix:
    117   @mv RMAExpress.java_orig RMAExpress.java
     116%.class: $(SRCDIR)/%.java
     117  javac -cp $(BASECORE) -d $(TOPDIR) $<
    118118
    119 %.class: %.java
    120   @javac -cp $(BASECORE) $<
     119$(SRCDIR):
     120  mkdir $@
  • trunk/se/lu/thep/affymetrix/Plier.java

    r265 r266  
    33
    44  Copyright (C) 2006 Jari Häkkinen
     5  Copyright (C) 2007 Peter Johansson
    56 
    67  This file is part of BASEPlugIns - Non-core plug-ins for BASE,
     
    8586/**
    8687   This plugin provides means to calculate the fold changes for a root bioassayset
    87    using RMAExpress. It needs the following parameters:
     88   using PLIER. It needs the following parameters:
    8889
    8990   <pre>
     
    9495   </pre>
    9596
    96    @author Jari
    97    @version MAKESUBSTOFVERSIONNUMBER
     97   @author Peter Johansson
     98   @version pre0.6
    9899   @base.modified $Date$
    99100*/
    100101
    101 public class RMAExpress
     102public class Plier
    102103  extends AbstractPlugin
    103104  implements InteractivePlugin
    104105{
    105106
    106   public RMAExpress() {}
     107  public Plier() {}
    107108
    108109  @SuppressWarnings("unchecked")
     
    243244
    244245
    245   public String getRMAExpressConsolePath()
    246   {
    247     if (RMAExpressConsolePath == null) {
     246  public String getAPTPath()
     247  {
     248    if (APTPath == null) {
    248249      DbControl dc = sc.newDbControl();
    249250      String jarpath=PluginDefinition.getByClassName(dc,
    250                                 "se.lu.thep.affymetrix.RMAExpress").getJarPath();
     251                                "se.lu.thep.affymetrix.Plier").getJarPath();
    251252      int pos = jarpath.length();
    252253      while ((pos>0) && (jarpath.charAt(pos-1)!=java.io.File.separatorChar))
    253254        --pos;
    254       RMAExpressConsolePath=jarpath.substring(0,pos);
     255      APTPath=jarpath.substring(0,pos);
    255256      // Hard coded file name and the binary must reside in the same
    256257      // directory as the plug-in jar. The idea behind this is that
    257258      // only the BASE administrator is allowed to change files in the
    258259      // BASE application direcotry structure.
    259       RMAExpressConsolePath+="RMAExpressConsole";
    260     }
    261     return RMAExpressConsolePath;
     260      APTPath+="apt-probeset-summarize";
     261    }
     262    return APTPath;
    262263  }
    263264
     
    303304      for (RawBioAssay rba : sources)
    304305        dc.reattachItem(rba);
    305       runRMAExpress(sources,progress);
    306       storeResult(dc,experiment,sources,name,progress);
    307       dc.commit();
     306      runPlier(sources,progress);
     307      //storeResult(dc,experiment,sources,name,progress);
     308      //dc.commit();
    308309      response.setDone("Plug-in ended successfully");
    309310    }
     
    323324
    324325
    325   private void runRMAExpress(List<RawBioAssay> sources,
    326                              ProgressReporter progress)
     326  private void runPlier(List<RawBioAssay> sources,
     327                        ProgressReporter progress)
    327328    throws InterruptedException, IOException
    328329  {
     
    332333    String filelistname="inputfiles.txt";
    333334    java.io.PrintWriter filelist =
    334       new java.io.PrintWriter(new java.io.File(getExecDirectory(),filelistname));
     335      new java.io.PrintWriter(new java.io.File(getExecDirectory(),
     336                                               filelistname));
     337    filelist.println("cel_files");
    335338    File cdf=Affymetrix.getCdfFile(sources.get(0).getArrayDesign());
    336339    progress.display(percentDone,"Downloading CDF file '" +cdf.getName()+ "'.");
    337     filelist.println(cdf.getName());
    338340    download(cdf);
    339341    for (RawBioAssay rba : sources) {
     
    344346    }
    345347    filelist.close();
    346     String optionname="option.txt";
    347     String resultname="./rma.txt";
    348     java.io.PrintWriter option =
    349       new java.io.PrintWriter(new java.io.File(getExecDirectory(), optionname));
    350     option.println("1\n"+resultname);
    351     option.close();
    352348    percentDone+=1;
    353     progress.display(percentDone,"Running RMAExpress.");
    354     Process p = Runtime.getRuntime().exec(getRMAExpressConsolePath() + " " +
    355                                           filelistname + " " + optionname, null,
    356                                           getExecDirectory());
     349    progress.display(percentDone,"Running PLIER.");
     350    String[] cmd = { getAPTPath() , "--cdf-file", cdf.getName(), "--cel-files",
     351                     filelistname, "-o", getExecDirectory().toString(),
     352                     "--analysis", "plier-mm" };
     353    Process p = Runtime.getRuntime().exec(cmd, null, getExecDirectory());
    357354    p.waitFor();
    358355    int status=p.exitValue();
    359356    if (status>0)
    360       throw new IOException("Unexpected exit of RMAExpress sub-process. " +
     357      throw new IOException("Unexpected exit of PLIER sub-process. " +
    361358                            "Return value: " + status);
    362359  }
     
    370367      FlatFileParser ffp=new FlatFileParser();
    371368      ffp.setInputStream(new java.io.FileInputStream
    372                          (getExecDirectory()+java.io.File.separator+"rma.txt"));
     369                         (getExecDirectory()+java.io.File.separator+
     370                          "plier-mm.summary.txt"), "null");
     371
    373372      ffp.setDataHeaderRegexp(Pattern.compile("Probesets\\t.*"));
    374373      ffp.setDataSplitterRegexp(Pattern.compile("\\t"));
     
    379378      Transformation t=experiment.newTransformation(Job.getById(dc,job.getId()),
    380379                                                    sources);
    381       t.setName("RMAExpress");
     380      t.setName("PLIER");
    382381      BioAssaySet root = t.newProduct("new", "new", false);
    383382      root.setName(name);
     
    428427
    429428  private static final About about = new AboutImpl
    430     ("RMAExpress plug-in", "Computes gene expression summary values for " +
    431      "Affymetrix Genechip data using the Robust Multichip Average " +
    432      "expression summary",
     429    ("PLIER plug-in", "Computes gene expression summary values for " +
     430     "Affymetrix Genechip data using the Probe Logarithm Intensity " +
     431     "ERror algorithm",
    433432     "Version: MAKESUBSTOFVERSIONNUMBER $Revision$ " +
    434433     "$Date$",
    435      "2006 Jari Hakkinen, " +
     434     "2007 Peter Johansson, " +
    436435     "Department of Theoretical Physics, Lund University",
    437436     null, null,
    438      "http://baseplugins.thep.lu.se/wiki/thep.lu.se.RMAExpress" );
     437     "http://baseplugins.thep.lu.se/wiki/se.lu.thep.affymetrix.Plier" );
    439438  private RequestInformation configureJob = null;
    440439  private RequestInformation configurePlugin = null;
     
    456455  private ItemParameterType<RawBioAssay> rawBioAssaysType;
    457456  private PluginParameter<RawBioAssay> rawBioAssaysParameter;
    458   private String RMAExpressConsolePath;
     457  private String APTPath;
    459458}
Note: See TracChangeset for help on using the changeset viewer.