Changeset 5652


Ignore:
Timestamp:
Jun 10, 2011, 3:31:58 PM (10 years ago)
Author:
Nicklas Nordborg
Message:

References #1153: Handling short read transcript sequence data

Replaced Scan with DerivedBioAssaySet. The code is once again in a status such that it compiles. I am working with the test programs to make sure that what has been done so far is working. The web client can't be used at the moment. The current design is a bit different from the UML. I'll update this later as I implement the remaining functionality.

Location:
trunk
Files:
8 added
10 deleted
56 edited

Legend:

Unmodified
Added
Removed
  • trunk/config/dist/ehcache.xml

    r5642 r5652  
    287287  />
    288288  <cache
    289     name="net.sf.basedb.core.data.ScanData"
    290     maxElementsInMemory="100"
    291     eternal="false"
    292     timeToIdleSeconds="3600"
    293     timeToLiveSeconds="3600"
    294     overflowToDisk="false"
    295   />
    296   <cache
    297289    name="net.sf.basedb.core.data.TagData"
    298290    maxElementsInMemory="100"
  • trunk/config/dist/hibernate.cfg.xml

    r5642 r5652  
    175175    />
    176176    <class-cache
    177       class="net.sf.basedb.core.data.ScanData"
    178       usage="nonstrict-read-write"
    179     />
    180     <class-cache
    181177      class="net.sf.basedb.core.data.TagData"
    182178      usage="nonstrict-read-write"
  • trunk/src/clients/web/net/sf/basedb/clients/web/PermissionUtil.java

    r5642 r5652  
    161161    Item.PLATEEVENT, Item.PLATEEVENTTYPE, Item.WELL,
    162162    Item.ARRAYDESIGNBLOCK, Item.FEATURE, Item.ARRAYDESIGNPLATE,
    163     Item.IMAGE, Item.SPOTIMAGES, Item.RAWDATA,
     163    Item.SPOTIMAGES, Item.RAWDATA,
    164164    Item.BIOASSAYSET, Item.BIOASSAY, Item.TRANSFORMATION, Item.EXTRAVALUE,
    165165    Item.VIRTUALDB, Item.DATACUBE, Item.DATACUBELAYER, Item.DATACUBECOLUMN, Item.DATACUBEFILTER,
     
    198198          Item.BIOSOURCE, Item.SAMPLE, Item.EXTRACT, Item.TAG,
    199199          Item.BIOMATERIALLIST, Item.BIOPLATE, Item.BIOPLATETYPE, Item.BIOPLATEEVENT, Item.BIOPLATEEVENTTYPE,
    200           Item.PHYSICALBIOASSAY, Item.SCAN, Item.RAWBIOASSAY, Item.EXPERIMENT, Item.FORMULA
     200          Item.PHYSICALBIOASSAY, Item.DERIVEDBIOASSAYSET, Item.RAWBIOASSAY, Item.EXPERIMENT, Item.FORMULA
    201201        })
    202202      );
  • trunk/src/clients/web/net/sf/basedb/clients/web/extensions/edit/EditUtil.java

    r5642 r5652  
    6363      Item.PLATEGEOMETRY, Item.PLATEMAPPING,
    6464      Item.DIRECTORY, Item.FILE, Item.FILESERVER, Item.PROJECT, Item.PERMISSIONTEMPLATE,
    65       Item.PHYSICALBIOASSAY, Item.SCAN, Item.IMAGE, Item.RAWBIOASSAY,
     65      Item.PHYSICALBIOASSAY, Item.DERIVEDBIOASSAYSET, Item.RAWBIOASSAY,
    6666      Item.FORMULA, Item.REPORTER, Item.REPORTERLIST,
    6767      Item.EXPERIMENT, Item.TRANSFORMATION, Item.BIOASSAYSET, Item.BIOASSAY,
  • trunk/src/clients/web/net/sf/basedb/clients/web/extensions/toolbar/ToolbarUtil.java

    r5642 r5652  
    6060      Item.RAWBIOASSAY, Item.RAWDATA, Item.FORMULA,
    6161      Item.REPORTER, Item.REPORTERLIST, Item.REPORTERSCORE,
    62       Item.SCAN, Item.IMAGE, Item.PHYSICALBIOASSAY,
     62      Item.DERIVEDBIOASSAYSET, Item.PHYSICALBIOASSAY,
    6363      Item.BIOSOURCE, Item.SAMPLE, Item.EXTRACT,
    6464      Item.TAG, Item.BIOMATERIALEVENT,
  • trunk/src/clients/web/net/sf/basedb/clients/web/resources/common.properties

    r5642 r5652  
    8484item.physicalbioassay Physical bioassay
    8585item.physicalbioassay+  Physical bioassays
    86 item.scan Scan
    87 item.scan+  Scans
    88 item.image  Image
    89 item.image+ Images
     86item.derivedbioassayset Derived bioassay set
     87item.derivedbioassayset+  Derived bioassay sets
     88item.derivedbioassay  Derived bioassay
     89item.derivedbioassay+ Derived bioassays
    9090item.rawbioassay  Raw bioassay
    9191item.rawbioassay+ Raw bioassays
  • trunk/src/clients/web/net/sf/basedb/clients/web/resources/menu.properties

    r5642 r5652  
    8787physicalbioassays.tooltip.1 Manage physical bioassays
    8888physicalbioassays.tooltip.0 You do not have permission to manage physical bioassays
    89 scans.tooltip.1 Manage scans
    90 scans.tooltip.0 You do not have permission to manage scans
    9189rawbioassays.tooltip.1  Manage raw bioassays
    9290rawbioassays.tooltip.0  You do not have permission to manage raw bioassays
  • trunk/src/core/common-queries.xml

    r5642 r5652  
    855855  </query>
    856856
    857   <query id="GET_SCANS_FOR_PROTOCOL" type="HQL">
    858     <sql>
    859       SELECT {1}
    860       FROM ScanData sc
    861       WHERE sc.protocol = :protocol
    862     </sql>
    863     <description>
    864       A Hibernate query that gets scans
     857  <query id="GET_DERIVEDBIOASSAYSET_FOR_PROTOCOL" type="HQL">
     858    <sql>
     859      SELECT {1}
     860      FROM DerivedBioAssaySetData dbas
     861      WHERE dbas.protocol = :protocol
     862    </sql>
     863    <description>
     864      A Hibernate query that gets derived bioassay sets
    865865      using a protocol.
    866866    </description>
     
    917917  </query>
    918918 
    919   <query id="GET_SCANS_FOR_SCANNER" type="HQL">
    920     <sql>
    921       SELECT {1}
    922       FROM ScanData scn
    923       WHERE scn.scanner = :scanner
    924     </sql>
    925     <description>
    926       A Hibernate query that gets scans which
    927       uses a given scanner (hardware).
     919  <query id="GET_DERIVEDBIOASSAYSETS_FOR_HARDWARE" type="HQL">
     920    <sql>
     921        SELECT {1}
     922        FROM DerivedBioAssaySetData dbas
     923        WHERE dbas.hardware = :hardware
     924    </sql>
     925    <description>
     926      A Hibernate query that gets derived bioassays which
     927      uses a given hardware.
    928928    </description>
    929929  </query>
     
    999999    </description>
    10001000  </query>
     1001
     1002  <query id="GET_DERIVEDBIOASSAYSETS_FOR_SOFTWARE" type="HQL">
     1003    <sql>
     1004      SELECT {1}
     1005      FROM DerivedBioAssaySetData dbas
     1006      WHERE dbas.software = :software
     1007    </sql>
     1008    <description>
     1009      A Hibernate query that gets the derived bioassay sets
     1010      using a given software.
     1011    </description>
     1012  </query>
     1013
    10011014
    10021015  <query id="GET_ANNOTATIONS_FOR_ANNOTATIONTYPE" type="HQL">
     
    13561369  </query>
    13571370
    1358   <query id="GET_SCANS_FOR_HYBRIDIZATION" type="HQL">
    1359     <sql>
    1360       SELECT {1}
    1361       FROM ScanData scn
    1362       WHERE scn.hybridization = :hybridization
    1363     </sql>
    1364     <description>
    1365       A Hibernate query that gets scans
    1366       that uses a specific hybridization.
     1371  <query id="GET_ROOT_DERIVEDBIOASSAYSETS_FOR_PHYSICALBIOASSAY" type="HQL">
     1372    <sql>
     1373      SELECT {1}
     1374      FROM DerivedBioAssaySetData dbs
     1375      WHERE dbs.physicalBioAssay = :bioAssay
     1376      AND dbs.parent is null
     1377    </sql>
     1378    <description>
     1379      A Hibernate query that gets root derived bioassay sets
     1380      created for a specific physical bioassay.
    13671381    </description>
    13681382  </query>
  • trunk/src/core/net/sf/basedb/core/DataFileType.java

    r5630 r5652  
    129129  */
    130130  public static final String MEV_TDMS = "mev.tdms";
     131 
     132  /**
     133    The external ID for the file type representing
     134    a SAM (Sequence Alignment/Map) file.
     135    @since 3.0
     136  */
     137  public static final String SAM = "assembly.sam";
     138
     139  /**
     140    The external ID for the file type representing
     141    a BAM (Binary Sequence Alignment/Map) file.
     142    @since 3.0
     143  */
     144  public static final String BAM = "assembly.bam";
    131145 
    132146  /**
  • trunk/src/core/net/sf/basedb/core/File.java

    r5630 r5652  
    164164  */
    165165  public static final String EXTRAVALUE_DATA = "net.sf.basedb.core.FileType.EXTRAVALUE_DATA";
     166
     167  /**
     168    The id for the <code>FileType</code> item representing a
     169    file containing aligned sequence data.
     170    @since 3.0
     171  */
     172  public static final String ALIGNED_SEQUENCE = "net.sf.basedb.core.FileType.ALIGNED_SEQUENCE";
    166173
    167174 
  • trunk/src/core/net/sf/basedb/core/Hardware.java

    r5651 r5652  
    114114      defaultId = PRINT_ROBOT;
    115115    }
    116     else if (itemType == Item.SCAN)
    117     {
    118       defaultId = SCANNER;
    119     }
    120116    return defaultId;
    121117  }
     
    231227    Check if:
    232228    <ul>
    233     <li>a {@link Scan} is linked to this hardware
     229    <li>a {@link DerivedBioAssaySet} is linked to this hardware
    234230    <li>an {@link ArrayBatch} is linked to this hardware
    235231    <li>a {@link BioMaterialEvent} is linked to this hardware
     
    249245    {
    250246      org.hibernate.Query q = HibernateUtil.getPredefinedQuery(session,
    251         "GET_SCANS_FOR_SCANNER", "count(*)");
    252       /*
    253         SELECT {1}
    254         FROM ScanData sc
    255         WHERE sc.scanner = :scanner
    256       */
    257       q.setEntity("scanner", this.getData());
     247        "GET_DERIVEDBIOASSAYSETS_FOR_HARDWARE", "count(*)");
     248      /*
     249        SELECT {1}
     250        FROM DerivedBioAssaySetData dbas
     251        WHERE dbas.hardware = :hardware
     252      */
     253      q.setEntity("hardware", this.getData());
    258254      used = HibernateUtil.loadData(Long.class, q) > 0;
    259255    }
     
    299295    Get all:
    300296    <ul>
    301     <li>{@link Scan}:s with this hardware
     297    <li>{@link DerivedBioAssaySet}:s with this hardware
    302298    <li>{@link ArrayBatch}:s with this hardware
    303299    <li>{@link BioMaterial}:s and {@link PhysicalBioAssay}:s with this hardware
     
    312308    org.hibernate.Session session = getDbControl().getHibernateSession();
    313309   
    314     // Scans
     310    // Derived bioassay sets
    315311    org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session,
    316       "GET_SCANS_FOR_SCANNER", "scn.id");
    317       /*
    318         SELECT {1}
    319         FROM ScanData scn
    320         WHERE sc.scanner = :scanner
    321       */
    322     query.setEntity("scanner", this.getData());
    323     addUsingItems(using, Item.SCAN, query);
     312      "GET_DERIVEDBIOASSAYSETS_FOR_HARDWARE", "dbas.id");
     313      /*
     314        SELECT {1}
     315        FROM DerivedBioAssaySetData dbas
     316        WHERE dbas.hardware = :hardware
     317      */
     318    query.setEntity("hardware", this.getData());
     319    addUsingItems(using, Item.DERIVEDBIOASSAYSET, query);
    324320
    325321    // Array batches
  • trunk/src/core/net/sf/basedb/core/Install.java

    r5645 r5652  
    368368      // Hybridization, raw data and experiments
    369369      createRoleKey(Item.PHYSICALBIOASSAY, "Physical bioassays", "Gives access to physical bioassays", users_create);
    370       createRoleKey(Item.SCAN, "Scans", "Gives access to scan", users_create);
     370      createRoleKey(Item.DERIVEDBIOASSAYSET, "Derived bioassay sets", "Gives access to derived bioassay sets", users_create);
    371371      createRoleKey(Item.RAWBIOASSAY, "Raw bioassays", "Gives access to raw bioassays", users_create);
    372372      createRoleKey(Item.EXPERIMENT, "Experiments", "Gives access to experiments", users_create);
     
    436436      ItemSubtypeData spotDataType = createItemSubtype(Item.FILE, File.SPOT_DATA, "Spot data", "Analysed bioassay set data");
    437437      ItemSubtypeData extraValueType = createItemSubtype(Item.FILE, File.EXTRAVALUE_DATA, "Extra value data", "Analysed extra values");
     438      ItemSubtypeData alignedType = createItemSubtype(Item.FILE, File.ALIGNED_SEQUENCE, "Aligned sequence data", "Files containsing sequenced data aligned against a reference data set.");
    438439
    439440      // Protocol subtypes
     
    450451          "Sequencing", "Protocol used while sequencing", protocolFileType);
    451452      createItemSubtype(Item.PROTOCOL, Protocol.PRINTING, "Printing", "Protocols used for printing a batch of array slides.", protocolFileType);
    452       createItemSubtype(Item.PROTOCOL, Protocol.SCANNING, "Scanning", "Protocols used for scanning microarray images.", protocolFileType);
     453      ItemSubtypeData scanningProtocol = createItemSubtype(Item.PROTOCOL, Protocol.SCANNING,
     454          "Scanning", "Protocols used for scanning microarray images.", protocolFileType);
    453455      createItemSubtype(Item.PROTOCOL, Protocol.FEATURE_EXTRACTION, "Feature extraction", "Protocols used for extracting features from microarray images.", protocolFileType);
    454456 
     
    462464 
    463465      // Software subtypes
    464       ItemSubtypeData feature = createItemSubtype(Item.SOFTWARE, Software.FEATURE_EXTRACTION, "Feature extraction", "Extracts features from microarray images.");
     466      ItemSubtypeData featureExtraction = createItemSubtype(Item.SOFTWARE, Software.FEATURE_EXTRACTION,
     467          "Feature extraction", "Extracts expression data from a source such as microarray images or aligned sequences.");
     468      ItemSubtypeData alignmentSoftware = createItemSubtype(Item.SOFTWARE, Software.ALIGNMENT,
     469          "Alignment", "Aligns sequenced data against a reference sequence database.");
    465470     
    466471      // Tag subtypes
     
    471476     
    472477      // Biomaterial subtypes
    473       ItemSubtypeData labeledExtract = createItemSubtype(Item.EXTRACT, Extract.LABELED, "Labeled extract",
    474         "A labeled extract is an extract which has been tagged with a label",
     478      ItemSubtypeData labeledExtract = createItemSubtype(Item.EXTRACT, Extract.LABELED,
     479        "Labeled extract", "A labeled extract is an extract which has been tagged with a label",
    475480        labelTag, labelingProtocol);
    476       ItemSubtypeData library = createItemSubtype(Item.EXTRACT, Extract.LIBRARY, "Library",
    477         "An extract that has been prepared with an adaptor sequence before sequencing",
     481      ItemSubtypeData library = createItemSubtype(Item.EXTRACT, Extract.LIBRARY,
     482        "Library", "An extract that has been prepared with an adaptor sequence before sequencing",
    478483        barcodeTag, libraryPreparation);
    479484     
    480485      // Physical bioassay subtypes
    481       createItemSubtype(Item.PHYSICALBIOASSAY, PhysicalBioAssay.HYBRIDIZATION, "Hybridization",
    482         "", hybProtocol, hybStation, labeledExtract);
    483       createItemSubtype(Item.PHYSICALBIOASSAY, PhysicalBioAssay.FLOW_CELL, "Flow cell",
    484         "", sequencingProtocol, sequencer, library);
     486      ItemSubtypeData hybridization = createItemSubtype(Item.PHYSICALBIOASSAY, PhysicalBioAssay.HYBRIDIZATION,
     487        "Hybridization", "A bioassay representing a microarray slide with labeled extracts.",
     488        hybProtocol, hybStation, labeledExtract);
     489      ItemSubtypeData flowCell = createItemSubtype(Item.PHYSICALBIOASSAY, PhysicalBioAssay.FLOW_CELL,
     490        "Flow cell", "A bioassay representing a flow cell with extracts.", library);
     491     
     492      // Derived bioassay set subtypes
     493      createItemSubtype(Item.DERIVEDBIOASSAYSET, DerivedBioAssaySet.SCAN,
     494        "Scan", "A hybridization that has been scanned to produce one or more images.",
     495        hybridization, scanner, scanningProtocol);
     496      createItemSubtype(Item.DERIVEDBIOASSAYSET, DerivedBioAssaySet.SEQUENCED,
     497        "Sequenced", "A flow cell that has been sequenced.",
     498        flowCell, sequencer, sequencingProtocol);
     499      createItemSubtype(Item.DERIVEDBIOASSAYSET, DerivedBioAssaySet.ASSEMBLY,
     500        "Assembly", "A data set of sequences that has been aligned against a reference database",
     501        alignmentSoftware);
    485502     
    486503      // Hardware
     
    503520      progressStep++;
    504521      if (progress != null) progress.display((int)(progressStep*progress_factor), "--Creating software...");
    505       createSoftware("BZScan", null, null, feature, rootUser, keyEveryoneUse);
    506       createSoftware("AIDA", null, null, feature, rootUser, keyEveryoneUse);
    507       createSoftware("GenePix Pro", "6.0", null, feature, rootUser, keyEveryoneUse);
    508       createSoftware("ImaGene", null, null, feature, rootUser, keyEveryoneUse);
    509       createSoftware("TIGR Spotfinder", null, null, feature, rootUser, keyEveryoneUse);
    510       createSoftware("Agilent Feature Extraction Software", "8.5", null, feature, rootUser, keyEveryoneUse);
    511       createSoftware("ChipSkipper", null, null, feature, rootUser, keyEveryoneUse);
    512       createSoftware("GeneTAC", null, null, feature, rootUser, keyEveryoneUse);
    513       createSoftware("ScanArray", null, null, feature, rootUser, keyEveryoneUse);
    514       createSoftware("Affymetrix GeneChip Software", "1.2", null, feature, rootUser, keyEveryoneUse);
    515       createSoftware("Illumina BeadStudio", null, null, feature, rootUser, keyEveryoneUse);
     522      // Feature extraction
     523      createSoftware("BZScan", null, null, featureExtraction, rootUser, keyEveryoneUse);
     524      createSoftware("AIDA", null, null, featureExtraction, rootUser, keyEveryoneUse);
     525      createSoftware("GenePix Pro", "6.0", null, featureExtraction, rootUser, keyEveryoneUse);
     526      createSoftware("ImaGene", null, null, featureExtraction, rootUser, keyEveryoneUse);
     527      createSoftware("TIGR Spotfinder", null, null, featureExtraction, rootUser, keyEveryoneUse);
     528      createSoftware("Agilent Feature Extraction Software", "8.5", null, featureExtraction, rootUser, keyEveryoneUse);
     529      createSoftware("ChipSkipper", null, null, featureExtraction, rootUser, keyEveryoneUse);
     530      createSoftware("GeneTAC", null, null, featureExtraction, rootUser, keyEveryoneUse);
     531      createSoftware("ScanArray", null, null, featureExtraction, rootUser, keyEveryoneUse);
     532      createSoftware("Affymetrix GeneChip Software", "1.2", null, featureExtraction, rootUser, keyEveryoneUse);
     533      createSoftware("Illumina BeadStudio", null, null, featureExtraction, rootUser, keyEveryoneUse);
     534      createSoftware("Cufflinks", null, null, featureExtraction, rootUser, keyEveryoneUse);
     535      // Alignment
     536      createSoftware("Bowtie", null, null, alignmentSoftware, rootUser, keyEveryoneUse);
     537      createSoftware("TopHat", null, null, alignmentSoftware, rootUser, keyEveryoneUse);
    516538 
    517539      // Item subtypes
     
    585607      createMimeType("text/plain", "Biorobotics TAM format", "tam", printMapType, true);
    586608      createMimeType("text/plain", "Molecularware MWBR format", "mvbr", printMapType, true);
     609      createMimeType("text/plain", "Sequence Alignment/Map", "sam", null, true);
     610      createMimeType("application/octet-stream", "Binary Sequence Alignment/Map", "bam", null, false);
    587611 
    588612      // Plate geometries
     
    830854        "A MeV Tab-Delimited Multiple Sample file",
    831855        Item.BIOASSAYSET, null, spotDataType);
     856      DataFileTypeData samFile = createDataFileType(
     857        DataFileType.SAM, "Sequence Alignment/Map",
     858        "SAM format is a generic format for storing large nucleotide sequence alignments.",
     859        Item.DERIVEDBIOASSAY, "sam", alignedType
     860      );
     861      DataFileTypeData bamFile = createDataFileType(
     862        DataFileType.BAM, "Compressed Sequence Alignment/Map",
     863        "BAM format is a BGZF-compressed SAM file.",
     864        Item.DERIVEDBIOASSAY, "bam", alignedType
     865      );
    832866     
    833867      // Platforms and variants
  • trunk/src/core/net/sf/basedb/core/Item.java

    r5642 r5652  
    426426  PHYSICALBIOASSAY(261, "Physical bioassay", "pba", PhysicalBioAssay.class, PhysicalBioAssayData.class, DefinedPermissions.shareable,
    427427    350),
    428   /**
    429     The item is a {@link Scan}.
    430   */
    431   SCAN(262, "Scan", "scn", Scan.class, ScanData.class, DefinedPermissions.shareable,
     428
     429  /**
     430    The item is a {@link DerivedBioAssaySet}.
     431  */
     432  DERIVEDBIOASSAYSET(267, "Derived bioassay set", "dbs", DerivedBioAssaySet.class, DerivedBioAssaySetData.class, DefinedPermissions.shareable,
    432433    330),
    433   /**
    434     The item is an {@link Image}.
    435   */
    436   IMAGE(263, "Image", "img", Image.class, ImageData.class, null,
    437     340),
     434   
     435  /**
     436    The item is a {@link DerivedBioAssay}.
     437  */
     438  DERIVEDBIOASSAY(268, "Derived bioassay", "dby", DerivedBioAssay.class, DerivedBioAssayData.class, null,
     439    330),
     440 
    438441  /**
    439442    The item is a {@link RawBioAssay}.
  • trunk/src/core/net/sf/basedb/core/PhysicalBioAssay.java

    r5642 r5652  
    9494  {
    9595    PhysicalBioAssay h = dc.newItem(PhysicalBioAssay.class);
    96     h.setName("New hybridization");
     96    h.setName("New physical bioassay");
    9797    h.setSize(1);
    9898    h.setBioPlateEventParticipant(master);
     
    130130  }
    131131
    132 
    133132  private BioMaterialEvent creationEvent;
    134133  private BioPlateEventParticipant bioPlateEventParticipant;
     
    259258    Check that:
    260259    <ul>
    261     <li>No {@link Scan}:s use the hybridization
     260    <li>No {@link DerivedBioAssaySet}:s use the physical bioassay
    262261    </ul>
    263262  */
     
    265264    throws BaseException
    266265  {
    267     return countScans() > 0 || super.isUsed();
     266    return countRootDerivedBioAssaySets() > 0 || super.isUsed();
    268267  }
    269268  /**
    270269    Get all:
    271270    <ul>
    272     <li>{@link Scan}:s created from this hybridization
     271    <li>(root) {@link DerivedBioAssaySet}:s created from this physical bioassay
    273272    <ul>
    274273    @since 2.2
     
    280279    org.hibernate.Session session = getDbControl().getHibernateSession();
    281280    org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session,
    282       "GET_SCANS_FOR_HYBRIDIZATION", "scn.id");
     281      "GET_ROOT_DERIVEDBIOASSAYSETS_FOR_PHYSICALBIOASSAY", "dbs.id");
    283282      /*
    284283        SELECT {1}
    285         FROM ScanData scn
    286         WHERE scn.hybridization = :hybridization
     284        FROM DerivedBioAssaySetData dbs
     285        WHERE dbs.physicalBioAssay = :bioAssay
     286        AND dbs.creationEvent.parent is null
    287287      */
    288     query.setEntity("hybridization", this.getData());
    289     addUsingItems(using, Item.SCAN, query);
     288    query.setEntity("bioAssay", this.getData());
     289    addUsingItems(using, Item.DERIVEDBIOASSAYSET, query);
    290290    return using;
    291291  }
     
    457457 
    458458  /**
    459     Create a new {@link Scan} from this hybridization.
    460    
    461     @return The new <code>Scan</code> item
    462     @throws PermissionDeniedException If the logged in user doesn't have
    463       use permission for the hybridzation
    464     @throws BaseException If there is another error
    465   */
    466   public Scan newScan()
    467     throws PermissionDeniedException, BaseException
    468   {
    469     Scan scn = Scan.getNew(getDbControl(), this);
    470     return scn;
    471   }
    472 
    473   /**
    474     Get a query that returns all scans created from this
    475     hybridization.
     459    Get a query that returns all root derived bioassay sets created from this
     460    physical bioassay.
    476461    @return An {@link ItemQuery} object
    477462  */
    478   public ItemQuery<Scan> getScans()
    479   {
    480     ItemQuery<Scan> query = Scan.getQuery();
     463  public ItemQuery<DerivedBioAssaySet> getRootDerivedBioAssaySets()
     464  {
     465    ItemQuery<DerivedBioAssaySet> query = DerivedBioAssaySet.getQuery();
    481466    query.restrictPermanent(
    482467      Restrictions.eq(
    483         Hql.property("hybridization"),
     468        Hql.property("physicalBioAssay"),
    484469        Hql.entity(this)
    485470      )
    486471    );
     472    query.restrictPermanent(Restrictions.eq(Hql.property("parent"), null));
    487473    return query;
    488474  }
    489475 
    490476  /**
    491     Counts all scans that have been created from this hybridization. The count
    492     includes scans that the logged in user doesn't have access to.
    493     @return The number of scans
    494     @throws BaseException If the scans could not be counted.
     477    Counts all root derived bioassay sets that have been created from this physical bioassay.
     478    The count includes bioassay sets that the logged in user doesn't have access to.
     479    @return The number of root bioassay sets
     480    @throws BaseException If the bioassay sets could not be counted.
    495481   */
    496   public long countScans()
     482  public long countRootDerivedBioAssaySets()
    497483    throws BaseException
    498484  {
    499485    org.hibernate.Session session = getDbControl().getHibernateSession();
    500486    org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session,
    501       "GET_SCANS_FOR_HYBRIDIZATION", "count(*)");
     487      "GET_ROOT_DERIVEDBIOASSAYSETS_FOR_PHYSICALBIOASSAY", "count(*)");
    502488    /*
    503489      SELECT {1}
    504       FROM ScanData scn
    505       WHERE scn.hybridization = :hybridization
     490      FROM DerivedBioAssaySetData dbs
     491      WHERE dbs.physicalBioAssay = :bioAssay
     492      AND dbs.parent is null
    506493    */
    507     query.setEntity("hybridization", this.getData());
     494    query.setEntity("bioAssay", this.getData());
    508495    return HibernateUtil.loadData(Long.class, query);
    509496  }
  • trunk/src/core/net/sf/basedb/core/Project.java

    r5650 r5652  
    771771  }
    772772
     773  BasicData findDefaultRelatedData(DbControl dc, Subtypable item, Item relatedItemType, boolean strict)
     774  {
     775    ItemSubtype relatedSubtype = ItemSubtype.getRelatedSubtype(dc, item, relatedItemType);
     776    if (relatedSubtype == null) return null;
     777   
     778    return findDefaultData(relatedItemType, relatedSubtype.getData(), strict);
     779  }
     780 
    773781  BasicData findDefaultData(DbControl dc, String subtypeId, boolean strict)
    774782  {
     
    781789    Find a default item in this project of the given item type (required)
    782790    and subtype (optional). If a subtype is given, this method first try to
    783     match exactly. If no item is found, and strict is false, a second attempt is made
    784     to match against items without subtype. If more than one
    785     item matches the critera, the first one found is returned.
     791    match exactly. If no item is found, and strict is false, a second attempt
     792    is made to match against items WITHOUT subtype (items with a different
     793    subtype are never matched). If more than one item matches the critera,
     794    the first one found is returned.
    786795   
    787796      @param itemType The main item type of the item we are looking for
    788797      @param subtype The subtype of the item we are looking for (optional)
    789       @param strict
     798      @param strict TRUE if the subtype must match
    790799      @since 3.0
    791800  */
  • trunk/src/core/net/sf/basedb/core/Protocol.java

    r5651 r5652  
    156156    {
    157157      defaultId = PRINTING;
    158     }
    159     else if (itemType == Item.SCAN)
    160     {
    161       defaultId = SCANNING;
    162158    }
    163159    else if (itemType == Item.RAWBIOASSAY)
     
    312308    <li>a {@link PlateEvent}
    313309    <li>an {@link ArrayBatch}
    314     <li>a {@link Scan}
     310    <li>a {@link DerivedBioAssay}
    315311    <li>a {@link RawBioAssay}
    316312    </ul>
     
    361357    {
    362358      org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session,
    363         "GET_SCANS_FOR_PROTOCOL", "count(*)");
    364       /*
    365         SELECT {1}
    366         FROM ScanData sc
    367         WHERE sc.protocol = :protocol
     359        "GET_DERIVEDBIOASSAYSET_FOR_PROTOCOL", "count(*)");
     360      /*
     361        SELECT {1}
     362        FROM DerivedBioAssaySetData dbas
     363        WHERE dbas.protocol = :protocol
    368364      */
    369365      query.setEntity("protocol", this.getData());
     
    390386    <li>a {@link Plate}:s using this protocol
    391387    <li>an {@link ArrayBatch}:s using this protocol
    392     <li>a {@link Scan}:s using this protocol
     388    <li>a {@link DerivedBioAssaySet}:s using this protocol
    393389    <li>a {@link RawBioAssay}:s using this protocol
    394390    <ul>
     
    447443    // Scans
    448444    query = HibernateUtil.getPredefinedQuery(session,
    449       "GET_SCANS_FOR_PROTOCOL", "sc.id");
    450       /*
    451         SELECT {1}
    452         FROM ScanData sc
    453         WHERE sc.protocol = :protocol
     445      "GET_DERIVEDBIOASSAYSET_FOR_PROTOCOL", "dbas.id");
     446      /*
     447        SELECT {1}
     448        FROM DerivedBioAssaySetData dbas
     449        WHERE dbas.protocol = :protocol
    454450      */
    455451    query.setEntity("protocol", this.getData());
    456     addUsingItems(using, Item.SCAN, query);
     452    addUsingItems(using, Item.DERIVEDBIOASSAYSET, query);
    457453   
    458454    // Raw bioassays
  • trunk/src/core/net/sf/basedb/core/RawBioAssay.java

    r5650 r5652  
    5656/**
    5757  A rawbioassay represents the raw data generated from a single
    58   {@link Scan}. A raw bioassay must have a {@link RawDataType}
     58  {@link DerivedBioAssay}. A raw bioassay must have a {@link RawDataType}
    5959  which specifies the data columns generated by the {@link Software}.
    6060  <p>
     
    237237    try
    238238    {
    239       if (getData().getScan() != null) annotatable.add(getScan());
     239      if (getData().getParent() != null) annotatable.add(getParent());
    240240    }
    241241    catch (PermissionDeniedException ex)
     
    612612  }
    613613  /**
    614     Set the hybridization array number this raw bioassay is linked to. The value should be
    615     between 1 and the number of arrays specified by the hybridization,
    616     {@link PhysicalBioAssay#getNumArrays()}.
     614    Set the array number on the physical bioassay this raw bioassay is linked to.
     615    The value should be  between 1 and the size specified by the physical bioassay
     616    {@link PhysicalBioAssay#getSize()}.
    617617    @param arrayNum A value > 0
    618618    @throws NumberOutOfRangeException If the value is <=0
     
    627627 
    628628  /**
    629     Get the {@link Scan} this raw bioassay is created from.
    630 
    631     @return The <code>Scan</code> item or null if not known
     629    Get the {@link DerivedBioAssay} this raw bioassay is created from.
     630
     631    @return The <code>DerivedBioAssay</code> item or null if not known
    632632    @throws PermissionDeniedException If the logged in user doesn't have
    633633      read permission for the scanner
    634634    @throws BaseException If there is another error.
    635   */
    636   public Scan getScan()
     635    @since 3.0
     636  */
     637  public DerivedBioAssay getParent()
    637638    throws PermissionDeniedException, BaseException
    638639  {
    639     return getDbControl().getItem(Scan.class, getData().getScan());
    640   }
    641  
    642   /**
    643     Set the {@link Scan} this raw bioassay is created from.
    644 
    645     @param scan The scan or null if not known
     640    return getDbControl().getItem(DerivedBioAssay.class, getData().getParent());
     641  }
     642 
     643  /**
     644    Set the {@link DerivedBioAssay} this raw bioassay is created from.
     645
     646    @param parent The parent bioassay or null if not known
    646647    @throws PermissionDeniedException If the logged in user doesn't have
    647648      write permission for the raw bioassay use permission for the scan
    648649    @throws BaseException If there is another error
    649   */
    650   public void setScan(Scan scan)
     650    @since 3.0
     651  */
     652  public void setParent(DerivedBioAssay parent)
    651653    throws PermissionDeniedException
    652654  {
    653655    checkPermission(Permission.WRITE);
    654     if (scan != null) scan.checkPermission(Permission.USE);
    655     getData().setScan(scan == null ? null : scan.getData());
     656    if (parent != null) parent.checkPermission(Permission.USE);
     657    getData().setParent(parent == null ? null : parent.getData());
    656658  }
    657659
  • trunk/src/core/net/sf/basedb/core/Software.java

    r5651 r5652  
    5757  public static final String FEATURE_EXTRACTION = "net.sf.basedb.core.SoftwareType.FEATURE_EXTRACTION";
    5858
     59  /**
     60    The id for the <code>SoftwareType</code> item representing software
     61    used for aligning sequenced data against a known reference database.
     62    @since 3.0
     63  */
     64  public static final String ALIGNMENT = "net.sf.basedb.core.SoftwareType.ALIGNMENT";
     65
    5966 
    6067  /**
     
    196203    <ul>
    197204    <li>a RawBioAssay was created with this software
     205    <li>a DerivedBioassaySet was created with this software
    198206    </ul>
    199207  */
     
    203211  {
    204212    org.hibernate.Session session = getDbControl().getHibernateSession();
    205     org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session,
    206       "GET_RAWBIOASSAYS_FOR_SOFTWARE", "count(*)");
    207     /*
    208       SELECT {1}
    209       FROM RawBioAssay rba
    210       WHERE rba.software = :software
    211     */
    212     query.setEntity("software", this.getData());
    213     return HibernateUtil.loadData(Long.class, query) > 0 || super.isUsed();
     213    boolean used = false;
     214    if (!used)
     215    {
     216      org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session,
     217        "GET_DERIVEDBIOASSAYSETS_FOR_SOFTWARE", "count(*)");
     218      /*
     219        SELECT {1}
     220        FROM DerivedBioAssaySetData dbas
     221        WHERE dbas.software = :software
     222      */
     223      query.setEntity("software", this.getData());
     224      used = HibernateUtil.loadData(Long.class, query) > 0;
     225    }
     226    if (!used)
     227    {
     228      org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session,
     229        "GET_RAWBIOASSAYS_FOR_SOFTWARE", "count(*)");
     230      /*
     231        SELECT {1}
     232        FROM RawBioAssay rba
     233        WHERE rba.software = :software
     234      */
     235      query.setEntity("software", this.getData());
     236      used = HibernateUtil.loadData(Long.class, query) > 0;
     237    }
     238    return used || super.isUsed();
    214239  }
    215240  /**
     
    217242    <ul>
    218243    <li>{@link RawBioAssay}:s created with this software
     244    <li>{@link DerivedBioAssaySet}: created with this software
    219245    <ul>
    220246    @since 2.2
     
    234260    query.setEntity("software", this.getData());
    235261    addUsingItems(using, Item.RAWBIOASSAY, query);
     262   
     263    // Derived bioassay sets
     264    query = HibernateUtil.getPredefinedQuery(session,
     265      "GET_DERIVEDBIOASSAYSETS_FOR_SOFTWARE", "dbas.id");
     266      /*
     267        SELECT {1}
     268        FROM DerivedBioAssaySetData dbas
     269        WHERE dbas.software = :software
     270      */
     271    query.setEntity("software", this.getData());
     272    addUsingItems(using, Item.DERIVEDBIOASSAYSET, query);
    236273    return using;
    237274  }
  • trunk/src/core/net/sf/basedb/core/data/PhysicalBioAssayData.java

    r5642 r5652  
    119119  }
    120120
    121   private Set<ScanData> scans;
     121  private Set<DerivedBioAssaySetData> rootDerivedBioAssaySets;
     122  /**
     123    This is the inverse end with an extra restriction
     124    @see DerivedBioAssaySetData#getPhysicalBioAssay()
     125    @hibernate.set lazy="true" inverse="true" where="`parent_id` is null"
     126    @hibernate.collection-key column="`bioassay_id`"
     127    @hibernate.collection-one-to-many class="net.sf.basedb.core.data.DerivedBioAssaySetData"
     128  */
     129  Set<DerivedBioAssaySetData> getRootDerivedBioAssaySets()
     130  {
     131    return rootDerivedBioAssaySets;
     132  }
     133  void setRootDerivedBioAssaySets(Set<DerivedBioAssaySetData> rootDerivedBioAssaySets)
     134  {
     135    this.rootDerivedBioAssaySets = rootDerivedBioAssaySets;
     136  }
     137 
     138  private Set<DerivedBioAssaySetData> derivedBioAssaySets;
    122139  /**
    123140    This is the inverse end.
    124     @see ScanData#getHybridization()
    125     @hibernate.set lazy="true" inverse="true"
    126     @hibernate.collection-key column="`hybridization_id`"
    127     @hibernate.collection-one-to-many class="net.sf.basedb.core.data.ScanData"
     141    @see DerivedBioAssaySetData#getPhysicalBioAssay()
     142    @hibernate.set lazy="true" inverse="true" 
     143    @hibernate.collection-key column="`bioassay_id`"
     144    @hibernate.collection-one-to-many class="net.sf.basedb.core.data.DerivedBioAssaySetData"
    128145  */
    129   Set<ScanData> getScans()
     146  Set<DerivedBioAssaySetData> getDerivedBioAssaySets()
    130147  {
    131     return scans;
     148    return derivedBioAssaySets;
    132149  }
    133   void setScans(Set<ScanData> scans)
     150  void setDerivedBioAssaySets(Set<DerivedBioAssaySetData> derivedBioAssaySets)
    134151  {
    135     this.scans = scans;
     152    this.derivedBioAssaySets = derivedBioAssaySets;
    136153  }
    137154
    138 
     155 
    139156}
  • trunk/src/core/net/sf/basedb/core/data/RawBioAssayData.java

    r4889 r5652  
    158158  }
    159159 
    160   private ScanData scan;
    161   /**
    162     Get the scan.
    163     @hibernate.many-to-one column="`scan_id`" not-null="false" outer-join="false"
    164   */
    165   public ScanData getScan()
    166   {
    167     return scan;
    168   }
    169   public void setScan(ScanData scan)
    170   {
    171     this.scan = scan;
    172   }
    173  
    174160  private SoftwareData software;
    175161  /**
     
    229215  }
    230216 
     217  private DerivedBioAssayData bioAssay;
     218  /**
     219    Get the derived bioassay that this raw bioassay has been created from.
     220    @hibernate.many-to-one column="`bioassay_id`" not-null="false" outer-join="false"
     221  */
     222  public DerivedBioAssayData getParent()
     223  {
     224    return bioAssay;
     225  }
     226  public void setParent(DerivedBioAssayData bioAssay)
     227  {
     228    this.bioAssay = bioAssay;
     229  }
     230
    231231  private String rawDataType;
    232232  /**
  • trunk/src/core/net/sf/basedb/core/log/db/DbLogManagerFactory.java

    r5068 r5652  
    3131import net.sf.basedb.core.data.BioMaterialEventData;
    3232import net.sf.basedb.core.data.FileSetMemberData;
    33 import net.sf.basedb.core.data.ImageData;
    3433import net.sf.basedb.core.data.LoggableData;
    3534import net.sf.basedb.core.data.PlateEventData;
     
    6463    setSpecialLogger(FileSetMemberData.class, new FileSetMemberLogger());
    6564    setSpecialLogger(PlateEventData.class, new PlateEventLogger(detailedProperties));
    66     setSpecialLogger(ImageData.class, new ImageLogger(detailedProperties));
    6765    setSpecialLogger(AnnotationSetData.class, new AnnotationSetLogger(detailedProperties));
    6866  }
  • trunk/src/core/net/sf/basedb/util/AnnotationUtil.java

    r5642 r5652  
    3131import net.sf.basedb.core.BaseException;
    3232import net.sf.basedb.core.DbControl;
     33import net.sf.basedb.core.DerivedBioAssaySet;
    3334import net.sf.basedb.core.PhysicalBioAssay;
    3435import net.sf.basedb.core.RawBioAssay;
    35 import net.sf.basedb.core.Scan;
    3636import net.sf.basedb.util.filter.Filter;
    3737
     
    9696    This wrapper class is needed because we need to keep
    9797    track of the {@link RawBioAssay#getArrayNum()} property
    98     until we have loaded the Labeled Extracts of a Hybridization.
     98    until we have loaded the Extracts of a Physical Bioassay.
    9999    <p>
    100100    The 'normal' value of arrayNum is 0, which means that it is ignored.
    101101    When we reach a {@link RawBioAssay} item, we use the arrayNum on
    102     that. The array num is kept as we move up to Scan and Hybridization.
    103     When the Hybridization is reached we use the arrayNum to call
     102    that. The array num is kept as we move up to DerivedBioAssaySet and PhysicalBioAssay.
     103    When the PhysicalBioAssay is reached we use the arrayNum to call
    104104    {@link PhysicalBioAssay#getAnnotatableParents(int)} so that we only
    105     get labeled extracts that are linked with the correct array num.
     105    get extracts that are linked with the correct array num.
    106106  */
    107107  static class AnnotatableWrapper
     
    112112      <ul>
    113113      <li>{@link RawBioAssay#getArrayNum()} if the item is a raw bioassay
    114       <li>'arrayNum' if the items is a Scan or Hybridization
     114      <li>'arrayNum' if the items is a DerivedBioAssaySet or PhysicalBioAssay
    115115      <li>0 in all other cases.
    116116    */
     
    121121        return ((RawBioAssay)item).getArrayNum();
    122122      }
    123       else if (item instanceof Scan || item instanceof PhysicalBioAssay)
     123      else if (item instanceof DerivedBioAssaySet || item instanceof PhysicalBioAssay)
    124124      {
    125125        return arrayNum;
  • trunk/src/core/net/sf/basedb/util/overview/OverviewUtil.java

    r5651 r5652  
    3535import net.sf.basedb.core.BasicItem;
    3636import net.sf.basedb.core.DbControl;
     37import net.sf.basedb.core.DerivedBioAssaySet;
    3738import net.sf.basedb.core.Presets;
    3839import net.sf.basedb.core.PhysicalBioAssay;
     
    4344import net.sf.basedb.core.SessionControl;
    4445import net.sf.basedb.core.RawBioAssay;
    45 import net.sf.basedb.core.Scan;
    4646import net.sf.basedb.core.Type;
    4747import net.sf.basedb.core.query.Expressions;
     
    347347    String cacheKey = "annotatable.parent." + item.getType().name() + "." + item.getId();
    348348
    349     PhysicalBioAssay hyb = null;
     349    PhysicalBioAssay pba = null;
    350350    int arrayNum = 1;
    351351    // Special case when starting with a raw bioassay since we only
     
    356356      RawBioAssay rba = (RawBioAssay)root;
    357357      arrayNum = rba.getArrayNum();
    358       if (item instanceof Scan)
     358      if (item instanceof DerivedBioAssaySet)
    359359      {
    360360        cacheKey += "#" + arrayNum;
     
    362362      else if (item instanceof PhysicalBioAssay)
    363363      {
    364         hyb = (PhysicalBioAssay)item;
     364        pba = (PhysicalBioAssay)item;
    365365        cacheKey += "#" + arrayNum;
    366366      }
     
    372372      parents = new HashSet<Annotatable>();
    373373      context.setCachedObject(cacheKey, parents);
    374       Set<Annotatable> temp = hyb != null ?
    375         hyb.getAnnotatableParents(arrayNum) : item.getAnnotatableParents();
     374      Set<Annotatable> temp = pba != null ?
     375          pba.getAnnotatableParents(arrayNum) : item.getAnnotatableParents();
    376376      if (temp != null)
    377377      {
  • trunk/src/core/net/sf/basedb/util/overview/loader/BasicItemNodeLoaderFactory.java

    r5651 r5652  
    222222    registerCheckedNodeLoader(Item.ARRAYSLIDE, ArraySlideLoader.class);
    223223    registerCheckedNodeLoader(Item.PHYSICALBIOASSAY, PhysicalBioAssayLoader.class);
    224     registerCheckedNodeLoader(Item.SCAN, ScanLoader.class);
     224    registerCheckedNodeLoader(Item.DERIVEDBIOASSAYSET, DerivedBioAssaySetLoader.class);
     225    registerCheckedNodeLoader(Item.DERIVEDBIOASSAY, DerivedBioAssayLoader.class);
    225226    registerCheckedNodeLoader(Item.RAWBIOASSAY, RawBioAssayLoader.class);
    226227    registerCheckedNodeLoader(Item.EXPERIMENT, ExperimentLoader.class);
     
    233234    registerCheckedNodeLoader(Item.SOFTWARE, SoftwareLoader.class);
    234235    registerCheckedNodeLoader(Item.HARDWARE, HardwareLoader.class);
    235     registerCheckedNodeLoader(Item.IMAGE, ImageLoader.class);
    236236    registerCheckedNodeLoader(Item.ANNOTATION, AnnotationLoader.class);
    237237    registerCheckedNodeLoader(Item.PLATFORM, PlatformLoader.class);
  • trunk/src/core/net/sf/basedb/util/overview/loader/HardwareLoader.java

    r5651 r5652  
    2525import net.sf.basedb.core.BasicItem;
    2626import net.sf.basedb.core.DbControl;
     27import net.sf.basedb.core.DerivedBioAssaySet;
    2728import net.sf.basedb.core.Hardware;
    2829import net.sf.basedb.core.MeasuredBioMaterial;
     
    3031import net.sf.basedb.core.Item;
    3132import net.sf.basedb.core.PermissionDeniedException;
    32 import net.sf.basedb.core.Scan;
    3333import net.sf.basedb.util.overview.Node;
    3434import net.sf.basedb.util.overview.OverviewContext;
     
    7777    {
    7878      BasicItem parentItem = (BasicItem)parentNode.getItem(dc);
    79       if (parentItem instanceof Scan)
     79      if (parentItem instanceof DerivedBioAssaySet)
    8080      {
    81         hardware = ((Scan)parentItem).getScanner();
     81        hardware = ((DerivedBioAssaySet)parentItem).getHardware();
    8282      }
    8383      else if (parentItem instanceof PhysicalBioAssay)
  • trunk/src/core/net/sf/basedb/util/overview/loader/PhysicalBioAssayLoader.java

    r5651 r5652  
    2424import net.sf.basedb.core.ArraySlide;
    2525import net.sf.basedb.core.DbControl;
     26import net.sf.basedb.core.DerivedBioAssaySet;
    2627import net.sf.basedb.core.Extract;
    2728import net.sf.basedb.core.PhysicalBioAssay;
     
    3132import net.sf.basedb.core.PermissionDeniedException;
    3233import net.sf.basedb.core.RawBioAssay;
    33 import net.sf.basedb.core.Scan;
    3434import net.sf.basedb.util.overview.Node;
    3535import net.sf.basedb.util.overview.OverviewContext;
     
    4545  <ol>
    4646  <li>{@link Extract}:s -&gt; {@link PhysicalBioAssay}:s -&gt;
    47   {@link Scan}:s.
     47  {@link DerivedBioAssaySet}:s.
    4848  <li>{@link ArraySlide}:s -&gt; {@link PhysicalBioAssay}:s -&gt;
    49   {@link Scan}:s
     49  {@link DerivedBioAssaySet}:s
    5050  </ol>
    5151 
    52   The reverse-loading direction starts with a scan and moves to both
     52  The reverse-loading direction starts with a derived bioassay set and moves to both
    5353  extracts and array slide.
    5454
     
    7171  */
    7272  /**
    73     Create forward-loading hybridization nodes from either an extract or
     73    Create forward-loading physical bioassay nodes from either an extract or
    7474    an array slide node. The returned node is either folder-type node containing
    7575    nodes for each bioassay that has been created from the extract
     
    9494 
    9595  /**
    96     Create a reverse-loading bioassay node from the scan node.
    97     @return A bioassay node, or null if the scan doesn't have a
    98       hybridization
    99   */
    100   @Override
    101   public Node createReverseNode(DbControl dc, OverviewContext context, Node scanNode)
     96    Create a reverse-loading bioassay node from the derived bioassay set node.
     97    @return A bioassay node
     98  */
     99  @Override
     100  public Node createReverseNode(DbControl dc, OverviewContext context, Node derivedBioAssaySetNode)
    102101  {
    103102    NodeFactory<PhysicalBioAssay> nf = getNodeFactory(dc, context);
     
    107106    try
    108107    {
    109       Scan scan = (Scan)scanNode.getItem(dc);
    110       bioAssay = scan.getHybridization();
    111       Node rbaNode = scanNode.getFirstParent(new ItemTypeFilter(Item.RAWBIOASSAY));
     108      DerivedBioAssaySet bas = (DerivedBioAssaySet)derivedBioAssaySetNode.getItem(dc);
     109      bioAssay = bas.getPhysicalBioAssay();
     110      Node rbaNode = derivedBioAssaySetNode.getFirstParent(new ItemTypeFilter(Item.RAWBIOASSAY));
    112111      if (rbaNode != null)
    113112      {
     
    121120    }
    122121    Object cacheKey = new IndexedCacheKey(bioAssay, arrayNum);
    123     Node bioAssayNode = createItemNode(nf, bioAssay, cacheKey, denied, scanNode, ChildNodeDirection.REVERSE);
     122    Node bioAssayNode = createItemNode(nf, bioAssay, cacheKey, denied, derivedBioAssaySetNode, ChildNodeDirection.REVERSE);
    124123    return bioAssayNode;
    125124  }
     
    149148    Load forward-loading child nodes:
    150149    <ul>
    151     <li>Scans: {@link ScanLoader#createForwardNode(DbControl, OverviewContext, Node)}
     150    <li>Derived bioassay sets (root): {@link DerivedBioAssaySetLoader#createForwardNode(DbControl, OverviewContext, Node)}
    152151    <li>Array slide in reverse direction (if the parent node is an extract):
    153152      {@link ArraySlideLoader#createReverseNode(DbControl, OverviewContext, Node)}
     
    159158  protected void loadForwardChildNodes(DbControl dc, OverviewContext context, Node bioAssayNode)
    160159  {
    161     getNodeLoader(context, Item.SCAN).createForwardNode(dc, context, bioAssayNode);
     160    getNodeLoader(context, Item.DERIVEDBIOASSAYSET).createForwardNode(dc, context, bioAssayNode);
    162161    Node parent = bioAssayNode.getParent();
    163162    if (parent != null && parent.getNodeType() == Node.Type.FOLDER)
     
    184183  */
    185184  @Override
    186   protected void loadReverseChildNodes(DbControl dc, OverviewContext context, Node hybNode)
    187   {
    188     getNodeLoader(context, Item.EXTRACT).createReverseNode(dc, context, hybNode);
    189     getNodeLoader(context, Item.ARRAYSLIDE).createReverseNode(dc, context, hybNode);
     185  protected void loadReverseChildNodes(DbControl dc, OverviewContext context, Node bioAssayNode)
     186  {
     187    getNodeLoader(context, Item.EXTRACT).createReverseNode(dc, context, bioAssayNode);
     188    getNodeLoader(context, Item.ARRAYSLIDE).createReverseNode(dc, context, bioAssayNode);
    190189  }
    191190  // --------------------------------------
  • trunk/src/core/net/sf/basedb/util/overview/loader/RawBioAssayLoader.java

    r5642 r5652  
    2424
    2525import net.sf.basedb.core.DbControl;
     26import net.sf.basedb.core.DerivedBioAssay;
    2627import net.sf.basedb.core.Experiment;
    2728import net.sf.basedb.core.Extract;
     
    3132import net.sf.basedb.core.ItemResultIterator;
    3233import net.sf.basedb.core.RawBioAssay;
    33 import net.sf.basedb.core.Scan;
    3434import net.sf.basedb.core.query.Expressions;
    3535import net.sf.basedb.core.query.Hql;
     
    4444/**
    4545  Node loader implementation for raw bioassays. The forward-loading
    46   direction goes from {@link Scan}:s -&gt; {@link RawBioAssay}:s -&gt;
     46  direction goes from {@link DerivedBioAssay}:s -&gt; {@link RawBioAssay}:s -&gt;
    4747  {@link Experiment}:s. The reverse-loading direction is the opposite
    4848  direction.
     
    6666  */
    6767  /**
    68     Create forward-loading raw bioassay nodes from a given scan node.
     68    Create forward-loading raw bioassay nodes from a given derived bioassay node.
    6969    The returned node is a folder-type node containing item nodes for
    7070    each raw bioassay that has been created from the scan.
     
    7272  */
    7373  @Override
    74   public Node createForwardNode(DbControl dc, OverviewContext context, Node scanNode)
     74  public Node createForwardNode(DbControl dc, OverviewContext context, Node bioAssayNode)
    7575  {
    7676    NodeFactory<RawBioAssay> nf = getNodeFactory(dc, context);
    7777    Node folderNode = null;
    78     Scan scan = (Scan)scanNode.getItem(dc);
    79     ItemQuery<RawBioAssay> query = context.initQuery(scan.getRawBioAssays(), "name");
     78    DerivedBioAssay ba = (DerivedBioAssay)bioAssayNode.getItem(dc);
     79    ItemQuery<RawBioAssay> query = context.initQuery(ba.getRawBioAssays(), "name");
    8080   
    8181    // If we have a extract as parent we need to know the array number
     
    8383    // may have other raw bioassays that are NOT related to the same extract
    8484    int arrayNum = 0;
    85     PhysicalBioAssay hyb = null;
    86     Node assayNode = scanNode.getFirstParent(new ItemTypeFilter(Item.PHYSICALBIOASSAY));
    87     if (assayNode != null)
     85    PhysicalBioAssay pba = null;
     86    Node physicalBioAssayNode = bioAssayNode.getFirstParent(new ItemTypeFilter(Item.PHYSICALBIOASSAY));
     87    if (physicalBioAssayNode != null)
    8888    {
    89       Node extractNode = assayNode.getFirstParent(new ItemTypeFilter(Item.EXTRACT));
     89      Node extractNode = physicalBioAssayNode.getFirstParent(new ItemTypeFilter(Item.EXTRACT));
    9090      if (extractNode != null)
    9191      {
    92         hyb = (PhysicalBioAssay)assayNode.getItem(dc);
     92        pba = (PhysicalBioAssay)physicalBioAssayNode.getItem(dc);
    9393        Extract extract = (Extract)extractNode.getItem();
    94         arrayNum = hyb.getCreationEvent().getSourceGroup(extract);
     94        arrayNum = pba.getCreationEvent().getSourceGroup(extract);
    9595      }
    9696    }
     
    106106      if (folderNode == null)
    107107      {
    108         folderNode =  new Node("rawbioassays", "Raw bioassays", scanNode, ChildNodeDirection.FORWARD);
     108        folderNode =  new Node("rawbioassays", "Raw bioassays", bioAssayNode, ChildNodeDirection.FORWARD);
    109109      }
    110110      createItemNode(nf, rba, rba, false, folderNode, ChildNodeDirection.FORWARD);
    111111    }
    112     postValidateFolder(nf, folderNode, scanNode, false);
     112    postValidateFolder(nf, folderNode, bioAssayNode, false);
    113113    return folderNode;
    114114  }
     
    161161  {
    162162    getNodeLoader(context, Item.ANNOTATION).createPropertyNode(dc, context, rawBioAssayNode);
     163    getNodeLoader(context, Item.FILESETMEMBER).createPropertyNode(dc, context, rawBioAssayNode);
    163164    getNodeLoader(context, Item.PLATFORM).createPropertyNode(dc, context, rawBioAssayNode);
    164     getNodeLoader(context, Item.FILESETMEMBER).createPropertyNode(dc, context, rawBioAssayNode);
    165165    getNodeLoader(context, Item.ARRAYDESIGN).createPropertyNode(dc, context, rawBioAssayNode);
    166166    getNodeLoader(context, Item.PROTOCOL).createPropertyNode(dc, context, rawBioAssayNode);
     
    178178  }
    179179  /**
    180     Loads the scan node that this raw bioassay is created from.
    181     @see ScanLoader#createReverseNode(DbControl, OverviewContext, Node)
     180    Loads the derived bioassay node that this raw bioassay is created from.
     181    @see DerivedBioAssayLoader#createReverseNode(DbControl, OverviewContext, Node)
    182182  */
    183183  @Override
    184184  protected void loadReverseChildNodes(DbControl dc, OverviewContext context, Node rawBioAssayNode)
    185185  {
    186     getNodeLoader(context, Item.SCAN).createReverseNode(dc, context, rawBioAssayNode);
     186    getNodeLoader(context, Item.DERIVEDBIOASSAY).createReverseNode(dc, context, rawBioAssayNode);
    187187  }
    188188  // --------------------------------
  • trunk/src/core/net/sf/basedb/util/overview/loader/SoftwareLoader.java

    r4740 r5652  
    2424import net.sf.basedb.core.BasicItem;
    2525import net.sf.basedb.core.DbControl;
     26import net.sf.basedb.core.DerivedBioAssaySet;
    2627import net.sf.basedb.core.Item;
    2728import net.sf.basedb.core.PermissionDeniedException;
     
    7071        software = ((RawBioAssay)parentItem).getSoftware();
    7172      }
     73      else if (parentItem instanceof DerivedBioAssaySet)
     74      {
     75        software = ((DerivedBioAssaySet)parentItem).getSoftware();
     76      }
     77
    7278      // If there are other items with a software
    7379      // we should add more cases here
  • trunk/src/core/net/sf/basedb/util/overview/validator/ArrayDesignValidator.java

    r5651 r5652  
    3333import net.sf.basedb.core.Project;
    3434import net.sf.basedb.core.RawBioAssay;
    35 import net.sf.basedb.core.Scan;
    3635import net.sf.basedb.util.overview.Fix;
    3736import net.sf.basedb.util.overview.OverviewContext;
     
    7372    Project project = context.getProject();
    7473    ArrayDesign design = (ArrayDesign)node.getItem();
    75     if (!project.isDefaultItem(design))
     74    if (project != null)
    7675    {
    77       context.createFailure(Validator.NONDEFAULT_ARRAYDESIGN, node, null,
    78         new Fix("Change default array design for project", project)
    79       );
     76      if (!project.isDefaultItem(design))
     77      {
     78        context.createFailure(Validator.NONDEFAULT_ARRAYDESIGN, node, null,
     79          new Fix("Change default array design for project", project)
     80        );
     81      }
    8082    }
    8183   
     
    8789      try
    8890      {
     91        /*
    8992        Scan scan = rba.getScan();
    9093        if (scan != null)
     
    9699          }
    97100        }
     101        */
    98102      }
    99103      catch (PermissionDeniedException ex)
  • trunk/src/core/net/sf/basedb/util/overview/validator/BasicItemNodeValidatorFactory.java

    r5651 r5652  
    198198    registerCheckedNodeValidator(Item.ARRAYSLIDE, ArraySlideValidator.class);
    199199    registerCheckedNodeValidator(Item.PHYSICALBIOASSAY, PhysicalBioAssayValidator.class);
    200     registerCheckedNodeValidator(Item.SCAN, ScanValidator.class);
     200//    registerCheckedNodeValidator(Item.DERIVEDBIOASSAYSET, DerivedBioAssaySetValidator.class);
     201//    registerCheckedNodeValidator(Item.DERIVEDBIOASSAY, DerivedBioAssayValidator.class);
    201202    registerCheckedNodeValidator(Item.RAWBIOASSAY, RawBioAssayValidator.class);
    202203    registerCheckedNodeValidator(Item.EXPERIMENT, ExperimentValidator.class);
  • trunk/src/core/net/sf/basedb/util/overview/validator/HardwareValidator.java

    r5651 r5652  
    112112    // Check if using project default hardware
    113113    Project project = context.getProject();
    114     if (!project.isDefaultItem(hardware))
     114    if (project != null)
    115115    {
    116       context.createFailure(Validator.NONDEFAULT_HARDWARE, parentNode, null,
    117         new Fix("Change hardware of '" + parentNode.getTitle() + "'", parentItem),
    118         new Fix("Add '" + hardware.getName() + "' as default hardware to project", project)
    119       );
     116      if (!project.isDefaultItem(hardware))
     117      {
     118        context.createFailure(Validator.NONDEFAULT_HARDWARE, parentNode, null,
     119          new Fix("Change hardware of '" + parentNode.getTitle() + "'", parentItem),
     120          new Fix("Add '" + hardware.getName() + "' as default hardware to project", project)
     121        );
     122      }
    120123    }
    121124  }
  • trunk/src/core/net/sf/basedb/util/overview/validator/PhysicalBioAssayValidator.java

    r5651 r5652  
    7474      }
    7575    }
    76 
    7776  }
    7877
    7978  /**
    80     @return Suggested fix is to add a scan to the parent raw bioassay.
     79    @return Always null (since it can never be missing)
    8180  */
    8281  @Override
    8382  protected Fix getMissingItemFix(DbControl dc, Node parentNode)
    8483  {
    85     Fix fix = null;
    86     if (parentNode.getItemType() == Item.SCAN)
    87     {
    88       fix = new Fix("Add bioassay to scan", parentNode.getItem());
    89     }
    90     return fix;
     84    return null;
    9185  }
    9286  // ----------------------------
  • trunk/src/core/net/sf/basedb/util/overview/validator/PlatformValidator.java

    r5651 r5652  
    6767  {
    6868    super.postValidate(dc, context, node, parentNode);
    69     Project project = context.getProject();
    7069    Platform platform = (Platform)node.getItem();
    7170    PlatformVariant variant = null;
     
    8988    }
    9089   
    91     if (!project.isDefaultItem(platform) ||
    92       (variant != null && !project.isDefaultItem(variant) && !failedVariant))
     90   
     91    Project project = context.getProject();
     92    if (project != null)
    9393    {
    94       context.createFailure(Validator.NONDEFAULT_PLATFORM, parentNode, null,
    95         canChangePlatform ? new Fix("Change platform of " + parentTypeName, parentItem) : null,
    96         new Fix("Change default platform of project", project)
    97       );
     94      if (!project.isDefaultItem(platform) ||
     95        (variant != null && !project.isDefaultItem(variant) && !failedVariant))
     96      {
     97        context.createFailure(Validator.NONDEFAULT_PLATFORM, parentNode, null,
     98          canChangePlatform ? new Fix("Change platform of " + parentTypeName, parentItem) : null,
     99          new Fix("Change default platform of project", project)
     100        );
     101      }
    98102    }
    99103  }
  • trunk/src/core/net/sf/basedb/util/overview/validator/ProtocolValidator.java

    r5651 r5652  
    113113    // Check if using project default protocol
    114114    Project project = context.getProject();
    115     if (!project.isDefaultItem(protocol))
     115    if (project != null)
    116116    {
    117       context.createFailure(Validator.NONDEFAULT_PROTOCOL, parentNode, null,
    118         new Fix("Change protocol of '" + parentNode.getTitle() + "'", parentItem),
    119         new Fix("Add '" + protocol.getName() + "' as default protocol to project", project)
    120       );
     117      if (!project.isDefaultItem(protocol))
     118      {
     119        context.createFailure(Validator.NONDEFAULT_PROTOCOL, parentNode, null,
     120          new Fix("Change protocol of '" + parentNode.getTitle() + "'", parentItem),
     121          new Fix("Add '" + protocol.getName() + "' as default protocol to project", project)
     122        );
     123      }
    121124    }
    122125  }
  • trunk/src/core/net/sf/basedb/util/overview/validator/RawBioAssayValidator.java

    r5651 r5652  
    2727import net.sf.basedb.core.ArrayDesign;
    2828import net.sf.basedb.core.DbControl;
     29import net.sf.basedb.core.DerivedBioAssay;
    2930import net.sf.basedb.core.PhysicalBioAssay;
    3031import net.sf.basedb.core.Project;
    3132import net.sf.basedb.core.RawBioAssay;
    3233import net.sf.basedb.core.RawDataType;
    33 import net.sf.basedb.core.Scan;
    3434import net.sf.basedb.util.Values;
    3535import net.sf.basedb.util.overview.Fix;
     
    8989   
    9090    // 1. Check if we have seen other raw bioassays with the same
    91     //    array index that are from the same scan
    92     // 2. Check array index is within the bounds set by hybridization
     91    //    array index that are from the same parent bioassay set
     92    // 2. Check array index is within the bounds set by physical bioassay
    9393    try
    9494    {
    9595      int arrayIndex = rba.getArrayNum();
    96       Scan scan = rba.getScan();
     96      DerivedBioAssay parent = rba.getParent();
    9797      Map<String, Node> used = (Map<String, Node>)context.getCachedObject("USED.ARRAYINDEX");
    9898      if (used == null)
     
    102102      }
    103103     
    104       String key = scan.getId() + ":" + arrayIndex;
     104      String key = parent.getId() + ":" + arrayIndex;
    105105      if (used.containsKey(key))
    106106      {
     
    120120      }
    121121     
    122       PhysicalBioAssay hyb = scan.getHybridization();
    123       if (arrayIndex > hyb.getSize() || arrayIndex < 1)
     122      PhysicalBioAssay pba = parent.getBioAssaySet().getPhysicalBioAssay();
     123      if (arrayIndex > pba.getSize() || arrayIndex < 1)
    124124      {
    125125        context.createFailure(Validator.INCORRECT_ARRAY_NUM, node,
    126126          "Incorrect sub-array index: " + arrayIndex +
    127             " (expected 1.." + hyb.getSize() + ")",
     127            " (expected 1.." + pba.getSize() + ")",
    128128          new Fix("Change array index on raw bioassay", rba),
    129           new Fix("Increase arrays on hybridization", hyb));
     129          new Fix("Increase size on physical bioassay", pba));
    130130      }
    131131    }
  • trunk/src/core/net/sf/basedb/util/overview/validator/SoftwareValidator.java

    r5651 r5652  
    9494    // Check if using project default software
    9595    Project project = context.getProject();
    96     if (!project.isDefaultItem(software))
     96    if (project != null)
    9797    {
    98       context.createFailure(Validator.NONDEFAULT_SOFTWARE, parentNode, null,
    99         new Fix("Change software of '" + parentNode.getTitle() + "'", parentItem),
    100         new Fix("Add '" + software.getName() + "' as default software to project", project)
    101       );
     98      if (!project.isDefaultItem(software))
     99      {
     100        context.createFailure(Validator.NONDEFAULT_SOFTWARE, parentNode, null,
     101          new Fix("Change software of '" + parentNode.getTitle() + "'", parentItem),
     102          new Fix("Add '" + software.getName() + "' as default software to project", project)
     103        );
     104      }
    102105    }
    103106  }
  • trunk/src/plugins/core/net/sf/basedb/plugins/IlluminaRawDataImporter.java

    r5630 r5652  
    6161import net.sf.basedb.core.RawDataTypes;
    6262import net.sf.basedb.core.RequestInformation;
    63 import net.sf.basedb.core.Scan;
    6463import net.sf.basedb.core.Software;
    6564import net.sf.basedb.core.StringParameterType;
     
    337336  private Experiment experiment;
    338337  private ArrayDesign design;
    339   private Scan scan;
    340338  private Software software;
    341339  private Protocol protocol;
     
    425423    this.experiment = (Experiment)job.getValue("experiment");
    426424    this.design = (ArrayDesign)job.getValue("arrayDesign");
    427     this.scan = (Scan)job.getValue("scan");
    428425    this.protocol = (Protocol)job.getValue("protocol");
    429426    this.software = (Software)job.getValue("software");
     
    676673            rba.setArrayNum(arrayNum);
    677674            if (design != null) rba.setArrayDesign(design);
    678             if (scan != null) rba.setScan(scan);
    679675            if (protocol != null) rba.setProtocol(protocol);
    680676            if (software != null) rba.setSoftware(software);
     
    732728        // parameters for scan, protocol, software and array design
    733729        dc = sc.newDbControl();
    734         List<Scan> scans = getItems(dc, Scan.getQuery());
    735730        List<Protocol> protocols = getItems(dc, Protocol.getQuery(),
    736731            Restrictions.eq(
     
    753748       
    754749        boolean hasAssociations =
    755           context.getItem() == Item.EXPERIMENT || scans.size() > 0 ||
     750          context.getItem() == Item.EXPERIMENT ||
    756751          protocols.size() > 0 || software.size() > 0 || designs.size() > 0;
    757752       
     
    779774            parameters.add(featureIdentificationParameter);
    780775          }
    781           if (!scans.isEmpty())
    782           {
    783             parameters.add(new PluginParameter<Scan>(
    784               "scan",
    785               "Scan",
    786               "The imported raw bioassays will be linked to the selected scan.",
    787               new ItemParameterType<Scan>(Scan.class, null, false, 1, scans)
    788             ));
    789           }
    790776          if (!protocols.isEmpty())
    791777          {
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/AbstractItemImporter.java

    r5650 r5652  
    5050import net.sf.basedb.core.ItemParameterType;
    5151import net.sf.basedb.core.PhysicalBioAssay;
    52 import net.sf.basedb.core.Image;
    5352import net.sf.basedb.core.Include;
    5453import net.sf.basedb.core.IntegerUtil;
     
    7776import net.sf.basedb.core.RequestInformation;
    7877import net.sf.basedb.core.Sample;
    79 import net.sf.basedb.core.Scan;
    8078import net.sf.basedb.core.Shareable;
    8179import net.sf.basedb.core.ShareableUtil;
     
    16521650  }
    16531651
    1654   private ItemQuery<Scan> scanQuery;
    1655   /**
    1656     Find a scan with a given identifier. This is a utility method that
    1657     subclasses can use when creating or updating items.
    1658     <p>
    1659     NOTE! The first time this method is called a query object is initialised
    1660     using the {@link IdMethod#prepareQuery(DbControl, ItemQuery)} method.
    1661     Subsequent calls uses the same query. Thus, this method should always be
    1662     called with the same id method object, otherwise the result is undefined.
    1663    
    1664     @param dc The DbControl to use for database access
    1665     @param identifier The identifier protocol
    1666     @return A scan, or null if no item could be found
    1667   */
    1668   protected Scan findScan(DbControl dc, IdMethod idMethod, String identifier)
    1669   {
    1670     if (identifier == null) return null;
    1671     if (scanQuery == null)
    1672     {
    1673       scanQuery = initReferenceQuery(dc, idMethod, Scan.getQuery(), false);
    1674     }
    1675     return findReferencedItem(dc, idMethod, scanQuery, identifier, 0, false);
    1676   }
    1677  
    1678   /**
    1679     Find an image with given scan and file. This is a utility method that
    1680     subclasses can use when creating or updating items.
    1681     New image will be created if given scan hasn't been saved to the database or
    1682     if no image could be found for the given file.
    1683     Null-value is returned if more then one image were found and
    1684     {@link #failIfMultipleFoundReferences} is set to FALSE.
    1685    
    1686       @param dc The DbControl to use for database access
    1687       @param scan The Scan for which the image should belong to.
    1688       @param imageFile The File, which the image is connected to.
    1689       @return An image, or null.
    1690       @since 2.12
    1691    */
    1692   protected Image findImage(DbControl dc, Scan scan, File imageFile)
    1693   {
    1694     if (imageFile == null) return null;   
    1695     Image image = null;
    1696     if (scan.isInDatabase())
    1697     {
    1698       ItemQuery<Image> imageQuery = scan.getImages();
    1699       imageQuery.include(Include.MINE, Include.IN_PROJECT, Include.SHARED, Include.OTHERS);
    1700       imageQuery.restrict(Restrictions.eq(Hql.property("file"), Hql.entity(imageFile)));
    1701       List<Image> images = imageQuery.list(dc);     
    1702       if (images.size() == 1)
    1703       {
    1704         image = images.get(0);
    1705       }
    1706       else if (images.size() > 1)
    1707       {
    1708         // Several images with given file were found
    1709         if (failIfMultipleFoundReferences)
    1710         {
    1711           throw new BaseException("Found " + images.size() + " " + Item.IMAGE + " [ File =" + imageFile.getPath() + "]");
    1712         }
    1713       }
    1714       else if (images.size() == 0)
    1715       {
    1716         // Create new image if no one could be found with the given file.     
    1717         image = scan.newImage();
    1718         dc.saveItemIf(scan, image, false);
    1719         image.setFile(imageFile);
    1720       }
    1721     }
    1722     else
    1723     {
    1724       // Create new image based on the given file if the scan hasn't been saved to the database.
    1725       image = scan.newImage();
    1726       dc.saveItemIf(scan, image, false);
    1727       image.setFile(imageFile);
    1728     }
    1729     return image;
    1730   }
    1731  
    17321652  private ItemQuery<ArrayDesign> designQuery;
    17331653  /**
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/RawBioAssayImporter.java

    r5630 r5652  
    3535import net.sf.basedb.core.Path;
    3636import net.sf.basedb.core.PathParameterType;
    37 import net.sf.basedb.core.PermissionDeniedException;
    3837import net.sf.basedb.core.Platform;
    3938import net.sf.basedb.core.PlatformVariant;
     
    4241import net.sf.basedb.core.RawBioAssay;
    4342import net.sf.basedb.core.RawDataType;
    44 import net.sf.basedb.core.Scan;
    4543import net.sf.basedb.core.Software;
    4644import net.sf.basedb.core.SystemItems;
     
    334332    }
    335333    ArrayDesign designFromScan = null;
     334    /*
    336335    if (scanMapper != null)
    337336    {
     
    349348      }
    350349    }
     350    */
    351351    if (!rba.hasData())
    352352    {
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/ScanImporter.java

    r5642 r5652  
    2323
    2424import net.sf.basedb.core.DbControl;
     25import net.sf.basedb.core.DerivedBioAssaySet;
    2526import net.sf.basedb.core.File;
    2627import net.sf.basedb.core.Hardware;
    2728import net.sf.basedb.core.PhysicalBioAssay;
    28 import net.sf.basedb.core.Image;
    2929import net.sf.basedb.core.Item;
    3030import net.sf.basedb.core.ItemQuery;
     
    3434import net.sf.basedb.core.PluginParameter;
    3535import net.sf.basedb.core.Protocol;
    36 import net.sf.basedb.core.Scan;
    3736import net.sf.basedb.core.SystemItems;
    3837import net.sf.basedb.core.plugin.GuiContext;
     
    5352*/
    5453public class ScanImporter
    55   extends AbstractItemImporter<Scan>
     54  extends AbstractItemImporter<DerivedBioAssaySet>
    5655{
    5756
    5857  private static final Set<GuiContext> guiContexts = 
    59     Collections.singleton(new GuiContext(Item.SCAN, GuiContext.Type.LIST));
     58    Collections.singleton(new GuiContext(Item.DERIVEDBIOASSAYSET, GuiContext.Type.LIST));
    6059 
    6160  protected static final PluginParameter<String> hardwareColumnMapping = new PluginParameter<String>(
     
    212211 
    213212  /**
    214     Calls {@link Scan#getQuery()}.
    215   */
    216   @Override
    217   protected ItemQuery<Scan> createItemQuery()
    218   {
    219     return Scan.getQuery();
     213    Calls {@link DerivedBioAssaySet#getQuery()}.
     214  */
     215  @Override
     216  protected ItemQuery<DerivedBioAssaySet> createItemQuery()
     217  {
     218    return DerivedBioAssaySet.getQuery();
    220219  }
    221220 
     
    224223  {
    225224    nameMapper = getMapper(ffp, (String)job.getValue("nameColumnMapping"),
    226         cropStrings ? Scan.MAX_NAME_LENGTH : null, null);
     225        cropStrings ? DerivedBioAssaySet.MAX_NAME_LENGTH : null, null);
    227226    descriptionMapper = getMapper(ffp, (String)job.getValue("descriptionColumnMapping"),
    228         cropStrings ? Scan.MAX_DESCRIPTION_LENGTH : null, null);
     227        cropStrings ? DerivedBioAssaySet.MAX_DESCRIPTION_LENGTH : null, null);
    229228    protocolMapper = getMapper(ffp, (String)job.getValue("protocolColumnMapping"), null, null);
    230229    hardwareMapper = getMapper(ffp, (String)job.getValue("hardwareColumnMapping"), null, null);
     
    243242 
    244243  @Override
    245   protected Scan createItem(DbControl dc, FlatFileParser.Data data)
     244  protected DerivedBioAssaySet createItem(DbControl dc, FlatFileParser.Data data)
    246245  {
    247246    PhysicalBioAssay hyb = null;
     
    251250    }
    252251
    253     Scan scan = Scan.getNew(dc, hyb);
     252    DerivedBioAssaySet scan = DerivedBioAssaySet.getNew(dc, hyb);
    254253    updateItem(dc, scan, data);
    255254    return scan;
     
    257256 
    258257  @Override
    259   protected void updateItem(DbControl dc, Scan scan, FlatFileParser.Data data)
     258  protected void updateItem(DbControl dc, DerivedBioAssaySet scan, FlatFileParser.Data data)
    260259  {
    261260    if (nameMapper != null) scan.setName(nameMapper.getValue(data));
    262261    if (descriptionMapper != null) scan.setDescription(descriptionMapper.getValue(data));
     262    /*
    263263    if (hybridizationMapper != null && scan.isInDatabase())
    264264    {
     
    270270      }
    271271    }
     272    */
    272273    if (protocolMapper != null)
    273274    {
     
    282283      ItemSubtype type = ItemSubtype.getById(dc, SystemItems.getId(Hardware.SCANNER));
    283284      Hardware scanner = findHardware(dc, FallbackIdMethod.NAME_OR_ID, nameOrId, type);
    284       if (nameOrId == null || scanner != null) scan.setScanner(scanner);
     285      if (nameOrId == null || scanner != null) scan.setHardware(scanner);
    285286    }
    286287   
     
    289290 
    290291  @Override
    291   protected void updateMultiLineItem(DbControl dc, Scan scan, FlatFileParser.Data data, int multiLineNum)
    292   {
    293     Image image = null;
     292  protected void updateMultiLineItem(DbControl dc, DerivedBioAssaySet scan, FlatFileParser.Data data, int multiLineNum)
     293  {
     294  //  Image image = null;
    294295    File imageFile = null;
    295296    String imageName = null;
     
    303304      }
    304305      imageFile = File.getByPath(dc, new Path(filePath, Path.Type.FILE), false);
    305       image = findImage(dc, scan, imageFile);
     306  //    image = findImage(dc, scan, imageFile);
    306307    }
    307308    if (imageNameMapper != null)
     
    309310      imageName = imageNameMapper.getValue(data);
    310311    }
     312    /*
    311313    else if (image != null)
    312314    {
    313315      imageName = image.getName();
    314316    }
    315    
     317    */
     318    /*
    316319    if (image != null)
    317320    {
     
    321324      if (imagePreviewMapper != null) image.setPreview(Boolean.getBoolean(imagePreviewMapper.getValue(data)));
    322325    }
     326    */
    323327  }
    324328  // ------------------------------------
  • trunk/src/test/TestAll.java

    r5642 r5652  
    115115    // Physical bioassays and raw data
    116116    results.put("TestPhysicalBioAssay", TestPhysicalBioAssay.test_all());
    117     results.put("TestScan", TestScan.test_all());
     117    results.put("TestDerivedBioAssaySet", TestDerivedBioAssaySet.test_all());
    118118    results.put("TestRawBioAssay", TestRawBioAssay.test_all());
    119119    results.put("TestSpotImages", TestSpotImages.test_all());
  • trunk/src/test/TestDataFileType.java

    r5630 r5652  
    2727import net.sf.basedb.core.DataFileType;
    2828import net.sf.basedb.core.File;
     29import net.sf.basedb.core.FileSetMember;
     30import net.sf.basedb.core.FileStoreEnabled;
    2931import net.sf.basedb.core.Item;
    3032import net.sf.basedb.core.ItemProxy;
     
    194196  }
    195197 
     198  static void write_item(int i, FileSetMember member)
     199    throws BaseException
     200  {
     201    if (!TestUtil.getSilent())
     202    {
     203      System.out.println(i+":\t"+member.getId()+"\t"+member.getFile().getName()+"\t"+
     204        member.getDataFileType().getName());
     205    }
     206  }
     207
     208 
    196209  static void write_item(int i, PlatformVariant v)
    197210    throws BaseException
     
    234247  }
    235248
     249  static void test_set_file(Item itemType, int itemId, String fileType, int fileId)
     250  {
     251    if (itemId == 0 || fileId == 0) return;
     252    DbControl dc = null;
     253    try
     254    {
     255      dc = TestUtil.getDbControl();
     256      FileStoreEnabled item = (FileStoreEnabled)itemType.getById(dc, itemId);
     257      DataFileType type = DataFileType.getByExternalId(dc, fileType);
     258      File file = File.getById(dc, fileId);
     259      item.getFileSet().setMember(file, type);
     260      dc.commit();
     261      write("--Set file OK ("+fileType+")");
     262    }
     263    catch (Throwable ex)
     264    {
     265      write("--Set file FAILED ("+fileType+")");
     266      ex.printStackTrace();
     267      ok = false;
     268    }
     269    finally
     270    {
     271      if (dc != null) dc.close();
     272    }
     273  }
     274
     275  static void test_list_files(Item itemType, int itemId, int expectedResults)
     276  {
     277    if (itemId == 0) return;
     278    DbControl dc = null;
     279    try
     280    {
     281      dc = TestUtil.getDbControl();
     282      FileStoreEnabled item = (FileStoreEnabled)itemType.getById(dc, itemId);
     283      ItemResultList<FileSetMember> l = item.getFileSet().getMembers().list(dc);
     284      for (int i = 0; i<l.size(); i++)
     285      {
     286        write_item(i, l.get(i));
     287      }
     288      if (expectedResults >= 0 && expectedResults != l.size())
     289      {
     290        throw new BaseException("Expected "+expectedResults+" results, not "+l.size());
     291      }
     292      write("--List files OK ("+l.size()+")");
     293    }
     294    catch (Throwable ex)
     295    {
     296      write("--List files FAILED");
     297      ex.printStackTrace();
     298      ok = false;
     299    }
     300    finally
     301    {
     302      if (dc != null) dc.close();
     303    }
     304  }
     305 
     306  static void test_list_file_types(Item itemType, int itemId, int expectedResults)
     307  {
     308    if (itemId == 0) return;
     309    DbControl dc = null;
     310    try
     311    {
     312      dc = TestUtil.getDbControl();
     313      FileStoreEnabled item = (FileStoreEnabled)itemType.getById(dc, itemId);
     314      ItemResultList<DataFileType> l = item.getFileSet().getMemberTypes().list(dc);
     315      for (int i = 0; i<l.size(); i++)
     316      {
     317        write_item(i, l.get(i));
     318      }
     319      if (expectedResults >= 0 && expectedResults != l.size())
     320      {
     321        throw new BaseException("Expected "+expectedResults+" results, not "+l.size());
     322      }
     323      write("--List file types OK ("+l.size()+")");
     324    }
     325    catch (Throwable ex)
     326    {
     327      write("--List file types FAILED");
     328      ex.printStackTrace();
     329      ok = false;
     330    }
     331    finally
     332    {
     333      if (dc != null) dc.close();
     334    }
     335  }
     336
     337 
    236338}
  • trunk/src/test/TestGenericOverview.java

    r5642 r5652  
    2525import net.sf.basedb.core.DataFileType;
    2626import net.sf.basedb.core.DbControl;
     27import net.sf.basedb.core.DerivedBioAssaySet;
    2728import net.sf.basedb.core.Extract;
    2829import net.sf.basedb.core.Hardware;
     
    6566    int scanningProtocol = TestProtocol.test_create(
    6667        SystemItems.getId(Protocol.SCANNING), "Scan protocol", false);
     68    int sequencingProtocol = TestProtocol.test_create(
     69        SystemItems.getId(Protocol.SEQUENCING), "Sequencing protocol", false);
    6770    int featureProtocol = TestProtocol.test_create(
    6871        SystemItems.getId(Protocol.FEATURE_EXTRACTION), "Feature protocol", false);
     
    7073    int milliWatt = TestUnit.test_load_by_symbol(power, "mW");
    7174    int scanPower = TestAnnotationType.test_create("Power", Type.FLOAT, milliWatt,
    72         null, null, Item.SCAN, 1, null, false);
     75        null, null, Item.DERIVEDBIOASSAYSET, 1, null, false);
    7376    TestProtocol.test_set_protocol_parameter(scanningProtocol, scanPower);
    7477
    7578    // Hardware and software
    7679    int scanner = TestHardware.test_create(
    77         SystemItems.getId(Hardware.SCANNER), "Overview scanner", false);
     80        SystemItems.getId(Hardware.SCANNER), "Scanner GO", false);
     81    int sequencer = TestHardware.test_create(
     82        SystemItems.getId(Hardware.SEQUENCER), "Sequencer GO", false);
    7883    int software = TestSoftware.test_create(
    79         SystemItems.getId(Software.FEATURE_EXTRACTION), "Overview software", false);
     84        SystemItems.getId(Software.FEATURE_EXTRACTION), "Feature extraction GO", false);
     85    int alignmentSoftware = TestSoftware.test_create(
     86        SystemItems.getId(Software.ALIGNMENT), "Alignment GO", false);
    8087   
    8188    // Data files
     
    8390    int celFile = TestFile.test_create("data/test.affymetrix.cel", false, false);
    8491    int reporterMap = TestFile.test_create("data/test", false, false);
     92    int samFile = TestFile.test_create("data/test.assembly.sam", false, false);
    8593
    8694    // Create main items
     
    94102    int extractPooled = TestExtract.test_create_pooled(extract1, extract2);
    95103   
     104    // Array design
     105    int arrayDesign = TestArrayDesign.test_create(Platform.GENERIC, false);
     106    TestArrayDesign.test_set_file(arrayDesign, DataFileType.GENERIC_REPORTER_MAP, reporterMap);
     107   
     108    // Array batch & slide
     109    int arrayBatch = TestArrayBatch.test_create(arrayDesign, false);
     110    int arraySlide = TestArraySlide.test_create(arrayBatch, false);
     111   
     112    // ******** Microarray part *******
     113    // Labeled extracts
    96114    int cy3 = TestTag.test_load("cy3");
    97115    int cy5 = TestTag.test_load("cy5");
     
    101119    int labeledExtract1Ref = TestExtract.test_create(extractPooled, "Labeled GO #1 (cy5)", labeledExtract, cy5, false);
    102120    int labeledExtract2Ref = TestExtract.test_create(extractPooled, "Labeled GO #2 (cy5)", labeledExtract, cy5, false);
    103 
    104     // Array design
    105     int arrayDesign = TestArrayDesign.test_create(Platform.GENERIC, false);
    106     TestArrayDesign.test_set_file(arrayDesign, DataFileType.GENERIC_REPORTER_MAP, reporterMap);
    107    
    108     // Array batch & slide
    109     int arrayBatch = TestArrayBatch.test_create(arrayDesign, false);
    110     int arraySlide = TestArraySlide.test_create(arrayBatch, false);
    111121   
    112122    // Hybridization
    113123    int hyb = TestPhysicalBioAssay.test_create(arraySlide, SystemItems.getId(PhysicalBioAssay.HYBRIDIZATION), false);
    114     TestPhysicalBioAssay.test_add_labeledextract(hyb, labeledExtract1, 1, null);
    115     TestPhysicalBioAssay.test_add_labeledextract(hyb, labeledExtract1Ref, 1, null);
    116     TestPhysicalBioAssay.test_add_labeledextract(hyb, labeledExtract2, 2, null);
    117     TestPhysicalBioAssay.test_add_labeledextract(hyb, labeledExtract2Ref, 2, null);
     124    TestPhysicalBioAssay.test_add_extract(hyb, labeledExtract1, 1, null);
     125    TestPhysicalBioAssay.test_add_extract(hyb, labeledExtract1Ref, 1, null);
     126    TestPhysicalBioAssay.test_add_extract(hyb, labeledExtract2, 2, null);
     127    TestPhysicalBioAssay.test_add_extract(hyb, labeledExtract2Ref, 2, null);
    118128
    119129    // Scan
    120     int scan = TestScan.test_create(hyb, scanner, scanningProtocol, false);
    121     TestAnnotation.test_annotatate(Item.SCAN, scan, scanPower, 0, 15.0f);
    122     TestScan.test_add_image(scan);
     130    int scan = TestDerivedBioAssaySet.test_create_root("Scanned hyb", hyb,
     131        SystemItems.getId(DerivedBioAssaySet.SCAN), scanningProtocol, scanner, 0);
     132    TestAnnotation.test_annotatate(Item.DERIVEDBIOASSAYSET, scan, scanPower, 0, 15.0f);
     133    int scannedAssayId1 = TestDerivedBioAssaySet.test_add_bioassay(scan, "Scanned GO #1");
     134    int scannedAssayId2 = TestDerivedBioAssaySet.test_add_bioassay(scan, "Scanned GO #2");
    123135   
    124136    // Raw bioassay #1
    125     int rawBioAssay1 = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", "RBA #1", scan, software, featureProtocol, arrayDesign, 1, false);
    126     TestRawBioAssay.test_set_file(rawBioAssay1, DataFileType.GENERIC_RAW_DATA, genePixFile);
    127     TestRawBioAssay.test_set_file(rawBioAssay1, DataFileType.AFFYMETRIX_CEL, celFile);
     137    int rawBioAssay1 = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", "RBA #1", scannedAssayId1, software, featureProtocol, arrayDesign, 1, false);
     138    TestDataFileType.test_set_file(Item.RAWBIOASSAY, rawBioAssay1, DataFileType.GENERIC_RAW_DATA, genePixFile);
     139    TestDataFileType.test_set_file(Item.RAWBIOASSAY, rawBioAssay1, DataFileType.AFFYMETRIX_CEL, celFile);
    128140    TestAnnotation.test_annotatate(Item.RAWBIOASSAY, rawBioAssay1, annotationType, 0, "alfa");
    129141
    130142    // Raw bioassay #2
    131     int rawBioAssay2 = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", "RBA #2", scan, software, scanningProtocol, arrayDesign, 2, false);
    132     TestRawBioAssay.test_set_file(rawBioAssay2, DataFileType.GENERIC_RAW_DATA, genePixFile);
    133 
    134     // Experiment
     143    int rawBioAssay2 = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", "RBA #2", scannedAssayId2, software, featureProtocol, arrayDesign, 2, false);
     144    TestDataFileType.test_set_file(Item.RAWBIOASSAY, rawBioAssay2, DataFileType.GENERIC_RAW_DATA, genePixFile);
     145
     146    // **** Sequencing part ********
     147    // Libraries
     148    int library = SystemItems.getId(Extract.LIBRARY);
     149    int library1 = TestExtract.test_create(extract1, "Library GO #1", library, 0, false);
     150    int library2 = TestExtract.test_create(extract2, "Library GO #2", library, 0, false);
     151   
     152    // Flow cell
     153    int flowCell = TestPhysicalBioAssay.test_create(0, SystemItems.getId(PhysicalBioAssay.FLOW_CELL), false);
     154    TestPhysicalBioAssay.test_add_extract(flowCell, library1, 1, null);
     155    TestPhysicalBioAssay.test_add_extract(flowCell, library2, 2, null);
     156   
     157    // Sequencing
     158    int sequencing = TestDerivedBioAssaySet.test_create_root("Sequenced GO", flowCell,
     159      SystemItems.getId(DerivedBioAssaySet.SEQUENCED), sequencingProtocol, sequencer, 0);
     160    int assembly = TestDerivedBioAssaySet.test_create_child("Assembly GO", sequencing,
     161      SystemItems.getId(DerivedBioAssaySet.ASSEMBLY), 0, 0, alignmentSoftware);
     162    int alignedAssayId1 = TestDerivedBioAssaySet.test_add_bioassay(assembly, "Aligned GO #1");
     163    int alignedAssayId2 = TestDerivedBioAssaySet.test_add_bioassay(assembly, "Aligned GO #2");
     164    TestDataFileType.test_set_file(Item.DERIVEDBIOASSAY, alignedAssayId1, DataFileType.SAM, samFile);
     165    TestDataFileType.test_set_file(Item.DERIVEDBIOASSAY, alignedAssayId2, DataFileType.SAM, samFile);
     166
     167    // Raw bioassays
     168    int seqRaw1 = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", "SeqRBA #1", alignedAssayId1, software, 0, arrayDesign, 1, false);
     169    int seqRaw2 = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", "SeqRBA #2", alignedAssayId2, software, 0, arrayDesign, 2, false);
     170   
     171    // **** Experiment ******
    135172    int experiment = TestExperiment.test_create("genepix", false);
    136173    TestExperiment.test_add_rawbioassay(experiment, rawBioAssay1, rawBioAssay2);
     
    147184    // Main items
    148185    TestExperiment.test_delete(experiment);
     186   
     187    TestRawBioAssay.test_delete(seqRaw1);
     188    TestRawBioAssay.test_delete(seqRaw2);
     189    TestDerivedBioAssaySet.test_delete(assembly);
     190    TestDerivedBioAssaySet.test_delete(sequencing);
     191    TestPhysicalBioAssay.test_delete(flowCell);
     192    TestExtract.test_delete(library1);
     193    TestExtract.test_delete(library2);
     194   
    149195    TestRawBioAssay.test_delete(rawBioAssay1);
    150196    TestRawBioAssay.test_delete(rawBioAssay2);
    151     TestScan.test_delete(scan);
     197    TestDerivedBioAssaySet.test_delete(scan);
    152198    TestPhysicalBioAssay.test_delete(hyb);
    153199    TestArraySlide.test_delete(arraySlide);
     
    158204    TestExtract.test_delete(labeledExtract2);
    159205    TestExtract.test_delete(labeledExtract2Ref);
     206   
    160207    TestExtract.test_delete(extractPooled);
    161208    TestExtract.test_delete(extract1);
     
    167214    // Support items
    168215    TestSoftware.test_delete(software);
     216    TestSoftware.test_delete(alignmentSoftware);
    169217    TestHardware.test_delete(scanner);
     218    TestHardware.test_delete(sequencer);
    170219    TestProtocol.test_delete(featureProtocol);
    171220    TestProtocol.test_delete(scanningProtocol);
     221    TestProtocol.test_delete(sequencingProtocol);
    172222    TestFile.test_delete(celFile);
    173223    TestFile.test_delete(genePixFile);
    174224    TestFile.test_delete(reporterMap);
     225    TestFile.test_delete(samFile);
    175226    TestAnnotationType.test_delete(scanPower);
    176227    TestAnnotationType.test_delete(annotationType);
  • trunk/src/test/TestIlluminaImporter.java

    r5642 r5652  
    4444    int fileId = TestFile.test_create("data/test.illumina.rawdata.txt", false, false);
    4545    int hybId = TestPhysicalBioAssay.test_create(0, 0, false);
    46     int scanId = TestScan.test_create(hybId, 0, 0, false);
     46    //int scanId = TestScan.test_create(hybId, 0, 0, false);
     47    int scanId = 0;
    4748    int protocolId = TestProtocol.test_create(SystemItems.getId(Protocol.FEATURE_EXTRACTION), null, false);
    4849    int softwareId = TestSoftware.test_create(SystemItems.getId(Software.FEATURE_EXTRACTION), null, false);
     
    7273    TestJob.test_delete(jobId);
    7374   
    74     TestScan.test_delete(scanId);
     75    //TestScan.test_delete(scanId);
    7576    TestSoftware.test_delete(softwareId);
    7677    TestProtocol.test_delete(protocolId);
     
    106107        request.setParameterValue("experiment", Experiment.getById(dc, experimentId));
    107108      }
     109      /*
    108110      if (scanId != 0)
    109111      {
    110112        request.setParameterValue("scan", Scan.getById(dc, scanId));
    111113      }
     114      */
    112115      if (protocolId != 0)
    113116      {
  • trunk/src/test/TestItemImporter.java

    r5649 r5652  
    142142   
    143143    // Import scans
     144    /*
    144145    int scanFileId = TestFile.test_create("data/test.batchimport.scans.txt", false, false);
    145146    int scanImporterId  = TestPluginDefinition.test_get("net.sf.basedb.plugins.batchimport.ScanImporter");
     
    147148    ok &= TestJob.test_execute(scanJobId, false);
    148149    TestScan.test_list(3);
     150    */
    149151 
    150152    // Import raw bioassays
     
    169171   
    170172    // Delete scans
     173    /*
    171174    TestScan.test_delete_all();
    172175    TestJob.test_delete(scanJobId);
    173176    TestFile.test_delete(scanFileId);
     177    */
    174178
    175179    // Delete hybridizations
     
    369373      request.setParameterValue("arraySlideColumnMapping", "\\Array slide\\");
    370374    }
     375    /*
    371376    if (itemType == Item.SCAN)
    372377    {
     
    375380      request.setParameterValue("hardwareColumnMapping", "\\Scanner\\");
    376381    }
     382    */
    377383    if (itemType == Item.RAWBIOASSAY)
    378384    {
    379385      request.setParameterValue("dataDirectory", "/");
    380386      request.setParameterValue("arrayIndexColumnMapping", "\\Array index\\");
    381       request.setParameterValue("scanColumnMapping", "\\Scan\\");
     387    //  request.setParameterValue("scanColumnMapping", "\\Scan\\");
    382388      request.setParameterValue("protocolColumnMapping", "\\Protocol\\");
    383389      request.setParameterValue("platformColumnMapping", "\\Platform\\");
  • trunk/src/test/TestMetadata.java

    r5642 r5652  
    2727import net.sf.basedb.core.BasicItem;
    2828import net.sf.basedb.core.DbControl;
     29import net.sf.basedb.core.DerivedBioAssay;
     30import net.sf.basedb.core.DerivedBioAssaySet;
    2931import net.sf.basedb.core.Extract;
    3032import net.sf.basedb.core.Formula;
     
    3436import net.sf.basedb.core.Platform;
    3537import net.sf.basedb.core.RawBioAssay;
    36 import net.sf.basedb.core.Scan;
    3738import net.sf.basedb.core.Metadata.PropertyPath;
    3839import net.sf.basedb.core.SystemItems;
     
    5960      test_create_property_path(RawBioAssay.class, "name", false);
    6061    // Association + id property
    61     PropertyPath<RawBioAssay, Scan> scan =
    62       test_create_property_path(RawBioAssay.class, "scan.id", false);
     62    PropertyPath<RawBioAssay, DerivedBioAssaySet> scan =
     63      test_create_property_path(RawBioAssay.class, "parent.bioAssaySet.id", false);
    6364    // Null association
    6465    PropertyPath<RawBioAssay, String> protocolName =
    65       test_create_property_path(RawBioAssay.class, "scan.protocol.name", false);
     66      test_create_property_path(RawBioAssay.class, "parent.bioAssaySet.creationEvent.protocol.name", false);
    6667    // Date value
    6768    PropertyPath<RawBioAssay, Date> hybDate =
    68       test_create_property_path(RawBioAssay.class, "scan.hybridization.creationEvent.entryDate", false);
     69      test_create_property_path(RawBioAssay.class, "parent.bioAssaySet.physicalBioAssay.creationEvent.entryDate", false);
    6970    // Long path + case insensitive
    7071    PropertyPath<RawBioAssay, String> design =
    71       test_create_property_path(RawBioAssay.class, "Scan.Hybridization.Arrayslide.Arraybatch.Arraydesign", false);
     72      test_create_property_path(RawBioAssay.class, "Parent.BioAssaySet.PhysicalBioAssay.Arrayslide.Arraybatch.Arraydesign", false);
    7273    // Component
    7374    PropertyPath<Formula, Float> formulaMinValue =
     
    8081    test_create_property_path(RawBioAssay.class, "foo", true);
    8182    test_create_property_path(RawBioAssay.class, "name.foo", true);
    82     test_create_property_path(RawBioAssay.class, "scan.foo", true);
     83    test_create_property_path(RawBioAssay.class, "parent.foo", true);
    8384   
    8485    // Collection of entities should fail
    85     test_create_property_path(Scan.class, "rawBioAssays", true);
     86    test_create_property_path(DerivedBioAssaySet.class, "bioAssays", true);
    8687   
    8788    int designId = TestArrayDesign.test_create(Platform.GENERIC, true);
     
    9192    int labeledExtractId = TestExtract.test_create(0, "Test extract", SystemItems.getId(Extract.LABELED), labelId, true);
    9293    int hybId = TestPhysicalBioAssay.test_create(slideId, SystemItems.getId(PhysicalBioAssay.HYBRIDIZATION), true, labeledExtractId);
    93     int scanId = TestScan.test_create(hybId, 0, 0, true);
     94//    int scanId = TestScan.test_create(hybId, 0, 0, true);
     95int scanId = 0;
    9496    int rawId = TestRawBioAssay.test_create(Platform.GENERIC, "genepix", "My raw bioassay",
    9597        scanId, 0, 0, designId, 1, true);
     
    110112    TestFormula.test_delete(formulaId);
    111113    TestRawBioAssay.test_delete(rawId);
    112     TestScan.test_delete(scanId);
     114//    TestScan.test_delete(scanId);
    113115    TestPhysicalBioAssay.test_delete(hybId);
    114116    TestExtract.test_delete(labeledExtractId);
  • trunk/src/test/TestPhysicalBioAssay.java

    r5642 r5652  
    8282  }
    8383
    84   static int test_create(int arraySlideId, int subtypeId, boolean setAll, int... labeledExtractIds)
     84  static int test_create(int arraySlideId, int subtypeId, boolean setAll, int... extractIds)
    8585  {
    8686    if (!TestUtil.hasPermission(Permission.CREATE, Item.PHYSICALBIOASSAY)) return 0;
     
    105105      }
    106106      BioMaterialEvent evt = h.getCreationEvent();
    107       for (int labeledExtractId : labeledExtractIds)
    108       {
    109         Extract le = Extract.getById(dc, labeledExtractId);
     107      for (int extractId : extractIds)
     108      {
     109        Extract le = Extract.getById(dc, extractId);
    110110        evt.addSource(le, 100.0f);
    111111      }
     
    267267  }
    268268 
    269   static void test_add_labeledextract(int hybId, int labeledExtractId, int arrayNum, Float usedQuantity)
    270   {
    271     if (hybId == 0 || labeledExtractId == 0) return;
     269  static void test_add_extract(int hybId, int extractId, int arrayNum, Float usedQuantity)
     270  {
     271    if (hybId == 0 || extractId == 0) return;
    272272    DbControl dc = null;
    273273    try
     
    275275      dc = TestUtil.getDbControl();
    276276      PhysicalBioAssay h = PhysicalBioAssay.getById(dc, hybId);
    277       Extract le = Extract.getById(dc, labeledExtractId);
     277      Extract le = Extract.getById(dc, extractId);
    278278      BioMaterialEvent event = h.getCreationEvent();
    279279      event.addSource(le, usedQuantity);
    280280      event.setSourceGroup(le, arrayNum);
    281281      dc.commit();
    282       write("--Add labeled extract to hybridization OK");
    283     }
    284     catch (Throwable ex)
    285     {
    286       write("--Add labeled extract to hybridization FAILED");
     282      write("--Add extract to bioassay OK");
     283    }
     284    catch (Throwable ex)
     285    {
     286      write("--Add extract to bioassay FAILED");
    287287      ex.printStackTrace();
    288288      ok = false;
  • trunk/src/test/TestRawBioAssay.java

    r5642 r5652  
    5555   
    5656    int hybridizationId = TestPhysicalBioAssay.test_create(0, 0, false);
    57     int scanId = TestScan.test_create(hybridizationId, 0, 0, false);
     57    int bioAssaySetId = TestDerivedBioAssaySet.test_create_root("Scan", hybridizationId,
     58      SystemItems.getId(DerivedBioAssaySet.SCAN), 0, 0, 0);
     59    int bioAssayId = TestDerivedBioAssaySet.test_add_bioassay(bioAssaySetId, "Bioassay 1");
    5860    int arrayDesignId = TestArrayDesign.test_create(Platform.GENERIC, false);
    5961    int arrayDesignId2 = TestArrayDesign.test_create(Platform.GENERIC, false);
     
    7072   
    7173    // Standard tests: create, load, list
    72     int id = test_create(Platform.GENERIC, "genepix", null, scanId, softwareId, protocolId, arrayDesignId, 1, true);
     74    int id = test_create(Platform.GENERIC, "genepix", null, bioAssayId, softwareId, protocolId, arrayDesignId, 1, true);
    7375    int id2 = test_create(Platform.GENERIC, "genepix", null, 0, 0, 0, 0, 1, false);   
    7476    int id3 = test_create(Platform.AFFYMETRIX, null, null, 0, 0, 0, 0, 1, false);
     
    8991    // Test adding raw data -- stored in files
    9092    int celId = TestFile.test_create("data/test.affymetrix.cel", false, false);
    91     test_set_file(id3, "affymetrix.cel", celId);
    92     test_list_files(id3, 1);
    93     test_list_file_types(id3, 1);
     93    TestDataFileType.test_set_file(Item.RAWBIOASSAY, id3, "affymetrix.cel", celId);
     94    TestDataFileType.test_list_files(Item.RAWBIOASSAY, id3, 1);
     95    TestDataFileType.test_list_file_types(Item.RAWBIOASSAY, id3, 1);
     96    ok &= TestDataFileType.ok;   
    9497   
    9598    if (TestUtil.waitBeforeDelete()) TestUtil.waitForEnter();
     
    102105
    103106    TestFile.test_delete(celId);
    104     TestScan.test_delete(scanId);
     107    TestDerivedBioAssaySet.test_delete(bioAssaySetId);
    105108    TestPhysicalBioAssay.test_delete(hybridizationId);
    106109    TestArrayDesign.test_delete(arrayDesignId);
     
    113116  }
    114117
    115   static int test_create(String platformId, String rawDataType, String name, int scanId, int softwareId, int protocolId, int arrayDesignId, int arrayNum, boolean setAll)
     118  static int test_create(String platformId, String rawDataType, String name, int bioAssayId, int softwareId, int protocolId, int arrayDesignId, int arrayNum, boolean setAll)
    116119  {
    117120    if (!TestUtil.hasPermission(Permission.CREATE, Item.RAWBIOASSAY)) return 0;
     
    138141        rba.setProtocol(Protocol.getById(dc, protocolId));
    139142      }
    140       if (scanId != 0)
    141       {
    142         rba.setScan(Scan.getById(dc, scanId));
     143      if (bioAssayId != 0)
     144      {
     145        rba.setParent(DerivedBioAssay.getById(dc, bioAssayId));
    143146      }
    144147      if (arrayDesignId != 0)
     
    316319        "\t"+rd.getX()+"\t"+rd.getY()+"\t"+rd.getPosition()+
    317320        "\t"+rd.getReporter()+"\t"+rd.getFeature()+(writeExtended ? "\t"+rd.getAllExtended() : ""));
    318     }
    319   }
    320  
    321   static void write_item(int i, FileSetMember member)
    322     throws BaseException
    323   {
    324     if (!TestUtil.getSilent())
    325     {
    326       System.out.println(i+":\t"+member.getId()+"\t"+member.getFile().getName()+"\t"+
    327         member.getDataFileType().getName());
    328321    }
    329322  }
     
    579572    }
    580573  }
    581 
    582   static void test_set_file(int rawBioAssayId, String fileType, int fileId)
    583   {
    584     if (rawBioAssayId == 0 || fileId == 0) return;
    585     DbControl dc = null;
    586     try
    587     {
    588       dc = TestUtil.getDbControl();
    589       RawBioAssay rba = RawBioAssay.getById(dc, rawBioAssayId);
    590       DataFileType type = DataFileType.getByExternalId(dc, fileType);
    591       File file = File.getById(dc, fileId);
    592       rba.getFileSet().setMember(file, type);
    593       dc.commit();
    594       write("--Set file OK ("+fileType+")");
    595     }
    596     catch (Throwable ex)
    597     {
    598       write("--Set file FAILED ("+fileType+")");
    599       ex.printStackTrace();
    600       ok = false;
    601     }
    602     finally
    603     {
    604       if (dc != null) dc.close();
    605     }
    606   }
    607  
    608   static void test_list_files(int rawBioAssayId, int expectedResults)
    609   {
    610     if (rawBioAssayId == 0) return;
    611     DbControl dc = null;
    612     try
    613     {
    614       dc = TestUtil.getDbControl();
    615       RawBioAssay rba = RawBioAssay.getById(dc, rawBioAssayId);
    616       ItemResultList<FileSetMember> l = rba.getFileSet().getMembers().list(dc);
    617       for (int i = 0; i<l.size(); i++)
    618       {
    619         write_item(i, l.get(i));
    620       }
    621       if (expectedResults >= 0 && expectedResults != l.size())
    622       {
    623         throw new BaseException("Expected "+expectedResults+" results, not "+l.size());
    624       }
    625       write("--List files OK ("+l.size()+")");
    626     }
    627     catch (Throwable ex)
    628     {
    629       write("--List files FAILED");
    630       ex.printStackTrace();
    631       ok = false;
    632     }
    633     finally
    634     {
    635       if (dc != null) dc.close();
    636     }
    637   }
    638  
    639   static void test_list_file_types(int rawBioAssayId, int expectedResults)
    640   {
    641     if (rawBioAssayId == 0) return;
    642     DbControl dc = null;
    643     try
    644     {
    645       dc = TestUtil.getDbControl();
    646       RawBioAssay rba = RawBioAssay.getById(dc, rawBioAssayId);
    647       ItemResultList<DataFileType> l = rba.getFileSet().getMemberTypes().list(dc);
    648       for (int i = 0; i<l.size(); i++)
    649       {
    650         write_item(i, l.get(i));
    651       }
    652       if (expectedResults >= 0 && expectedResults != l.size())
    653       {
    654         throw new BaseException("Expected "+expectedResults+" results, not "+l.size());
    655       }
    656       write("--List file types OK ("+l.size()+")");
    657     }
    658     catch (Throwable ex)
    659     {
    660       write("--List file types FAILED");
    661       ex.printStackTrace();
    662       ok = false;
    663     }
    664     finally
    665     {
    666       if (dc != null) dc.close();
    667     }
    668   }
    669574 
    670575  static void test_change_arraydesign(int id, int arrayDesignId)
  • trunk/src/test/TestWebservices.java

    r5368 r5652  
    2424import net.sf.basedb.core.Config;
    2525import net.sf.basedb.core.DataFileType;
     26import net.sf.basedb.core.Item;
    2627import net.sf.basedb.core.Platform;
    2728import net.sf.basedb.core.Type;
     
    112113    TestArrayDesign.test_set_file(affyDesignId, DataFileType.AFFYMETRIX_CDF, cdfId);
    113114    int affyRaw1 = TestRawBioAssay.test_create(Platform.AFFYMETRIX, null, "Affymetrix.1", 0, 0, 0, affyDesignId, 1, false);
    114     TestRawBioAssay.test_set_file(affyRaw1, "affymetrix.cel", celId);
     115    TestDataFileType.test_set_file(Item.RAWBIOASSAY, affyRaw1, "affymetrix.cel", celId);
    115116    int affyRaw2 = TestRawBioAssay.test_create(Platform.AFFYMETRIX, null, "Affymetrix.2", 0, 0, 0, affyDesignId, 1, false);
    116     TestRawBioAssay.test_set_file(affyRaw2, "affymetrix.cel", celId);
     117    TestDataFileType.test_set_file(Item.RAWBIOASSAY, affyRaw2, "affymetrix.cel", celId);
    117118   
    118119    int affyExperimentId = TestExperiment.test_create("platform.affymetrix", true);
  • trunk/src/test/net/sf/basedb/test/roles/PowerUserTest.java

    r5650 r5652  
    134134      Unit volt = potential.getUnit("V");
    135135      AnnotationType pmtGain = createProtocolParameter(dc, "PMT gain",
    136           Type.FLOAT, volt, null, new Item[] { Item.SCAN }
     136          Type.FLOAT, volt, null, new Item[] { Item.DERIVEDBIOASSAYSET }
    137137      );
    138138     
  • trunk/src/test/net/sf/basedb/test/roles/UserTest.java

    r5649 r5652  
    3333import net.sf.basedb.core.DataFileType;
    3434import net.sf.basedb.core.DbControl;
     35import net.sf.basedb.core.DerivedBioAssaySet;
    3536import net.sf.basedb.core.Experiment;
    3637import net.sf.basedb.core.Extract;
     
    5455import net.sf.basedb.core.RawDataTypes;
    5556import net.sf.basedb.core.Sample;
    56 import net.sf.basedb.core.Scan;
    5757import net.sf.basedb.core.StringParameterType;
    5858import net.sf.basedb.core.SystemItems;
     
    169169      Sample sRef = null;
    170170     
    171       Scan sc1 = null;
    172       Scan sc2 = null;
    173       Scan sc1DyeSwap = null;
    174       Scan sc2DyeSwap = null;
    175       Scan affyScan1 = null;
    176       Scan affyScan2 = null;
    177       Scan affyScan3 = null;
     171      DerivedBioAssaySet sc1 = null;
     172      DerivedBioAssaySet sc2 = null;
     173      DerivedBioAssaySet sc1DyeSwap = null;
     174      DerivedBioAssaySet sc2DyeSwap = null;
     175      DerivedBioAssaySet affyScan1 = null;
     176      DerivedBioAssaySet affyScan2 = null;
     177      DerivedBioAssaySet affyScan3 = null;
    178178
    179179      RawBioAssay rba1 = null;
     
    278278        importHybridizations(hybridizationBatchImporter, batchImportFile_Hybridization);     
    279279        importScans(scanBatchImporter, batchImportFile_Scan);
    280         importAnnotations(annotationImporter, batchImportFile_Scan, Item.SCAN, getScanColumnHeaders(), "\\t");
     280        importAnnotations(annotationImporter, batchImportFile_Scan, Item.DERIVEDBIOASSAYSET, getScanColumnHeaders(), "\\t");
    281281        importRawBioAssays(rawBioAssayBatchImporter, batchImportFile_RawBioAssay);
    282282        bioSource = Util.findBioSource(dc, "Biosource A");
     
    459459    Create a scan.
    460460  */
    461   public static Scan createScan(DbControl dc, String name, PhysicalBioAssay hyb, Float pmtGain, Unit unit)
     461  public static DerivedBioAssaySet createScan(DbControl dc, String name, PhysicalBioAssay hyb, Float pmtGain, Unit unit)
    462462  {
    463463    TestUtil.write("--Creating scan: " + name + "\n");
    464     Scan scan = Scan.getNew(dc, hyb);
     464    DerivedBioAssaySet scan = DerivedBioAssaySet.getNew(dc, hyb);
     465    scan.setItemSubtype(ItemSubtype.getById(dc, SystemItems.getId(DerivedBioAssaySet.SCAN)));
    465466    scan.setName(name);
    466467    scan.setProtocol(Util.findProtocol(dc, "Scanning A"));
    467     scan.setScanner(Util.findHardware(dc, "Scanner A"));
     468    scan.setHardware(Util.findHardware(dc, "Scanner A"));
    468469    dc.saveItem(scan);
    469470   
    470471    if (pmtGain != null)
    471472    {
    472       AnnotationType at = Util.findAnnotationType(dc, "PMT gain", Item.SCAN);
     473      AnnotationType at = Util.findAnnotationType(dc, "PMT gain", Item.DERIVEDBIOASSAYSET);
    473474      Util.setAnnotation(scan, at, pmtGain, unit);
    474475    }
     
    481482  */
    482483  public static RawBioAssay createRawBioAssay(DbControl dc, Platform platform,
    483     RawDataType rawDataType, String name, Scan scan, ArrayDesign design)
     484    RawDataType rawDataType, String name, DerivedBioAssaySet scan, ArrayDesign design)
    484485  {
    485486    TestUtil.write("--Creating raw bioassay: " + name + "\n");
    486487    RawBioAssay rba = RawBioAssay.getNew(dc, platform, rawDataType);
    487488    rba.setName(name);
    488     rba.setScan(scan);
     489    //rba.setScan(scan);
    489490    rba.setProtocol(Util.findProtocol(dc, "Feature extraction A"));
    490491    rba.setSoftware(Util.findSoftware(dc, "Software A"));
  • trunk/src/test/net/sf/basedb/test/roles/Util.java

    r5632 r5652  
    3535import net.sf.basedb.core.BioSource;
    3636import net.sf.basedb.core.DbControl;
     37import net.sf.basedb.core.DerivedBioAssaySet;
    3738import net.sf.basedb.core.Experiment;
    3839import net.sf.basedb.core.Formula;
     
    5253import net.sf.basedb.core.Role;
    5354import net.sf.basedb.core.Sample;
    54 import net.sf.basedb.core.Scan;
    5555import net.sf.basedb.core.Software;
     56import net.sf.basedb.core.SystemItems;
    5657import net.sf.basedb.core.Tag;
    5758import net.sf.basedb.core.Unit;
     
    320321    Returns the first scan that was found with a certain name
    321322   */
    322   public static Scan findScan(DbControl dc, String name)
    323   {
    324     ItemQuery<Scan> query = Scan.getQuery();
     323  public static DerivedBioAssaySet findScan(DbControl dc, String name)
     324  {
     325    ItemQuery<DerivedBioAssaySet> query = DerivedBioAssaySet.getQuery();
     326    query.restrict(Restrictions.eq(Hql.property("itemSubtype"), Expressions.integer(SystemItems.getId(DerivedBioAssaySet.SCAN))));
    325327    query.restrict(Restrictions.eq(Hql.property("name"), Expressions.string(name)));
    326328    return query.list(dc).get(0);
  • trunk/www/include/menu.jsp

    r5642 r5652  
    466466    final boolean hasPhysicalBioAssays     = !sc.hasPermission(Permission.DENIED, Item.PHYSICALBIOASSAY);
    467467
    468     final boolean hasScans              = !sc.hasPermission(Permission.DENIED, Item.SCAN);
    469     final boolean createScans           =  sc.hasPermission(Permission.CREATE, Item.SCAN);
    470468    final boolean hasRawBioAssays       = !sc.hasPermission(Permission.DENIED, Item.RAWBIOASSAY);
    471469    final boolean createRawBioAssays    =  sc.hasPermission(Permission.CREATE, Item.RAWBIOASSAY);
     
    549547        tooltip="<%=menu.getString("physicalbioassays.tooltip", hasPhysicalBioAssays)%>"
    550548        enabled="<%=hasPhysicalBioAssays%>"
    551       />
    552       <m:menuitem
    553         title="<%=common.getString("item.scan+")%>"
    554         onclick="<%="Menu.openUrl('"+root+"views/scans/index.jsp?ID="+ID+"')"%>"
    555         tooltip="<%=menu.getString("scans.tooltip", hasScans)%>"
    556         enabled="<%=hasScans%>"
    557549      />
    558550      <m:menuitem
  • trunk/www/views/physicalbioassays/index.jsp

    r5649 r5652  
    3636  import="net.sf.basedb.core.Hardware"
    3737  import="net.sf.basedb.core.ItemSubtype"
     38  import="net.sf.basedb.core.DerivedBioAssaySet"
    3839  import="net.sf.basedb.core.ItemQuery"
    3940  import="net.sf.basedb.core.ItemResultIterator"
     
    4445  import="net.sf.basedb.core.PermissionDeniedException"
    4546  import="net.sf.basedb.core.ItemAlreadyExistsException"
    46   import="net.sf.basedb.core.Scan"
    4747  import="net.sf.basedb.core.query.Hql"
    4848  import="net.sf.basedb.core.query.Orders"
     
    7676<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
    7777<%!
    78   private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,itemSubtype,extracts,arraySlide,scans,description");
     78  private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,itemSubtype,extracts,arraySlide,description");
    7979  private static final Item itemType = Item.PHYSICALBIOASSAY;
    8080 
     
    9494    extractQuery.order(Orders.asc(Hql.property("name")));
    9595    cc.setObject("export.dataloader.&creationEvent.sourceBioMaterials(name)", new ItemQueryLoader(extractQuery, bioassayParameter));
    96    
    97     ItemQuery<Scan> scanQuery = Scan.getQuery();
    98     scanQuery.include(cc.getInclude());
    99     scanQuery.restrict(Restrictions.eq(Hql.property("hybridization"), Expressions.parameter(bioassayParameter)));
    100     scanQuery.order(Orders.asc(Hql.property("name")));
    101     cc.setObject("export.dataloader.&scans(name)", new ItemQueryLoader(scanQuery, bioassayParameter));
     96
     97    ItemQuery<DerivedBioAssaySet> dbasQuery = DerivedBioAssaySet.getQuery();
     98    dbasQuery.include(cc.getInclude());
     99    dbasQuery.restrict(Restrictions.eq(Hql.property("physicalBioAssay"), Expressions.parameter(bioassayParameter)));
     100    dbasQuery.restrict(Restrictions.eq(Hql.property("parent"), null));
     101    dbasQuery.order(Orders.asc(Hql.property("name")));
     102    cc.setObject("export.dataloader.&rootDerivedBioAssaySets(name)", new ItemQueryLoader(dbasQuery, bioassayParameter));
    102103  }
    103104%>
  • trunk/www/views/physicalbioassays/list_bioassays.jsp

    r5649 r5652  
    3131  import="net.sf.basedb.core.Extract"
    3232  import="net.sf.basedb.core.Tag"
    33   import="net.sf.basedb.core.Scan"
     33  import="net.sf.basedb.core.DerivedBioAssaySet"
    3434  import="net.sf.basedb.core.BioMaterialEvent"
    3535  import="net.sf.basedb.core.AnnotationType"
     
    106106  extractQuery.order(Orders.asc(Hql.property("name")));
    107107
    108   // Query for scans relatated to the current hybridization
    109   final ItemQuery<Scan> scanQuery = Scan.getQuery();
    110   scanQuery.include(cc.getInclude());
    111   scanQuery.restrict(Restrictions.eq(Hql.property("hybridization"), Expressions.parameter("hybridization")));
    112   scanQuery.order(Orders.asc(Hql.property("name")));
    113   final boolean createScanPermission = sc.hasPermission(Permission.CREATE, Item.SCAN); 
     108  // Query for derived bioassay sets from to the current bioassay
     109  final ItemQuery<DerivedBioAssaySet> dbasQuery = DerivedBioAssaySet.getQuery();
     110  dbasQuery.include(cc.getInclude());
     111  dbasQuery.restrict(Restrictions.eq(Hql.property("physicalBioAssay"), Expressions.parameter("bioAssay")));
     112  dbasQuery.restrict(Restrictions.eq(Hql.property("parent"), null));
     113  dbasQuery.order(Orders.asc(Hql.property("name")));
     114  final boolean createDerivedBioAssaySetPermission = sc.hasPermission(Permission.CREATE, Item.DERIVEDBIOASSAYSET); 
    114115 
    115116  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
     
    306307      />
    307308      <tbl:columndef
    308         id="scans"
    309         title="Scans"
    310         property="&scans(name)"
     309        id="derivedBioAssaySets"
     310        title="Derived bioassay sets"
     311        property="&rootDerivedBioAssaySets(name)"
    311312        datatype="string"
    312313        filterable="true"
     
    641642                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
    642643                  /></tbl:cell>
    643                 <tbl:cell column="scans">
     644                <tbl:cell column="derivedBioAssaySets">
    644645                  <%
    645                   scanQuery.setParameter("hybridization", itemId, Type.INT);
     646                  dbasQuery.setParameter("bioAssay", itemId, Type.INT);
    646647                  try
    647648                  {
    648649                    String separator = "";
    649                     for (Scan s : scanQuery.list(dc))
     650                    for (DerivedBioAssaySet dbas : dbasQuery.list(dc))
    650651                    {
    651652                      out.write(separator);
    652653                      if (mode.hasPropertyLink())
    653654                      {
    654                         out.write(Base.getLinkedName(ID, s, false, mode.hasEditLink()));
     655                        out.write(Base.getLinkedName(ID, dbas, false, mode.hasEditLink()));
    655656                      }
    656657                      else
    657658                      {
    658                         out.write(HTML.encodeTags(s.getName()));
     659                        out.write(HTML.encodeTags(dbas.getName()));
    659660                      }
    660661                      separator = ", ";
     
    670671                  <base:icon
    671672                    image="add.png"
    672                     onclick="<%="newScan("+itemId+")"%>"
    673                     tooltip="Create new scan"
    674                     visible="<%=mode.hasEditLink() && createScanPermission && usePermission %>"
     673                    onclick="<%="newDerivedBioAssaySet("+itemId+")"%>"
     674                    tooltip="Create new derived bioassay set"
     675                    visible="<%=mode.hasEditLink() && createDerivedBioAssaySetPermission && usePermission %>"
    675676                  />
    676677                </tbl:cell>
  • trunk/www/views/physicalbioassays/view_bioassay.jsp

    r5649 r5652  
    3737  import="net.sf.basedb.core.BioMaterialEvent"
    3838  import="net.sf.basedb.core.Protocol"
    39   import="net.sf.basedb.core.Scan"
     39  import="net.sf.basedb.core.DerivedBioAssaySet"
    4040  import="net.sf.basedb.core.Group"
    4141  import="net.sf.basedb.core.Hardware"
     
    221221      <tbl:button
    222222        image="add.png"
    223         onclick="newScan()"
    224         title="New scan&hellip;"
    225         tooltip="Create a new scan from this hybridization"
    226         visible="<%=sc.hasPermission(Permission.CREATE, Item.SCAN) && usePermission%>"
     223        onclick="newDerivedBioAssaySet()"
     224        title="New derived bioassay set&hellip;"
     225        tooltip="Create a new derived bioassay set from this physical bioassay"
     226        visible="<%=sc.hasPermission(Permission.CREATE, Item.DERIVEDBIOASSAYSET) && usePermission%>"
    227227      />
    228228      <tbl:button
     
    404404     
    405405      <%
    406       ItemQuery<Scan> scanQuery = (ItemQuery<Scan>)pba.getScans();
    407       scanQuery.include(Include.ALL);
    408       scanQuery.order(Orders.asc(Hql.property("name")));
    409       ItemResultList<Scan> scans = scanQuery.list(dc);
    410       if (scans.size() == 0)
    411       {
    412         %>
    413         <h4>Scans</h4>
    414         No scans has been created from this hybridization
     406      ItemQuery<DerivedBioAssaySet> dbasQuery = (ItemQuery<DerivedBioAssaySet>)pba.getRootDerivedBioAssaySets();
     407      dbasQuery.include(Include.ALL);
     408      dbasQuery.order(Orders.asc(Hql.property("name")));
     409      ItemResultList<DerivedBioAssaySet> bioAssaySets = dbasQuery.list(dc);
     410      if (bioAssaySets.size() == 0)
     411      {
     412        %>
     413        <h4>Derived bioassay sets</h4>
     414        No derived bioassay sets has been created from this bioassay
    415415        (or, you don't have permission to view them).
    416416        <%
     
    420420        %>
    421421        <base:section
    422           id="scanSection"
    423           title="<%="Scans (" + scans.size() + ")"%>"
     422          id="derivedBioAssaySetsSection"
     423          title="<%="Derived bioassay sets (" + bioAssaySets.size() + ")"%>"
    424424          context="<%=cc%>"
    425425          >
    426426          <tbl:table
    427             id="scans"
     427            id="derivedBioAssaySets"
    428428            clazz="itemlist"
    429429            columns="all"
     
    434434          />
    435435          <tbl:columndef
    436             id="scanner"
    437             title="Scanner"
     436            id="hardware"
     437            title="Hardware"
    438438          />
    439439 
     
    447447            <tbl:rows>
    448448            <%
    449             for (Scan item : scans)
     449            for (DerivedBioAssaySet item : bioAssaySets)
    450450            {
    451451              %>
     
    456456                    visible="<%=item.isRemoved()%>"
    457457                  /><%=Base.getLinkedName(ID, item, false, true)%></tbl:cell>
    458                 <tbl:cell column="scanner"><base:propertyvalue item="<%=item%>" property="scanner" /></tbl:cell>
     458                <tbl:cell column="hardware"><base:propertyvalue item="<%=item%>" property="hardware" /></tbl:cell>
    459459                <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell>
    460460              </tbl:row>
Note: See TracChangeset for help on using the changeset viewer.