Changeset 3801


Ignore:
Timestamp:
Oct 2, 2007, 9:12:24 AM (15 years ago)
Author:
Nicklas Nordborg
Message:

References #721: It is now possible to select files for an array design

Location:
branches/filedb
Files:
5 added
14 edited

Legend:

Unmodified
Added
Removed
  • branches/filedb/src/clients/web/net/sf/basedb/clients/web/Base.java

    r3783 r3801  
    2727
    2828import net.sf.basedb.core.Coloring;
     29import net.sf.basedb.core.DataFileType;
    2930import net.sf.basedb.core.DateUtil;
    3031import net.sf.basedb.core.File;
     32import net.sf.basedb.core.FileSet;
     33import net.sf.basedb.core.FileStoreEnabled;
    3134import net.sf.basedb.core.Location;
     35import net.sf.basedb.core.Path;
     36import net.sf.basedb.core.Platform;
     37import net.sf.basedb.core.PlatformVariant;
    3238import net.sf.basedb.core.Protocol;
    3339import net.sf.basedb.core.SessionControl;
     
    826832  }
    827833 
     834  /**
     835    Get a query that returns all data file types for a specific
     836    platform/variant that can be used on a given item type.
     837    @param itemType The item type
     838    @param platform The platform to get file types for, or null
     839    @param variant The platform variant to get file types for, or null
     840    @return An <code>ItemQuery</code> object
     841    @since 2.5
     842  */
     843  public static ItemQuery<DataFileType> getDataFileTypes(Item itemType, Platform platform, PlatformVariant variant)
     844  {
     845    ItemQuery<DataFileType> q = DataFileType.getQuery();
     846    q.restrict(
     847      Restrictions.eq(
     848        Hql.property("itemType"),
     849        Expressions.integer(itemType.getValue())
     850      )
     851    );
     852    if (platform != null)
     853    {
     854      q.join(Hql.innerJoin("platforms", "pft"));
     855      q.restrict(Restrictions.eq(Hql.property("pft", "platform"), Hql.entity(platform)));
     856      if (variant != null)
     857      {
     858        q.restrict(Restrictions.or(
     859            Restrictions.eq(Hql.property("pft", "variant"), null),
     860            Restrictions.eq(Hql.property("pft", "variant"), Hql.entity(variant))
     861        ));
     862      }
     863      else
     864      {
     865        q.restrict(Restrictions.eq(Hql.property("pft", "variant"), null));
     866      }
     867    }
     868    q.order(Orders.asc(Hql.property("name")));
     869    q.setCacheResult(true);
     870    return q;
     871  }
     872 
    828873  private static final Float defaultScale = 1.0f;
    829874  /**
     
    10651110  }
    10661111 
     1112  @SuppressWarnings("unchecked")
     1113  public static void updateFiles(DbControl dc, FileStoreEnabled item, HttpServletRequest request)
     1114    throws ItemModifiedException, BaseException
     1115  {
     1116    Enumeration<String> names = (Enumeration<String>)request.getParameterNames();
     1117    FileSet fileSet = null;
     1118    while (names.hasMoreElements())
     1119    {
     1120      String param = names.nextElement();
     1121      if (param.startsWith("datafile."))
     1122      {
     1123        int dataFileTypeId = Values.getInt(param.substring(9));
     1124        String filePath = request.getParameter(param);
     1125        if (fileSet == null) fileSet = item.getFileSet();
     1126        DataFileType dft = DataFileType.getById(dc, dataFileTypeId);
     1127        File file = File.getByPath(dc, new Path(filePath, Path.Type.FILE), false);
     1128        fileSet.setMember(file, dft);
     1129      }
     1130    }
     1131   
     1132  }
     1133 
    10671134  /**
    10681135    @see #getEncodedName(Nameable, boolean, String)
  • branches/filedb/src/core/net/sf/basedb/core/Affymetrix.java

    r3741 r3801  
    4444    The name of the {@link AnyToAny} link between an array design
    4545    and a file that contains the CDF information.
     46    @deprecated See {@link DataFileType#AFFYMETRIX_CDF}
    4647  */
    4748  public static final String CDF_LINK_NAME = "cdf-file";
     
    5051    The name of the {@link AnyToAny} link between a raw bioassay
    5152    and a file that contains the CEL information.
     53    @deprecated See {@link DataFileType#AFFYMETRIX_CEL}
    5254  */
    5355  public static final String CEL_LINK_NAME = "cel-file";
     
    5658    The name of the {@link AnyToAny} link between a raw bioassay
    5759    and a file that contains the CHP information.
     60    @deprecated See {@link DataFileType}
    5861  */
    5962  public static final String CHP_LINK_NAME = "chp-file";
     
    7578      Affymetrix chip or if the file is not a CDF file
    7679    @throws BaseException If there is another error
     80    @deprecated
    7781  */
    7882  public static void setCdfFile(ArrayDesign design, File file)
     
    96100      if (!ata.isInDatabase()) dc.saveItem(ata);
    97101      design.getData().setHasFeatures(true);
    98       design.getData().setNumFeatures(cdf.getHeader().getNumProbeSets());
     102      design.getData().setNumFileFeatures(cdf.getHeader().getNumProbeSets());
    99103    }
    100104    else
     
    107111  /**
    108112    Get the file that has been specified as the CDF file for an
    109     array design.
     113    array design. This method has been deprecated with the
     114    implementation of the {@link Platform} and {@link DataFileType}
     115    which solves the problem in a more generic way.
     116    <p>
     117    This method is equivalent to:
     118    <pre class="code">
     119DataFileType cdfType =
     120   DataFileType.getByExternalId(dc, DataFileType.AFFYMETRIX_CDF);
     121File cdfFile = design.getFileSet().getMember(cdfType.getFile());
     122</pre>
    110123   
    111124    @param design The design to get the CDF file from, it must
     
    117130      Affymetrix chip
    118131    @throws BaseException If there is another error
     132    @deprecated Use {@link FileSet#getMember(DataFileType)}
     133      with a data file type of {@link DataFileType#AFFYMETRIX_CDF}
     134      instead
    119135  */
    120136  public static File getCdfFile(ArrayDesign design)
     
    128144    DbControl dc = design.getDbControl();
    129145    File cdfFile = null;
    130     try
    131     {
    132       AnyToAny ata = AnyToAny.getByName(dc, design, CDF_LINK_NAME);
    133       if (ata.getToType() == Item.FILE)
    134       {
    135         cdfFile = (File)ata.getTo();
    136       }
    137     }
    138     catch (ItemNotFoundException ex)
    139     {}
     146    if (design.hasFileSet())
     147    {
     148      FileSet fileSet = design.getFileSet();
     149      DataFileType cdfType = DataFileType.getByExternalId(dc, DataFileType.AFFYMETRIX_CDF);
     150      if (fileSet.hasMember(cdfType))
     151      {
     152        FileSetMember member = fileSet.getMember(cdfType);
     153        cdfFile = member.getFile();
     154      }
     155    }
    140156    return cdfFile;
    141157  }
     
    170186      raw data type
    171187    @throws BaseException If there is another error
     188    @deprecated
    172189  */
    173190  public static void setCelFile(RawBioAssay rawBioAssay, File file)
     
    250267      Affymetrix raw data type
    251268    @throws BaseException If there is another error
     269    @deprecated
    252270  */
    253271  public static File getCelFile(RawBioAssay rawBioAssay)
  • branches/filedb/src/core/net/sf/basedb/core/ArrayDesign.java

    r3797 r3801  
    9595    ad.setPlatform(platform);
    9696    return ad;
    97    
    98   }
     97  }
     98
     99  public static ArrayDesign getNew(DbControl dc, PlatformVariant variant)
     100  {
     101    ArrayDesign ad = dc.newItem(ArrayDesign.class);
     102    ad.setName("New array design");
     103    ad.setVariant(variant);
     104    return ad;
     105  }
     106 
    99107 
    100108  /**
     
    265273  // -------------------------------------------
    266274 
    267   private void setPlatform(Platform platform)
    268   {
     275  public void setPlatform(Platform platform)
     276  {
     277    checkPermission(Permission.WRITE);
    269278    if (platform == null) throw new InvalidUseOfNullException("platform");
    270279    getData().setPlatform(platform.getData());
    271   }
    272  
    273   private void setVariant(PlatformVariant variant)
    274   {
    275     if (variant == null) throw new InvalidUseOfNullException("variant");
    276     getData().setVariant(variant.getData());
     280    getData().setVariant(null);
     281  }
     282 
     283  public void setVariant(PlatformVariant variant)
     284  {
     285    checkPermission(Permission.WRITE);
     286    if (variant != null)
     287    {
     288      getData().setVariant(variant.getData());
     289      getData().setPlatform(variant.getData().getPlatform());
     290    }
     291    else
     292    {
     293      getData().setVariant(null);
     294    }
    277295  }
    278296 
     
    280298      @return TRUE if this is an AffyChip, FALSE otherwise.
    281299      @deprecated Use {@link #getPlatform()} instead and compare the
    282         system ID with {@link Platform#AFFYMETRIX}
     300        external ID with {@link Platform#AFFYMETRIX}
    283301  */
    284302  public boolean isAffyChip()
     
    580598  /**
    581599    Get the number of features added to this array design. If the
    582     array design is an Affymetrix design information in the CDF file is
    583     used, otherwise the database is queried.
     600    array design has features in the database the value from {@link #getNumDbFeatures()}
     601    is returned, otherwise the value from {@link #getNumFileFeatures()}
    584602    @return The number of features or probesets
    585603    @since 2.4
    586     @deprecated Use {@link #getNumFeatures()} instead
     604    @deprecated Use {@link #getNumDbFeatures()} and/or {@link #getNumFileFeatures()}
     605      instead
    587606  */
    588607  public long getNumFeatures(DbControl dc)
    589608  {
    590     return getNumFeatures();
    591   }
    592  
    593   /**
    594     Get the number of features on this array design. Depending on the
    595     type of array design, this may or may not correspond to the number
    596     of features in the database.
     609    int dbFeatures = getNumDbFeatures();
     610    return dbFeatures > 0 ? dbFeatures : getNumFileFeatures();
     611  }
     612 
     613  /**
     614    Get the number of features on this array design that are
     615    stored in the database.
    597616    @return The number of features or probesets
    598617    @since 2.5
    599618  */
    600   public int getNumFeatures()
    601   {
    602     return getData().getNumFeatures();
     619  public int getNumDbFeatures()
     620  {
     621    return getData().getNumDbFeatures();
     622  }
     623
     624  /**
     625    Get the number of features on this array design that are
     626    stored inside files.
     627    @return The number of features or probesets
     628    @since 2.5
     629  */
     630  public int getNumFileFeatures()
     631  {
     632    return getData().getNumFileFeatures();
    603633  }
    604634 
  • branches/filedb/src/core/net/sf/basedb/core/DataFileType.java

    r3797 r3801  
    5353  public static final Item TYPE = Item.DATAFILETYPE;
    5454
     55  public static String AFFYMETRIX_CDF = "affymetrix.cdf";
     56  public static String AFFYMETRIX_CEL = "affymetrix.cel";
     57 
    5558  /**
    5659    The maximum length of the file extension that can be stored in the database.
  • branches/filedb/src/core/net/sf/basedb/core/Install.java

    r3800 r3801  
    687687        "net.sf.basedb.core.filehandler.CdfFileHandler",
    688688        "net.sf.basedb.core.filehandler.CdfFileHandler");
     689      DataFileTypeData reporterMapFile = createDataFileType(
     690        "generic.reportermap", "Reporter map",
     691        "Generic file that contains information about the reporters present on an array design",
     692        Item.ARRAYDESIGN, null, reporterMapType, null, null);
     693      DataFileTypeData printMapFile = createDataFileType(
     694        "generic.printmap", "Print map",
     695        "Generic file that contains information about how the plates was printed on the array design",
     696        Item.ARRAYDESIGN, null, printMapType, null, null);
    689697     
    690698      // Platforms and variants
    691699      if (progress != null) progress.display((int)(26*progress_factor), "--Creating platforms...");
    692700      createPlatform("generic", "Generic", "Generic platform which expects data to be imported into the database",
    693         false, null, 0);
     701        false, null, 0,
     702        new PlatformFT(reporterMapFile, false),
     703        new PlatformFT(printMapFile, false));
    694704      createPlatform("affymetrix", "Affymetrix", "Affymetrix platform", true, null, 1,
    695705        new PlatformFT(celFile, true),
  • branches/filedb/src/core/net/sf/basedb/core/Platform.java

    r3800 r3801  
    485485  }
    486486 
     487 
     488  public PlatformFileType getFileType(DataFileType type, PlatformVariant variant)
     489  {
     490    if (type == null) throw new InvalidUseOfNullException("type");
     491    PlatformFileType pf = null;
     492    FileTypeIndex index = new FileTypeIndex(variant == null ? null : variant.getData(), type.getData());
     493    if (getData().getFileTypes().containsKey(index))
     494    {
     495      PlatformFileTypeData pfData = getData().getFileTypes().get(index);
     496      if (pfData != null)
     497      {
     498        DbControl dc = getDbControl();
     499        pf = dc.getItem(PlatformFileType.class, pfData);
     500      }
     501    }
     502    return pf;
     503  }
     504 
    487505}
  • branches/filedb/src/core/net/sf/basedb/core/Update.java

    r3796 r3801  
    16681668          log.error("Could not set number of features on array design: " + design, t);
    16691669        }
    1670         design.setNumFeatures(numFeatures);
     1670        //design.setNumFeatures(numFeatures);
    16711671      }
    16721672
  • branches/filedb/src/core/net/sf/basedb/core/data/ArrayDesignData.java

    r3764 r3801  
    6464    Get the platform this raw bioassay uses
    6565    @since 2.5
    66     @hibernate.many-to-one outer-join="false" update="false"
     66    @hibernate.many-to-one outer-join="false"
    6767    @hibernate.column name="`platform_id`" not-null="true"
    6868  */
     
    8080    Get the platform variant this raw bioassay uses, or null.
    8181    @since 2.5
    82     @hibernate.many-to-one outer-join="false" update="false"
     82    @hibernate.many-to-one outer-join="false"
    8383    @hibernate.column name="`variant_id`"
    8484  */
     
    124124  }
    125125
    126   private int features;
    127   /**
    128     The number of features on this array design
    129     @hibernate.property column="`features`" type="int" not-null="true"
    130   */
    131   public int getNumFeatures()
    132   {
    133     return features;
    134   }
    135   public void setNumFeatures(int features)
    136   {
    137     this.features = features;
     126  private int dbFeatures;
     127  /**
     128    The number of features on this array design that are stored in
     129    the database.
     130    @hibernate.property column="`db_features`" type="int" not-null="true"
     131    @since 2.5
     132  */
     133  public int getNumDbFeatures()
     134  {
     135    return dbFeatures;
     136  }
     137  public void setNumDbFeatures(int dbFeatures)
     138  {
     139    this.dbFeatures = dbFeatures;
     140  }
     141 
     142  private int fileFeatures;
     143  /**
     144    The number of features on this array design that are stored inside
     145    files.
     146    @hibernate.property column="`file_features`" type="int" not-null="true"
     147    @since 2.5
     148  */
     149  public int getNumFileFeatures()
     150  {
     151    return fileFeatures;
     152  }
     153  public void setNumFileFeatures(int fileFeatures)
     154  {
     155    this.fileFeatures = fileFeatures;
    138156  }
    139157 
  • branches/filedb/src/core/net/sf/basedb/core/data/DataFileTypeData.java

    r3797 r3801  
    2323*/
    2424package net.sf.basedb.core.data;
     25
     26import java.util.Set;
    2527
    2628/**
     
    189191  }
    190192
     193  private Set<PlatformFileTypeData> platforms;
     194  /**
     195    This is the inverse end.
     196    @see PlatformFileTypeData#getDataFileType()
     197    @hibernate.set lazy="true" inverse="true"
     198    @hibernate.collection-key column="`datafiletype_id`"
     199    @hibernate.collection-one-to-many class="net.sf.basedb.core.data.PlatformFileTypeData"
     200  */
     201  Set<PlatformFileTypeData> getPlatforms()
     202  {
     203    return platforms;
     204  }
     205  void setPlatforms(Set<PlatformFileTypeData> platforms)
     206  {
     207    this.platforms = platforms;
     208  }
     209 
    191210}
  • branches/filedb/www/include/styles/main.css

    r3793 r3801  
    209209}
    210210
     211.selectoptionindent {
     212  padding-left: 1em;
     213}
     214
    211215.selectionlist .default {
    212216}
  • branches/filedb/www/lims/arraydesigns/edit_design.jsp

    r3679 r3801  
    3535  import="net.sf.basedb.core.ArrayDesign"
    3636  import="net.sf.basedb.core.File"
     37  import="net.sf.basedb.core.Platform"
     38  import="net.sf.basedb.core.PlatformVariant"
    3739  import="net.sf.basedb.core.Affymetrix"
    3840  import="net.sf.basedb.core.ItemQuery"
     
    6567  ArrayDesign design = null;
    6668 
    67   boolean readCurrentCdfFile = true;
    68   File currentCdfFile = null;
    69 
    70   // Load recently used items
    71   List<File> recentFiles = (List<File>)cc.getRecent(dc, Item.FILE);
     69  Platform currentPlatform = null;
     70  PlatformVariant currentVariant = null;
    7271 
    7372  if (itemId == 0)
     
    8281    title = "Edit array design -- " + HTML.encodeTags(design.getName());
    8382   
    84     if (design.isAffyChip())
    85     {
    86       try
    87       {
    88         currentCdfFile = Affymetrix.getCdfFile(design);
    89       }
    90       catch (PermissionDeniedException ex)
    91       {
    92         readCurrentCdfFile = false;
    93       }
    94     }
     83    currentPlatform = design.getPlatform();
     84    currentVariant = design.getVariant();
     85    design.checkPermission(Permission.WRITE);
    9586  }
    96   if (design != null && !design.hasPermission(Permission.WRITE))
    97   {
    98     throw new PermissionDeniedException(Permission.WRITE, itemType.toString());
    99   }
     87
     88  ItemQuery<Platform> platformQuery = Platform.getQuery();
     89  platformQuery.order(Orders.asc(Hql.property("name")));
     90  platformQuery.setCacheResult(true);
     91  ItemResultList<Platform> platforms = platformQuery.list(dc);
     92
     93  ItemQuery<PlatformVariant> variantQuery = PlatformVariant.getQuery();
     94  variantQuery.order(Orders.asc(Hql.property("name")));
     95  variantQuery.setCacheResult(true);
     96  ItemResultList<PlatformVariant> variants = variantQuery.list(dc);
     97 
    10098  final String clazz = "class=\"text\"";
    10199  final String requiredClazz = "class=\"text required\"";
     
    103101
    104102  <base:page type="popup" title="<%=title%>">
    105   <base:head scripts="tabcontrol.js,annotations.js" styles="tabcontrol.css">
     103  <base:head scripts="tabcontrol.js,annotations.js,platforms.js" styles="tabcontrol.css">
    106104    <script language="JavaScript">
    107105    // Validate the "ArrayDesign" tab
     
    132130          Annotations.addInheritedAnnotationsToForm(frames.inheritedAnnotations, frm);
    133131        }
     132        if (dataFilesLoaded)
     133        {
     134          Platforms.addDataFilesToForm(frames.datafiles, frm);
     135        }
    134136        frm.submit();
    135137      }
     
    139141    var inheritedAnnotationsLoaded = false;
    140142    var parentsChanged = false;
     143    var dataFilesLoaded = false;
     144    var platformChanged = false;
    141145    function switchTab(tabControlId, tabId)
    142146    {
     
    155159          parentsChanged = false;
    156160        }
     161        else if (tabId == 'datafiles' && (platformChanged || !dataFilesLoaded))
     162        {
     163          var platformId = getPlatform();
     164          var variantId = getVariant();
     165          Platforms.loadDataFilesFrame(frames.datafiles, '<%=ID%>', '<%=itemType.name()%>', <%=design == null ? 0 : design.getId()%>, platformId, variantId);
     166          dataFilesLoaded = true;
     167          platformChanged = false;
     168        }
    157169      }
    158170    }
     
    162174      return new Array();
    163175    }
    164 
    165     function selectFileOnClick()
    166     {
    167       var frm = document.forms['design'];
    168       if (frm.affy_chip && !frm.affy_chip.checked)
    169       {
    170         if (!confirm('CDF-files are only used for Affymetrix chips.\nDo you want to activate the checkbox'))
    171         {
    172           return;
    173         }
    174         frm.affy_chip.checked = true;
    175       }
    176       var url = '../../filemanager/index.jsp?ID=<%=ID%>&cmd=SelectOne&callback=setFileCallback';
    177       if (frm.cdffile_id.length > 1)
    178       {
    179         var id = Math.abs(parseInt(frm.cdffile_id[1].value));       
    180         url += '&item_id='+id;
    181       }
    182       url += '&filter:STRING:name=%25.cdf';
    183       Main.openPopup(url, 'SelectFile', 1000, 700);
    184     }
    185     function setFileCallback(id, name)
    186     {
    187       var frm = document.forms['design'];
    188       var list = frm.cdffile_id;
    189       if (list.length < 2 || list[1].value == '0') // >
    190       {
    191         Forms.addListOption(list, 1, new Option());
    192       }
    193       list[1].value = id;
    194       list[1].text = name;
    195       list.selectedIndex = 1;
    196     }
    197 
    198     function affyChipOnClick()
    199     {
    200       var frm = document.forms['design'];
    201       if (!frm.affy_chip.checked)
    202       {
    203         frm.cdffile_id.selectedIndex = 0;
    204       }
    205       else if (frm.cdffile_id.length > 1)
    206       {
    207         frm.cdffile_id.selectedIndex = 1;
    208       }
     176   
     177    function getPlatform()
     178    {
     179      var frm = document.forms['design'];
     180      var pv = frm.platform[frm.platform.selectedIndex].value.split(':');
     181      return pv[0];
     182    }
     183   
     184    function getVariant()
     185    {
     186      var frm = document.forms['design'];
     187      var pv = frm.platform[frm.platform.selectedIndex].value.split(':');
     188      return pv.length > 1 ? pv[1] : null;
     189    }
     190
     191    function platformOnChange()
     192    {
     193      platformChanged = true;
    209194    }
    210195
     
    221206      }
    222207      %>
     208      initPlatforms(<%=currentPlatform == null ? 0 : currentPlatform.getId()%>, <%=currentVariant == null ? 0 : currentVariant.getId()%>);
     209    }
     210   
     211    function initPlatforms(platformId, variantId)
     212    {
     213      var platforms = new Array();
     214      var variants = new Array();
     215      <%
     216      for (Platform p : platforms)
     217      {
     218        %>
     219        platforms[platforms.length] = { name:'<%=p.getName()%>', id:<%=p.getId()%> };
     220        variants['platform.<%=p.getId()%>'] = new Array();
     221        <%
     222      }
     223      for (PlatformVariant v : variants)
     224      {
     225        Platform p = v.getPlatform();
     226        String index = "platform." + p.getId();
     227        %>
     228        variants['<%=index%>'][variants['<%=index%>'].length] = { name:'<%=v.getName()%>', id:<%=v.getId()%> };
     229        <%
     230      }
     231      %>
     232      var frm = document.forms['design'];
     233      for (var p = 0; p < platforms.length; p++)
     234      {
     235        var platform = platforms[p];
     236        var index = 'platform.' + platform.id;
     237        var option = new Option(platform.name, platform.id, false, platformId == platform.id && !variantId);
     238        frm.platform[frm.platform.length] = option;
     239        option.className = 'selectoptionheader';
     240        for (var v = 0; v < variants[index].length; v++)
     241        {
     242          var variant = variants[index][v];
     243          option = new Option(variant.name, platform.id + ':' + variant.id, false, platformId == platform.id && variantId == variant.id);
     244          option.className = 'selectoptionindent';
     245          frm.platform[frm.platform.length] = option;
     246        }
     247      }
    223248    }
    224249    </script>
     
    241266      </tr>
    242267      <tr>
    243         <td class="prompt">Affy chip</td>
     268        <td class="prompt">Platform</td>
    244269        <td>
    245           <%
    246           if (design != null)
    247           {
    248             %>
    249             <%=design.isAffyChip() ? "yes" : "no"%>
    250             <%
    251           }
    252           else
    253           {
    254             %>
    255             <input type="checkbox" name="affy_chip" value="1"
    256               onclick="affyChipOnClick()"
    257               <%=Values.getBoolean(cc.getPropertyValue("affyChip")) ? "checked" : ""%>>
    258               (can't be changed later)
    259             <%
    260           }
    261           %>
     270          <select name="platform" onchange="platformOnChange()">
     271          </select>
    262272        </td>
    263273      </tr>
    264       <%
    265       if (design == null || design.isAffyChip())
    266       {
    267         %>
    268         <tr id="cdfFile">
    269           <td class="prompt">CDF file</td>
    270           <td>
    271             <base:select
    272               id="cdffile_id"
    273               clazz="selectionlist"
    274               required="false"
    275               current="<%=currentCdfFile%>"
    276               denied="<%=!readCurrentCdfFile%>"
    277               recent="<%=recentFiles%>"
    278               newitem="<%=design == null%>"
    279               onselect="selectFileOnClick()"
    280             />
    281           </td>
    282         </tr>
    283         <%
    284       }
    285       %>
    286274      <tr valign=top>
    287275        <td class="prompt">Description</td>
     
    295283      </table>
    296284      <div align=right>&nbsp;<i><base:icon image="required.gif" /> = required information</i></div>
     285    </t:tab>
     286
     287    <t:tab id="datafiles" title="Data files" helpid="datafiles.edit">
     288      <iframe name="datafiles" id="idDatafiles" src="../../common/datafiles/wait.jsp"
     289        width="100%"  height="<%=(int)(scale*370)%>" frameborder=0 vspace=0 hspace=0
     290        marginwidth=0 marginheight=0 scrolling="auto" style="overflow: visible"></iframe>
    297291    </t:tab>
    298292   
  • branches/filedb/www/lims/arraydesigns/index.jsp

    r3741 r3801  
    3434  import="net.sf.basedb.core.ArrayDesign"
    3535  import="net.sf.basedb.core.Affymetrix"
     36  import="net.sf.basedb.core.Platform"
     37  import="net.sf.basedb.core.PlatformVariant"
    3638  import="net.sf.basedb.core.Plate"
    3739  import="net.sf.basedb.core.File"
    3840  import="net.sf.basedb.core.FileType"
     41  import="net.sf.basedb.core.FileSet"
     42  import="net.sf.basedb.core.Path"
     43  import="net.sf.basedb.core.DataFileType"
    3944  import="net.sf.basedb.core.ItemQuery"
    4045  import="net.sf.basedb.core.ItemResultIterator"
     
    6065<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
    6166<%!
    62   private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,affyChip,numFeatures,description");
     67  private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,platform,numDbFeatures,numFileFeatures,description");
    6368  private static final Item itemType = Item.ARRAYDESIGN;
    6469%>
     
    135140    dc = sc.newDbControl();
    136141    ArrayDesign design = (ArrayDesign)cc.getObject("item");
     142   
     143    String[] pv = request.getParameter("platform").split(":");
     144    int platformId = Values.getInt(pv[0], -1);
     145    int variantId = pv.length > 1 ? Values.getInt(pv[1], -1) : -1;
     146    Platform platform = platformId > 0 ? Platform.getById(dc, platformId) : null;
     147    PlatformVariant variant = variantId > 0 ? PlatformVariant.getById(dc, variantId) : null;
    137148    if (design == null)
    138149    {
    139       boolean isAffy = Values.getBoolean(request.getParameter("affy_chip"));
    140       design = ArrayDesign.getNew(dc, isAffy);
     150      if (variant != null)
     151      {
     152        design = ArrayDesign.getNew(dc, variant);
     153      }
     154      else
     155      {
     156        design = ArrayDesign.getNew(dc, platform);
     157      }
    141158      message = "Array design created";
    142159      dc.saveItem(design);
     
    145162    {
    146163      dc.reattachItem(design);
     164      if (variant != null)
     165      {
     166        design.setVariant(variant);
     167      }
     168      else if (platform != null)
     169      {
     170        design.setPlatform(platform);
     171      }
    147172      message = "Array design updated";
    148173    }
    149174    design.setName(Values.getStringOrNull(request.getParameter("name")));
    150175    design.setDescription(Values.getStringOrNull(request.getParameter("description")));
    151     if (design.isAffyChip())
    152     {
    153       int cdfFileId = Values.getInt(request.getParameter("cdffile_id"), -1);
    154       if (cdfFileId >= 0) // < 0 = denied or unchanged
    155       {
    156         File cdfFile = cdfFileId == 0 ? null : File.getById(dc, cdfFileId);
    157         Affymetrix.setCdfFile(design, cdfFile);
    158         if (cdfFile != null) cc.setRecent(cdfFile, maxRecent);
    159       }
    160     }
    161 
     176
     177    // Data files tab
     178    Base.updateFiles(dc, design, request);
     179   
    162180    // Annotations tab
    163181    Base.updateAnnotations(dc, design, design, request);
  • branches/filedb/www/lims/arraydesigns/list_designs.jsp

    r3741 r3801  
    3333  import="net.sf.basedb.core.ArrayBatch"
    3434  import="net.sf.basedb.core.Affymetrix"
     35  import="net.sf.basedb.core.Platform"
     36  import="net.sf.basedb.core.PlatformVariant"
    3537  import="net.sf.basedb.core.File"
    3638  import="net.sf.basedb.core.AnnotationType"
     
    9597  final boolean createBatchPermission = sc.hasPermission(Permission.CREATE, Item.ARRAYBATCH);   
    9698
     99  // Get all platforms
     100  final ItemQuery<Platform> platformQuery = Platform.getQuery();
     101  platformQuery.order(Orders.asc(Hql.property("name")));
     102  platformQuery.setCacheResult(true);
     103  Enumeration<String, String> platforms = new Enumeration<String, String>();
     104  for (Platform p : platformQuery.list(dc))
     105  {
     106    platforms.add(Integer.toString(p.getId()), p.getName());
     107  }
     108 
    97109  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
    98110  annotationTypes = annotationTypeQuery.list(dc);
     
    264276      />
    265277      <tbl:columndef
    266         id="numFeatures"
    267         property="numFeatures"
     278        id="numDbFeatures"
     279        property="numDbFeatures"
    268280        datatype="int"
    269         title="Num features"
    270         sortable="true"
    271         filterable="true"
    272         exportable="true"
    273       />
     281        title="Db features"
     282        sortable="true"
     283        filterable="true"
     284        exportable="true"
     285      />
     286      <tbl:columndef
     287        id="numFileFeatures"
     288        property="numFileFeatures"
     289        datatype="int"
     290        title="File features"
     291        sortable="true"
     292        filterable="true"
     293        exportable="true"
     294      />
     295      <tbl:columndef
     296        id="platform"
     297        property="platform"
     298        sortproperty="platform.name"
     299        exportproperty="platform.name"
     300        datatype="int"
     301        enumeration="<%=platforms%>"
     302        title="Platform"
     303        sortable="true"
     304        filterable="true"
     305        exportable="true"
     306      /> 
     307      <tbl:columndef
     308        id="variant"
     309        property="variant.name"
     310        datatype="string"
     311        title="Variant"
     312        sortable="true"
     313        filterable="true"
     314        exportable="true"
     315      /> 
    274316      <tbl:columndef
    275317        id="batches"
     
    493535                  onclick="itemOnClick(<%=writePermission ? "event" : null%>, <%=itemId%>)"
    494536                  title="<%=tooltip%>"><%=name%></div></tbl:cell>
     537                <tbl:cell column="platform"
     538                  ><base:propertyvalue
     539                    item="<%=item%>"
     540                    property="platform"
     541                    enableEditLink="<%=mode.hasEditLink()%>"
     542                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
     543                  /></tbl:cell>
     544                <tbl:cell column="variant"
     545                  ><base:propertyvalue
     546                    item="<%=item%>"
     547                    property="variant"
     548                    enableEditLink="<%=mode.hasEditLink()%>"
     549                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
     550                  /></tbl:cell>
    495551                <tbl:cell column="affyChip"><%=item.isAffyChip()%></tbl:cell>
    496552                <tbl:cell column="cdfFile">
     
    515571                </tbl:cell>
    516572                <tbl:cell column="hasFeatures"><%=item.hasFeatures() ? "yes" : "no"%></tbl:cell>
    517                 <tbl:cell column="numFeatures"><%=item.getNumFeatures()%></tbl:cell>
     573                <tbl:cell column="numDbFeatures"><%=item.getNumDbFeatures()%></tbl:cell>
     574                <tbl:cell column="numFileFeatures"><%=item.getNumFileFeatures()%></tbl:cell>
    518575                <tbl:cell column="batches">
    519576                  <%
  • branches/filedb/www/lims/arraydesigns/view_design.jsp

    r3741 r3801  
    3636  import="net.sf.basedb.core.Permission"
    3737  import="net.sf.basedb.core.AnnotationType"
     38  import="net.sf.basedb.core.FileSet"
     39  import="net.sf.basedb.core.FileSetMember"
     40  import="net.sf.basedb.core.DataFileType"
    3841  import="net.sf.basedb.core.AnnotationSet"
    3942  import="net.sf.basedb.core.ArrayDesign"
     
    268271      </tr>
    269272      <tr>
    270         <td class="prompt">Affy chip</td>
    271         <td><%=design.isAffyChip() ? "yes" : "no"%></td>
     273        <td class="prompt">Platform</td>
     274        <td><base:propertyvalue item="<%=design%>" property="platform" /></td>
    272275      </tr>
    273       <%
    274       if (design.isAffyChip())
    275       {
    276         boolean readCurrentCdfFile = true;
    277         File currentCdfFile = null;
    278         try
    279         {
    280           currentCdfFile = Affymetrix.getCdfFile(design);
    281         }
    282         catch (PermissionDeniedException ex)
    283         {
    284           readCurrentCdfFile = false;
    285         }
    286         %>
    287         <tr>
    288           <td class="prompt">CDF file</td>
    289           <td>
    290             <%=Base.getLinkedFile(ID, currentCdfFile, !readCurrentCdfFile, true, true, root)%>
    291             <%
    292             if (currentCdfFile != null)
    293             {
    294               try
    295               {
    296                 PluginDefinition.getByClassName(dc, "net.sf.basedb.plugins.CdfFileReporterImporter");
    297                 %>
    298                 [<a href="javascript:verifyReporters()">verify reporters</a>]
    299                 <%
    300               }
    301               catch (Throwable t)
    302               {}
    303             }
    304             %>
    305           </td>
    306         </tr>
    307         <%
    308       }
    309       %>
     276      <tr>
     277        <td class="prompt">Variant</td>
     278        <td><base:propertyvalue item="<%=design%>" property="variant" /></td>
     279      </tr>
    310280      <tr>
    311281        <td class="prompt">Features</td>
    312         <td><%=design.hasFeatures() ? "yes (" + design.getNumFeatures() + ")" : "no"%></td>
     282        <td><%=design.hasFeatures() ? "yes (db: " + design.getNumDbFeatures() + "; file: " + design.getNumFileFeatures() + ")" : "no"%></td>
    313283      </tr>
    314284      <tr>
     
    321291      </tr>
    322292      </table>
     293     
     294     
     295      <jsp:include page="../../common/datafiles/list_files.jsp">
     296        <jsp:param name="item_type" value="<%=itemType.name()%>" />
     297        <jsp:param name="item_id" value="<%=itemId%>" />
     298        <jsp:param name="ID" value="<%=ID%>" />
     299      </jsp:include>
    323300     
    324301      <%
Note: See TracChangeset for help on using the changeset viewer.