* ---------------
* ***************
@@ -278,7 +278,7 @@ void addToRowMaps( Integer row, CompositeSequence designElement ) {
*
* A more typical and easy case (one microarray design used):
*
- *
+ *
*
* ----------------
* ****************
@@ -286,7 +286,7 @@ void addToRowMaps( Integer row, CompositeSequence designElement ) {
*
* If every sample was run on two different array designs:
*
- *
+ *
*
* ----------------
* ****************
@@ -294,7 +294,7 @@ void addToRowMaps( Integer row, CompositeSequence designElement ) {
*
*
* Every sample was run on a different array design:
- *
+ *
*
* -----------------------
* ******
@@ -384,7 +384,9 @@ void selectVectors( Collection extends DesignElementDataVector> vectors ) {
this.getQuantitationTypes().add( vectorQuantitationType );
} else {
if ( quantitationType != vectorQuantitationType ) {
- throw new IllegalArgumentException( "Cannot pass vectors from more than one quantitation type" );
+ throw new IllegalArgumentException( "Cannot pass vectors from more than one quantitation type: " +
+ vectorQuantitationType + " vs "
+ + quantitationType );
}
}
From 42f5a45f438fc7c1ebbf5dfa0e29e2f6d4e53870 Mon Sep 17 00:00:00 2001
From: Paul Pavlidis
Date: Fri, 4 Aug 2023 14:25:04 -0700
Subject: [PATCH 022/370] add the category to factorvalue toString
---
.../ubic/gemma/model/expression/experiment/FactorValue.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gemma-core/src/main/java/ubic/gemma/model/expression/experiment/FactorValue.java b/gemma-core/src/main/java/ubic/gemma/model/expression/experiment/FactorValue.java
index 358ba4eb19..9c5ef911a9 100644
--- a/gemma-core/src/main/java/ubic/gemma/model/expression/experiment/FactorValue.java
+++ b/gemma-core/src/main/java/ubic/gemma/model/expression/experiment/FactorValue.java
@@ -109,9 +109,10 @@ public String toString() {
buf.append( "FactorValue " ).append( this.getId() ).append( ": " );
if ( this.getExperimentalFactor() != null )
- buf.append( this.getExperimentalFactor().getName() ).append( ":" );
+ buf.append( this.getExperimentalFactor().getName() ).append( ": " );
if ( this.getCharacteristics().size() > 0 ) {
for ( Characteristic c : this.getCharacteristics() ) {
+ buf.append(c.getCategory() + " - ");
buf.append( c.getValue() );
if ( this.getCharacteristics().size() > 1 )
buf.append( " | " );
From 7b86b2ba98eb2ee00e1b5a0dd5c9e13e297199ee Mon Sep 17 00:00:00 2001
From: Paul Pavlidis
Date: Tue, 8 Aug 2023 16:12:07 -0700
Subject: [PATCH 023/370] for work on
https://github.com/PavlidisLab/Gemma/issues/705
directly support two complete triplet-like statements within the GUI
Backend support for this is not in the model - TBD
---
.../expression/geo/GeoConverterImpl.java | 1 +
.../gemma/core/ontology/OntologyService.java | 6 +
.../core/ontology/OntologyServiceImpl.java | 33 +
.../experiment/FactorValueValueObject.java | 6 +
.../gemma/core/ontology/Relation.terms.txt | 20 +
.../experiment/AnnotationController.java | 4 +
.../ExperimentalDesignControllerImpl.java | 4 +
.../src/main/webapp/WEB-INF/gemma-servlet.xml | 1 +
.../api/annotation/FactorValueEditor.js | 1498 +++++++++--------
.../scripts/api/annotation/RelationCombo.js | 72 +
.../main/webapp/scripts/api/dwrServices.js | 3 +
11 files changed, 976 insertions(+), 672 deletions(-)
create mode 100644 gemma-core/src/main/resources/ubic/gemma/core/ontology/Relation.terms.txt
create mode 100644 gemma-web/src/main/webapp/scripts/api/annotation/RelationCombo.js
diff --git a/gemma-core/src/main/java/ubic/gemma/core/loader/expression/geo/GeoConverterImpl.java b/gemma-core/src/main/java/ubic/gemma/core/loader/expression/geo/GeoConverterImpl.java
index ad9b69ecec..bd775f170f 100644
--- a/gemma-core/src/main/java/ubic/gemma/core/loader/expression/geo/GeoConverterImpl.java
+++ b/gemma-core/src/main/java/ubic/gemma/core/loader/expression/geo/GeoConverterImpl.java
@@ -910,6 +910,7 @@ private void initializeTerm2OntologyMappings() {
continue;
}
+ // NOTE: extensions via modifiers is not to be supported here, as GEO only has key-value pairs.
CharacteristicBasicValueObject c = new CharacteristicBasicValueObject( null, value, valueUri, category, categoryUri );
term2OntologyMappings.get( category ).put( inputValue, c );
}
diff --git a/gemma-core/src/main/java/ubic/gemma/core/ontology/OntologyService.java b/gemma-core/src/main/java/ubic/gemma/core/ontology/OntologyService.java
index ed9f66bb24..32c2a33db2 100644
--- a/gemma-core/src/main/java/ubic/gemma/core/ontology/OntologyService.java
+++ b/gemma-core/src/main/java/ubic/gemma/core/ontology/OntologyService.java
@@ -101,6 +101,12 @@ Collection findExperimentsCharacteristicTags( String
*/
Collection getCategoryTerms();
+ /**
+ *
+ * @return terms allowed for the predicate (relationship) in a Characteristic
+ */
+ Collection getRelationTerms();
+
/**
* Obtain the parents of a collection of terms.
* @see OntologyTerm#getParents(boolean, boolean)
diff --git a/gemma-core/src/main/java/ubic/gemma/core/ontology/OntologyServiceImpl.java b/gemma-core/src/main/java/ubic/gemma/core/ontology/OntologyServiceImpl.java
index 49afe9608d..a0bb602781 100644
--- a/gemma-core/src/main/java/ubic/gemma/core/ontology/OntologyServiceImpl.java
+++ b/gemma-core/src/main/java/ubic/gemma/core/ontology/OntologyServiceImpl.java
@@ -117,6 +117,8 @@ public class OntologyServiceImpl implements OntologyService, InitializingBean {
private Set categoryTerms = null;
+ private Set relationTerms = null;
+
@Override
public void afterPropertiesSet() throws Exception {
List enabledOntologyServices = ontologyServiceFactories.stream()
@@ -140,6 +142,7 @@ public void afterPropertiesSet() throws Exception {
// remove GeneOntologyService, it was originally not included in the list before bean injection was used
ontologyServices.remove( geneOntologyService );
initializeCategoryTerms();
+ initializeRelationTerms();
}
private void countOccurrences( Map results ) {
@@ -419,6 +422,17 @@ public Collection getCategoryTerms() {
.collect( Collectors.toSet() );
}
+
+ @Override
+ public Collection getRelationTerms() {
+ // FIXME: it's not quite like categoryTerms so this map operation is probably not needed at all, the relations don't come from any particular ontology
+ return relationTerms.stream()
+ .map( term -> {
+ return term;
+ } )
+ .collect( Collectors.toSet() );
+ }
+
@Override
public OntologyResource getResource( String uri ) {
return findFirst( ontology -> ontology.getResource( uri ) );
@@ -822,6 +836,25 @@ private void initializeCategoryTerms() throws IOException {
}
}
+
+ private void initializeRelationTerms() throws IOException {
+ Set relationTerms= new HashSet<>();
+ Resource resource = new ClassPathResource( "/ubic/gemma/core/ontology/Relation.terms.txt" );
+ try ( BufferedReader reader = new BufferedReader( new InputStreamReader( resource.getInputStream() ) ) ) {
+ String line;
+ while ( ( line = reader.readLine() ) != null ) {
+ if ( line.startsWith( "#" ) || StringUtils.isEmpty( line ) )
+ continue;
+ String[] f = StringUtils.split( line, '\t' );
+ if ( f.length < 2 ) {
+ continue;
+ }
+ relationTerms.add( new OntologyTermSimple( f[0], f[1] ) );
+ }
+ this.relationTerms = Collections.unmodifiableSet( relationTerms );
+ }
+ }
+
/**
* given a collection of characteristics add them to the correct List
*/
diff --git a/gemma-core/src/main/java/ubic/gemma/model/expression/experiment/FactorValueValueObject.java b/gemma-core/src/main/java/ubic/gemma/model/expression/experiment/FactorValueValueObject.java
index d47665c9f2..25ad9d64b6 100644
--- a/gemma-core/src/main/java/ubic/gemma/model/expression/experiment/FactorValueValueObject.java
+++ b/gemma-core/src/main/java/ubic/gemma/model/expression/experiment/FactorValueValueObject.java
@@ -42,6 +42,12 @@ public class FactorValueValueObject extends IdentifiableValueObject
private String factorValue;
private String value;
private String valueUri;
+
+ /*
+ * TODO: support objects and predicates for extension of the characteristics
+ */
+
+
/**
* It could be the id of the measurement if there is no characteristic.
*/
diff --git a/gemma-core/src/main/resources/ubic/gemma/core/ontology/Relation.terms.txt b/gemma-core/src/main/resources/ubic/gemma/core/ontology/Relation.terms.txt
new file mode 100644
index 0000000000..826ea0da32
--- /dev/null
+++ b/gemma-core/src/main/resources/ubic/gemma/core/ontology/Relation.terms.txt
@@ -0,0 +1,20 @@
+# Terms usable for relations among concepts.
+http://purl.obolibrary.org/obo/RO_0000087 has role
+http://purl.obolibrary.org/obo/RO_0001000 derives from
+http://purl.obolibrary.org/obo/RO_0000053 has characteristic
+http://purl.obolibrary.org/obo/ENVO_01003004 derives from part of
+http://purl.obolibrary.org/obo/RO_0002260 has biological role
+http://purl.obolibrary.org/obo/RO_0000086 has quality
+http://purl.obolibrary.org/obo/RO_0002573 has modifier
+http://purl.obolibrary.org/obo/RO_0016002 has disease
+http://purl.obolibrary.org/obo/RO_0002200 has phenotype
+http://purl.obolibrary.org/obo/RO_0001025 located in
+# missing:
+# has_delivered or delivered_by
+# has_timepoint
+# from_cell_line (derived from?)
+# has_genotype
+# has_dose
+# has_stage (developmental stage)
+# has_allele
+# fusion_gene
diff --git a/gemma-web/src/main/java/ubic/gemma/web/controller/expression/experiment/AnnotationController.java b/gemma-web/src/main/java/ubic/gemma/web/controller/expression/experiment/AnnotationController.java
index 8a66ffaff4..71f0eb4000 100644
--- a/gemma-web/src/main/java/ubic/gemma/web/controller/expression/experiment/AnnotationController.java
+++ b/gemma-web/src/main/java/ubic/gemma/web/controller/expression/experiment/AnnotationController.java
@@ -79,6 +79,10 @@ public Collection getCategoryTerms() {
return ontologyService.getCategoryTerms();
}
+ public Collection getRelationTerms() {
+ return ontologyService.getRelationTerms();
+ }
+
public void createBiomaterialTag( Characteristic vc, Long id ) {
BioMaterial bm = bioMaterialService.load( id );
if ( bm == null ) {
diff --git a/gemma-web/src/main/java/ubic/gemma/web/controller/expression/experiment/ExperimentalDesignControllerImpl.java b/gemma-web/src/main/java/ubic/gemma/web/controller/expression/experiment/ExperimentalDesignControllerImpl.java
index 0dc019df65..4a2402d4cd 100644
--- a/gemma-web/src/main/java/ubic/gemma/web/controller/expression/experiment/ExperimentalDesignControllerImpl.java
+++ b/gemma-web/src/main/java/ubic/gemma/web/controller/expression/experiment/ExperimentalDesignControllerImpl.java
@@ -656,6 +656,10 @@ public void updateExperimentalFactors( ExperimentalFactorValueObject[] efvos ) {
@Override
public void updateFactorValueCharacteristics( FactorValueValueObject[] fvvos ) {
+ /*
+ * TODO: support Characteristic extensions (predicate-object)
+ */
+
if ( fvvos == null || fvvos.length == 0 )
return;
diff --git a/gemma-web/src/main/webapp/WEB-INF/gemma-servlet.xml b/gemma-web/src/main/webapp/WEB-INF/gemma-servlet.xml
index 4ce09c059d..b6ad4a6f63 100644
--- a/gemma-web/src/main/webapp/WEB-INF/gemma-servlet.xml
+++ b/gemma-web/src/main/webapp/WEB-INF/gemma-servlet.xml
@@ -472,6 +472,7 @@
+
diff --git a/gemma-web/src/main/webapp/scripts/api/annotation/FactorValueEditor.js b/gemma-web/src/main/webapp/scripts/api/annotation/FactorValueEditor.js
index 9c67f88baf..49f5ca805c 100755
--- a/gemma-web/src/main/webapp/scripts/api/annotation/FactorValueEditor.js
+++ b/gemma-web/src/main/webapp/scripts/api/annotation/FactorValueEditor.js
@@ -1,695 +1,849 @@
-Ext.namespace('Gemma');
+Ext.namespace( 'Gemma' );
/**
* Forms the bottom panel of the experimental design editor.
*
* @author Luke, Paul
*/
-Gemma.FactorValueRecord = Ext.data.Record.create([{
- name: "charId"
+Gemma.FactorValueRecord = Ext.data.Record.create( [ {
+ name : "charId"
}, {
- name: "id"
+ name : "id"
}, {
- name: "category",
- type: "string"
+ name : "category",
+ type : "string"
}, {
- name: "categoryUri",
- type: "string"
+ name : "categoryUri",
+ type : "string"
}, {
- name: "value",
- type: "string"
+ name : "value",
+ type : "string"
}, {
- name: "measurement",
- type: "bool"
+ name : "valueUri",
+ type : "string"
}, {
- name: "valueUri",
- type: "string"
+ name : "measurement",
+ type : "bool"
}, {
- name: "factorValue",
- type: "string"
-}]);
-
-Gemma.FactorValueGrid = Ext.extend(Gemma.GemmaGridPanel, {
-
- loadMask: true,
-
- viewConfig: {
- forceFit: false
- },
-
- taxonId: null,
-
- disabledClass: '.x-factor-grid-disabled',
-
- record: Gemma.FactorValueRecord,
-
- /**
- * @memberOf Gemma.FactorValueGrid
- */
- categoryStyler: function (value, metadata, record, row, col, ds) {
- return Gemma.GemmaGridPanel.formatTermWithStyle(value, record.data.categoryUri);
- },
-
- valueStyler: function (value, metadata, record, row, col, ds) {
- if (value) {
- return Gemma.GemmaGridPanel.formatTermWithStyle(value, record.data.valueUri);
- } else {
- return ''
- + ((this.editable) ? 'Double-click to define the value' : '(no value)') + '';
- }
- },
-
- createNew: function () {
- var ef = this.experimentalFactor;
- var oldmsg = this.loadMask.msg;
- this.loadMask.msg = "Creating new factor value";
- this.loadMask.show();
-
- var callback = function () {
- this.loadMask.hide();
- this.loadMask.msg = oldmsg;
- this.factorValueCreated(ef);
- this.getTopToolbar().characteristicToolbar.setExperimentalFactor(ef.id);
- }.createDelegate(this);
-
- var errorHandler = function (er) {
- this.loadMask.hide();
- this.loadMask.msg = oldmsg;
- Ext.Msg.alert("Error", er);
- }.createDelegate(this);
-
- ExperimentalDesignController.createFactorValue(this.experimentalFactor, {
- callback: callback,
- errorHandler: errorHandler
- });
- },
-
- initComponent: function () {
-
- this.columns = [{
- header: "FactorValue",
- dataIndex: "id"
- }, {
- header: "Category",
- dataIndex: "category",
- renderer: this.categoryStyler,
- width: 120
- }, {
- header: "Value",
- dataIndex: "value",
- renderer: this.valueStyler
- }, {
- header: "Summary",
- dataIndex: "factorValue",
- hidden: true
- }];
-
- this.experimentalDesign = {
- id: this.edId,
- classDelegatingFor: "ExperimentalDesign"
- };
- this.experimentalFactor = {
- id: this.efId,
- classDelegatingFor: "ExperimentalFactor"
- };
-
- this.categoryCombo = new Gemma.CategoryCombo({
- lazyRender: true,
- termKey: "factorvalue"
- });
- var categoryEditor = new Ext.grid.GridEditor(this.categoryCombo);
- // when user selects a category from the combo.
- this.categoryCombo.on("select", function (combo, record, index) {
- categoryEditor.completeEdit();
- });
-
- this.valueCombo = new Gemma.CharacteristicCombo({
- lazyRender: true,
- taxonId: this.taxonId
- });
- var valueEditor = new Ext.grid.GridEditor(this.valueCombo);
- // when user selects an item from the search results.
- this.valueCombo.on("select", function (combo, record, index) {
- valueEditor.completeEdit();
- });
-
- this.store = new Ext.data.GroupingStore({
- proxy: new Ext.data.DWRProxy(ExperimentalDesignController.getFactorValuesWithCharacteristics),
- reader: new Ext.data.ListRangeReader({
- id: "charId"
- }, this.record),
- groupField: "id"
- });
-
- /*
- * The checkboxes defined here require that this.form be set: a