-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for multiple cell type labelling
Makes it so that a single-cell dimension can have multiple cell type labelling. The cell type labelling is represented as a subclass of an Analysis and its protocol describe the labelling process in details. Create an experimental factor for the cell type when labels are assigned to the preferred single-cell vectors. The factor is re-created when new labels are assigned and removed when those labels are removed.
- Loading branch information
Showing
12 changed files
with
487 additions
and
118 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
gemma-core/src/main/java/ubic/gemma/model/common/description/Categories.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package ubic.gemma.model.common.description; | ||
|
||
import ubic.gemma.core.ontology.OntologyService; | ||
|
||
/** | ||
* Enumeration of commonly used categories for referring to in the code. | ||
* <p> | ||
* Entries here have corresponding declarations in {@code EFO.factor.categories.txt} and are also available via | ||
* {@link OntologyService#getCategoryTerms()} in the form of ontology terms. | ||
*/ | ||
public final class Categories { | ||
|
||
public static Category CELL_TYPE = new Category( "cell type", "http://www.ebi.ac.uk/efo/EFO_0000324" ); | ||
} |
20 changes: 20 additions & 0 deletions
20
gemma-core/src/main/java/ubic/gemma/model/common/description/Category.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package ubic.gemma.model.common.description; | ||
|
||
import lombok.Value; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
/** | ||
* Represents a category. | ||
* <p> | ||
* We intend to <a href="https://github.com/PavlidisLab/Gemma/issues/913">revamp the the characteristic hierarchy</a> | ||
* which will make categories persistent alongside {@link ubic.gemma.model.expression.experiment.Statement} and terms. | ||
* @author poirigui | ||
* @see Categories | ||
*/ | ||
@Value | ||
public class Category { | ||
String category; | ||
@Nullable | ||
String categoryUri; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
gemma-core/src/main/java/ubic/gemma/model/expression/bioAssayData/CellTypeLabelling.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package ubic.gemma.model.expression.bioAssayData; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.springframework.util.Assert; | ||
import ubic.gemma.model.analysis.Analysis; | ||
import ubic.gemma.model.common.description.Characteristic; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Represents the labelling of cell types. | ||
*/ | ||
@Getter | ||
@Setter | ||
public class CellTypeLabelling extends Analysis { | ||
|
||
/** | ||
* Indicate if this labelling is the preferred one. | ||
*/ | ||
private boolean preferred; | ||
|
||
/** | ||
* Cell types assignment to individual cells from the {@link #cellTypeLabels} collections. | ||
*/ | ||
private int[] cellTypes; | ||
|
||
/** | ||
* Cell type labels. | ||
*/ | ||
private List<Characteristic> cellTypeLabels; | ||
|
||
/** | ||
* Number of distinct cell types. | ||
* <p> | ||
* This must always be equal to number of distinct elements of {@link #cellTypeLabels}. | ||
*/ | ||
private Integer numberOfCellTypeLabels; | ||
|
||
public Characteristic getCellTypeLabel( int index ) { | ||
Assert.notNull( cellTypes, "No cell types have been assigned." ); | ||
Assert.notNull( cellTypeLabels, "No cell labels exist." ); | ||
return cellTypeLabels.get( cellTypes[index] ); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash( Arrays.hashCode( cellTypes ), cellTypeLabels ); | ||
} | ||
|
||
@Override | ||
public boolean equals( Object object ) { | ||
return super.equals( object ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.