Class ArrayDesignFactory
java.lang.Object
ubic.gemma.core.util.test.fixture.ArrayDesignFactory
Typed factory for persistent
ArrayDesign test fixtures.
This is the Phase 3 replacement for
PersistentDummyObjectHelper.getTestPersistentArrayDesign(...).
It produces a persistent ArrayDesign with optional probes
(CompositeSequence) and optional sequences (BioSequence).
Usage:
// Empty AD, default mouse taxon, ONECOLOR
ArrayDesign ad = arrayDesignFactory.oneColor().build();
// AD with 10 probes, no biosequences
ArrayDesign ad = arrayDesignFactory.oneColor().withProbes(10).build();
// AD with 10 probes, each with a BioSequence attached (GenBank entry)
ArrayDesign ad = arrayDesignFactory.oneColor()
.withProbes(10)
.withSequences(true)
.withTaxon(humanTaxon)
.build();
// Two-color (cdna probe) variant
ArrayDesign ad = arrayDesignFactory.twoColor().withProbes(20).build();
// Affymetrix-style "GENE_CHIP" with deterministic probe naming
ArrayDesign ad = arrayDesignFactory.geneChip()
.withProbes(50)
.withRandomProbeNames(false)
.build();
Design notes (HB6-relevant):
build()persists the AD viaSecurableBaseImmutableService.create(ArrayDesign)so the ACL-creation listener fires through the production code path (mirrors how real ADs are created on ingest).- CompositeSequences are attached to
ad.getCompositeSequences()viaadd(...)(not viasetCompositeSequences(new HashSet<>(...))). The CS→AD set has cascade=all on the AD side, so CSes persist as a side effect of AD persist. - BioSequences are persisted FIRST via
BioSequenceService.findOrCreate(Collection)because the CS→biologicalCharacteristic FK has no cascade. Skipping this caused HB5→HB6 breakage; doing it explicitly is the safe pattern. - Taxa are resolved via
TaxonFactoryso they come from the seededinit-data.sqlrows (never fabricated transient). - GenBank
ExternalDatabaseis resolved fromExternalDatabaseService.findByName(String); only theDatabaseEntrythat links to it is transient.
- Author:
- Phase 3 (Vision section 3 - test-fixture rewrite)
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongeneChip()Start building a "GENE_CHIP" (Affymetrix-style) array design.oneColor()Start building a one-color (single-channel) array design.twoColor()Start building a two-color (dual-channel, cDNA) array design.Start building an array design with a caller-supplied technology type.
-
Constructor Details
-
ArrayDesignFactory
public ArrayDesignFactory()
-
-
Method Details
-
oneColor
Start building a one-color (single-channel) array design. Default flavour for most expression tests. -
twoColor
Start building a two-color (dual-channel, cDNA) array design. -
geneChip
Start building a "GENE_CHIP" (Affymetrix-style) array design. -
withTechnologyType
Start building an array design with a caller-supplied technology type. Prefer the named starters above when they fit.
-