diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/BiocompendiumAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/BiocompendiumAnnotator.java index 7fbe3d16ac7b37b5e2e32f50a28e659e933c579b..5a8ffbd5411a9ec0ccc2489fb4c41fbfb928b710 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/BiocompendiumAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/BiocompendiumAnnotator.java @@ -32,13 +32,13 @@ import lcsb.mapviewer.annotation.services.IExternalService; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.converter.model.celldesigner.annotation.RestAnnotationParser; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; import lcsb.mapviewer.model.map.AnnotatedObject; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; /** * This class is responsible for connection to Vencata annotation service. The diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotator.java index 319445dfead422c4ea67f2d351a6b89c84c88cf7..0ac86df18d49793d0dec93ab97a22c6075a35a53 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotator.java @@ -20,13 +20,13 @@ import lcsb.mapviewer.annotation.services.ExternalServiceStatusType; import lcsb.mapviewer.annotation.services.IExternalService; import lcsb.mapviewer.common.comparator.StringSetComparator; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Chemical; import lcsb.mapviewer.model.map.AnnotatedObject; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.ChemicalAlias; -import lcsb.mapviewer.model.map.species.Chemical; import lcsb.mapviewer.modelutils.map.ElementUtils; import uk.ac.ebi.chebi.webapps.chebiWS.client.ChebiWebServiceClient; import uk.ac.ebi.chebi.webapps.chebiWS.model.ChebiWebServiceFault_Exception; diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotator.java index 64717722d7bee9f2236d3b7984c114bc21f22519..af1b1e6f62277c6e265fd4d009adbaaecc4c68ac 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotator.java @@ -7,6 +7,8 @@ import org.apache.log4j.Logger; import lcsb.mapviewer.annotation.cache.CachableInterface; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Chemical; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.AnnotatedObject; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; @@ -14,8 +16,6 @@ import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.ChemicalAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.Chemical; -import lcsb.mapviewer.model.map.species.Species; /** * Interface that allows to annotate {@link AnnotatedObject elements} in the diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotator.java index ff4369192590ba4134a88c0a0831760cd944a925..e467af1db7931ca91068c72a3cb045cc2ad23dff 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotator.java @@ -20,6 +20,10 @@ import lcsb.mapviewer.annotation.services.IExternalService; import lcsb.mapviewer.annotation.services.WrongResponseCodeIOException; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; import lcsb.mapviewer.model.map.AnnotatedObject; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; @@ -28,10 +32,6 @@ import lcsb.mapviewer.model.map.layout.alias.GeneAlias; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.layout.alias.RnaAlias; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; import lcsb.mapviewer.modelutils.map.ElementUtils; /** diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotator.java index fe76c9d5d7ccb49ef7a1ca647608b00d7181e7a8..41c4c55270cc73df7788e8fc03341d464a44b356 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotator.java @@ -23,6 +23,7 @@ import lcsb.mapviewer.annotation.services.IExternalService; import lcsb.mapviewer.annotation.services.WrongResponseCodeIOException; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; import lcsb.mapviewer.model.map.AnnotatedObject; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; @@ -32,7 +33,6 @@ import lcsb.mapviewer.model.map.layout.alias.GeneAlias; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.layout.alias.RnaAlias; -import lcsb.mapviewer.model.map.species.GenericProtein; import lcsb.mapviewer.modelutils.map.ElementUtils; /** diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/GoAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/GoAnnotator.java index e232b856f09583e9eb0ac7ab97874495cb155852..5595d42818e88d7a63033222e0a0405c959a3827 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/GoAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/GoAnnotator.java @@ -21,17 +21,17 @@ import lcsb.mapviewer.annotation.services.IExternalService; import lcsb.mapviewer.annotation.services.MiriamConnector; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Phenotype; import lcsb.mapviewer.model.map.AnnotatedObject; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; import lcsb.mapviewer.model.map.layout.alias.PhenotypeAlias; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Phenotype; import lcsb.mapviewer.modelutils.map.ElementUtils; /** diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotator.java index 2e6170a9bf08c4ffd9b0cba65aa403f1214acee4..b734a9f78f237c3fad269b4d80738ae67bd22fca 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotator.java @@ -15,6 +15,10 @@ import lcsb.mapviewer.annotation.services.ExternalServiceStatusType; import lcsb.mapviewer.annotation.services.IExternalService; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; import lcsb.mapviewer.model.map.AnnotatedObject; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; @@ -24,10 +28,6 @@ import lcsb.mapviewer.model.map.layout.alias.GeneAlias; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.layout.alias.RnaAlias; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; import lcsb.mapviewer.modelutils.map.ElementUtils; /** diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotator.java index 8bc93762e70b5552fdd1f40bc3a7e91496c13140..1d70b5b048b8495909066f1f9e848d3121abda09 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotator.java @@ -17,16 +17,16 @@ import lcsb.mapviewer.annotation.services.ExternalServiceStatusType; import lcsb.mapviewer.annotation.services.IExternalService; import lcsb.mapviewer.common.EventStorageLoggerAppender; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Chemical; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.AnnotatedObject; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.ChemicalAlias; import lcsb.mapviewer.model.map.layout.alias.SimpleMoleculeAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.Chemical; -import lcsb.mapviewer.model.map.species.SimpleMolecule; -import lcsb.mapviewer.model.map.species.Species; import lcsb.mapviewer.modelutils.map.ElementUtils; /** diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotator.java index ae6cec46b141bf86f6aa2333efcf9ad04d526476..6557299e04a08bede407760f4ed763d65570a735 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotator.java @@ -17,15 +17,15 @@ import lcsb.mapviewer.annotation.services.ExternalServiceStatus; import lcsb.mapviewer.annotation.services.ExternalServiceStatusType; import lcsb.mapviewer.annotation.services.IExternalService; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; import lcsb.mapviewer.model.map.AnnotatedObject; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.GeneAlias; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.layout.alias.RnaAlias; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; import lcsb.mapviewer.modelutils.map.ElementUtils; /** diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/ImproperAnnotationsTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/ImproperAnnotationsTest.java index 099744a303b773a9ed8cdee0c7f6f3de70b9d811..dbad82e990e73cb288221cb5381136999612af5b 100644 --- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/ImproperAnnotationsTest.java +++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/ImproperAnnotationsTest.java @@ -13,10 +13,10 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; -import lcsb.mapviewer.model.map.species.GenericProtein; public class ImproperAnnotationsTest { diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/MissingAnnotationTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/MissingAnnotationTest.java index 5d3d0aa7e69b46c3f8b62924f09f8c8ec2a0b314..fe0833059105f3ac7bf74ade0657063cc55f325b 100644 --- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/MissingAnnotationTest.java +++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/MissingAnnotationTest.java @@ -7,8 +7,8 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; -import lcsb.mapviewer.model.map.species.GenericProtein; public class MissingAnnotationTest { diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/MissingRequiredAnnotationsTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/MissingRequiredAnnotationsTest.java index c6062c60c0afca74d1884e9acd24cd6fc13180dd..a743f67faf41c746895d76d2637a07b3df6e4915 100644 --- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/MissingRequiredAnnotationsTest.java +++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/MissingRequiredAnnotationsTest.java @@ -11,9 +11,9 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; -import lcsb.mapviewer.model.map.species.GenericProtein; public class MissingRequiredAnnotationsTest { diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/ModelAnnotatorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/ModelAnnotatorTest.java index eb03a329920815bb4d2ce2a0a9eabc657dc8ccee..70e37ad8b3e4bbed697083625ce21d74cf6dbe47 100644 --- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/ModelAnnotatorTest.java +++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/ModelAnnotatorTest.java @@ -29,6 +29,8 @@ import lcsb.mapviewer.annotation.services.annotators.AnnotatorException; import lcsb.mapviewer.annotation.services.annotators.ElementAnnotator; import lcsb.mapviewer.annotation.services.annotators.ReconAnnotator; import lcsb.mapviewer.common.IProgressUpdater; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; import lcsb.mapviewer.model.map.AnnotatedObject; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; @@ -42,8 +44,6 @@ import lcsb.mapviewer.model.map.model.ModelFullIndexed; import lcsb.mapviewer.model.map.model.ModelSubmodelConnection; import lcsb.mapviewer.model.map.model.SubmodelType; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Protein; import lcsb.mapviewer.persist.dao.map.ModelDao; public class ModelAnnotatorTest extends AnnotationTestFunctions { diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotatorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotatorTest.java index 5049a7a502e9c6622d48f115b7fe75f557e424a6..c395af212678cc2186e691007bddece0f1850d31 100644 --- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotatorTest.java +++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotatorTest.java @@ -25,13 +25,13 @@ import lcsb.mapviewer.annotation.cache.SourceNotAvailable; import lcsb.mapviewer.annotation.data.Chebi; import lcsb.mapviewer.annotation.services.ExternalServiceStatusType; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Chemical; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.SimpleMoleculeAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.Chemical; -import lcsb.mapviewer.model.map.species.SimpleMolecule; import uk.ac.ebi.chebi.webapps.chebiWS.client.ChebiWebServiceClient; import uk.ac.ebi.chebi.webapps.chebiWS.model.ChebiWebServiceFault_Exception; import uk.ac.ebi.chebi.webapps.chebiWS.model.DataItem; diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotatorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotatorTest.java index b355a0407fbac5af376889ab83aab697b4f425ed..1d5c8ad097fe969b12a48f66e0319519ddf48481 100644 --- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotatorTest.java +++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotatorTest.java @@ -11,12 +11,12 @@ import org.junit.Test; import lcsb.mapviewer.annotation.AnnotationTestFunctions; import lcsb.mapviewer.annotation.cache.CachableInterface; import lcsb.mapviewer.annotation.cache.SourceNotAvailable; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Ion; import lcsb.mapviewer.model.map.AnnotatedObject; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.IonAlias; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Ion; public class ElementAnnotatorTest extends AnnotationTestFunctions { diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotatorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotatorTest.java index 24dc111f73ccf1f0debd978baf15fdf60566dcdc..d46f769e80034bff5f30747eec06acc86c9e20f1 100644 --- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotatorTest.java +++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotatorTest.java @@ -24,12 +24,12 @@ import lcsb.mapviewer.annotation.cache.WebPageDownloader; import lcsb.mapviewer.annotation.services.ExternalServiceStatusType; import lcsb.mapviewer.annotation.services.WrongResponseCodeIOException; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Species; public class EnsemblAnnotatorTest extends AnnotationTestFunctions { diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotatorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotatorTest.java index 78352367bd6b6b7f93a0e7cc018f8dea93fa11b8..dde266a54c8391b551668b6744a729a30904ff6e 100644 --- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotatorTest.java +++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotatorTest.java @@ -28,11 +28,11 @@ import lcsb.mapviewer.annotation.data.EntrezData; import lcsb.mapviewer.annotation.services.ExternalServiceStatusType; import lcsb.mapviewer.annotation.services.WrongResponseCodeIOException; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.GenericProtein; public class EntrezAnnotatorTest extends AnnotationTestFunctions { diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/GoAnnotatorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/GoAnnotatorTest.java index a14942ea7ce8f15fea13b0db27a9323be2b31e7d..39572ea55bdacdc51d9f9e5f1161afac542ca565 100644 --- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/GoAnnotatorTest.java +++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/GoAnnotatorTest.java @@ -25,10 +25,10 @@ import lcsb.mapviewer.annotation.cache.WebPageDownloader; import lcsb.mapviewer.annotation.data.Go; import lcsb.mapviewer.annotation.services.ExternalServiceStatusType; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; public class GoAnnotatorTest extends AnnotationTestFunctions { diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotatorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotatorTest.java index 1739fa2d83d6db0a7cb3476fe7db4e7a530e829c..0a774fba1fd039267f18a1a103425e7db4f20512 100644 --- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotatorTest.java +++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotatorTest.java @@ -16,11 +16,11 @@ import org.springframework.beans.factory.annotation.Autowired; import lcsb.mapviewer.annotation.AnnotationTestFunctions; import lcsb.mapviewer.annotation.services.ExternalServiceStatusType; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.GenericProtein; public class HgncAnnotatorTest extends AnnotationTestFunctions { diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotatorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotatorTest.java index e4b824ea690d56a8f501860db8439bbc37514731..95ba90d632f3106c774a85267a23266327cb8cc1 100644 --- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotatorTest.java +++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotatorTest.java @@ -21,10 +21,10 @@ import lcsb.mapviewer.annotation.AnnotationTestFunctions; import lcsb.mapviewer.annotation.cache.WebPageDownloader; import lcsb.mapviewer.annotation.services.ExternalServiceStatusType; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; import lcsb.mapviewer.model.map.layout.alias.SimpleMoleculeAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.SimpleMolecule; public class ReconAnnotatorTest extends AnnotationTestFunctions { Logger logger = Logger.getLogger(ReconAnnotatorTest.class); diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotatorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotatorTest.java index 92e67a2fc7b61d92a6ae3a2c0db1dac662ae66a7..100dca76eef2a810abf5af262a891292140e57cd 100644 --- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotatorTest.java +++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotatorTest.java @@ -19,11 +19,11 @@ import lcsb.mapviewer.annotation.AnnotationTestFunctions; import lcsb.mapviewer.annotation.cache.WebPageDownloader; import lcsb.mapviewer.annotation.services.ExternalServiceStatusType; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.GenericProtein; public class UniprotAnnotatorTest extends AnnotationTestFunctions { diff --git a/console/src/main/java/lcsb/mapviewer/run/BellExport.java b/console/src/main/java/lcsb/mapviewer/run/BellExport.java index d280b3888757d33320307ae93abad8dc409a848e..603295e43eba110a46ad310ad385f9c6d944f906 100644 --- a/console/src/main/java/lcsb/mapviewer/run/BellExport.java +++ b/console/src/main/java/lcsb/mapviewer/run/BellExport.java @@ -4,8 +4,8 @@ import lcsb.mapviewer.annotation.services.ModelAnnotator; import lcsb.mapviewer.common.IProgressUpdater; import lcsb.mapviewer.converter.ConverterParams; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.model.Model; -import lcsb.mapviewer.model.map.species.Species; import lcsb.mapviewer.persist.ApplicationContextLoader; import lcsb.mapviewer.persist.DbUtils; import lcsb.mapviewer.services.interfaces.IExporterService; diff --git a/console/src/main/java/lcsb/mapviewer/run/ConsoleConverter.java b/console/src/main/java/lcsb/mapviewer/run/ConsoleConverter.java index c0b76acea080b923df1e0a95ef9bb6034c5ec4d8..9bab0dc4beedb2f563a3ef9891af8da64f7d7406 100644 --- a/console/src/main/java/lcsb/mapviewer/run/ConsoleConverter.java +++ b/console/src/main/java/lcsb/mapviewer/run/ConsoleConverter.java @@ -21,12 +21,14 @@ import lcsb.mapviewer.common.exception.InvalidStateException; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.converter.InvalidInputDataExecption; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.graphics.PolylineData; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.InconsistentModelException; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; @@ -37,8 +39,6 @@ import lcsb.mapviewer.model.map.reaction.Modifier; import lcsb.mapviewer.model.map.reaction.Product; import lcsb.mapviewer.model.map.reaction.Reactant; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Species; import lcsb.mapviewer.modelutils.map.ElementUtils; /** diff --git a/console/src/main/java/lcsb/mapviewer/run/DiabetesTest.java b/console/src/main/java/lcsb/mapviewer/run/DiabetesTest.java index 913b48991fb8bcecdcf7f4e9e858a7b938efb495..09c363daa0f10519d662300d1f01143319203087 100644 --- a/console/src/main/java/lcsb/mapviewer/run/DiabetesTest.java +++ b/console/src/main/java/lcsb/mapviewer/run/DiabetesTest.java @@ -12,11 +12,13 @@ import java.util.List; import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.graphics.PolylineData; import lcsb.mapviewer.model.map.InconsistentModelException; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; @@ -29,8 +31,6 @@ import lcsb.mapviewer.model.map.reaction.type.NegativeInfluenceReaction; import lcsb.mapviewer.model.map.reaction.type.PositiveInfluenceReaction; import lcsb.mapviewer.model.map.reaction.type.UnknownPositiveInfluenceReaction; import lcsb.mapviewer.model.map.reaction.type.UnknownTransitionReaction; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Species; import lcsb.mapviewer.persist.ApplicationContextLoader; import org.apache.log4j.Logger; diff --git a/console/src/main/java/lcsb/mapviewer/run/ReactomeComparison.java b/console/src/main/java/lcsb/mapviewer/run/ReactomeComparison.java index 74ea907a171577ae1ca7cedcd3dcca5097a91194..6d6cf330a4f0daf87fd71b127841d51f005dad4b 100644 --- a/console/src/main/java/lcsb/mapviewer/run/ReactomeComparison.java +++ b/console/src/main/java/lcsb/mapviewer/run/ReactomeComparison.java @@ -17,10 +17,10 @@ import lcsb.mapviewer.annotation.services.annotators.AnnotatorException; import lcsb.mapviewer.common.IProgressUpdater; import lcsb.mapviewer.converter.ConverterParams; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.Species; import lcsb.mapviewer.persist.ApplicationContextLoader; import lcsb.mapviewer.reactome.model.ReactomeDatabaseObject; import lcsb.mapviewer.reactome.model.ReactomeReactionlikeEvent; diff --git a/console/src/main/java/lcsb/mapviewer/run/ReactomeExport.java b/console/src/main/java/lcsb/mapviewer/run/ReactomeExport.java index 556976542d2f47a551e080ef9f2594a0c8c2b971..e68583c3ce5cad853057b8d62ca080b31d765a3d 100644 --- a/console/src/main/java/lcsb/mapviewer/run/ReactomeExport.java +++ b/console/src/main/java/lcsb/mapviewer/run/ReactomeExport.java @@ -14,8 +14,13 @@ import java.util.Set; import lcsb.mapviewer.converter.ConverterParams; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser; -import lcsb.mapviewer.model.map.Element; -import lcsb.mapviewer.model.map.agregator.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Ion; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; @@ -28,11 +33,6 @@ import lcsb.mapviewer.model.map.reaction.Product; import lcsb.mapviewer.model.map.reaction.Reactant; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.ReactionNode; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Ion; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.SimpleMolecule; -import lcsb.mapviewer.model.map.species.Species; import lcsb.mapviewer.persist.ApplicationContextLoader; import lcsb.mapviewer.reactome.model.ReactomeDatabaseObject; import lcsb.mapviewer.reactome.utils.DataSourceUpdater; diff --git a/console/src/main/java/lcsb/mapviewer/run/RunOptions.java b/console/src/main/java/lcsb/mapviewer/run/RunOptions.java index 394f4238f049abe10f27f6f7a22aa1fe6f73038f..c68686c26ede1db7658ee73f57ae41c1af2c402f 100644 --- a/console/src/main/java/lcsb/mapviewer/run/RunOptions.java +++ b/console/src/main/java/lcsb/mapviewer/run/RunOptions.java @@ -2,7 +2,7 @@ package lcsb.mapviewer.run; import java.util.List; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.modelutils.map.ElementUtils; diff --git a/console/src/main/java/lcsb/mapviewer/run/Statistics.java b/console/src/main/java/lcsb/mapviewer/run/Statistics.java index 90dbec74ede2b7aec6262b1aa251b2abd3e4ddd6..1448d17aa6723437ae973b54e486404b9812ff93 100644 --- a/console/src/main/java/lcsb/mapviewer/run/Statistics.java +++ b/console/src/main/java/lcsb/mapviewer/run/Statistics.java @@ -20,14 +20,14 @@ import lcsb.mapviewer.common.Configuration; import lcsb.mapviewer.common.IProgressUpdater; import lcsb.mapviewer.converter.ConverterParams; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Species; import lcsb.mapviewer.persist.ApplicationContextLoader; import lcsb.mapviewer.persist.DbUtils; diff --git a/console/src/main/java/lcsb/mapviewer/run/UnknownReactionInReactome.java b/console/src/main/java/lcsb/mapviewer/run/UnknownReactionInReactome.java index c0f17f66b1a0ec97cfde5ef6f8370eca9feb61ed..ba1845afc97ba03c6fb9c2f475aed4d0934f92f1 100644 --- a/console/src/main/java/lcsb/mapviewer/run/UnknownReactionInReactome.java +++ b/console/src/main/java/lcsb/mapviewer/run/UnknownReactionInReactome.java @@ -19,6 +19,7 @@ import lcsb.mapviewer.commands.CreateHierarchyCommand; import lcsb.mapviewer.converter.ConverterParams; import lcsb.mapviewer.converter.graphics.MapGenerator; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.ArtifitialCompartmentAlias; @@ -26,7 +27,6 @@ import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.ReactionNode; -import lcsb.mapviewer.model.map.species.Species; import lcsb.mapviewer.persist.ApplicationContextLoader; import lcsb.mapviewer.reactome.model.ReactomeDatabaseObject; import lcsb.mapviewer.reactome.utils.DataFormatter; diff --git a/console/src/main/java/lcsb/mapviewer/run/VibineSnippet.java b/console/src/main/java/lcsb/mapviewer/run/VibineSnippet.java index 32f4a07f0f161fd877a11d9262cfcfb16199b9b1..0d4e197c427c2e86726a4986910be8f4a3505f87 100644 --- a/console/src/main/java/lcsb/mapviewer/run/VibineSnippet.java +++ b/console/src/main/java/lcsb/mapviewer/run/VibineSnippet.java @@ -8,7 +8,7 @@ import org.apache.log4j.Logger; import lcsb.mapviewer.converter.ConverterParams; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.reaction.Reaction; diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/CellDesignerElementCollection.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/CellDesignerElementCollection.java index 2c71b7c21e75e0f8ca414a6e1508cd779b793469..186ac05c5ea567fa634a065d487cce4f978eb012 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/CellDesignerElementCollection.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/CellDesignerElementCollection.java @@ -5,11 +5,11 @@ import java.util.List; import java.util.Map; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.Element; -import lcsb.mapviewer.model.map.agregator.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.Species; import lcsb.mapviewer.modelutils.map.ElementUtils; public class CellDesignerElementCollection { @@ -44,7 +44,8 @@ public class CellDesignerElementCollection { private void addElement(Element element, String id) { if (elementById.get(id) != null) { - throw new InvalidArgumentException(eu.getElementTag(element) + "Element with given id alread exists. ID: " + id); + throw new InvalidArgumentException( + "[" + element.getClass().getSimpleName() + " " + element.getElementId() + "]\t" + "Element with given id alread exists. ID: " + id); } elementById.put(id, element); } diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/CellDesignerXmlParser.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/CellDesignerXmlParser.java index 2623c4cd0cb6e7a917b94a137dc56d6453230bb0..c672d69e483d06ac6fb954beca2bae545d3ef8d8 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/CellDesignerXmlParser.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/CellDesignerXmlParser.java @@ -33,9 +33,10 @@ import lcsb.mapviewer.converter.model.celldesigner.reaction.ReactionCollectionXm import lcsb.mapviewer.converter.model.celldesigner.reaction.UnknownReactionClassException; import lcsb.mapviewer.converter.model.celldesigner.species.InternalModelSpeciesData; import lcsb.mapviewer.converter.model.celldesigner.species.SpeciesCollectionXmlParser; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.graphics.PolylineData; import lcsb.mapviewer.model.map.InconsistentModelException; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaAlias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; @@ -51,7 +52,6 @@ import lcsb.mapviewer.model.map.layout.graphics.LayerText; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelFullIndexed; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.Species; /** * This class is a parser for CellDesigner files. There are two typical use diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/AbstractAliasXmlParser.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/AbstractAliasXmlParser.java index ee9116d5585ac28d931c3a883a3cbffaf2d8a55e..f32f4b8625063089525259fb521e3ab09b42c701 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/AbstractAliasXmlParser.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/AbstractAliasXmlParser.java @@ -8,7 +8,7 @@ import org.w3c.dom.NodeList; import lcsb.mapviewer.common.XmlParser; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.converter.model.celldesigner.CommonXmlParser; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; import lcsb.mapviewer.model.map.layout.alias.Alias; /** diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/CompartmentAliasXmlParser.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/CompartmentAliasXmlParser.java index 4768fc6e8d12561057858fa5cf42ba8b12b00887..44a1aafc9c3c1c51a4707ce17ec3064046d45692 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/CompartmentAliasXmlParser.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/CompartmentAliasXmlParser.java @@ -10,7 +10,7 @@ import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.species.SpeciesCollection; -import lcsb.mapviewer.model.map.agregator.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; import lcsb.mapviewer.model.map.layout.alias.BottomSquareCompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.LeftSquareCompartmentAlias; diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/ComplexAliasXmlParser.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/ComplexAliasXmlParser.java index d0b03bcfbcbe8257b230ca179fca54b0f7e9e83d..632558759441acec54347b6f4605f79b734c7427 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/ComplexAliasXmlParser.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/ComplexAliasXmlParser.java @@ -11,6 +11,7 @@ import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; import lcsb.mapviewer.converter.model.celldesigner.structure.View; import lcsb.mapviewer.model.map.layout.alias.ArtifitialCompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; @@ -18,7 +19,6 @@ import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelData; -import lcsb.mapviewer.model.map.species.ComplexSpecies; /** * Parser of CellDesigner xml used for parsing complex aliases. Important: Only diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/SpeciesAliasXmlParser.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/SpeciesAliasXmlParser.java index 59e38e69ef0a5e18b4cac167c2bc1131a09a2e04..4fb76150be97a5d908f0d842ed50e8531e750045 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/SpeciesAliasXmlParser.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/alias/SpeciesAliasXmlParser.java @@ -7,6 +7,8 @@ import org.w3c.dom.NodeList; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.converter.model.celldesigner.structure.View; import lcsb.mapviewer.model.map.layout.alias.ArtifitialCompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; @@ -14,8 +16,6 @@ import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelData; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Species; /** * Parser of CellDesigner xml used for parsing SpeciesAlias. diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/annotation/NoteField.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/annotation/NoteField.java index b654b06476352a6b72d0ed60f00717eae1443f0c..f64ef822ac3692f8870825011d6fdbabec599ea6 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/annotation/NoteField.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/annotation/NoteField.java @@ -1,10 +1,10 @@ package lcsb.mapviewer.converter.model.celldesigner.annotation; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.AnnotatedObject; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.Species; /** * Describes structural information that appears in the cell designer notes. diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/compartment/CompartmentCollectionXmlParser.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/compartment/CompartmentCollectionXmlParser.java index 239e2c054c4296a7965bdbe5342d97e863db19f9..eeeb3105cafabc2f43ab755bdc743b38f62ef0d2 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/compartment/CompartmentCollectionXmlParser.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/compartment/CompartmentCollectionXmlParser.java @@ -12,7 +12,7 @@ import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.common.XmlParser; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; -import lcsb.mapviewer.model.map.agregator.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; /** diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/compartment/CompartmentXmlParser.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/compartment/CompartmentXmlParser.java index ea871ffcb651ee6e433482eef8a61bd9fd7731d1..fdb5c0e3cc8ba7701923907b2de874d7c4f0b9a6 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/compartment/CompartmentXmlParser.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/compartment/CompartmentXmlParser.java @@ -9,7 +9,7 @@ import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.annotation.XmlAnnotationParser; import lcsb.mapviewer.converter.model.celldesigner.species.AbstractElementXmlParser; -import lcsb.mapviewer.model.map.agregator.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; /** diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/geometry/ProteinCellDesignerAliasConverter.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/geometry/ProteinCellDesignerAliasConverter.java index b794659117301c76035fabb55248ffd64138d304..d51a63d4444f53d61eb50ee3e4054c01f15a629d 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/geometry/ProteinCellDesignerAliasConverter.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/geometry/ProteinCellDesignerAliasConverter.java @@ -13,6 +13,11 @@ import org.apache.log4j.Logger; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.converter.model.celldesigner.geometry.helper.CellDesignerAnchor; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.IonChannelProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.ReceptorProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.TruncatedProtein; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.IonChannelProteinAlias; @@ -20,11 +25,6 @@ import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.layout.alias.ReceptorProteinAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.layout.alias.TruncatedProteinAlias; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.IonChannelProtein; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.ReceptorProtein; -import lcsb.mapviewer.model.map.species.TruncatedProtein; import lcsb.mapviewer.modelutils.map.ElementUtils; /** diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/geometry/UnknownCellDesignerAliasConverter.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/geometry/UnknownCellDesignerAliasConverter.java index 5e2c2eb7831fe971380389e0d609727c3d46a247..719c38f3b892fceb69c3e25efc0b25615d8a4327 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/geometry/UnknownCellDesignerAliasConverter.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/geometry/UnknownCellDesignerAliasConverter.java @@ -1,43 +1,43 @@ -package lcsb.mapviewer.converter.model.celldesigner.geometry; - -import java.awt.geom.PathIterator; -import java.awt.geom.Point2D; - -import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.converter.model.celldesigner.geometry.helper.CellDesignerAnchor; -import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; - -/** - * Class that provides CellDesigner specific graphical information for - * {@link lcsb.mapviewer.db.model.map.species.Unknown Unknown}. It's used for - * conversion from xml to normal x,y coordinates. - * - * @author Piotr Gawron - * - */ -public class UnknownCellDesignerAliasConverter extends AbstractCellDesignerAliasConverter<SpeciesAlias> { - @Override - public Point2D getPointCoordinates(SpeciesAlias alias, CellDesignerAnchor anchor) { - if (invalidAnchorPosition(alias, anchor)) { - return alias.getCenter(); - } - return getEllipseTransformation().getPointOnEllipseByAnchor(alias.getX(), alias.getY(), alias.getWidth(), alias.getHeight(), anchor); - } - - @Override - public PathIterator getBoundPathIterator(SpeciesAlias alias) { - throw new NotImplementedException("This class doesn't provide boundPath"); - } - - @Override - public Point2D getAnchorPointCoordinates(SpeciesAlias alias, double angle) { - if (alias.getWidth() == 0 && alias.getHeight() == 0) { - return alias.getCenter(); - } - Point2D result; - result = getEllipseTransformation().getPointOnEllipseByRadian(alias.getX(), alias.getY(), alias.getWidth(), alias.getHeight(), angle); - return result; - - } - -} +package lcsb.mapviewer.converter.model.celldesigner.geometry; + +import java.awt.geom.PathIterator; +import java.awt.geom.Point2D; + +import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.geometry.helper.CellDesignerAnchor; +import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; + +/** + * Class that provides CellDesigner specific graphical information for + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.db.model.map.species.Unknown Unknown}. It's used for + * conversion from xml to normal x,y coordinates. + * + * @author Piotr Gawron + * + */ +public class UnknownCellDesignerAliasConverter extends AbstractCellDesignerAliasConverter<SpeciesAlias> { + @Override + public Point2D getPointCoordinates(SpeciesAlias alias, CellDesignerAnchor anchor) { + if (invalidAnchorPosition(alias, anchor)) { + return alias.getCenter(); + } + return getEllipseTransformation().getPointOnEllipseByAnchor(alias.getX(), alias.getY(), alias.getWidth(), alias.getHeight(), anchor); + } + + @Override + public PathIterator getBoundPathIterator(SpeciesAlias alias) { + throw new NotImplementedException("This class doesn't provide boundPath"); + } + + @Override + public Point2D getAnchorPointCoordinates(SpeciesAlias alias, double angle) { + if (alias.getWidth() == 0 && alias.getHeight() == 0) { + return alias.getCenter(); + } + Point2D result; + result = getEllipseTransformation().getPointOnEllipseByRadian(alias.getX(), alias.getY(), alias.getWidth(), alias.getHeight(), angle); + return result; + + } + +} diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionFromXml.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionFromXml.java index 295e4813440815dc3cf76bbefdf7d7067707e4ae..3cb76024ffa9235deaef8008810539553a9840cd 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionFromXml.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionFromXml.java @@ -27,7 +27,9 @@ import lcsb.mapviewer.converter.model.celldesigner.geometry.helper.CellDesignerP import lcsb.mapviewer.converter.model.celldesigner.geometry.helper.PolylineDataFactory; import lcsb.mapviewer.converter.model.celldesigner.structure.ConnectScheme; import lcsb.mapviewer.converter.model.celldesigner.structure.EditPoints; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; import lcsb.mapviewer.converter.model.celldesigner.structure.LineProperties; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.converter.model.celldesigner.types.ModifierType; import lcsb.mapviewer.converter.model.celldesigner.types.ModifierTypeUtils; import lcsb.mapviewer.converter.model.celldesigner.types.OperatorType; @@ -36,7 +38,6 @@ import lcsb.mapviewer.model.graphics.ArrowType; import lcsb.mapviewer.model.graphics.ArrowTypeData; import lcsb.mapviewer.model.graphics.LineType; import lcsb.mapviewer.model.graphics.PolylineData; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.model.Model; @@ -62,7 +63,6 @@ import lcsb.mapviewer.model.map.reaction.type.SimpleReactionInterface; import lcsb.mapviewer.model.map.reaction.type.TruncationReaction; import lcsb.mapviewer.model.map.reaction.type.TwoProductReactionInterface; import lcsb.mapviewer.model.map.reaction.type.TwoReactantReactionInterface; -import lcsb.mapviewer.model.map.species.Species; /** * This is a part of {@link ReactionXmlParser} class functionality that allows diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionToXml.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionToXml.java index 1a41106fac98ff66e8bcba0e29c2256277e23594..629a3958b27b2ae84cb745eda3cb2df7f26fa455 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionToXml.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionToXml.java @@ -21,6 +21,7 @@ import lcsb.mapviewer.converter.model.celldesigner.geometry.CellDesignerAliasCon import lcsb.mapviewer.converter.model.celldesigner.geometry.helper.CellDesignerAnchor; import lcsb.mapviewer.converter.model.celldesigner.geometry.helper.CellDesignerLineTransformation; import lcsb.mapviewer.converter.model.celldesigner.geometry.helper.CellDesignerPointTransformation; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.converter.model.celldesigner.types.ModifierType; import lcsb.mapviewer.converter.model.celldesigner.types.ModifierTypeUtils; import lcsb.mapviewer.converter.model.celldesigner.types.OperatorType; @@ -38,7 +39,6 @@ import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.type.SimpleReactionInterface; import lcsb.mapviewer.model.map.reaction.type.TwoProductReactionInterface; import lcsb.mapviewer.model.map.reaction.type.TwoReactantReactionInterface; -import lcsb.mapviewer.model.map.species.Species; import lcsb.mapviewer.modelutils.map.ElementUtils; /** diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/AbstractElementXmlParser.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/AbstractElementXmlParser.java index b276976c9459e8f64c0c06f8b6825ad00389c30c..5dc3dea2150ad6038cf9a7bdf4ff0772e80b9684 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/AbstractElementXmlParser.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/AbstractElementXmlParser.java @@ -7,7 +7,7 @@ import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.common.XmlParser; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.converter.model.celldesigner.annotation.RestAnnotationParser; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; import lcsb.mapviewer.model.map.InconsistentModelException; import lcsb.mapviewer.model.map.layout.alias.Alias; diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/AntisenseRnaXmlParser.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/AntisenseRnaXmlParser.java index e822b78bf65b34ddba9fbbfca8cda6ba6732ed75..99878f25d4f91a1afc74b22d9e779c60885c0dff 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/AntisenseRnaXmlParser.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/AntisenseRnaXmlParser.java @@ -8,11 +8,11 @@ import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.annotation.RestAnnotationParser; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRna; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRnaRegion; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaAlias; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaRegionAlias; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaRegionAlias.AntisenseRnaRegionType; -import lcsb.mapviewer.model.map.species.AntisenseRna; -import lcsb.mapviewer.model.map.species.fields.AntisenseRnaRegion; /** * Class that performs parsing of the CellDesigner xml for AntisenseRna object. diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/GeneXmlParser.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/GeneXmlParser.java index ed3050e1f77428a42e2972aa468dfa932d9174a2..5e14f7b498d4b558e9c72bd7381182bbb3614a0b 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/GeneXmlParser.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/GeneXmlParser.java @@ -8,11 +8,11 @@ import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.annotation.RestAnnotationParser; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.ModificationResidue; import lcsb.mapviewer.model.map.layout.alias.GeneAlias; import lcsb.mapviewer.model.map.layout.alias.ModificationResidueAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; /** * Class that performs parsing of the CellDesigner xml for {@link Gene} object. diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/InternalModelSpeciesData.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/InternalModelSpeciesData.java index d56085c958453a2dd0164a9179366271133983b1..df965befb13c026fc52afb2505c5c845437ce7de 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/InternalModelSpeciesData.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/InternalModelSpeciesData.java @@ -1,214 +1,214 @@ -package lcsb.mapviewer.converter.model.celldesigner.species; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.apache.log4j.Logger; - -import lcsb.mapviewer.common.Pair; -import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.species.AntisenseRna; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Degraded; -import lcsb.mapviewer.model.map.species.Drug; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.Ion; -import lcsb.mapviewer.model.map.species.Phenotype; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; -import lcsb.mapviewer.model.map.species.SimpleMolecule; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.model.map.species.Unknown; - -/** - * This class contains information about all species in model that are relevant - * during parsing via CellDesigner parser. - * - * @author Piotr Gawron - * - */ -public class InternalModelSpeciesData { - - /** - * Default class logger. - */ - @SuppressWarnings("unused") - private final Logger logger = Logger.getLogger(InternalModelSpeciesData.class); - - /** - * Collection of proteins. Used only by the CellDesigner parser. - */ - private SpeciesCollection<Protein> proteins; - - /** - * Collection of genes. Used only by the CellDesigner parser. - */ - private SpeciesCollection<Gene> genes; - - /** - * Collection of genes. Used only by the CellDesigner parser. - */ - private SpeciesCollection<Rna> rnas; - - /** - * Collection of antisense rnas. Used only by the CellDesigner parser. - */ - private SpeciesCollection<AntisenseRna> antisenseRnas; - - /** - * Collection of phenotypes. Used only by the CellDesigner parser. - */ - private SpeciesCollection<Phenotype> phenotypes; - - /** - * Collection of ions. Used only by the CellDesigner parser. - */ - private SpeciesCollection<Ion> ions; - - /** - * Collection of simple molecules. Used only by the CellDesigner parser. - */ - private SpeciesCollection<SimpleMolecule> simpleMolecules; - - /** - * Collection of drugs. Used only by the CellDesigner parser. - */ - private SpeciesCollection<Drug> drugs; - - /** - * Collection of unknowns. Used only by the CellDesigner parser. - */ - private SpeciesCollection<Unknown> unknowns; - - /** - * Collection of degraded elements. Used only by the CellDesigner parser. - */ - private SpeciesCollection<Degraded> degradeds; - - /** - * Collection of complexes. - */ - private List<ComplexSpecies> complexes = new ArrayList<ComplexSpecies>(); - - /** - * Default constructor. - */ - public InternalModelSpeciesData() { - proteins = new SpeciesCollection<Protein>(); - genes = new SpeciesCollection<Gene>(); - rnas = new SpeciesCollection<Rna>(); - antisenseRnas = new SpeciesCollection<AntisenseRna>(); - phenotypes = new SpeciesCollection<Phenotype>(); - ions = new SpeciesCollection<Ion>(); - simpleMolecules = new SpeciesCollection<SimpleMolecule>(); - drugs = new SpeciesCollection<Drug>(); - unknowns = new SpeciesCollection<Unknown>(); - degradeds = new SpeciesCollection<Degraded>(); - } - - /** - * - * @return {@link #proteins} - */ - public Collection<Protein> getProteins() { - return proteins.getAll(); - } - - /** - * - * @return {@link #genes} - */ - public Collection<Gene> getGenes() { - return genes.getAll(); - } - - /** - * - * @return {@link #rnas} - */ - public Collection<Rna> getRnas() { - return rnas.getAll(); - } - - /** - * - * @return {@link #antisenseRnas} - */ - public Collection<AntisenseRna> getAntisenseRnas() { - return antisenseRnas.getAll(); - } - - /** - * Updates information about species in the dataset. - * - * @param collection - * set of species to be updated, first element in pair defines - * celldesigner identifier, second is the species - */ - public void updateSpecies(Collection<Pair<String, ? extends Species>> collection) { - for (Pair<String, ? extends Species> species : collection) { - updateSpecies(species.getRight(), species.getLeft()); - } - } - - /** - * Updates information about species in the dataset (identified by - * celldesigner specific identifier). - * - * @param sp - * species to be updated - * @param identifier - * celldesigner identifier - */ - public void updateSpecies(Species sp, String identifier) { - if (sp instanceof Gene) { - genes.updateSpeciesByLocalId((Gene) sp, identifier); - } else if (sp instanceof Protein) { - proteins.updateSpeciesByLocalId((Protein) sp, identifier); - } else if (sp instanceof Rna) { - rnas.updateSpeciesByLocalId((Rna) sp, identifier); - } else if (sp instanceof AntisenseRna) { - antisenseRnas.updateSpeciesByLocalId((AntisenseRna) sp, identifier); - } else if (sp instanceof Degraded) { - degradeds.updateSpeciesByLocalId((Degraded) sp, identifier); - } else if (sp instanceof Unknown) { - unknowns.updateSpeciesByLocalId((Unknown) sp, identifier); - } else if (sp instanceof Drug) { - drugs.updateSpeciesByLocalId((Drug) sp, identifier); - } else if (sp instanceof SimpleMolecule) { - simpleMolecules.updateSpeciesByLocalId((SimpleMolecule) sp, identifier); - } else if (sp instanceof Ion) { - ions.updateSpeciesByLocalId((Ion) sp, identifier); - } else if (sp instanceof Phenotype) { - phenotypes.updateSpeciesByLocalId((Phenotype) sp, identifier); - } else if (sp instanceof ComplexSpecies) { - complexes.add((ComplexSpecies) sp); - } else { - throw new InvalidArgumentException("Unknown species type: " + sp.getClass().getName()); - } - } - - /** - * Returns list of all species in dataset. - * - * @return list of all species in dataset - */ - public Collection<Species> getAll() { - List<Species> result = new ArrayList<Species>(); - - result.addAll(genes.getAll()); - result.addAll(rnas.getAll()); - result.addAll(antisenseRnas.getAll()); - result.addAll(phenotypes.getAll()); - result.addAll(ions.getAll()); - result.addAll(simpleMolecules.getAll()); - result.addAll(drugs.getAll()); - result.addAll(unknowns.getAll()); - result.addAll(degradeds.getAll()); - result.addAll(proteins.getAll()); - result.addAll(complexes); - - return result; - } -} +package lcsb.mapviewer.converter.model.celldesigner.species; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.apache.log4j.Logger; + +import lcsb.mapviewer.common.Pair; +import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRna; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Degraded; +import lcsb.mapviewer.converter.model.celldesigner.structure.Drug; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.Ion; +import lcsb.mapviewer.converter.model.celldesigner.structure.Phenotype; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; +import lcsb.mapviewer.converter.model.celldesigner.structure.Unknown; + +/** + * This class contains information about all species in model that are relevant + * during parsing via CellDesigner parser. + * + * @author Piotr Gawron + * + */ +public class InternalModelSpeciesData { + + /** + * Default class logger. + */ + @SuppressWarnings("unused") + private final Logger logger = Logger.getLogger(InternalModelSpeciesData.class); + + /** + * Collection of proteins. Used only by the CellDesigner parser. + */ + private SpeciesCollection<Protein> proteins; + + /** + * Collection of genes. Used only by the CellDesigner parser. + */ + private SpeciesCollection<Gene> genes; + + /** + * Collection of genes. Used only by the CellDesigner parser. + */ + private SpeciesCollection<Rna> rnas; + + /** + * Collection of antisense rnas. Used only by the CellDesigner parser. + */ + private SpeciesCollection<AntisenseRna> antisenseRnas; + + /** + * Collection of phenotypes. Used only by the CellDesigner parser. + */ + private SpeciesCollection<Phenotype> phenotypes; + + /** + * Collection of ions. Used only by the CellDesigner parser. + */ + private SpeciesCollection<Ion> ions; + + /** + * Collection of simple molecules. Used only by the CellDesigner parser. + */ + private SpeciesCollection<SimpleMolecule> simpleMolecules; + + /** + * Collection of drugs. Used only by the CellDesigner parser. + */ + private SpeciesCollection<Drug> drugs; + + /** + * Collection of unknowns. Used only by the CellDesigner parser. + */ + private SpeciesCollection<Unknown> unknowns; + + /** + * Collection of degraded elements. Used only by the CellDesigner parser. + */ + private SpeciesCollection<Degraded> degradeds; + + /** + * Collection of complexes. + */ + private List<ComplexSpecies> complexes = new ArrayList<ComplexSpecies>(); + + /** + * Default constructor. + */ + public InternalModelSpeciesData() { + proteins = new SpeciesCollection<Protein>(); + genes = new SpeciesCollection<Gene>(); + rnas = new SpeciesCollection<Rna>(); + antisenseRnas = new SpeciesCollection<AntisenseRna>(); + phenotypes = new SpeciesCollection<Phenotype>(); + ions = new SpeciesCollection<Ion>(); + simpleMolecules = new SpeciesCollection<SimpleMolecule>(); + drugs = new SpeciesCollection<Drug>(); + unknowns = new SpeciesCollection<Unknown>(); + degradeds = new SpeciesCollection<Degraded>(); + } + + /** + * + * @return {@link #proteins} + */ + public Collection<Protein> getProteins() { + return proteins.getAll(); + } + + /** + * + * @return {@link #genes} + */ + public Collection<Gene> getGenes() { + return genes.getAll(); + } + + /** + * + * @return {@link #rnas} + */ + public Collection<Rna> getRnas() { + return rnas.getAll(); + } + + /** + * + * @return {@link #antisenseRnas} + */ + public Collection<AntisenseRna> getAntisenseRnas() { + return antisenseRnas.getAll(); + } + + /** + * Updates information about species in the dataset. + * + * @param collection + * set of species to be updated, first element in pair defines + * celldesigner identifier, second is the species + */ + public void updateSpecies(Collection<Pair<String, ? extends Species>> collection) { + for (Pair<String, ? extends Species> species : collection) { + updateSpecies(species.getRight(), species.getLeft()); + } + } + + /** + * Updates information about species in the dataset (identified by + * celldesigner specific identifier). + * + * @param sp + * species to be updated + * @param identifier + * celldesigner identifier + */ + public void updateSpecies(Species sp, String identifier) { + if (sp instanceof Gene) { + genes.updateSpeciesByLocalId((Gene) sp, identifier); + } else if (sp instanceof Protein) { + proteins.updateSpeciesByLocalId((Protein) sp, identifier); + } else if (sp instanceof Rna) { + rnas.updateSpeciesByLocalId((Rna) sp, identifier); + } else if (sp instanceof AntisenseRna) { + antisenseRnas.updateSpeciesByLocalId((AntisenseRna) sp, identifier); + } else if (sp instanceof Degraded) { + degradeds.updateSpeciesByLocalId((Degraded) sp, identifier); + } else if (sp instanceof Unknown) { + unknowns.updateSpeciesByLocalId((Unknown) sp, identifier); + } else if (sp instanceof Drug) { + drugs.updateSpeciesByLocalId((Drug) sp, identifier); + } else if (sp instanceof SimpleMolecule) { + simpleMolecules.updateSpeciesByLocalId((SimpleMolecule) sp, identifier); + } else if (sp instanceof Ion) { + ions.updateSpeciesByLocalId((Ion) sp, identifier); + } else if (sp instanceof Phenotype) { + phenotypes.updateSpeciesByLocalId((Phenotype) sp, identifier); + } else if (sp instanceof ComplexSpecies) { + complexes.add((ComplexSpecies) sp); + } else { + throw new InvalidArgumentException("Unknown species type: " + sp.getClass().getName()); + } + } + + /** + * Returns list of all species in dataset. + * + * @return list of all species in dataset + */ + public Collection<Species> getAll() { + List<Species> result = new ArrayList<Species>(); + + result.addAll(genes.getAll()); + result.addAll(rnas.getAll()); + result.addAll(antisenseRnas.getAll()); + result.addAll(phenotypes.getAll()); + result.addAll(ions.getAll()); + result.addAll(simpleMolecules.getAll()); + result.addAll(drugs.getAll()); + result.addAll(unknowns.getAll()); + result.addAll(degradeds.getAll()); + result.addAll(proteins.getAll()); + result.addAll(complexes); + + return result; + } +} diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/ProteinMapping.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/ProteinMapping.java index 4eab52ba7c3912fec62e3ade28f30995b6551eff..4e968b7396df588d28bd622fb9b10759c4849e10 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/ProteinMapping.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/ProteinMapping.java @@ -3,16 +3,16 @@ package lcsb.mapviewer.converter.model.celldesigner.species; import org.apache.log4j.Logger; import lcsb.mapviewer.common.exception.InvalidStateException; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.IonChannelProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.ReceptorProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.TruncatedProtein; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.IonChannelProteinAlias; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.layout.alias.ReceptorProteinAlias; import lcsb.mapviewer.model.map.layout.alias.TruncatedProteinAlias; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.IonChannelProtein; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.ReceptorProtein; -import lcsb.mapviewer.model.map.species.TruncatedProtein; /** * This enum contains information about mapping between CellDesigner xml nodes diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/ProteinXmlParser.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/ProteinXmlParser.java index fc1c009314e2995351b5980dbeaccc6db02274b6..3350a306118326d06a5e8c3a762b27d0cb00e5a5 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/ProteinXmlParser.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/ProteinXmlParser.java @@ -8,10 +8,10 @@ import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; +import lcsb.mapviewer.converter.model.celldesigner.structure.ModificationResidue; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; import lcsb.mapviewer.model.map.layout.alias.ModificationResidueAlias; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; /** * Class that performs parsing of the CellDesigner xml for {@link Protein} diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/RnaXmlParser.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/RnaXmlParser.java index 94058290765a47d6ec8919fa744c6b0e70549407..ffa563d00ba05ffb2d7d9c9f383ec027563d14bc 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/RnaXmlParser.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/RnaXmlParser.java @@ -8,10 +8,10 @@ import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.annotation.RestAnnotationParser; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; +import lcsb.mapviewer.converter.model.celldesigner.structure.RnaRegion; import lcsb.mapviewer.model.map.layout.alias.RnaAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.Rna; -import lcsb.mapviewer.model.map.species.fields.RnaRegion; /** * Class that performs parsing of the CellDesigner xml for {@link Rna} object. diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesCollection.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesCollection.java index b6163eee5b89924881a6dedfe44fdf820ded9548..7594604db14c09bd353716d6bea66555f29381e4 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesCollection.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesCollection.java @@ -8,7 +8,7 @@ import java.util.Map; import org.apache.log4j.Logger; import lcsb.mapviewer.common.exception.InvalidStateException; -import lcsb.mapviewer.model.map.species.Species; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; /** * This collection performs some magic, so please try no to understand it :). It diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesCollectionXmlParser.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesCollectionXmlParser.java index 61fe98c92058b962e26a54d074ed6683ced5e701..db98bc09d95f8a30baad140567e062afbd23f3aa 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesCollectionXmlParser.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesCollectionXmlParser.java @@ -16,7 +16,13 @@ import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.annotation.RestAnnotationParser; import lcsb.mapviewer.converter.model.celldesigner.annotation.XmlAnnotationParser; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRna; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.InconsistentModelException; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaAlias; @@ -26,12 +32,6 @@ import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.layout.alias.RnaAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.model.Model; -import lcsb.mapviewer.model.map.species.AntisenseRna; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; -import lcsb.mapviewer.model.map.species.Species; /** * Class used to parse CellDesigner xml nodes containing collections of diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesMapping.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesMapping.java index 981859c2c98d496147443379fbb1d18a176fe9a1..abe71c3ce17aba3218876a7aada5b5428af06157 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesMapping.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesMapping.java @@ -1,6 +1,18 @@ package lcsb.mapviewer.converter.model.celldesigner.species; import lcsb.mapviewer.common.exception.InvalidStateException; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRna; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Degraded; +import lcsb.mapviewer.converter.model.celldesigner.structure.Drug; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.Ion; +import lcsb.mapviewer.converter.model.celldesigner.structure.Phenotype; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; +import lcsb.mapviewer.converter.model.celldesigner.structure.Unknown; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaAlias; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; @@ -13,18 +25,6 @@ import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.layout.alias.RnaAlias; import lcsb.mapviewer.model.map.layout.alias.SimpleMoleculeAlias; import lcsb.mapviewer.model.map.layout.alias.UnknownAlias; -import lcsb.mapviewer.model.map.species.AntisenseRna; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Degraded; -import lcsb.mapviewer.model.map.species.Drug; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.Ion; -import lcsb.mapviewer.model.map.species.Phenotype; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; -import lcsb.mapviewer.model.map.species.SimpleMolecule; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.model.map.species.Unknown; /** * This enum contains information about mapping between CellDesigner xml nodes diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesSbmlParser.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesSbmlParser.java index eebd2c75ab2da87c657e76bc4194ecb75b6b3681..38d6af5ff6d80c4c1cea9f45362694a9500177d1 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesSbmlParser.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesSbmlParser.java @@ -11,28 +11,28 @@ import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.annotation.RestAnnotationParser; import lcsb.mapviewer.converter.model.celldesigner.annotation.XmlAnnotationParser; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRna; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRnaRegion; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.ModificationResidue; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; +import lcsb.mapviewer.converter.model.celldesigner.structure.RnaRegion; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.converter.model.celldesigner.structure.SpeciesState; import lcsb.mapviewer.model.map.InconsistentModelException; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaAlias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.GeneAlias; +import lcsb.mapviewer.model.map.layout.alias.ModificationState; +import lcsb.mapviewer.model.map.layout.alias.PositionToCompartment; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.layout.alias.RnaAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.model.Model; -import lcsb.mapviewer.model.map.species.AntisenseRna; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; -import lcsb.mapviewer.model.map.species.SimpleMolecule; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.model.map.species.fields.AntisenseRnaRegion; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; -import lcsb.mapviewer.model.map.species.fields.ModificationState; -import lcsb.mapviewer.model.map.species.fields.PositionToCompartment; -import lcsb.mapviewer.model.map.species.fields.RnaRegion; /** * Parser for sbml part of CellDesigner format. It's used for retrieving Species diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/AntisenseRna.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/AntisenseRna.java similarity index 93% rename from model/src/main/java/lcsb/mapviewer/model/map/species/AntisenseRna.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/AntisenseRna.java index 24861717484253dcfb2158033116011fbbb49c38..dbe7dc37c591b33bb17686a7c8a3922019b623bf 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/AntisenseRna.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/AntisenseRna.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.util.ArrayList; import java.util.List; @@ -15,7 +15,6 @@ import org.hibernate.annotations.LazyCollectionOption; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaAlias; -import lcsb.mapviewer.model.map.species.fields.AntisenseRnaRegion; /** * Class representing antisense rna in the model. diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/AntisenseRnaComparator.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/AntisenseRnaComparator.java similarity index 91% rename from model/src/main/java/lcsb/mapviewer/model/map/species/AntisenseRnaComparator.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/AntisenseRnaComparator.java index 0f0b0e3188ff437d5e0f24dc32d341678328efc5..2bb9ff7cb0779217acc9408bef49ef8de9e884cd 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/AntisenseRnaComparator.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/AntisenseRnaComparator.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.util.Comparator; import java.util.HashSet; @@ -7,7 +7,6 @@ import java.util.Set; import lcsb.mapviewer.common.Configuration; import lcsb.mapviewer.common.comparator.StringSetComparator; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.fields.AntisenseRnaRegion; /** * This class implements comparator interface for AntisenseRna. diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/fields/AntisenseRnaRegion.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/AntisenseRnaRegion.java similarity index 92% rename from model/src/main/java/lcsb/mapviewer/model/map/species/fields/AntisenseRnaRegion.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/AntisenseRnaRegion.java index 0fa6e0fa5802f0545e6518305554f87279c7d7fc..8966d674256e615fcee50c189a6f96326bf291b4 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/fields/AntisenseRnaRegion.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/AntisenseRnaRegion.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species.fields; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.io.Serializable; @@ -19,13 +19,13 @@ import org.hibernate.annotations.CascadeType; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaRegionAlias; +import lcsb.mapviewer.model.map.layout.alias.ModificationState; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaRegionAlias.AntisenseRnaRegionType; -import lcsb.mapviewer.model.map.species.Species; /** * This structure contains information about antisense rna region (rna fragment * of interest) for a specific - * {@link lcsb.mapviewer.model.map.species.AntisenseRna AntisenseRna}. + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRna AntisenseRna}. * * @author Piotr Gawron * diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/Chemical.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Chemical.java similarity index 92% rename from model/src/main/java/lcsb/mapviewer/model/map/species/Chemical.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Chemical.java index 7de4104415913c9a9665fc6650fc52068b240e2d..b99380b8bef881dc8fde50828aaa0b2837f70f10 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/Chemical.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Chemical.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import javax.persistence.Column; import javax.persistence.DiscriminatorValue; diff --git a/model/src/main/java/lcsb/mapviewer/model/map/agregator/Compartment.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Compartment.java similarity index 93% rename from model/src/main/java/lcsb/mapviewer/model/map/agregator/Compartment.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Compartment.java index a60649bd67db6097cdc5fa8090cba67bc15554f5..0396a2a81f7536461b90107785a28669b68b4a3a 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/agregator/Compartment.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Compartment.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.agregator; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.util.HashSet; import java.util.Set; @@ -11,7 +11,6 @@ import javax.persistence.OneToMany; import org.apache.log4j.Logger; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; /** diff --git a/model/src/main/java/lcsb/mapviewer/model/map/agregator/CompartmentComparator.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/CompartmentComparator.java similarity index 92% rename from model/src/main/java/lcsb/mapviewer/model/map/agregator/CompartmentComparator.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/CompartmentComparator.java index 7b9fa190fd5035e4c2e43bf2421f667b132c9c18..00344697734b645a23dd0bf3f95613772f302449 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/agregator/CompartmentComparator.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/CompartmentComparator.java @@ -1,90 +1,89 @@ -package lcsb.mapviewer.model.map.agregator; - -import java.util.Comparator; - -import lcsb.mapviewer.common.Configuration; -import lcsb.mapviewer.common.exception.InvalidClassException; -import lcsb.mapviewer.model.map.ElementComparator; - -/** - * This class implements comparator interface for Compartment. - * - * @author Piotr Gawron - * - * @see Compartment - * - */ -public class CompartmentComparator implements Comparator<Compartment> { - - /** - * Epsilon value used for comparison of doubles. - */ - private double epsilon; - - /** - * Constructor that requires {@link #epsilon} parameter. - * - * @param epsilon - * {@link #epsilon} - */ - public CompartmentComparator(double epsilon) { - this.epsilon = epsilon; - } - - /** - * Default constructor. - */ - public CompartmentComparator() { - this(Configuration.EPSILON); - } - - @Override - public int compare(Compartment arg0, Compartment arg1) { - if (arg0 == null) { - if (arg1 == null) { - return 0; - } else { - return 1; - } - } else if (arg1 == null) { - return -1; - } - - if (arg0.getClass().equals(arg1.getClass())) { - if (arg0.getClass().equals(Compartment.class)) { - return internalCompare(arg0, arg1); - } else { - throw new InvalidClassException("Don't know how to compare classes: " + arg0.getClass()); - } - } else { - return -1; - } - } - - /** - * This method compares only the fields that are defined in Compartment class - * in inheritence tree. By the design it calls also comparator of the upper - * (Element) class. - * - * @param arg0 - * first object to compare - * @param arg1 - * second object to compare - * @return if all fields are qual then returns 0. If they are different then - * -1/1 is returned. - */ - private int internalCompare(Compartment arg0, Compartment arg1) { - ElementComparator elementComparator = new ElementComparator(epsilon); - - int result = elementComparator.internalCompare(arg0, arg1); - if (result != 0) { - return result; - } - - if (!arg0.getElementId().equals(arg1.getElementId())) { - return arg0.getElementId().compareTo(arg1.getElementId()); - } - return 0; - } - -} +package lcsb.mapviewer.converter.model.celldesigner.structure; + +import java.util.Comparator; + +import lcsb.mapviewer.common.Configuration; +import lcsb.mapviewer.common.exception.InvalidClassException; + +/** + * This class implements comparator interface for Compartment. + * + * @author Piotr Gawron + * + * @see Compartment + * + */ +public class CompartmentComparator implements Comparator<Compartment> { + + /** + * Epsilon value used for comparison of doubles. + */ + private double epsilon; + + /** + * Constructor that requires {@link #epsilon} parameter. + * + * @param epsilon + * {@link #epsilon} + */ + public CompartmentComparator(double epsilon) { + this.epsilon = epsilon; + } + + /** + * Default constructor. + */ + public CompartmentComparator() { + this(Configuration.EPSILON); + } + + @Override + public int compare(Compartment arg0, Compartment arg1) { + if (arg0 == null) { + if (arg1 == null) { + return 0; + } else { + return 1; + } + } else if (arg1 == null) { + return -1; + } + + if (arg0.getClass().equals(arg1.getClass())) { + if (arg0.getClass().equals(Compartment.class)) { + return internalCompare(arg0, arg1); + } else { + throw new InvalidClassException("Don't know how to compare classes: " + arg0.getClass()); + } + } else { + return -1; + } + } + + /** + * This method compares only the fields that are defined in Compartment class + * in inheritence tree. By the design it calls also comparator of the upper + * (Element) class. + * + * @param arg0 + * first object to compare + * @param arg1 + * second object to compare + * @return if all fields are qual then returns 0. If they are different then + * -1/1 is returned. + */ + private int internalCompare(Compartment arg0, Compartment arg1) { + ElementComparator elementComparator = new ElementComparator(epsilon); + + int result = elementComparator.internalCompare(arg0, arg1); + if (result != 0) { + return result; + } + + if (!arg0.getElementId().equals(arg1.getElementId())) { + return arg0.getElementId().compareTo(arg1.getElementId()); + } + return 0; + } + +} diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/ComplexSpecies.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/ComplexSpecies.java similarity index 94% rename from model/src/main/java/lcsb/mapviewer/model/map/species/ComplexSpecies.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/ComplexSpecies.java index db9107d2aa05d3bf125a9a94fe134a72608885ce..35cceece6a96aa2bc57be017bcf74518f93643e4 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/ComplexSpecies.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/ComplexSpecies.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.util.HashSet; import java.util.Set; @@ -12,7 +12,6 @@ import org.apache.log4j.Logger; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; /** diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/ComplexSpeciesComparator.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/ComplexSpeciesComparator.java similarity index 93% rename from model/src/main/java/lcsb/mapviewer/model/map/species/ComplexSpeciesComparator.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/ComplexSpeciesComparator.java index 70c072161e1e5ccfb21874d7c274caeda6d0169f..c8e398769aa29815e7c71e9813c13bf36b7ce484 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/ComplexSpeciesComparator.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/ComplexSpeciesComparator.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.util.Comparator; @@ -8,9 +8,6 @@ import lcsb.mapviewer.common.Configuration; import lcsb.mapviewer.common.comparator.IntegerComparator; import lcsb.mapviewer.common.comparator.StringComparator; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.Element; -import lcsb.mapviewer.model.map.ElementComparator; -import lcsb.mapviewer.model.map.agregator.Compartment; /** * This class implements comparator interface for ComplexSpecies. diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/Degraded.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Degraded.java similarity index 90% rename from model/src/main/java/lcsb/mapviewer/model/map/species/Degraded.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Degraded.java index 6d4f86d5fbea0dde83db74484c8c4426b9dd87e1..3f4935ffb20becae46bbc2066f59aaccdede2e69 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/Degraded.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Degraded.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/DegradedComparator.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/DegradedComparator.java similarity index 92% rename from model/src/main/java/lcsb/mapviewer/model/map/species/DegradedComparator.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/DegradedComparator.java index 341a95a1d657e607bfd40925ce8c5cd09c3b6dcf..c59ba6e2b4372e4018fb69794bd9f780546b67f6 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/DegradedComparator.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/DegradedComparator.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.util.Comparator; diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/Drug.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Drug.java similarity index 90% rename from model/src/main/java/lcsb/mapviewer/model/map/species/Drug.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Drug.java index b44732d67197f76a14a506792847a957c5847fee..977bca234dffb0b1abd82ed713ac1ccee050e48e 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/Drug.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Drug.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/DrugComparator.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/DrugComparator.java similarity index 92% rename from model/src/main/java/lcsb/mapviewer/model/map/species/DrugComparator.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/DrugComparator.java index 722268f52652522a90a894318d7b41fad1215bfb..46522e97af5565eace4eed3f935272218c6c0aa1 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/DrugComparator.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/DrugComparator.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.util.Comparator; diff --git a/model/src/main/java/lcsb/mapviewer/model/map/Element.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Element.java similarity index 98% rename from model/src/main/java/lcsb/mapviewer/model/map/Element.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Element.java index 8279738bce095f43747967092e6f82acaf3ba92a..40e2c6bd2b5b14f7dac62db664d37f4972ac6e14 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/Element.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Element.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.io.Serializable; import java.util.ArrayList; @@ -32,12 +32,11 @@ import org.hibernate.annotations.Cascade; import org.hibernate.annotations.IndexColumn; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.agregator.Compartment; +import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelData; -import lcsb.mapviewer.model.map.species.ComplexSpecies; /** * Generic element of the map. It is a root object in inheritence three for diff --git a/model/src/main/java/lcsb/mapviewer/model/map/ElementComparator.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/ElementComparator.java similarity index 92% rename from model/src/main/java/lcsb/mapviewer/model/map/ElementComparator.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/ElementComparator.java index ee7fb16e3d92f9919c796b5133202bf9ab7af2f4..9e573a0ab84c16f0e4f6ea66a7c69b756e305901 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/ElementComparator.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/ElementComparator.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.util.Comparator; import java.util.HashSet; @@ -9,10 +9,7 @@ import lcsb.mapviewer.common.comparator.StringComparator; import lcsb.mapviewer.common.comparator.StringListComparator; import lcsb.mapviewer.common.comparator.StringSetComparator; import lcsb.mapviewer.common.exception.InvalidClassException; -import lcsb.mapviewer.model.map.agregator.Compartment; -import lcsb.mapviewer.model.map.agregator.CompartmentComparator; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.model.map.species.SpeciesComparator; +import lcsb.mapviewer.model.map.MiriamData; import org.apache.log4j.Logger; diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/Gene.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Gene.java similarity index 92% rename from model/src/main/java/lcsb/mapviewer/model/map/species/Gene.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Gene.java index 3056fdea1281b70394e1d4f8bddf6af633e0f545..bd9660cdbb6f772bf5628ff4efe0e34312971710 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/Gene.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Gene.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.util.ArrayList; import java.util.List; @@ -14,7 +14,6 @@ import org.hibernate.annotations.LazyCollectionOption; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.model.map.layout.alias.GeneAlias; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; /** * Class representing gene in the model. diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/GeneComparator.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/GeneComparator.java similarity index 91% rename from model/src/main/java/lcsb/mapviewer/model/map/species/GeneComparator.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/GeneComparator.java index 2522cbdcd64ffde4efae36fe62c48da00825ceb8..9f5ea4b31c1fb4d724adfdac438834239d125b60 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/GeneComparator.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/GeneComparator.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.util.Comparator; import java.util.HashSet; @@ -7,7 +7,6 @@ import java.util.Set; import lcsb.mapviewer.common.Configuration; import lcsb.mapviewer.common.comparator.StringSetComparator; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; /** * This class implements comparator interface for Gene. diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/GenericProtein.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/GenericProtein.java similarity index 90% rename from model/src/main/java/lcsb/mapviewer/model/map/species/GenericProtein.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/GenericProtein.java index 1d757016c59904f1726a07824a43280936405411..7161bcfe86e182ebbd7518a3353f7898173581c7 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/GenericProtein.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/GenericProtein.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/Ion.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Ion.java similarity index 90% rename from model/src/main/java/lcsb/mapviewer/model/map/species/Ion.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Ion.java index 4132566ff4136219c43feb141c06325d5586864e..13198e509dd76d72f50f274c7744423e3bff5d07 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/Ion.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Ion.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/IonChannelProtein.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/IonChannelProtein.java similarity index 90% rename from model/src/main/java/lcsb/mapviewer/model/map/species/IonChannelProtein.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/IonChannelProtein.java index 62cc3a6ea5944de7d7e2c09e506dd00d6acb40bc..c0189b97eb366ba4f7a41217b4fe7b21ed4ad97f 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/IonChannelProtein.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/IonChannelProtein.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/IonComparator.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/IonComparator.java similarity index 92% rename from model/src/main/java/lcsb/mapviewer/model/map/species/IonComparator.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/IonComparator.java index 8c35ad4a35f9ce387f77ca110b698cfb067b0c47..352ad337ba9820ea25739092a7c586e7562556ce 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/IonComparator.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/IonComparator.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.util.Comparator; diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/fields/ModificationResidue.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/ModificationResidue.java similarity index 93% rename from model/src/main/java/lcsb/mapviewer/model/map/species/fields/ModificationResidue.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/ModificationResidue.java index 0470ff62b76d01b197d715edfdea1a9c3c69d39d..37e568326991dd797b8a65194afb28cd99aa54ee 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/fields/ModificationResidue.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/ModificationResidue.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species.fields; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.io.Serializable; @@ -17,7 +17,7 @@ import org.apache.log4j.Logger; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.model.map.layout.alias.ModificationResidueAlias; -import lcsb.mapviewer.model.map.species.Species; +import lcsb.mapviewer.model.map.layout.alias.ModificationState; /** * This class represent modification residue in protein and gene. However, it is diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Phenotype.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Phenotype.java new file mode 100644 index 0000000000000000000000000000000000000000..b43dac692f171ffae67dd07b46658351f2d482c1 --- /dev/null +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Phenotype.java @@ -0,0 +1,62 @@ +package lcsb.mapviewer.converter.model.celldesigner.structure; + +import javax.persistence.DiscriminatorValue; +import javax.persistence.Entity; + +import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.model.map.layout.alias.PhenotypeAlias; + +/** + * Class representing phenotype in the model. + * + * @author Piotr Gawron + * + */ +@Entity +@DiscriminatorValue("Phenotype") +public class Phenotype extends Species<PhenotypeAlias> { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Constructor that initializes phenotype with the data passed in the + * argument. + * + * @param species + * original species used for data initialization + */ + public Phenotype(Species species) { + super(species); + } + + /** + * Default constructor. + */ + public Phenotype() { + } + + @Override + public Phenotype copy() { + if (this.getClass() == Phenotype.class) { + return new Phenotype(this); + } else { + throw new NotImplementedException("Method copy() should be overriden in class " + this.getClass()); + } + } + + @Override + public String getStringType() { + return "Phenotype"; + } + + @Override + public PhenotypeAlias createAlias(String aliasId) { + PhenotypeAlias result = new PhenotypeAlias(aliasId); + super.setAliasFields(result); + return result; + } + +} diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/PhenotypeComparator.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/PhenotypeComparator.java similarity index 62% rename from model/src/main/java/lcsb/mapviewer/model/map/species/PhenotypeComparator.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/PhenotypeComparator.java index 39318fab7366efa7495de6411547df3134934887..b0a691dc86c0366266bba7cc8e7100ab527dffaa 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/PhenotypeComparator.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/PhenotypeComparator.java @@ -1,13 +1,11 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.util.Comparator; import org.apache.log4j.Logger; import lcsb.mapviewer.common.Configuration; -import lcsb.mapviewer.common.comparator.IntegerComparator; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.fields.AssociatedElementComparator; /** * This class implements comparator interface for Phenotype. @@ -86,20 +84,6 @@ public class PhenotypeComparator implements Comparator<Phenotype> { return result; } - IntegerComparator integerComparator = new IntegerComparator(); - - if (integerComparator.compare(arg0.getAssociatedElements().size(), arg1.getAssociatedElements().size()) != 0) { - logger.debug("number of associated elements different: " + arg0.getAssociatedElements().size() + ", " + arg1.getAssociatedElements().size()); - return integerComparator.compare(arg0.getAssociatedElements().size(), arg1.getAssociatedElements().size()); - } - - AssociatedElementComparator associatedElementComparator = new AssociatedElementComparator(); - for (int i = 0; i < arg0.getAssociatedElements().size(); i++) { - if (associatedElementComparator.compare(arg0.getAssociatedElements().get(i), arg1.getAssociatedElements().get(i)) != 0) { - logger.debug("Associated elements different"); - return associatedElementComparator.compare(arg0.getAssociatedElements().get(i), arg1.getAssociatedElements().get(i)); - } - } return 0; } diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/Protein.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Protein.java similarity index 94% rename from model/src/main/java/lcsb/mapviewer/model/map/species/Protein.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Protein.java index f53a79e3e720bf92ec4b84d0fcba473ef79bea0e..4bfa7ab8d494b7a8f04041d7e3fe49a27ee75f8d 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/Protein.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Protein.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.util.ArrayList; import java.util.List; @@ -17,7 +17,6 @@ import org.hibernate.annotations.LazyCollectionOption; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.model.map.layout.alias.ModificationResidueAlias; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; /** * Class representing protein in the model. diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/ProteinComparator.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/ProteinComparator.java similarity index 93% rename from model/src/main/java/lcsb/mapviewer/model/map/species/ProteinComparator.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/ProteinComparator.java index a102f6b7aaf38041b9de80cb8a3fd43c61f38d79..0c3f33d7f07af42f689e1e7a3848920f1b183659 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/ProteinComparator.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/ProteinComparator.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.util.Comparator; import java.util.HashSet; @@ -10,7 +10,6 @@ import lcsb.mapviewer.common.Configuration; import lcsb.mapviewer.common.comparator.IntegerComparator; import lcsb.mapviewer.common.comparator.StringComparator; import lcsb.mapviewer.common.comparator.StringSetComparator; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; /** * This class implements comparator interface for Protein. diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/ReceptorProtein.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/ReceptorProtein.java similarity index 90% rename from model/src/main/java/lcsb/mapviewer/model/map/species/ReceptorProtein.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/ReceptorProtein.java index 22b69af23c7e051bedc321bea0839d75b974acb8..82a4e23eb421ca6a8b6628fa884d6b62c476ae6c 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/ReceptorProtein.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/ReceptorProtein.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/Rna.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Rna.java similarity index 93% rename from model/src/main/java/lcsb/mapviewer/model/map/species/Rna.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Rna.java index 7f879606cb0aedd5244e1e53089bf42272ec7fc4..e0bdfba4dd42e658c69d955803d78867ebba1bf7 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/Rna.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Rna.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.util.ArrayList; import java.util.List; @@ -15,7 +15,6 @@ import org.hibernate.annotations.LazyCollectionOption; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.model.map.layout.alias.RnaAlias; -import lcsb.mapviewer.model.map.species.fields.RnaRegion; /** * Class representing rna in the model. diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/RnaComparator.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/RnaComparator.java similarity index 92% rename from model/src/main/java/lcsb/mapviewer/model/map/species/RnaComparator.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/RnaComparator.java index c1273dada267f860ff1dd426fc48f8ec04d97ef8..d1982ef41333c8255b859b05365c440eb87da580 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/RnaComparator.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/RnaComparator.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.util.Comparator; import java.util.HashSet; @@ -7,7 +7,6 @@ import java.util.Set; import lcsb.mapviewer.common.Configuration; import lcsb.mapviewer.common.comparator.StringSetComparator; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.fields.RnaRegion; /** * This class implements comparator interface for Rna. diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/fields/RnaRegion.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/RnaRegion.java similarity index 91% rename from model/src/main/java/lcsb/mapviewer/model/map/species/fields/RnaRegion.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/RnaRegion.java index dc681880cb11801295e45342c10f17df37c3d0a8..128dcfe834ca73f347f4d46bc67d1b885998a937 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/fields/RnaRegion.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/RnaRegion.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species.fields; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.io.Serializable; @@ -15,12 +15,12 @@ import javax.persistence.Table; import org.apache.log4j.Logger; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.model.map.layout.alias.ModificationState; import lcsb.mapviewer.model.map.layout.alias.RnaRegionAlias; -import lcsb.mapviewer.model.map.species.Species; /** * This structure contains information about rna region (rna fragment of - * interest) for a specific {@link lcsb.mapviewer.model.map.species.Rna Rna}. + * interest) for a specific {@link lcsb.mapviewer.converter.model.celldesigner.structure.Rna Rna}. * * @author Piotr Gawron * diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/SimpleMolecule.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/SimpleMolecule.java similarity index 91% rename from model/src/main/java/lcsb/mapviewer/model/map/species/SimpleMolecule.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/SimpleMolecule.java index d99677feb8e6c5ecd0395b3f814e669c888a49d0..64ca650675f8b6c0a88891a7ce396a2de8d41c2d 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/SimpleMolecule.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/SimpleMolecule.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/SimpleMoleculeComparator.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/SimpleMoleculeComparator.java similarity index 94% rename from model/src/main/java/lcsb/mapviewer/model/map/species/SimpleMoleculeComparator.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/SimpleMoleculeComparator.java index 24d954c4a36c2e3c76b52ba15aa00ec95354d892..bb24f976d690cc90592f4cc4fdbc185f41debf43 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/SimpleMoleculeComparator.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/SimpleMoleculeComparator.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.util.Comparator; diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/Species.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Species.java similarity index 94% rename from model/src/main/java/lcsb/mapviewer/model/map/species/Species.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Species.java index 1cb2b2f556bca381179efd5c715df9ab9b72253f..4a79d01566a3bc0476be5c786e3618fae533dcf7 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/Species.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Species.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; @@ -9,10 +9,9 @@ import org.apache.log4j.Logger; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.MiriamData; +import lcsb.mapviewer.model.map.layout.alias.PositionToCompartment; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.fields.PositionToCompartment; /** * Generic species of the map. diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/SpeciesComparator.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesComparator.java similarity index 96% rename from model/src/main/java/lcsb/mapviewer/model/map/species/SpeciesComparator.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesComparator.java index b07ba68a12ea894fbe038c85001e428c465192ec..486f9d688119d84f894e32e734bb791098dc29a8 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/SpeciesComparator.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesComparator.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.util.Comparator; @@ -9,7 +9,6 @@ import lcsb.mapviewer.common.comparator.BooleanComparator; import lcsb.mapviewer.common.comparator.IntegerComparator; import lcsb.mapviewer.common.comparator.StringComparator; import lcsb.mapviewer.common.exception.InvalidClassException; -import lcsb.mapviewer.model.map.ElementComparator; /** * This class implements comparator interface for Species. It calls comparator diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesState.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesState.java index dffaf038f6d6194719c3e5aec3f7db8b0f69ac9f..41f82d6aa09268af3c5cbe537c343ddb9a3d723e 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesState.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesState.java @@ -13,13 +13,6 @@ import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.layout.alias.RnaAlias; import lcsb.mapviewer.model.map.layout.alias.RnaRegionAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; -import lcsb.mapviewer.model.map.species.fields.RnaRegion; /** * Structure for storing the state of the Species in CellDesigner format. diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/TruncatedProtein.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/TruncatedProtein.java similarity index 90% rename from model/src/main/java/lcsb/mapviewer/model/map/species/TruncatedProtein.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/TruncatedProtein.java index bf3168b5b4362d721d5f56bcbfd1001a82eebaac..2a1ebc5dfed5950eaf13e867e708d5c80b7cdbae 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/TruncatedProtein.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/TruncatedProtein.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/Unknown.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Unknown.java similarity index 90% rename from model/src/main/java/lcsb/mapviewer/model/map/species/Unknown.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Unknown.java index dd10b378f3b597022a27b3ff49452e4aa833e14a..1c1d8077a9421dd763c42a8a08afbb7bb79f0e66 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/Unknown.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/Unknown.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/UnknownComparator.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/UnknownComparator.java similarity index 92% rename from model/src/main/java/lcsb/mapviewer/model/map/species/UnknownComparator.java rename to converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/UnknownComparator.java index 5ec909397193203575b3f015c06398731e2b25e3..2e064d10ee6f3c4d8a8cbc246e69636d49a79a1a 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/UnknownComparator.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/structure/UnknownComparator.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import java.util.Comparator; diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/types/ModifierTypeUtils.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/types/ModifierTypeUtils.java index cc5784f1b3b491554db5da564b556d988d4ff11d..9ef5fe91970e80cffbe538fb7da95866a4c3b8bf 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/types/ModifierTypeUtils.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/types/ModifierTypeUtils.java @@ -9,8 +9,8 @@ import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidStateException; import lcsb.mapviewer.common.geometry.PointTransformation; import lcsb.mapviewer.converter.model.celldesigner.geometry.ReactionCellDesignerConverter; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; import lcsb.mapviewer.model.graphics.PolylineData; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.reaction.AbstractNode; import lcsb.mapviewer.model.map.reaction.Modifier; diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/CellDesignerXmlParserTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/CellDesignerXmlParserTest.java index fdc24dab147e0059758cd71dc3da2cac185350f4..98712e479cc89cefd3483625ac0fd01c1d84fdc8 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/CellDesignerXmlParserTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/CellDesignerXmlParserTest.java @@ -27,8 +27,11 @@ import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.converter.ConverterParams; import lcsb.mapviewer.converter.InvalidInputDataExecption; import lcsb.mapviewer.converter.model.celldesigner.annotation.RestAnnotationParser; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.graphics.PolylineData; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.GeneAlias; @@ -42,9 +45,6 @@ import lcsb.mapviewer.model.map.layout.graphics.LayerText; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelComparator; import lcsb.mapviewer.model.map.model.ModelFullIndexed; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Species; public class CellDesignerXmlParserTest extends CellDesignerTestFunctions { Logger logger = Logger.getLogger(CellDesignerXmlParserTest.class); diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/ComplexParserTests.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/ComplexParserTests.java index 774abcfd629d661c603c4c9ec0cfcfdce22280e4..5cae4d2dd7d8e6c09f9ec1b63323001e3c61260c 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/ComplexParserTests.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/ComplexParserTests.java @@ -27,13 +27,13 @@ import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.ModificationResidueAlias; +import lcsb.mapviewer.model.map.layout.alias.ModificationState; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.layout.alias.RnaAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelComparator; import lcsb.mapviewer.model.map.model.ModelFullIndexed; -import lcsb.mapviewer.model.map.species.fields.ModificationState; import lcsb.mapviewer.modelutils.map.ElementUtils; public class ComplexParserTests extends CellDesignerTestFunctions { diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/LayerXmlParserTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/LayerXmlParserTest.java index 2c6a02437a8867ce6764a49ef6630a47609db7f0..864e24d010cfea913b34e22fed5f6c76f23c779f 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/LayerXmlParserTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/LayerXmlParserTest.java @@ -15,6 +15,7 @@ import org.junit.Test; import org.w3c.dom.Node; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; import lcsb.mapviewer.model.graphics.PolylineData; import lcsb.mapviewer.model.graphics.PolylineDataComparator; import lcsb.mapviewer.model.map.layout.alias.AliasGroup; @@ -30,7 +31,6 @@ import lcsb.mapviewer.model.map.layout.graphics.LayerText; import lcsb.mapviewer.model.map.layout.graphics.LayerTextComparator; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelFullIndexed; -import lcsb.mapviewer.model.map.species.GenericProtein; public class LayerXmlParserTest extends CellDesignerTestFunctions { Logger logger = Logger.getLogger(LayerXmlParserTest.class); diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/NestedComplexParsingTests.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/NestedComplexParsingTests.java index 4a29655ff1a1751b2791201a5298c4b6936113b4..ccc01fb0437c83f161648e41d3184b58c519adba 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/NestedComplexParsingTests.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/NestedComplexParsingTests.java @@ -4,12 +4,12 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.model.Model; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Species; import org.apache.log4j.Logger; import org.junit.After; diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/alias/AliasCollectionXmlParserTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/alias/AliasCollectionXmlParserTest.java index f0ac6dcdc7e4ea34a7c86830c75e44bba4de8fde..fc8482f9e866d162627f04fef912c9dcabb6b835 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/alias/AliasCollectionXmlParserTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/alias/AliasCollectionXmlParserTest.java @@ -17,15 +17,15 @@ import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions; import lcsb.mapviewer.converter.model.celldesigner.species.ModelMock; -import lcsb.mapviewer.model.map.agregator.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelFullIndexed; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Species; public class AliasCollectionXmlParserTest extends CellDesignerTestFunctions { diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/alias/CompartmentAliasXmlParserTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/alias/CompartmentAliasXmlParserTest.java index be613603e22f174d8cdca5caf999178dc6ea91c4..5a84ec35f8663e9861d8339a9dfecf3a9211a7e5 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/alias/CompartmentAliasXmlParserTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/alias/CompartmentAliasXmlParserTest.java @@ -17,7 +17,8 @@ import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions; import lcsb.mapviewer.converter.model.celldesigner.species.ModelMock; -import lcsb.mapviewer.model.map.agregator.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; import lcsb.mapviewer.model.map.layout.alias.BottomSquareCompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.LeftSquareCompartmentAlias; @@ -26,7 +27,6 @@ import lcsb.mapviewer.model.map.layout.alias.SquareCompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.TopSquareCompartmentAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelFullIndexed; -import lcsb.mapviewer.model.map.species.ComplexSpecies; public class CompartmentAliasXmlParserTest extends CellDesignerTestFunctions { static Logger logger = Logger.getLogger(CompartmentAliasXmlParser.class); diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/alias/ComplexAliasXmlParserTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/alias/ComplexAliasXmlParserTest.java index 4e8cf26bce72ecdddb66b3785453b240781501af..fb303e53ac3910c211599ee6ff148aad3dd6af65 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/alias/ComplexAliasXmlParserTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/alias/ComplexAliasXmlParserTest.java @@ -11,11 +11,11 @@ import org.junit.Test; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions; import lcsb.mapviewer.converter.model.celldesigner.species.ModelMock; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelFullIndexed; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Species; public class ComplexAliasXmlParserTest extends CellDesignerTestFunctions { Model model; diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/alias/SpeciesAliasXmlParserTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/alias/SpeciesAliasXmlParserTest.java index 199b98bc2b32f4eed5415063667f93827af97e9a..eb0b36804bece0509fd357278d0f929ab8e34e99 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/alias/SpeciesAliasXmlParserTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/alias/SpeciesAliasXmlParserTest.java @@ -21,16 +21,16 @@ import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions; import lcsb.mapviewer.converter.model.celldesigner.species.ModelMock; -import lcsb.mapviewer.model.map.agregator.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelData; import lcsb.mapviewer.model.map.model.ModelFullIndexed; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Species; public class SpeciesAliasXmlParserTest extends CellDesignerTestFunctions { static Logger logger = Logger.getLogger(SpeciesAliasXmlParser.class); diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/annotation/RestAnnotationParserTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/annotation/RestAnnotationParserTest.java index 65815619db25aa3eca5ec74634746bfa3b77017d..c4e168099af3579b97ea00c071a00bf1d099cf1e 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/annotation/RestAnnotationParserTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/annotation/RestAnnotationParserTest.java @@ -22,6 +22,8 @@ import org.w3c.dom.Node; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.AnnotatedObject; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; @@ -31,8 +33,6 @@ import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Species; public class RestAnnotationParserTest extends CellDesignerTestFunctions { Logger logger = Logger.getLogger(RestAnnotationParserTest.class); diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/compartment/CompartmentCollectionXmlParserTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/compartment/CompartmentCollectionXmlParserTest.java index 439b789a3c0335e759cc3cc89ef61e4be5c58834..f85656e82bbb0e3574905a0d39fddab88d056fe9 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/compartment/CompartmentCollectionXmlParserTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/compartment/CompartmentCollectionXmlParserTest.java @@ -17,7 +17,7 @@ import org.w3c.dom.Node; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions; -import lcsb.mapviewer.model.map.agregator.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; public class CompartmentCollectionXmlParserTest extends CellDesignerTestFunctions { diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/compartment/CompartmentXmlParserTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/compartment/CompartmentXmlParserTest.java index 1d15e75ad8e163307a51987fc153e28db68477f7..c0453784756e3a41e58e5e5f853940b2fd06fd60 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/compartment/CompartmentXmlParserTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/compartment/CompartmentXmlParserTest.java @@ -23,7 +23,7 @@ import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions; import lcsb.mapviewer.converter.model.celldesigner.species.ProteinXmlParserTest; -import lcsb.mapviewer.model.map.agregator.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.model.Model; diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/AbstractCellDesignerAliasConverterTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/AbstractCellDesignerAliasConverterTest.java index 81d2959cfbd198610fddaf7490de0fd46d6d98e1..4dc677a758667e04629d5030c8e17407cda9a975 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/AbstractCellDesignerAliasConverterTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/AbstractCellDesignerAliasConverterTest.java @@ -17,10 +17,10 @@ import lcsb.mapviewer.converter.model.celldesigner.geometry.helper.CellDesignerA import lcsb.mapviewer.converter.model.celldesigner.geometry.helper.CellDesignerEllipseTransformation; import lcsb.mapviewer.converter.model.celldesigner.geometry.helper.CellDesignerPolygonTransformation; import lcsb.mapviewer.converter.model.celldesigner.geometry.helper.CellDesignerRectangleTransformation; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.GenericProtein; public class AbstractCellDesignerAliasConverterTest { diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/IonCellDesignerAliasConverterTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/IonCellDesignerAliasConverterTest.java index 9f2af55ad5e69bb9bc0e74640c9d14cde2524d2d..7ccdbdbbece30f4ee136d08ec37da39a6b87bb71 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/IonCellDesignerAliasConverterTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/IonCellDesignerAliasConverterTest.java @@ -11,9 +11,9 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Ion; import lcsb.mapviewer.model.map.layout.alias.IonAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.Ion; public class IonCellDesignerAliasConverterTest { diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/ProteinConverterTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/ProteinConverterTest.java index 8ed9d0a7595014042103ec6136e754053cfebfc3..6973e8af94a4f948da4032b39a962fcb87398494 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/ProteinConverterTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/geometry/ProteinConverterTest.java @@ -11,8 +11,8 @@ import org.junit.Test; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions; import lcsb.mapviewer.converter.model.celldesigner.geometry.helper.CellDesignerAnchor; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; -import lcsb.mapviewer.model.map.species.GenericProtein; public class ProteinConverterTest extends CellDesignerTestFunctions { static Logger logger = Logger.getLogger(ProteinConverterTest.class); diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionCollectionXmlParserTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionCollectionXmlParserTest.java index f3def802ed15e01c9a1650d79a4a70de8341e775..4b0c112fedf70b7f2af7d6ae39f28211509be782 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionCollectionXmlParserTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionCollectionXmlParserTest.java @@ -14,12 +14,12 @@ import org.w3c.dom.Node; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelFullIndexed; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.GenericProtein; public class ReactionCollectionXmlParserTest extends CellDesignerTestFunctions { Logger logger = Logger.getLogger(ReactionCollectionXmlParserTest.class); diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionFromXmlTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionFromXmlTest.java index 59b7ca63b18f420ad152243d72e80b78c4995ebb..0604c7d35c568604e6a3c45ce722449e22df42d9 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionFromXmlTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionFromXmlTest.java @@ -12,6 +12,7 @@ import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions; import lcsb.mapviewer.converter.model.celldesigner.compartment.CompartmentCollectionXmlParser; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.model.Model; @@ -21,7 +22,6 @@ import lcsb.mapviewer.model.map.reaction.Reactant; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.type.TwoProductReactionInterface; import lcsb.mapviewer.model.map.reaction.type.TwoReactantReactionInterface; -import lcsb.mapviewer.model.map.species.GenericProtein; public class ReactionFromXmlTest extends CellDesignerTestFunctions { ReactionXmlParser parser; diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionParserTests.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionParserTests.java index 17d7115f07268264122d6771df5d8c7f49004548..6da9140073ee1342a21aab58d70a6312320b8109 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionParserTests.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionParserTests.java @@ -22,6 +22,7 @@ import lcsb.mapviewer.converter.ConverterParams; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; import lcsb.mapviewer.model.graphics.ArrowType; import lcsb.mapviewer.model.graphics.LineType; import lcsb.mapviewer.model.graphics.PolylineData; @@ -56,7 +57,6 @@ import lcsb.mapviewer.model.map.reaction.type.TranscriptionReaction; import lcsb.mapviewer.model.map.reaction.type.TranslationReaction; import lcsb.mapviewer.model.map.reaction.type.TransportReaction; import lcsb.mapviewer.model.map.reaction.type.TruncationReaction; -import lcsb.mapviewer.model.map.species.GenericProtein; public class ReactionParserTests extends CellDesignerTestFunctions { diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionToXmlTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionToXmlTest.java index d3342c7c9bfc1b589a47672b12b90872dcafc133..2202e9cf5ee2bbec396ddb09688123311c9c7942 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionToXmlTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/reaction/ReactionToXmlTest.java @@ -17,6 +17,8 @@ import org.junit.Test; import lcsb.mapviewer.common.EventStorageLoggerAppender; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; import lcsb.mapviewer.model.graphics.PolylineData; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; @@ -32,8 +34,6 @@ import lcsb.mapviewer.model.map.reaction.Reactant; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.type.DissociationReaction; import lcsb.mapviewer.model.map.reaction.type.TransportReaction; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.GenericProtein; public class ReactionToXmlTest { Logger logger = Logger.getLogger(ReactionToXmlTest.class); diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/AntisenseRnaXmlParserTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/AntisenseRnaXmlParserTest.java index d4ec47fbdc1ce8c1673b3946eb16ee048abbbae4..7fec98632d7e9755ef3fd0d47016d63f67ee9fae 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/AntisenseRnaXmlParserTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/AntisenseRnaXmlParserTest.java @@ -21,9 +21,9 @@ import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRna; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRnaRegion; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaRegionAlias.AntisenseRnaRegionType; -import lcsb.mapviewer.model.map.species.AntisenseRna; -import lcsb.mapviewer.model.map.species.fields.AntisenseRnaRegion; public class AntisenseRnaXmlParserTest extends CellDesignerTestFunctions { protected Logger logger = Logger.getLogger(AntisenseRnaXmlParserTest.class.getName()); diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/ComplexParserTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/ComplexParserTest.java index e1f3350f76d605ad61d92bcf99f3881f5fffa48f..ec79d3196b2c79b43f6ad7754de9f082dc97fe88 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/ComplexParserTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/ComplexParserTest.java @@ -22,14 +22,14 @@ import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions; import lcsb.mapviewer.converter.model.celldesigner.alias.ComplexAliasXmlParser; -import lcsb.mapviewer.model.map.Element; -import lcsb.mapviewer.model.map.agregator.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelData; import lcsb.mapviewer.model.map.model.ModelFullIndexed; -import lcsb.mapviewer.model.map.species.ComplexSpecies; public class ComplexParserTest extends CellDesignerTestFunctions { Logger logger = Logger.getLogger(ComplexParserTest.class); diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/GeneXmlParserTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/GeneXmlParserTest.java index 10fc0e353ce43d82cc81345059669c782cba2a9e..1aed0e229d3f657fb40e74a9f5d562b217bd2862 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/GeneXmlParserTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/GeneXmlParserTest.java @@ -23,12 +23,12 @@ import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.ModificationResidue; import lcsb.mapviewer.model.map.layout.alias.GeneAlias; import lcsb.mapviewer.model.map.layout.alias.ModificationResidueAlias; +import lcsb.mapviewer.model.map.layout.alias.ModificationState; import lcsb.mapviewer.model.map.model.Model; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; -import lcsb.mapviewer.model.map.species.fields.ModificationState; public class GeneXmlParserTest extends CellDesignerTestFunctions { Logger logger = Logger.getLogger(GeneXmlParserTest.class.getName()); diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/InternalModelSpeciesDataTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/InternalModelSpeciesDataTest.java index 56033d7409421229d53a02b24a2189d7fbf8de79..c3277a44550689cc0cc4c61e170bcff6acca2bc8 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/InternalModelSpeciesDataTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/InternalModelSpeciesDataTest.java @@ -1,50 +1,50 @@ -package lcsb.mapviewer.converter.model.celldesigner.species; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.Test; - -import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.species.Species; - -public class InternalModelSpeciesDataTest { - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testGetters() { - InternalModelSpeciesData data = new InternalModelSpeciesData(); - assertNotNull(data.getAll()); - assertNotNull(data.getAntisenseRnas()); - assertNotNull(data.getGenes()); - assertNotNull(data.getProteins()); - assertNotNull(data.getRnas()); - } - - @Test - public void testUpdateUnknownSpecies() { - InternalModelSpeciesData data = new InternalModelSpeciesData(); - try { - data.updateSpecies(new Species(), null); - fail("Exception expected"); - } catch (InvalidArgumentException e) { - assertTrue(e.getMessage().contains("Unknown species type")); - } - } - -} +package lcsb.mapviewer.converter.model.celldesigner.species; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; + +import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; + +public class InternalModelSpeciesDataTest { + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testGetters() { + InternalModelSpeciesData data = new InternalModelSpeciesData(); + assertNotNull(data.getAll()); + assertNotNull(data.getAntisenseRnas()); + assertNotNull(data.getGenes()); + assertNotNull(data.getProteins()); + assertNotNull(data.getRnas()); + } + + @Test + public void testUpdateUnknownSpecies() { + InternalModelSpeciesData data = new InternalModelSpeciesData(); + try { + data.updateSpecies(new Species(), null); + fail("Exception expected"); + } catch (InvalidArgumentException e) { + assertTrue(e.getMessage().contains("Unknown species type")); + } + } + +} diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/ModelMock.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/ModelMock.java index 0c414a753c50225c8b735b22c7c9d86ef998c836..466f686c23eb52b19202cd13f86f38af67b18354 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/ModelMock.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/ModelMock.java @@ -9,12 +9,13 @@ import java.util.Map; import java.util.Set; import lcsb.mapviewer.common.EventStorageLoggerAppender; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.Project; import lcsb.mapviewer.model.map.AnnotatedObject; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.OverviewImage; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.graph.DataMiningSet; import lcsb.mapviewer.model.map.layout.Layout; import lcsb.mapviewer.model.map.layout.alias.Alias; @@ -29,7 +30,6 @@ import lcsb.mapviewer.model.map.model.ModelData; import lcsb.mapviewer.model.map.model.ModelSubmodelConnection; import lcsb.mapviewer.model.map.model.SubmodelConnection; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.Species; import org.apache.log4j.Logger; diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/ProteinMappingTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/ProteinMappingTest.java index ea3672b70822e31c30f663eb46b5f979523072f8..2ba1853a7689642d586e7a6ec6908129043d551e 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/ProteinMappingTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/ProteinMappingTest.java @@ -13,7 +13,7 @@ import org.junit.Test; import lcsb.mapviewer.common.exception.InvalidStateException; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; public class ProteinMappingTest { Logger logger = Logger.getLogger(ProteinMappingTest.class); diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/ProteinXmlParserTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/ProteinXmlParserTest.java index 0fa86025bd7a752fb54008f419adc9607e9944e4..19c2ab508343e30fd2502dca348228a8df5e734c 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/ProteinXmlParserTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/ProteinXmlParserTest.java @@ -23,10 +23,10 @@ import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Protein; public class ProteinXmlParserTest extends CellDesignerTestFunctions { Logger logger = Logger.getLogger(ProteinXmlParserTest.class.getName()); diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/RnaXmlParserTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/RnaXmlParserTest.java index 69edb09f7295718aa3747b238dfb8ade87c9b964..34757ada7caed2c666a3e0fc19c181f93f1834ba 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/RnaXmlParserTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/RnaXmlParserTest.java @@ -22,7 +22,7 @@ import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions; -import lcsb.mapviewer.model.map.species.Rna; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; public class RnaXmlParserTest extends CellDesignerTestFunctions { protected Logger logger = Logger.getLogger(RnaXmlParserTest.class.getName()); diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesCollectionTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesCollectionTest.java index 2893ddaeb9f3cf768cf538608462133aaa8479fa..07dde3ae483484d0da90ef09f5089aaed77f3670 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesCollectionTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesCollectionTest.java @@ -12,11 +12,11 @@ import org.junit.Test; import lcsb.mapviewer.common.exception.InvalidStateException; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.model.map.species.TruncatedProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; +import lcsb.mapviewer.converter.model.celldesigner.structure.TruncatedProtein; public class SpeciesCollectionTest { Logger logger = Logger.getLogger(SpeciesCollectionTest.class); diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesCollectionXmlParserTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesCollectionXmlParserTest.java index bc35785af400eece9e763fde98695492652a9b94..3b78eebfc6bd7342a7ace664835c65fbca495098 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesCollectionXmlParserTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesCollectionXmlParserTest.java @@ -24,6 +24,13 @@ import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRna; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaAlias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; @@ -33,13 +40,6 @@ import lcsb.mapviewer.model.map.layout.alias.RnaAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelFullIndexed; -import lcsb.mapviewer.model.map.species.AntisenseRna; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; -import lcsb.mapviewer.model.map.species.Species; public class SpeciesCollectionXmlParserTest extends CellDesignerTestFunctions { static Logger logger = Logger.getLogger(SpeciesCollectionXmlParserTest.class); diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesMappingTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesMappingTest.java index 633ad1af14a1c572309cc6f4343bb51ff551f2a3..1d7030627092e0bcadd3df8cdf15a3809759a5e1 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesMappingTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesMappingTest.java @@ -11,7 +11,7 @@ import org.junit.Test; import lcsb.mapviewer.common.exception.InvalidStateException; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.Species; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; public class SpeciesMappingTest { diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesSbmlParserTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesSbmlParserTest.java index 4a32a8915710623ef71897171e1eacb2a7d0b1b7..fd258d2988d0ce32a21afbf87309931f319f9047 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesSbmlParserTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/species/SpeciesSbmlParserTest.java @@ -27,30 +27,30 @@ import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRna; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRnaRegion; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Degraded; +import lcsb.mapviewer.converter.model.celldesigner.structure.Drug; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Ion; +import lcsb.mapviewer.converter.model.celldesigner.structure.ModificationResidue; +import lcsb.mapviewer.converter.model.celldesigner.structure.Phenotype; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; +import lcsb.mapviewer.converter.model.celldesigner.structure.RnaRegion; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.converter.model.celldesigner.structure.SpeciesState; +import lcsb.mapviewer.converter.model.celldesigner.structure.Unknown; import lcsb.mapviewer.model.map.InconsistentModelException; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelFullIndexed; -import lcsb.mapviewer.model.map.species.AntisenseRna; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Degraded; -import lcsb.mapviewer.model.map.species.Drug; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Ion; -import lcsb.mapviewer.model.map.species.Phenotype; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; -import lcsb.mapviewer.model.map.species.SimpleMolecule; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.model.map.species.Unknown; -import lcsb.mapviewer.model.map.species.fields.AntisenseRnaRegion; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; -import lcsb.mapviewer.model.map.species.fields.RnaRegion; public class SpeciesSbmlParserTest extends CellDesignerTestFunctions { @SuppressWarnings("unused") diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/AntisenseRnaComparatorTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/AntisenseRnaComparatorTest.java similarity index 87% rename from model/src/test/java/lcsb/mapviewer/model/map/species/AntisenseRnaComparatorTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/AntisenseRnaComparatorTest.java index e22fb2cb7e33eabebb63d814c43704d75ca4aa3f..fa649ac8af088fa69d9d1b633f305c5096b97eff 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/AntisenseRnaComparatorTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/AntisenseRnaComparatorTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -9,8 +9,10 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRna; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRnaComparator; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRnaRegion; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaRegionAlias.AntisenseRnaRegionType; -import lcsb.mapviewer.model.map.species.fields.AntisenseRnaRegion; public class AntisenseRnaComparatorTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/fields/AntisenseRnaRegionTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/AntisenseRnaRegionTest.java similarity index 93% rename from model/src/test/java/lcsb/mapviewer/model/map/species/fields/AntisenseRnaRegionTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/AntisenseRnaRegionTest.java index bce8a334db9afe28eba40affcff5a3cfbadae99b..0564a8bc982d1c66554dc9e35f00b1831b489525 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/fields/AntisenseRnaRegionTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/AntisenseRnaRegionTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species.fields; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -14,7 +14,7 @@ import lcsb.mapviewer.common.Configuration; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaRegionAlias.AntisenseRnaRegionType; -import lcsb.mapviewer.model.map.species.Species; +import lcsb.mapviewer.model.map.layout.alias.ModificationState; public class AntisenseRnaRegionTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/AntisenseRnaTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/AntisenseRnaTest.java similarity index 91% rename from model/src/test/java/lcsb/mapviewer/model/map/species/AntisenseRnaTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/AntisenseRnaTest.java index a57f4364fc016fd938878af1aeb8db43f2a06b7c..4e4b7fa223067a09a481e26726180fed4d83ee10 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/AntisenseRnaTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/AntisenseRnaTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -14,8 +14,7 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.fields.AntisenseRnaRegion; -import lcsb.mapviewer.model.map.species.fields.ModificationState; +import lcsb.mapviewer.model.map.layout.alias.ModificationState; public class AntisenseRnaTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/agregator/CompartmentComparatorTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/CompartmentComparatorTest.java similarity index 93% rename from model/src/test/java/lcsb/mapviewer/model/map/agregator/CompartmentComparatorTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/CompartmentComparatorTest.java index 41f9c54ebb94c9bbf204ff43dc40b148bc6b7028..5e52e347f98eb96a467b4489d756457f70355d24 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/agregator/CompartmentComparatorTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/CompartmentComparatorTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.agregator; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; diff --git a/model/src/test/java/lcsb/mapviewer/model/map/agregator/CompartmentTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/CompartmentTest.java similarity index 91% rename from model/src/test/java/lcsb/mapviewer/model/map/agregator/CompartmentTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/CompartmentTest.java index 9c3f6451a616db2c3ad8b8ef8cf4b17bbb40253f..4c2061915b4df439d89416582062bb59fa13f45d 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/agregator/CompartmentTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/CompartmentTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.agregator; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -12,8 +12,6 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.Element; -import lcsb.mapviewer.model.map.species.GenericProtein; public class CompartmentTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/ComplexSpeciesComparatorTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ComplexSpeciesComparatorTest.java similarity index 90% rename from model/src/test/java/lcsb/mapviewer/model/map/species/ComplexSpeciesComparatorTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ComplexSpeciesComparatorTest.java index 4bbaa3ab6c9bab504e06d1e8b7dffa2f61c88974..8decad505fba5a013f54415fe5ce99bbe97f1e9e 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/ComplexSpeciesComparatorTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ComplexSpeciesComparatorTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -11,8 +11,12 @@ import org.junit.Test; import org.mockito.Mockito; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.Element; -import lcsb.mapviewer.model.map.agregator.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpeciesComparator; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; public class ComplexSpeciesComparatorTest { Logger logger = Logger.getLogger(ComplexSpeciesComparatorTest.class); diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/ComplexSpeciesTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ComplexSpeciesTest.java similarity index 87% rename from model/src/test/java/lcsb/mapviewer/model/map/species/ComplexSpeciesTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ComplexSpeciesTest.java index 1547c2f3296afca3da7b51e89cb69c9cc9237810..1c15f8cf5a0ee5e8182c7cb8959c4f4fab3aee9e 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/ComplexSpeciesTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ComplexSpeciesTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -14,7 +14,9 @@ import org.junit.Test; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; public class ComplexSpeciesTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/DegradedComparatorTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/DegradedComparatorTest.java similarity index 88% rename from model/src/test/java/lcsb/mapviewer/model/map/species/DegradedComparatorTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/DegradedComparatorTest.java index 793abb6410d8038d1e8c69ff6cd74d11ba99b7d0..0d15ec6b2a8c56fe6c2709dc3038aa40d1b20960 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/DegradedComparatorTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/DegradedComparatorTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -9,6 +9,8 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Degraded; +import lcsb.mapviewer.converter.model.celldesigner.structure.DegradedComparator; public class DegradedComparatorTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/DegradedTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/DegradedTest.java similarity index 83% rename from model/src/test/java/lcsb/mapviewer/model/map/species/DegradedTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/DegradedTest.java index 495b9157daf65b3e701b424cc3788df5ce40f24b..fafbfa6f55dc1c8dc262b2a01756ed0bfe74e18b 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/DegradedTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/DegradedTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; @@ -9,6 +9,8 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Degraded; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; public class DegradedTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/DrugComparatorTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/DrugComparatorTest.java similarity index 86% rename from model/src/test/java/lcsb/mapviewer/model/map/species/DrugComparatorTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/DrugComparatorTest.java index 2ca3baa4e2263d2478d71cfdd74318f871c3cd5e..84c3de7bec661b1848ed2e0fb0a9c34447e7d0cc 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/DrugComparatorTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/DrugComparatorTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -9,6 +9,8 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Drug; +import lcsb.mapviewer.converter.model.celldesigner.structure.DrugComparator; public class DrugComparatorTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/DrugTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/DrugTest.java similarity index 83% rename from model/src/test/java/lcsb/mapviewer/model/map/species/DrugTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/DrugTest.java index 57d7c4efc471735522533a1997fc06a3f34bb570..381663e7c4b2bf436eb6608d3235d742f1963e98 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/DrugTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/DrugTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; @@ -9,6 +9,8 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Drug; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; public class DrugTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/ElementComparatorTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ElementComparatorTest.java similarity index 92% rename from model/src/test/java/lcsb/mapviewer/model/map/ElementComparatorTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ElementComparatorTest.java index a8f10c4b6c8e500f649c9fdf8b8329e291c72f9a..596a4ce3537a6d4c9a5ad9f2dda5ffb9ce34d52e 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/ElementComparatorTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ElementComparatorTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -10,10 +10,10 @@ import org.junit.Test; import org.mockito.Mockito; import lcsb.mapviewer.common.exception.InvalidClassException; -import lcsb.mapviewer.model.map.agregator.Compartment; -import lcsb.mapviewer.model.map.species.SimpleMolecule; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.model.map.species.fields.PositionToCompartment; +import lcsb.mapviewer.model.map.MiriamData; +import lcsb.mapviewer.model.map.MiriamRelationType; +import lcsb.mapviewer.model.map.MiriamType; +import lcsb.mapviewer.model.map.layout.alias.PositionToCompartment; public class ElementComparatorTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/ElementTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ElementTest.java similarity index 89% rename from model/src/test/java/lcsb/mapviewer/model/map/ElementTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ElementTest.java index 9550d36991152de0ea8d00784a70fba3cfccc974..4191dd34eb4e08f37619d7f55d841041903e8829 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/ElementTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ElementTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -15,10 +15,13 @@ import org.junit.Test; import lcsb.mapviewer.ModelTestFunctions; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.model.map.MiriamData; +import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelFullIndexed; -import lcsb.mapviewer.model.map.species.ComplexSpecies; public class ElementTest extends ModelTestFunctions { Logger logger = Logger.getLogger(ElementTest.class); diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/GeneComparatorTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/GeneComparatorTest.java similarity index 90% rename from model/src/test/java/lcsb/mapviewer/model/map/species/GeneComparatorTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/GeneComparatorTest.java index 69a1698416607c677ec54c1ed142726cc18ca799..d93122574d7e709bcd7ed553b87281be3ba3817f 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/GeneComparatorTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/GeneComparatorTest.java @@ -1,17 +1,16 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; -import lcsb.mapviewer.model.map.species.fields.ModificationState; - import org.junit.After; import org.junit.Before; import org.junit.Test; +import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.model.map.layout.alias.ModificationState; + public class GeneComparatorTest { GeneComparator comparator = new GeneComparator(); diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/GeneTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/GeneTest.java similarity index 86% rename from model/src/test/java/lcsb/mapviewer/model/map/species/GeneTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/GeneTest.java index d1964f7db7c208ee0ec9e91b75a10cddfcc6d4aa..9cd00ce899a89634fe8783d66ef074c921d90ac0 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/GeneTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/GeneTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -13,7 +13,9 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.ModificationResidue; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; public class GeneTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/GenericProteinTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/GenericProteinTest.java similarity index 82% rename from model/src/test/java/lcsb/mapviewer/model/map/species/GenericProteinTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/GenericProteinTest.java index a71219dde63e31eb2af2a509d1eb6b7001d1fb6e..308a7a834130c816d688c1b4b44198bf2cd5a3d2 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/GenericProteinTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/GenericProteinTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; @@ -9,6 +9,8 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; public class GenericProteinTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/IonChannelProteinTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/IonChannelProteinTest.java similarity index 82% rename from model/src/test/java/lcsb/mapviewer/model/map/species/IonChannelProteinTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/IonChannelProteinTest.java index 211c9dd81cfea2a986c39f4730a8d42c4311c11d..df94d86afb43b99cae05959b6b4281884553202e 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/IonChannelProteinTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/IonChannelProteinTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; @@ -9,6 +9,8 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.IonChannelProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; public class IonChannelProteinTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/IonComparatorTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/IonComparatorTest.java similarity index 86% rename from model/src/test/java/lcsb/mapviewer/model/map/species/IonComparatorTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/IonComparatorTest.java index c81434ca607ee193b0bded60fc9d30e5872d4709..a55e4fb58c1c48589024511abdc014ceead2e48b 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/IonComparatorTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/IonComparatorTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -9,6 +9,8 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Ion; +import lcsb.mapviewer.converter.model.celldesigner.structure.IonComparator; public class IonComparatorTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/IonTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/IonTest.java similarity index 83% rename from model/src/test/java/lcsb/mapviewer/model/map/species/IonTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/IonTest.java index 03de3ea919535f1bff5c3e6735c3b8a52d193258..d97de2bcb6e8efa5d406ba0a6e77579b56b80f33 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/IonTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/IonTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; @@ -9,6 +9,8 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Ion; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; public class IonTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/fields/ModificationResidueTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ModificationResidueTest.java similarity index 92% rename from model/src/test/java/lcsb/mapviewer/model/map/species/fields/ModificationResidueTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ModificationResidueTest.java index e3b41d4e7e0d3377ad6ccd37d2a867eb798c88a3..1690e144ac1860c687600bc8ed6d70973197a770 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/fields/ModificationResidueTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ModificationResidueTest.java @@ -1,155 +1,155 @@ -package lcsb.mapviewer.model.map.species.fields; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; - -import org.apache.commons.lang3.SerializationUtils; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import lcsb.mapviewer.common.Configuration; -import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.Species; - -public class ModificationResidueTest { - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testSerialization() { - try { - SerializationUtils.serialize(new ModificationResidue()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testConstructor() { - try { - ModificationResidue original = new ModificationResidue(); - ModificationResidue copy = new ModificationResidue(original); - assertNotNull(copy); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testUpdate() { - try { - ModificationResidue original = new ModificationResidue(); - ModificationResidue update = new ModificationResidue(); - - String name = "n"; - String side = "s"; - ModificationState state = ModificationState.ACETYLATED; - Double angle = 3.9; - Double size = 5.0; - - update.setName(name); - update.setSide(side); - update.setAngle(angle); - update.setSize(size); - update.setState(state); - - original.update(update); - - assertEquals(name, original.getName()); - assertEquals(side, original.getSide()); - assertEquals(angle, original.getAngle()); - assertEquals(size, original.getSize()); - assertEquals(state, original.getState()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testGetters() { - try { - ModificationResidue original = new ModificationResidue(); - - String doubleStr = "2.0"; - String invalidDoubleStr = "a2.0"; - String nullStr = null; - Double angle = 2.0; - Species species = new Species(); - int id = 5; - - original.setAngle(doubleStr); - assertEquals(angle, original.getAngle(), Configuration.EPSILON); - try { - original.setAngle(invalidDoubleStr); - fail("Exception expected"); - } catch (InvalidArgumentException e) { - } - original.setAngle(nullStr); - assertNull(original.getAngle()); - - original.setSize(doubleStr); - assertEquals(angle, original.getSize(), Configuration.EPSILON); - try { - original.setSize(invalidDoubleStr); - fail("Exception expected"); - } catch (InvalidArgumentException e) { - } - original.setSize(doubleStr); - original.setSize(nullStr); - assertNull(original.getSize()); - - original.setId(id); - assertEquals(id, original.getId()); - - original.setSpecies(species); - assertEquals(species, original.getSpecies()); - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testCopy() { - try { - ModificationResidue degraded = new ModificationResidue().copy(); - assertNotNull(degraded); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testInvalidCopy() { - try { - new ModificationResidue() { - - /** - * - */ - private static final long serialVersionUID = 1L; - }.copy(); - fail("Exception expected"); - } catch (NotImplementedException e) { - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - -} +package lcsb.mapviewer.converter.model.celldesigner.structure; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import org.apache.commons.lang3.SerializationUtils; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import lcsb.mapviewer.common.Configuration; +import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.model.map.layout.alias.ModificationState; + +public class ModificationResidueTest { + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testSerialization() { + try { + SerializationUtils.serialize(new ModificationResidue()); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testConstructor() { + try { + ModificationResidue original = new ModificationResidue(); + ModificationResidue copy = new ModificationResidue(original); + assertNotNull(copy); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testUpdate() { + try { + ModificationResidue original = new ModificationResidue(); + ModificationResidue update = new ModificationResidue(); + + String name = "n"; + String side = "s"; + ModificationState state = ModificationState.ACETYLATED; + Double angle = 3.9; + Double size = 5.0; + + update.setName(name); + update.setSide(side); + update.setAngle(angle); + update.setSize(size); + update.setState(state); + + original.update(update); + + assertEquals(name, original.getName()); + assertEquals(side, original.getSide()); + assertEquals(angle, original.getAngle()); + assertEquals(size, original.getSize()); + assertEquals(state, original.getState()); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testGetters() { + try { + ModificationResidue original = new ModificationResidue(); + + String doubleStr = "2.0"; + String invalidDoubleStr = "a2.0"; + String nullStr = null; + Double angle = 2.0; + Species species = new Species(); + int id = 5; + + original.setAngle(doubleStr); + assertEquals(angle, original.getAngle(), Configuration.EPSILON); + try { + original.setAngle(invalidDoubleStr); + fail("Exception expected"); + } catch (InvalidArgumentException e) { + } + original.setAngle(nullStr); + assertNull(original.getAngle()); + + original.setSize(doubleStr); + assertEquals(angle, original.getSize(), Configuration.EPSILON); + try { + original.setSize(invalidDoubleStr); + fail("Exception expected"); + } catch (InvalidArgumentException e) { + } + original.setSize(doubleStr); + original.setSize(nullStr); + assertNull(original.getSize()); + + original.setId(id); + assertEquals(id, original.getId()); + + original.setSpecies(species); + assertEquals(species, original.getSpecies()); + + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testCopy() { + try { + ModificationResidue degraded = new ModificationResidue().copy(); + assertNotNull(degraded); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testInvalidCopy() { + try { + new ModificationResidue() { + + /** + * + */ + private static final long serialVersionUID = 1L; + }.copy(); + fail("Exception expected"); + } catch (NotImplementedException e) { + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + +} diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/PhenotypeComparatorTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/PhenotypeComparatorTest.java similarity index 62% rename from model/src/test/java/lcsb/mapviewer/model/map/species/PhenotypeComparatorTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/PhenotypeComparatorTest.java index 4f9f9861c1e97d2645dd9ca33ba3d1726449d448..1812f7a3ca1fe51c833e37353c0183b9a3881fad 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/PhenotypeComparatorTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/PhenotypeComparatorTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -10,7 +10,6 @@ import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.species.fields.AssociatedElement; public class PhenotypeComparatorTest { @@ -39,11 +38,6 @@ public class PhenotypeComparatorTest { assertEquals(0, comparator.compare(phenotype1, phenotype2)); assertEquals(0, comparator.compare(phenotype2, phenotype1)); - phenotype1.addAssociatedElement(new AssociatedElement()); - phenotype2.addAssociatedElement(new AssociatedElement()); - assertEquals(0, comparator.compare(phenotype1, phenotype2)); - assertEquals(0, comparator.compare(phenotype2, phenotype1)); - } catch (Exception e) { e.printStackTrace(); fail("Unknowne exception occurred"); @@ -99,35 +93,4 @@ public class PhenotypeComparatorTest { return result; } - @Test - public void testDifferentNewFields() throws Exception { - try { - Phenotype species1 = createPhenotype(); - Phenotype species2 = createPhenotype(); - - AssociatedElement ae = new AssociatedElement(); - - species1.addAssociatedElement(ae); - assertTrue(comparator.compare(species1, species2) != 0); - assertTrue(comparator.compare(species2, species1) != 0); - - species1 = createPhenotype(); - species2 = createPhenotype(); - - AssociatedElement ae1 = new AssociatedElement(); - AssociatedElement ae2 = new AssociatedElement(); - - ae2.setSource(MiriamType.CHEMBL_COMPOUND); - - species1.addAssociatedElement(ae1); - species2.addAssociatedElement(ae2); - assertTrue(comparator.compare(species1, species2) != 0); - assertTrue(comparator.compare(species2, species1) != 0); - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - } diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/PhenotypeTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/PhenotypeTest.java similarity index 57% rename from model/src/test/java/lcsb/mapviewer/model/map/species/PhenotypeTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/PhenotypeTest.java index 2e8e9f53130c0f2ae0dc09de9c50d16f2ba2da4e..f137ee4d62b4a6172a8a9851c6166fc4217a117d 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/PhenotypeTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/PhenotypeTest.java @@ -1,21 +1,14 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; -import java.util.ArrayList; -import java.util.List; - import org.apache.commons.lang3.SerializationUtils; import org.junit.After; import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.MiriamData; -import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.species.fields.AssociatedElement; public class PhenotypeTest { @@ -41,9 +34,6 @@ public class PhenotypeTest { public void testConstructor1() { try { Phenotype original = new Phenotype(); - AssociatedElement ae = new AssociatedElement(); - ae.setData(new MiriamData(MiriamType.CCDS, "a")); - original.addAssociatedElement(ae); Phenotype copy = new Phenotype(original); assertNotNull(copy); } catch (Exception e) { @@ -52,21 +42,6 @@ public class PhenotypeTest { } } - @Test - public void testGetters() { - try { - Phenotype phenotype = new Phenotype(new Species()); - assertNotNull(phenotype.getStringType()); - List<AssociatedElement> associatedElements = new ArrayList<>(); - phenotype.setAssociatedElements(associatedElements); - - assertEquals(associatedElements, phenotype.getAssociatedElements()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - @Test public void testCopy() { try { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/fields/PositionToCompartmentTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/PositionToCompartmentTest.java similarity index 80% rename from model/src/test/java/lcsb/mapviewer/model/map/species/fields/PositionToCompartmentTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/PositionToCompartmentTest.java index cc78192b32a713c6242d02754148d95ed2ddf76a..95502105f0787c192e615731a54158f932d63f6c 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/fields/PositionToCompartmentTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/PositionToCompartmentTest.java @@ -1,37 +1,39 @@ -package lcsb.mapviewer.model.map.species.fields; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class PositionToCompartmentTest { - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testValidValues() { - for (PositionToCompartment type : PositionToCompartment.values()) { - assertNotNull(type); - assertNotNull(type.getStringName()); - - // for coverage tests - PositionToCompartment.valueOf(type.toString()); - } - } - - @Test - public void testGetByString() { - assertNotNull(PositionToCompartment.getByString("insideOfMembrane")); - assertNull(PositionToCompartment.getByString("insideOfasdasdas")); - } - -} +package lcsb.mapviewer.converter.model.celldesigner.structure; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import lcsb.mapviewer.converter.model.celldesigner.structure.PositionToCompartment; + +public class PositionToCompartmentTest { + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testValidValues() { + for (PositionToCompartment type : PositionToCompartment.values()) { + assertNotNull(type); + assertNotNull(type.getStringName()); + + // for coverage tests + PositionToCompartment.valueOf(type.toString()); + } + } + + @Test + public void testGetByString() { + assertNotNull(PositionToCompartment.getByString("insideOfMembrane")); + assertNull(PositionToCompartment.getByString("insideOfasdasdas")); + } + +} diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/ProteinComparatorTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ProteinComparatorTest.java similarity index 83% rename from model/src/test/java/lcsb/mapviewer/model/map/species/ProteinComparatorTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ProteinComparatorTest.java index dfdb3be78d2e2c572697b3945ed1e41e74582ec4..b980ff726384e0ab2483aa58dd2fbd0c6f13589e 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/ProteinComparatorTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ProteinComparatorTest.java @@ -1,10 +1,14 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; -import lcsb.mapviewer.model.map.species.fields.ModificationState; + +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.ModificationResidue; +import lcsb.mapviewer.converter.model.celldesigner.structure.ModificationState; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.ProteinComparator; import org.junit.After; import org.junit.Before; diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/ProteinTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ProteinTest.java similarity index 86% rename from model/src/test/java/lcsb/mapviewer/model/map/species/ProteinTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ProteinTest.java index deb606733456898fd970d057504d3ebcd7f09feb..6c7acf7e8817ee568872bb19df32639ed79218a8 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/ProteinTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ProteinTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -13,7 +13,10 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.ModificationResidue; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; public class ProteinTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/ReceptorProteinTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ReceptorProteinTest.java similarity index 82% rename from model/src/test/java/lcsb/mapviewer/model/map/species/ReceptorProteinTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ReceptorProteinTest.java index ffc8af66ebb79ed25b6ea1535cdfa4d28660b2e1..0f9fad624923ba08982619812f987a35d3cc48c1 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/ReceptorProteinTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/ReceptorProteinTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; @@ -9,6 +9,8 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.ReceptorProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; public class ReceptorProteinTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/RnaComparatorTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/RnaComparatorTest.java similarity index 84% rename from model/src/test/java/lcsb/mapviewer/model/map/species/RnaComparatorTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/RnaComparatorTest.java index beea204bb98d7927fc0d2c6a52e443e1b60fd286..2466831932b46eed06f5397d23cfa7e6f295b8ef 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/RnaComparatorTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/RnaComparatorTest.java @@ -1,12 +1,14 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.fields.ModificationState; -import lcsb.mapviewer.model.map.species.fields.RnaRegion; +import lcsb.mapviewer.converter.model.celldesigner.structure.ModificationState; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; +import lcsb.mapviewer.converter.model.celldesigner.structure.RnaComparator; +import lcsb.mapviewer.converter.model.celldesigner.structure.RnaRegion; import org.junit.After; import org.junit.Before; diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/fields/RnaRegionTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/RnaRegionTest.java similarity index 85% rename from model/src/test/java/lcsb/mapviewer/model/map/species/fields/RnaRegionTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/RnaRegionTest.java index 76651462d0fdbbf550f4ef8bff20480782df3b35..f0dc640df0e2d7af6a5295659a28a96984f7575d 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/fields/RnaRegionTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/RnaRegionTest.java @@ -1,134 +1,136 @@ -package lcsb.mapviewer.model.map.species.fields; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -import org.apache.commons.lang3.SerializationUtils; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import lcsb.mapviewer.common.Configuration; -import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Species; - -public class RnaRegionTest { - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testSerialization() { - try { - SerializationUtils.serialize(new RnaRegion()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testConstructor() { - try { - RnaRegion region = new RnaRegion(new RnaRegion()); - assertNotNull(region); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testSetSize() { - try { - RnaRegion region = new RnaRegion(); - try { - region.setSize("as"); - fail("Exception expected"); - } catch (InvalidArgumentException e) { - } - region.setSize("0.0"); - assertEquals(0.0, region.getSize(), Configuration.EPSILON); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testSetPos() { - try { - RnaRegion region = new RnaRegion(); - try { - region.setPos("as"); - fail("Exception expected"); - } catch (InvalidArgumentException e) { - } - region.setPos("1.0"); - assertEquals(1.0, region.getPos(), Configuration.EPSILON); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testUpdate() { - try { - RnaRegion region = new RnaRegion(); - RnaRegion region2 = new RnaRegion(); - region2.setState(ModificationState.ACETYLATED); - region2.setName("asd"); - region2.setPos(2.2); - region.update(region2); - assertEquals(region2.getName(), region.getName()); - assertEquals(region2.getPos(), region.getPos()); - assertEquals(region2.getState(), region.getState()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testUpdate2() { - try { - RnaRegion region = new RnaRegion(); - region.setIdRnaRegion("1"); - RnaRegion region2 = new RnaRegion(); - region2.setIdRnaRegion("2"); - region.update(region2); - fail("Exception expected"); - } catch (InvalidArgumentException e) { - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testGetters() { - try { - RnaRegion region = new RnaRegion(); - int id = 47; - double size = 2.5; - Species species = new GenericProtein(); - region.setId(id); - region.setSize(size); - region.setSpecies(species); - assertEquals(id, region.getId()); - assertEquals(size, region.getSize(), Configuration.EPSILON); - assertEquals(species, region.getSpecies()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } -} +package lcsb.mapviewer.converter.model.celldesigner.structure; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + +import org.apache.commons.lang3.SerializationUtils; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import lcsb.mapviewer.common.Configuration; +import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.ModificationState; +import lcsb.mapviewer.converter.model.celldesigner.structure.RnaRegion; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; + +public class RnaRegionTest { + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testSerialization() { + try { + SerializationUtils.serialize(new RnaRegion()); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testConstructor() { + try { + RnaRegion region = new RnaRegion(new RnaRegion()); + assertNotNull(region); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testSetSize() { + try { + RnaRegion region = new RnaRegion(); + try { + region.setSize("as"); + fail("Exception expected"); + } catch (InvalidArgumentException e) { + } + region.setSize("0.0"); + assertEquals(0.0, region.getSize(), Configuration.EPSILON); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testSetPos() { + try { + RnaRegion region = new RnaRegion(); + try { + region.setPos("as"); + fail("Exception expected"); + } catch (InvalidArgumentException e) { + } + region.setPos("1.0"); + assertEquals(1.0, region.getPos(), Configuration.EPSILON); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testUpdate() { + try { + RnaRegion region = new RnaRegion(); + RnaRegion region2 = new RnaRegion(); + region2.setState(ModificationState.ACETYLATED); + region2.setName("asd"); + region2.setPos(2.2); + region.update(region2); + assertEquals(region2.getName(), region.getName()); + assertEquals(region2.getPos(), region.getPos()); + assertEquals(region2.getState(), region.getState()); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testUpdate2() { + try { + RnaRegion region = new RnaRegion(); + region.setIdRnaRegion("1"); + RnaRegion region2 = new RnaRegion(); + region2.setIdRnaRegion("2"); + region.update(region2); + fail("Exception expected"); + } catch (InvalidArgumentException e) { + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testGetters() { + try { + RnaRegion region = new RnaRegion(); + int id = 47; + double size = 2.5; + Species species = new GenericProtein(); + region.setId(id); + region.setSize(size); + region.setSpecies(species); + assertEquals(id, region.getId()); + assertEquals(size, region.getSize(), Configuration.EPSILON); + assertEquals(species, region.getSpecies()); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } +} diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/RnaTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/RnaTest.java similarity index 85% rename from model/src/test/java/lcsb/mapviewer/model/map/species/RnaTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/RnaTest.java index 63fbc0f06b1d13455be709a74a59b31852c6031a..afc4f0748a3600a619a6e35a8ac3b74f594a182b 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/RnaTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/RnaTest.java @@ -1,167 +1,170 @@ -package lcsb.mapviewer.model.map.species; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.SerializationUtils; -import org.apache.log4j.Logger; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.fields.RnaRegion; -import lcsb.mapviewer.model.map.species.fields.ModificationState; - -public class RnaTest { - Logger logger = Logger.getLogger(RnaTest.class); - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testSerialization() { - try { - SerializationUtils.serialize(new Rna()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - - @Test - public void testConstructor1() { - try { - Rna rna = new Rna(new Species()); - assertNotNull(rna); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testGetters() { - try { - Rna rna = new Rna(new Species()); - assertNotNull(rna.getStringType()); - List<RnaRegion> regions = new ArrayList<>(); - - rna.setRegions(regions); - - assertEquals(regions, rna.getRegions()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testCopy() { - try { - Rna rna = new Rna().copy(); - assertNotNull(rna); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testInvalidCopy() { - try { - new Rna() { - - /** - * - */ - private static final long serialVersionUID = 1L; - }.copy(); - fail("Exception expected"); - } catch (NotImplementedException e) { - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - - @Test - public void testAddRnaRegion() { - try { - Rna original = new Rna(); - RnaRegion region = new RnaRegion(); - region.setIdRnaRegion("id1"); - original.addRegion(region); - - RnaRegion region2 = new RnaRegion(); - region2.setIdRnaRegion("id1"); - region2.setName("nam"); - original.addRegion(region2); - - assertEquals(1, original.getRegions().size()); - - assertEquals("nam", original.getRegions().get(0).getName()); - - RnaRegion region3 = new RnaRegion(); - region3.setIdRnaRegion("id2"); - region3.setName("nam"); - original.addRegion(region3); - - assertEquals(2, original.getRegions().size()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testUpdate() { - try { - Rna original = new Rna(); - RnaRegion region2 = new RnaRegion(); - region2.setIdRnaRegion("id1"); - region2.setName("nam"); - original.addRegion(region2); - RnaRegion region3 = new RnaRegion(); - region3.setIdRnaRegion("id2"); - region3.setName("nam"); - original.addRegion(region3); - - Rna copy = new Rna(original); - copy.addRegion(new RnaRegion()); - copy.getRegions().get(0).setState(ModificationState.ACETYLATED); - - logger.debug(copy.getRegions().size()); - - original.update(copy); - - boolean acetylatedFound = false; - for (RnaRegion region : copy.getRegions()) { - if (ModificationState.ACETYLATED.equals(region.getState())) { - acetylatedFound = true; - } - } - assertTrue(acetylatedFound); - assertEquals(3, original.getRegions().size()); - assertEquals(3, copy.getRegions().size()); - - original.update(new GenericProtein()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - -} +package lcsb.mapviewer.converter.model.celldesigner.structure; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.SerializationUtils; +import org.apache.log4j.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.ModificationState; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; +import lcsb.mapviewer.converter.model.celldesigner.structure.RnaRegion; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; + +public class RnaTest { + Logger logger = Logger.getLogger(RnaTest.class); + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testSerialization() { + try { + SerializationUtils.serialize(new Rna()); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + + @Test + public void testConstructor1() { + try { + Rna rna = new Rna(new Species()); + assertNotNull(rna); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testGetters() { + try { + Rna rna = new Rna(new Species()); + assertNotNull(rna.getStringType()); + List<RnaRegion> regions = new ArrayList<>(); + + rna.setRegions(regions); + + assertEquals(regions, rna.getRegions()); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testCopy() { + try { + Rna rna = new Rna().copy(); + assertNotNull(rna); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testInvalidCopy() { + try { + new Rna() { + + /** + * + */ + private static final long serialVersionUID = 1L; + }.copy(); + fail("Exception expected"); + } catch (NotImplementedException e) { + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + + @Test + public void testAddRnaRegion() { + try { + Rna original = new Rna(); + RnaRegion region = new RnaRegion(); + region.setIdRnaRegion("id1"); + original.addRegion(region); + + RnaRegion region2 = new RnaRegion(); + region2.setIdRnaRegion("id1"); + region2.setName("nam"); + original.addRegion(region2); + + assertEquals(1, original.getRegions().size()); + + assertEquals("nam", original.getRegions().get(0).getName()); + + RnaRegion region3 = new RnaRegion(); + region3.setIdRnaRegion("id2"); + region3.setName("nam"); + original.addRegion(region3); + + assertEquals(2, original.getRegions().size()); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testUpdate() { + try { + Rna original = new Rna(); + RnaRegion region2 = new RnaRegion(); + region2.setIdRnaRegion("id1"); + region2.setName("nam"); + original.addRegion(region2); + RnaRegion region3 = new RnaRegion(); + region3.setIdRnaRegion("id2"); + region3.setName("nam"); + original.addRegion(region3); + + Rna copy = new Rna(original); + copy.addRegion(new RnaRegion()); + copy.getRegions().get(0).setState(ModificationState.ACETYLATED); + + logger.debug(copy.getRegions().size()); + + original.update(copy); + + boolean acetylatedFound = false; + for (RnaRegion region : copy.getRegions()) { + if (ModificationState.ACETYLATED.equals(region.getState())) { + acetylatedFound = true; + } + } + assertTrue(acetylatedFound); + assertEquals(3, original.getRegions().size()); + assertEquals(3, copy.getRegions().size()); + + original.update(new GenericProtein()); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + +} diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/SimpleMoleculeComparatorTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SimpleMoleculeComparatorTest.java similarity index 91% rename from model/src/test/java/lcsb/mapviewer/model/map/species/SimpleMoleculeComparatorTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SimpleMoleculeComparatorTest.java index 729d959778ac444b20110797ede37a42a6e7a91d..06e688cf76e925998efa705c91b77f12b8ba1ff6 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/SimpleMoleculeComparatorTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SimpleMoleculeComparatorTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -9,6 +9,8 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMoleculeComparator; public class SimpleMoleculeComparatorTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/SimpleMoleculeTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SimpleMoleculeTest.java similarity index 83% rename from model/src/test/java/lcsb/mapviewer/model/map/species/SimpleMoleculeTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SimpleMoleculeTest.java index ade7b468f075a7a004914c5788fc4d2207283838..82db2cc5d4e726003046ea368ff5283c01e20c07 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/SimpleMoleculeTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SimpleMoleculeTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; @@ -9,6 +9,8 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; public class SimpleMoleculeTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/SpeciesComparatorTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesComparatorTest.java similarity index 84% rename from model/src/test/java/lcsb/mapviewer/model/map/species/SpeciesComparatorTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesComparatorTest.java index 70ef5263e9b1728fc8e74e51e3eb81fcda1b9613..418cbaf994e116c453bcdb9a608c0b5cd042417b 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/SpeciesComparatorTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesComparatorTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -9,10 +9,19 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.InvalidClassException; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRna; +import lcsb.mapviewer.converter.model.celldesigner.structure.Degraded; +import lcsb.mapviewer.converter.model.celldesigner.structure.Drug; +import lcsb.mapviewer.converter.model.celldesigner.structure.Ion; +import lcsb.mapviewer.converter.model.celldesigner.structure.Phenotype; +import lcsb.mapviewer.converter.model.celldesigner.structure.PositionToCompartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; +import lcsb.mapviewer.converter.model.celldesigner.structure.SpeciesComparator; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.species.fields.PositionToCompartment; public class SpeciesComparatorTest { diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesStateTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesStateTest.java index 8efc570bf143aa6a9a3e6b798ea3e815d4c534c7..882a0b0e6848c826ea9f9cff23b7dafc5a6efe4e 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesStateTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesStateTest.java @@ -15,7 +15,6 @@ import lcsb.mapviewer.model.map.layout.alias.GeneAlias; import lcsb.mapviewer.model.map.layout.alias.ModificationResidueAlias; import lcsb.mapviewer.model.map.layout.alias.RnaAlias; import lcsb.mapviewer.model.map.layout.alias.RnaRegionAlias; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; public class SpeciesStateTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/SpeciesTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesTest.java similarity index 94% rename from model/src/test/java/lcsb/mapviewer/model/map/species/SpeciesTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesTest.java index cb3b3ec8103c044ee1dd698e1d261f2e6100f9ee..611c1d97bce67c3920c4811a38588cdff835b977 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/SpeciesTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/SpeciesTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -14,6 +14,7 @@ import org.junit.Test; import lcsb.mapviewer.ModelTestFunctions; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.MiriamData; public class SpeciesTest extends ModelTestFunctions { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/TruncatedProteinTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/TruncatedProteinTest.java similarity index 82% rename from model/src/test/java/lcsb/mapviewer/model/map/species/TruncatedProteinTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/TruncatedProteinTest.java index c0c0743d30e4823cd23139e29c0d4b7be4e4e00f..90ebc9489c00e969913bb3c54901f5a7a7922a9f 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/TruncatedProteinTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/TruncatedProteinTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; @@ -9,6 +9,8 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; +import lcsb.mapviewer.converter.model.celldesigner.structure.TruncatedProtein; public class TruncatedProteinTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/UnknownComparatorTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/UnknownComparatorTest.java similarity index 86% rename from model/src/test/java/lcsb/mapviewer/model/map/species/UnknownComparatorTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/UnknownComparatorTest.java index 87ae8c8b1a06c54d004996f89c05dce121a2a6cf..009dd1d89e550aa3b9e759a2f0ca95f14b08103c 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/UnknownComparatorTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/UnknownComparatorTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -9,6 +9,8 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Unknown; +import lcsb.mapviewer.converter.model.celldesigner.structure.UnknownComparator; public class UnknownComparatorTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/UnknownTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/UnknownTest.java similarity index 83% rename from model/src/test/java/lcsb/mapviewer/model/map/species/UnknownTest.java rename to converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/UnknownTest.java index 5caa89237a852117f409547212c1a4424294eaff..24ac6f9abf60aac1f5fb92c1199b8b0d0d1d1f81 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/UnknownTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/structure/UnknownTest.java @@ -1,4 +1,4 @@ -package lcsb.mapviewer.model.map.species; +package lcsb.mapviewer.converter.model.celldesigner.structure; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; @@ -9,6 +9,8 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; +import lcsb.mapviewer.converter.model.celldesigner.structure.Unknown; public class UnknownTest { diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/types/ModifierTypeUtilsTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/types/ModifierTypeUtilsTest.java index db4717bce503828dbf6232644b8009a475ce4388..e27cfaae401d75047e2bb5f55b542f256b303f33 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/types/ModifierTypeUtilsTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/types/ModifierTypeUtilsTest.java @@ -16,8 +16,9 @@ import org.junit.Test; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidStateException; import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.graphics.PolylineData; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.reaction.AndOperator; @@ -26,7 +27,6 @@ import lcsb.mapviewer.model.map.reaction.NodeOperator; import lcsb.mapviewer.model.map.reaction.Product; import lcsb.mapviewer.model.map.reaction.Reactant; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.Species; public class ModifierTypeUtilsTest { diff --git a/converter-SBGNML/src/main/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlExporter.java b/converter-SBGNML/src/main/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlExporter.java index 26b277c84f767c345a60fed90ea9942838c66b6c..a270247ead32d3ae68f924277b96e5709aca4a6a 100644 --- a/converter-SBGNML/src/main/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlExporter.java +++ b/converter-SBGNML/src/main/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlExporter.java @@ -28,8 +28,10 @@ import org.sbgn.bindings.Sbgn; import lcsb.mapviewer.common.comparator.DoubleComparator; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.converter.graphics.reaction.ReactionConverter; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.ModificationResidue; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; import lcsb.mapviewer.model.graphics.ArrowType; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaAlias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; @@ -71,8 +73,6 @@ import lcsb.mapviewer.model.map.reaction.type.ReducedPhysicalStimulationReaction import lcsb.mapviewer.model.map.reaction.type.ReducedTriggerReaction; import lcsb.mapviewer.model.map.reaction.type.StateTransitionReaction; import lcsb.mapviewer.model.map.reaction.type.UnknownTransitionReaction; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; import lcsb.mapviewer.modelutils.map.ElementUtils; /** diff --git a/converter-SBGNML/src/main/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlParser.java b/converter-SBGNML/src/main/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlParser.java index 888a7368641ec8d76d38bfa6ed10720940aa59db..9e9b45f3a41ad235082f7ade5c7a926fd18e22e7 100644 --- a/converter-SBGNML/src/main/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlParser.java +++ b/converter-SBGNML/src/main/java/lcsb/mapviewer/converter/model/sbgnml/SbgnmlXmlParser.java @@ -29,6 +29,18 @@ import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.converter.ConverterParams; import lcsb.mapviewer.converter.InvalidInputDataExecption; import lcsb.mapviewer.converter.graphics.species.SpeciesConverter; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Degraded; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.ModificationResidue; +import lcsb.mapviewer.converter.model.celldesigner.structure.Phenotype; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; +import lcsb.mapviewer.converter.model.celldesigner.structure.Unknown; import lcsb.mapviewer.converter.model.celldesigner.types.ModifierType; import lcsb.mapviewer.converter.model.celldesigner.types.ModifierTypeUtils; import lcsb.mapviewer.converter.model.sbgnml.structures.Process; @@ -36,10 +48,10 @@ import lcsb.mapviewer.model.graphics.ArrowType; import lcsb.mapviewer.model.graphics.ArrowTypeData; import lcsb.mapviewer.model.graphics.LineType; import lcsb.mapviewer.model.graphics.PolylineData; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; +import lcsb.mapviewer.model.map.layout.alias.ModificationState; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.layout.alias.SquareCompartmentAlias; import lcsb.mapviewer.model.map.model.Model; @@ -64,18 +76,6 @@ import lcsb.mapviewer.model.map.reaction.type.ReducedPhysicalStimulationReaction import lcsb.mapviewer.model.map.reaction.type.ReducedTriggerReaction; import lcsb.mapviewer.model.map.reaction.type.StateTransitionReaction; import lcsb.mapviewer.model.map.reaction.type.UnknownTransitionReaction; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Degraded; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Phenotype; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; -import lcsb.mapviewer.model.map.species.SimpleMolecule; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.model.map.species.Unknown; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; -import lcsb.mapviewer.model.map.species.fields.ModificationState; /** * This class is a parser for SBGN-ML files. diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/AliasConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/AliasConverter.java index 4d0ed6846277380e8139be1c89be34b28dad0f81..43255ebac455ccd1165a1830ef813bce816333b3 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/AliasConverter.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/AliasConverter.java @@ -27,33 +27,29 @@ import lcsb.mapviewer.converter.graphics.species.RnaConverter; import lcsb.mapviewer.converter.graphics.species.SBGNNucleicAcidFeatureConverter; import lcsb.mapviewer.converter.graphics.species.SimpleMoleculeConverter; import lcsb.mapviewer.converter.graphics.species.UnknownConverter; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.ColorSchema; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaAlias; import lcsb.mapviewer.model.map.layout.alias.ArtifitialCompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.BottomSquareCompartmentAlias; +import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; +import lcsb.mapviewer.model.map.layout.alias.DegradedAlias; +import lcsb.mapviewer.model.map.layout.alias.DrugAlias; import lcsb.mapviewer.model.map.layout.alias.GeneAlias; +import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; +import lcsb.mapviewer.model.map.layout.alias.IonAlias; +import lcsb.mapviewer.model.map.layout.alias.IonChannelProteinAlias; import lcsb.mapviewer.model.map.layout.alias.LeftSquareCompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.OvalCompartmentAlias; +import lcsb.mapviewer.model.map.layout.alias.PhenotypeAlias; +import lcsb.mapviewer.model.map.layout.alias.ReceptorProteinAlias; import lcsb.mapviewer.model.map.layout.alias.RightSquareCompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.RnaAlias; +import lcsb.mapviewer.model.map.layout.alias.SimpleMoleculeAlias; import lcsb.mapviewer.model.map.layout.alias.SquareCompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.TopSquareCompartmentAlias; -import lcsb.mapviewer.model.map.species.AntisenseRna; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Degraded; -import lcsb.mapviewer.model.map.species.Drug; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Ion; -import lcsb.mapviewer.model.map.species.IonChannelProtein; -import lcsb.mapviewer.model.map.species.Phenotype; -import lcsb.mapviewer.model.map.species.ReceptorProtein; -import lcsb.mapviewer.model.map.species.Rna; -import lcsb.mapviewer.model.map.species.SimpleMolecule; -import lcsb.mapviewer.model.map.species.TruncatedProtein; -import lcsb.mapviewer.model.map.species.Unknown; +import lcsb.mapviewer.model.map.layout.alias.TruncatedProteinAlias; +import lcsb.mapviewer.model.map.layout.alias.UnknownAlias; /** * This class is designed to convert any type of alias into a graphic glyph that @@ -68,7 +64,7 @@ public class AliasConverter implements IAliasConverter<Alias> { /** * Default class logger. */ - private static Logger logger = Logger.getLogger(AliasConverter.class.getName()); + private static Logger logger = Logger.getLogger(AliasConverter.class.getName()); // ***************************************************************** // @@ -76,39 +72,31 @@ public class AliasConverter implements IAliasConverter<Alias> { // // ***************************************************************** - /** - * Static map of graphic alias converters used for conversion of aliases. Key - * in this map is a class of element to which alias reference to. Value is - * instance of a converter that can process the alias with the specific - * element type reference. - */ - private static Map<Class<? extends Element>, IAliasConverter<?>> elementConverters = new HashMap<Class<? extends Element>, IAliasConverter<?>>(); - /** * Static map of graphic alias converters used for conversion of aliases. Key * in this map is a class of alias. Value is the converter that can process * this type of alias. */ - private static Map<Class<? extends Alias>, IAliasConverter<?>> aliasConverters = new HashMap<Class<? extends Alias>, IAliasConverter<?>>(); + private static Map<Class<? extends Alias>, IAliasConverter<?>> aliasConverters = new HashMap<Class<? extends Alias>, IAliasConverter<?>>(); static { // at the beginning lets add all implemented aliases // for element reference - addElementConverter(GenericProtein.class, new ProteinConverter()); - addElementConverter(IonChannelProtein.class, new ProteinConverter()); - addElementConverter(ReceptorProtein.class, new ProteinConverter()); - addElementConverter(TruncatedProtein.class, new ProteinConverter()); - addElementConverter(Degraded.class, new DegradedConverter()); - addElementConverter(ComplexSpecies.class, new ComplexConverter()); - addElementConverter(SimpleMolecule.class, new SimpleMoleculeConverter()); - addElementConverter(Drug.class, new DrugConverter()); - addElementConverter(Ion.class, new IonConverter()); - addElementConverter(Phenotype.class, new PhenotypeConverter()); - addElementConverter(Rna.class, new RnaConverter()); - addElementConverter(AntisenseRna.class, new AntisenseRnaConverter()); - addElementConverter(Gene.class, new GeneConverter()); - addElementConverter(Unknown.class, new UnknownConverter()); + addAliasConverter(GenericProteinAlias.class, new ProteinConverter()); + addAliasConverter(IonChannelProteinAlias.class, new ProteinConverter()); + addAliasConverter(ReceptorProteinAlias.class, new ProteinConverter()); + addAliasConverter(TruncatedProteinAlias.class, new ProteinConverter()); + addAliasConverter(DegradedAlias.class, new DegradedConverter()); + addAliasConverter(ComplexAlias.class, new ComplexConverter()); + addAliasConverter(SimpleMoleculeAlias.class, new SimpleMoleculeConverter()); + addAliasConverter(DrugAlias.class, new DrugConverter()); + addAliasConverter(IonAlias.class, new IonConverter()); + addAliasConverter(PhenotypeAlias.class, new PhenotypeConverter()); + addAliasConverter(RnaAlias.class, new RnaConverter()); + addAliasConverter(AntisenseRnaAlias.class, new AntisenseRnaConverter()); + addAliasConverter(GeneAlias.class, new GeneConverter()); + addAliasConverter(UnknownAlias.class, new UnknownConverter()); // for compartment aliases addAliasConverter(SquareCompartmentAlias.class, new SquareCompartmentConverter()); @@ -121,21 +109,6 @@ public class AliasConverter implements IAliasConverter<Alias> { } - /** - * Method that set a converter for element referenced by alias to process. - * - * @param clazz - * class type of element referenced by alias - * @param converter - * converter that should be used for conversion of this alias - */ - protected static void addElementConverter(final Class<? extends Element> clazz, final IAliasConverter<?> converter) { - if (elementConverters.get(clazz) != null) { - logger.warn("Converter for " + clazz + " has been already added"); - } - elementConverters.put(clazz, converter); - } - /** * Method that set a converter for specific alias type. * diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/AntisenseRnaConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/AntisenseRnaConverter.java index b1ca0be5070de4760d7603793992d80cfe60b7f2..ebfb0c2dcc2c23e95bd80c0e1c2ab2180d8c8cff 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/AntisenseRnaConverter.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/AntisenseRnaConverter.java @@ -11,16 +11,13 @@ import java.awt.geom.Path2D; import java.awt.geom.PathIterator; import java.awt.geom.Point2D; +import org.apache.log4j.Logger; + import lcsb.mapviewer.converter.graphics.ConverterParams; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaAlias; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaRegionAlias; -import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.AntisenseRna; -import lcsb.mapviewer.model.map.species.fields.AntisenseRnaRegion; -import lcsb.mapviewer.model.map.species.fields.ModificationState; - -import org.apache.log4j.Logger; +import lcsb.mapviewer.model.map.layout.alias.ModificationState; /** * This class defines methods used for drawing Antisense Rna SpeciesAlias on the @@ -35,7 +32,7 @@ public class AntisenseRnaConverter extends SpeciesConverter<AntisenseRnaAlias> { * Default class logger. */ @SuppressWarnings("unused") - private static Logger logger = Logger.getLogger(AntisenseRnaConverter.class.getName()); + private static Logger logger = Logger.getLogger(AntisenseRnaConverter.class.getName()); @Override public void drawAlias(final AntisenseRnaAlias alias, final Graphics2D graphics, final ConverterParams params) { diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/GeneConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/GeneConverter.java index 2419143dcd81f83506ef6e3f665b62877508c0bf..fecd7d7777a0b1d0bdde74465d585888702e10b9 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/GeneConverter.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/GeneConverter.java @@ -17,7 +17,7 @@ import lcsb.mapviewer.converter.graphics.ConverterParams; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.GeneAlias; import lcsb.mapviewer.model.map.layout.alias.ModificationResidueAlias; -import lcsb.mapviewer.model.map.species.fields.ModificationState; +import lcsb.mapviewer.model.map.layout.alias.ModificationState; /** * This class defines methods used for drawing Gene SpeciesAlias on the @@ -31,7 +31,7 @@ public class GeneConverter extends SpeciesConverter<GeneAlias> { * Default class logger. */ @SuppressWarnings("unused") - private static Logger logger = Logger.getLogger(GeneConverter.class.getName()); + private static Logger logger = Logger.getLogger(GeneConverter.class.getName()); @Override public void drawAlias(final GeneAlias alias, final Graphics2D graphics, final ConverterParams params) { diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/IonConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/IonConverter.java index 7f0f3e644cda2e7b055e4171faf6aaf572b5c263..1b0dd1ac478e67487457e4f6a174062009542602 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/IonConverter.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/IonConverter.java @@ -1,111 +1,111 @@ -package lcsb.mapviewer.converter.graphics.species; - -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.Shape; -import java.awt.Stroke; -import java.awt.geom.Ellipse2D; -import java.awt.geom.PathIterator; -import java.awt.geom.Point2D; - -import lcsb.mapviewer.common.exception.InvalidStateException; -import lcsb.mapviewer.converter.graphics.ConverterParams; -import lcsb.mapviewer.model.map.layout.alias.Alias; -import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; - -import org.apache.log4j.Logger; - -/** - * This class defines methods used for drawing SpeciesAlias of - * {@link lcsb.mapviewer.db.model.map.species.Ion Ion} on the {@link Graphics2D} - * object. - * - * @author Piotr Gawron - * - */ -public class IonConverter extends SpeciesConverter<SpeciesAlias> { - /** - * Default class logger. - */ - private static Logger logger = Logger.getLogger(IonConverter.class.getName()); - - @Override - public void drawAlias(final SpeciesAlias alias, final Graphics2D graphics, final ConverterParams params) { - double diameter = getDiameter(alias); - double x = getXCoord(alias, diameter); - double y = getYCoord(alias); - Shape shape = new Ellipse2D.Double(x, y, diameter, diameter); - Color c = graphics.getColor(); - graphics.setColor(alias.getColor()); - graphics.fill(shape); - graphics.setColor(c); - Stroke stroke = graphics.getStroke(); - graphics.setStroke(getBorderLine(alias)); - graphics.draw(shape); - graphics.setStroke(stroke); - drawText(alias, graphics, params); - } - - /** - * Returns transformed y coordinate for the ion alias. - * - * @param alias - * object alias to to which we are looking for y coordinate - * @return y coordinate of the alias - */ - private double getYCoord(final Alias alias) { - double y = alias.getY(); - return y; - } - - /** - * Returns transformed x coordinate for the ion alias. - * - * @param alias - * object alias to to which we are looking for x coordinate - * @param diameter - * diameter of circle representation of ion - * @return x coordinate of the alias - */ - private double getXCoord(final Alias alias, final double diameter) { - double x = alias.getX() + (alias.getWidth() - diameter) / 2; - return x; - } - - /** - * Returns diameter of circle representation of ion. - * - * @param alias - * object alias to to which we are looking for diameter. - * @return diameter of ion circle representation - */ - private double getDiameter(final Alias alias) { - double diameter = Math.min(alias.getWidth(), alias.getHeight()); - if (diameter < 0) { - logger.warn("Something is wrong. Size cannot be negative"); - diameter = 0; - } - - return diameter; - } - - @Override - public PathIterator getBoundPathIterator(final SpeciesAlias alias) { - throw new InvalidStateException("This class doesn't have bound"); - } - - @Override - public Point2D getPointCoordinatesOnBorder(final SpeciesAlias alias, final double angle) { - if (alias.getWidth() == 0 && alias.getHeight() == 0) { - logger.warn("Looking for coordinates for the alias with 0 size"); - return alias.getCenter(); - } - double diameter = getDiameter(alias); - double x = getXCoord(alias, diameter); - double y = getYCoord(alias); - Point2D result = getEllipseTransformation().getPointOnEllipseByRadian(x, y, diameter, diameter, angle); - return result; - - } - -} +package lcsb.mapviewer.converter.graphics.species; + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.Shape; +import java.awt.Stroke; +import java.awt.geom.Ellipse2D; +import java.awt.geom.PathIterator; +import java.awt.geom.Point2D; + +import lcsb.mapviewer.common.exception.InvalidStateException; +import lcsb.mapviewer.converter.graphics.ConverterParams; +import lcsb.mapviewer.model.map.layout.alias.Alias; +import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; + +import org.apache.log4j.Logger; + +/** + * This class defines methods used for drawing SpeciesAlias of + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.db.model.map.species.Ion Ion} on the {@link Graphics2D} + * object. + * + * @author Piotr Gawron + * + */ +public class IonConverter extends SpeciesConverter<SpeciesAlias> { + /** + * Default class logger. + */ + private static Logger logger = Logger.getLogger(IonConverter.class.getName()); + + @Override + public void drawAlias(final SpeciesAlias alias, final Graphics2D graphics, final ConverterParams params) { + double diameter = getDiameter(alias); + double x = getXCoord(alias, diameter); + double y = getYCoord(alias); + Shape shape = new Ellipse2D.Double(x, y, diameter, diameter); + Color c = graphics.getColor(); + graphics.setColor(alias.getColor()); + graphics.fill(shape); + graphics.setColor(c); + Stroke stroke = graphics.getStroke(); + graphics.setStroke(getBorderLine(alias)); + graphics.draw(shape); + graphics.setStroke(stroke); + drawText(alias, graphics, params); + } + + /** + * Returns transformed y coordinate for the ion alias. + * + * @param alias + * object alias to to which we are looking for y coordinate + * @return y coordinate of the alias + */ + private double getYCoord(final Alias alias) { + double y = alias.getY(); + return y; + } + + /** + * Returns transformed x coordinate for the ion alias. + * + * @param alias + * object alias to to which we are looking for x coordinate + * @param diameter + * diameter of circle representation of ion + * @return x coordinate of the alias + */ + private double getXCoord(final Alias alias, final double diameter) { + double x = alias.getX() + (alias.getWidth() - diameter) / 2; + return x; + } + + /** + * Returns diameter of circle representation of ion. + * + * @param alias + * object alias to to which we are looking for diameter. + * @return diameter of ion circle representation + */ + private double getDiameter(final Alias alias) { + double diameter = Math.min(alias.getWidth(), alias.getHeight()); + if (diameter < 0) { + logger.warn("Something is wrong. Size cannot be negative"); + diameter = 0; + } + + return diameter; + } + + @Override + public PathIterator getBoundPathIterator(final SpeciesAlias alias) { + throw new InvalidStateException("This class doesn't have bound"); + } + + @Override + public Point2D getPointCoordinatesOnBorder(final SpeciesAlias alias, final double angle) { + if (alias.getWidth() == 0 && alias.getHeight() == 0) { + logger.warn("Looking for coordinates for the alias with 0 size"); + return alias.getCenter(); + } + double diameter = getDiameter(alias); + double x = getXCoord(alias, diameter); + double y = getYCoord(alias); + Point2D result = getEllipseTransformation().getPointOnEllipseByRadian(x, y, diameter, diameter, angle); + return result; + + } + +} diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/PhenotypeConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/PhenotypeConverter.java index 3cacd381fba3464ef3685a0982251f338374b1e1..217c3f630d8249a782be56835a337e94c44a8afb 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/PhenotypeConverter.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/PhenotypeConverter.java @@ -1,73 +1,73 @@ -package lcsb.mapviewer.converter.graphics.species; - -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.Stroke; -import java.awt.geom.AffineTransform; -import java.awt.geom.GeneralPath; -import java.awt.geom.Path2D; -import java.awt.geom.PathIterator; - -import lcsb.mapviewer.converter.graphics.ConverterParams; -import lcsb.mapviewer.model.map.layout.alias.Alias; -import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; - -import org.apache.log4j.Logger; - -/** - * This class defines methods used for drawing SpeciesAlias of - * {@link lcsb.mapviewer.db.model.map.species.Phenotype Phenotype} on the - * {@link Graphics2D} object. - * - * @author Piotr Gawron - * - */ -public class PhenotypeConverter extends SpeciesConverter<SpeciesAlias> { - /** - * Default class logger. - */ - @SuppressWarnings("unused") - private static Logger logger = Logger.getLogger(PhenotypeConverter.class.getName()); - - @Override - public void drawAlias(final SpeciesAlias alias, final Graphics2D graphics, final ConverterParams params) { - GeneralPath path = getPhenotypePath(alias); - - Color c = graphics.getColor(); - graphics.setColor(alias.getColor()); - graphics.fill(path); - graphics.setColor(c); - Stroke stroke = graphics.getStroke(); - graphics.setStroke(getBorderLine(alias)); - graphics.draw(path); - graphics.setStroke(stroke); - drawText(alias, graphics, params); - } - - /** - * Returns shape of the Phenotype as a GeneralPath object. - * - * @param alias - * alias for which we are looking for a border - * @return GeneralPath object defining border of the given alias - */ - private GeneralPath getPhenotypePath(final Alias alias) { - // CHECKSTYLE:OFF - GeneralPath path = new GeneralPath(Path2D.WIND_EVEN_ODD, 6); - path.moveTo(alias.getX() + alias.getWidth() / 6, alias.getY()); - path.lineTo(alias.getX() + alias.getWidth() * 5 / 6, alias.getY()); - path.lineTo(alias.getX() + alias.getWidth(), alias.getY() + alias.getHeight() / 2); - path.lineTo(alias.getX() + alias.getWidth() * 5 / 6, alias.getY() + alias.getHeight()); - path.lineTo(alias.getX() + alias.getWidth() / 6, alias.getY() + alias.getHeight()); - path.lineTo(alias.getX(), alias.getY() + alias.getHeight() / 2); - // CHECKSTYLE:ON - path.closePath(); - return path; - } - - @Override - public PathIterator getBoundPathIterator(final SpeciesAlias alias) { - return getPhenotypePath(alias).getPathIterator(new AffineTransform()); - } - -} +package lcsb.mapviewer.converter.graphics.species; + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.Stroke; +import java.awt.geom.AffineTransform; +import java.awt.geom.GeneralPath; +import java.awt.geom.Path2D; +import java.awt.geom.PathIterator; + +import lcsb.mapviewer.converter.graphics.ConverterParams; +import lcsb.mapviewer.model.map.layout.alias.Alias; +import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; + +import org.apache.log4j.Logger; + +/** + * This class defines methods used for drawing SpeciesAlias of + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.db.model.map.species.Phenotype Phenotype} on the + * {@link Graphics2D} object. + * + * @author Piotr Gawron + * + */ +public class PhenotypeConverter extends SpeciesConverter<SpeciesAlias> { + /** + * Default class logger. + */ + @SuppressWarnings("unused") + private static Logger logger = Logger.getLogger(PhenotypeConverter.class.getName()); + + @Override + public void drawAlias(final SpeciesAlias alias, final Graphics2D graphics, final ConverterParams params) { + GeneralPath path = getPhenotypePath(alias); + + Color c = graphics.getColor(); + graphics.setColor(alias.getColor()); + graphics.fill(path); + graphics.setColor(c); + Stroke stroke = graphics.getStroke(); + graphics.setStroke(getBorderLine(alias)); + graphics.draw(path); + graphics.setStroke(stroke); + drawText(alias, graphics, params); + } + + /** + * Returns shape of the Phenotype as a GeneralPath object. + * + * @param alias + * alias for which we are looking for a border + * @return GeneralPath object defining border of the given alias + */ + private GeneralPath getPhenotypePath(final Alias alias) { + // CHECKSTYLE:OFF + GeneralPath path = new GeneralPath(Path2D.WIND_EVEN_ODD, 6); + path.moveTo(alias.getX() + alias.getWidth() / 6, alias.getY()); + path.lineTo(alias.getX() + alias.getWidth() * 5 / 6, alias.getY()); + path.lineTo(alias.getX() + alias.getWidth(), alias.getY() + alias.getHeight() / 2); + path.lineTo(alias.getX() + alias.getWidth() * 5 / 6, alias.getY() + alias.getHeight()); + path.lineTo(alias.getX() + alias.getWidth() / 6, alias.getY() + alias.getHeight()); + path.lineTo(alias.getX(), alias.getY() + alias.getHeight() / 2); + // CHECKSTYLE:ON + path.closePath(); + return path; + } + + @Override + public PathIterator getBoundPathIterator(final SpeciesAlias alias) { + return getPhenotypePath(alias).getPathIterator(new AffineTransform()); + } + +} diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/ProteinConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/ProteinConverter.java index 9baf37c17759a7d11a5953bf1c8fa8999cfd3634..be62fa2f7b5e209b6c820f660b0db8853dc35643 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/ProteinConverter.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/ProteinConverter.java @@ -25,15 +25,11 @@ import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.IonChannelProteinAlias; import lcsb.mapviewer.model.map.layout.alias.ModificationResidueAlias; +import lcsb.mapviewer.model.map.layout.alias.ModificationState; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.layout.alias.ReceptorProteinAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.layout.alias.TruncatedProteinAlias; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.IonChannelProtein; -import lcsb.mapviewer.model.map.species.ReceptorProtein; -import lcsb.mapviewer.model.map.species.TruncatedProtein; -import lcsb.mapviewer.model.map.species.fields.ModificationState; import lcsb.mapviewer.modelutils.map.ElementUtils; /** diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/RnaConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/RnaConverter.java index 177559f4fea2cc045fe968aa1e829115ca8d97b9..0e0c06e2b300ff9f1b95ccc27370d5c06759d594 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/RnaConverter.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/RnaConverter.java @@ -15,15 +15,14 @@ import org.apache.log4j.Logger; import lcsb.mapviewer.converter.graphics.ConverterParams; import lcsb.mapviewer.model.map.layout.alias.Alias; +import lcsb.mapviewer.model.map.layout.alias.ModificationState; import lcsb.mapviewer.model.map.layout.alias.RnaAlias; import lcsb.mapviewer.model.map.layout.alias.RnaRegionAlias; -import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.fields.ModificationState; /** * This class defines methods used for drawing SpeciesAlias of - * {@link lcsb.mapviewer.db.model.map.species.Rna Rna} on the {@link Graphics2D} - * object. + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.db.model.map.species.Rna + * Rna} on the {@link Graphics2D} object. * * @author Piotr Gawron * @@ -33,7 +32,7 @@ public class RnaConverter extends SpeciesConverter<RnaAlias> { * Default class logger. */ @SuppressWarnings("unused") - private static Logger logger = Logger.getLogger(RnaConverter.class.getName()); + private static Logger logger = Logger.getLogger(RnaConverter.class.getName()); @Override public void drawAlias(final RnaAlias alias, final Graphics2D graphics, final ConverterParams params) { diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/SBGNNucleicAcidFeatureConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/SBGNNucleicAcidFeatureConverter.java index 0eb77c8dbb28cde6463e143bfe79c6eefa417237..25252c49450fe4db3bdb845d63855c59f271d461 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/SBGNNucleicAcidFeatureConverter.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/SBGNNucleicAcidFeatureConverter.java @@ -11,44 +11,40 @@ import java.awt.geom.PathIterator; import lcsb.mapviewer.converter.graphics.ConverterParams; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.Species; /** - * This class defines methods used for drawing SpeciesAlias of - * nucleic acid feature in the SBGN way on the - * {@link Graphics2D} object. + * This class defines methods used for drawing SpeciesAlias of nucleic acid + * feature in the SBGN way on the {@link Graphics2D} object. * * @author Michał Kuźma * */ public class SBGNNucleicAcidFeatureConverter extends SpeciesConverter<SpeciesAlias> { - + /** - * How big should be the arc in rectangle for nucleic acid feature representation. + * How big should be the arc in rectangle for nucleic acid feature + * representation. */ - private static final int RECTANGLE_CORNER_ARC_SIZE = 5; + private static final int RECTANGLE_CORNER_ARC_SIZE = 5; /** * Returns shape of SBGN Nucleic acid feature. + * * @param alias - * alias for which the shape should be returned - * @return - * shape of the SBGN Nucleic acid feature for given alias + * alias for which the shape should be returned + * @return shape of the SBGN Nucleic acid feature for given alias */ private Shape getShape(final Alias alias) { GeneralPath bottomRoundedRectangle = new GeneralPath(GeneralPath.WIND_EVEN_ODD); double x = alias.getX(), y = alias.getY(), width = alias.getWidth(), height = alias.getHeight(); - + bottomRoundedRectangle.moveTo(x, y); bottomRoundedRectangle.lineTo(x, y + height - RECTANGLE_CORNER_ARC_SIZE); - bottomRoundedRectangle.curveTo(x, y + height, - x + RECTANGLE_CORNER_ARC_SIZE, y + height, - x + RECTANGLE_CORNER_ARC_SIZE, y + height); + bottomRoundedRectangle.curveTo(x, y + height, x + RECTANGLE_CORNER_ARC_SIZE, y + height, x + RECTANGLE_CORNER_ARC_SIZE, y + height); bottomRoundedRectangle.lineTo(x + width - RECTANGLE_CORNER_ARC_SIZE, y + height); - bottomRoundedRectangle.curveTo(x + width, y + height, - x + width, y + height - RECTANGLE_CORNER_ARC_SIZE, - x + width, y + height - RECTANGLE_CORNER_ARC_SIZE); + bottomRoundedRectangle + .curveTo(x + width, y + height, x + width, y + height - RECTANGLE_CORNER_ARC_SIZE, x + width, y + height - RECTANGLE_CORNER_ARC_SIZE); bottomRoundedRectangle.lineTo(x + width, y); bottomRoundedRectangle.closePath(); return bottomRoundedRectangle; @@ -56,7 +52,7 @@ public class SBGNNucleicAcidFeatureConverter extends SpeciesConverter<SpeciesAli @Override public void drawAlias(SpeciesAlias alias, Graphics2D graphics, ConverterParams params) { - //Unit of information text - multimer cardinality + // Unit of information text - multimer cardinality String unitOfInformationText = null; if (alias.getAliasStatePrefix() != null && alias.getAliasStateLabel() != null) { if (alias.getAliasStatePrefix().equals("free input")) { @@ -65,15 +61,15 @@ public class SBGNNucleicAcidFeatureConverter extends SpeciesConverter<SpeciesAli unitOfInformationText = alias.getAliasStatePrefix() + ":" + alias.getAliasStateLabel(); } } - + int homodir = alias.getHomodimer(); - + alias.setWidth(alias.getWidth() - SpeciesConverter.HOMODIMER_OFFSET * (alias.getHomodimer() - 1)); alias.setHeight(alias.getHeight() - SpeciesConverter.HOMODIMER_OFFSET * (alias.getHomodimer() - 1)); - + alias.setX(alias.getX() + SpeciesConverter.HOMODIMER_OFFSET * homodir); alias.setY(alias.getY() + SpeciesConverter.HOMODIMER_OFFSET * homodir); - + int glyphCount; if (homodir > 1) { glyphCount = 2; @@ -83,19 +79,19 @@ public class SBGNNucleicAcidFeatureConverter extends SpeciesConverter<SpeciesAli for (int i = 0; i < glyphCount; i++) { alias.setX(alias.getX() - SpeciesConverter.HOMODIMER_OFFSET); alias.setY(alias.getY() - SpeciesConverter.HOMODIMER_OFFSET); - + Shape shape = getShape(alias); - + Color c = graphics.getColor(); graphics.setColor(alias.getColor()); graphics.fill(shape); graphics.setColor(c); - + Stroke stroke = graphics.getStroke(); graphics.setStroke(getBorderLine(alias)); graphics.draw(shape); graphics.setStroke(stroke); - + if (i == 1) { if (homodir > 1 && (unitOfInformationText == null || !unitOfInformationText.contains("N:"))) { if (unitOfInformationText == null) { @@ -106,12 +102,12 @@ public class SBGNNucleicAcidFeatureConverter extends SpeciesConverter<SpeciesAli unitOfInformationText = unitOfInformationText.concat("N:").concat(Integer.toString(homodir)); } } - + } - + drawUnitOfInformation(unitOfInformationText, alias, graphics); drawText(alias, graphics, params); - + alias.setWidth(alias.getWidth() + SpeciesConverter.HOMODIMER_OFFSET * (homodir - 1)); alias.setHeight(alias.getHeight() + SpeciesConverter.HOMODIMER_OFFSET * (homodir - 1)); } diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/SimpleMoleculeConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/SimpleMoleculeConverter.java index f01f64b1a4ccbf74506dccb49d5201ca0354778f..35fed2b2387eb7ad41b2ddbd553b0580b9fd4767 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/SimpleMoleculeConverter.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/SimpleMoleculeConverter.java @@ -8,18 +8,16 @@ import java.awt.geom.Ellipse2D; import java.awt.geom.PathIterator; import java.awt.geom.Point2D; +import org.apache.log4j.Logger; + import lcsb.mapviewer.common.exception.InvalidStateException; import lcsb.mapviewer.converter.graphics.ConverterParams; import lcsb.mapviewer.model.map.layout.alias.SimpleMoleculeAlias; -import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.SimpleMolecule; - -import org.apache.log4j.Logger; /** * This class defines methods used for drawing SpeciesAlias of - * {@link lcsb.mapviewer.db.model.map.species.SimpleMolecule SimpleMolecule} on the - * {@link Graphics2D} object. + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.db.model.map.species.SimpleMolecule + * SimpleMolecule} on the {@link Graphics2D} object. * * @author Piotr Gawron * @@ -28,13 +26,14 @@ public class SimpleMoleculeConverter extends SpeciesConverter<SimpleMoleculeAlia /** * Default class logger. */ - private static Logger logger = Logger.getLogger(SimpleMoleculeConverter.class.getName()); + private static Logger logger = Logger.getLogger(SimpleMoleculeConverter.class.getName()); @Override public void drawAlias(final SimpleMoleculeAlias alias, final Graphics2D graphics, final ConverterParams params) { int homodir; if (params.isSbgnFormat()) { - //If the SBGN display mode is set, multimer is shown as two stacked glyphs + // If the SBGN display mode is set, multimer is shown as two stacked + // glyphs if (alias.getHomodimer() > 1) { homodir = 2; } else { @@ -43,16 +42,16 @@ public class SimpleMoleculeConverter extends SpeciesConverter<SimpleMoleculeAlia } else { homodir = alias.getHomodimer(); } - + alias.setWidth(alias.getWidth() - SpeciesConverter.HOMODIMER_OFFSET * (homodir - 1)); alias.setHeight(alias.getHeight() - SpeciesConverter.HOMODIMER_OFFSET * (homodir - 1)); - + // SBGN view - simple molecules are represented as circles if (params.isSbgnFormat()) { alias.setX(alias.getX() + (alias.getWidth() - alias.getHeight()) / 2); alias.setWidth(alias.getHeight()); } - + alias.setX(alias.getX() + SpeciesConverter.HOMODIMER_OFFSET * (homodir)); alias.setY(alias.getY() + SpeciesConverter.HOMODIMER_OFFSET * (homodir)); @@ -68,8 +67,9 @@ public class SimpleMoleculeConverter extends SpeciesConverter<SimpleMoleculeAlia graphics.setStroke(getBorderLine(alias)); graphics.draw(shape); graphics.setStroke(stroke); - - // SBGN view - multimers are displayed with a unit of information containing cardinality + + // SBGN view - multimers are displayed with a unit of information + // containing cardinality if (params.isSbgnFormat() && (i == homodir - 1)) { String unitOfInformationText = null; if (alias.getAliasStatePrefix() != null && alias.getAliasStateLabel() != null) { @@ -83,7 +83,7 @@ public class SimpleMoleculeConverter extends SpeciesConverter<SimpleMoleculeAlia } unitOfInformationText += "N:" + alias.getHomodimer(); } - + drawUnitOfInformation(unitOfInformationText, alias, graphics); } } diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/UnknownConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/UnknownConverter.java index ac97a2a4f06fc12174f07be53a5e25a6b41a9b92..4337fe9367b03b652561995d56777da32ca84dc7 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/UnknownConverter.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/species/UnknownConverter.java @@ -1,70 +1,70 @@ -package lcsb.mapviewer.converter.graphics.species; - -import java.awt.Color; -import java.awt.Graphics2D; -import java.awt.Shape; -import java.awt.Stroke; -import java.awt.geom.Ellipse2D; -import java.awt.geom.PathIterator; -import java.awt.geom.Point2D; - -import lcsb.mapviewer.common.exception.InvalidStateException; -import lcsb.mapviewer.converter.graphics.ConverterParams; -import lcsb.mapviewer.model.graphics.LineType; -import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; - -import org.apache.log4j.Logger; - -/** - * This class defines methods used for drawing SpeciesAlias of - * {@link lcsb.mapviewer.db.model.map.species.Unknown Unknown} on the - * {@link Graphics2D} object. - * - * @author Piotr Gawron - * - */ -public class UnknownConverter extends SpeciesConverter<SpeciesAlias> { - /** - * Default class logger. - */ - private static Logger logger = Logger.getLogger(UnknownConverter.class.getName()); - - @Override - public void drawAlias(final SpeciesAlias alias, final Graphics2D graphics, final ConverterParams params) { - if (alias.getActivity()) { - int border = ACTIVITY_BORDER_DISTANCE; - alias.increaseBorder(border); - Shape shape2 = new Ellipse2D.Double(alias.getX(), alias.getY(), alias.getWidth(), alias.getHeight()); - Stroke stroke = graphics.getStroke(); - graphics.setStroke(LineType.DOTTED.getStroke()); - graphics.draw(shape2); - graphics.setStroke(stroke); - alias.increaseBorder(-border); - } - - Shape shape = new Ellipse2D.Double(alias.getX(), alias.getY(), alias.getWidth(), alias.getHeight()); - Color c = graphics.getColor(); - graphics.setColor(alias.getColor()); - graphics.fill(shape); - graphics.setColor(c); - drawText(alias, graphics, params); - } - - @Override - public PathIterator getBoundPathIterator(final SpeciesAlias alias) { - throw new InvalidStateException("This class doesn't provide boundPath"); - } - - @Override - public Point2D getPointCoordinatesOnBorder(final SpeciesAlias alias, final double angle) { - if (alias.getWidth() == 0 && alias.getHeight() == 0) { - logger.warn("Looking for coordinates for unknown of 0 size"); - return alias.getCenter(); - } - Point2D result; - result = getEllipseTransformation().getPointOnEllipseByRadian(alias.getX(), alias.getY(), alias.getWidth(), alias.getHeight(), angle); - return result; - - } - -} +package lcsb.mapviewer.converter.graphics.species; + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.Shape; +import java.awt.Stroke; +import java.awt.geom.Ellipse2D; +import java.awt.geom.PathIterator; +import java.awt.geom.Point2D; + +import lcsb.mapviewer.common.exception.InvalidStateException; +import lcsb.mapviewer.converter.graphics.ConverterParams; +import lcsb.mapviewer.model.graphics.LineType; +import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; + +import org.apache.log4j.Logger; + +/** + * This class defines methods used for drawing SpeciesAlias of + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.db.model.map.species.Unknown Unknown} on the + * {@link Graphics2D} object. + * + * @author Piotr Gawron + * + */ +public class UnknownConverter extends SpeciesConverter<SpeciesAlias> { + /** + * Default class logger. + */ + private static Logger logger = Logger.getLogger(UnknownConverter.class.getName()); + + @Override + public void drawAlias(final SpeciesAlias alias, final Graphics2D graphics, final ConverterParams params) { + if (alias.getActivity()) { + int border = ACTIVITY_BORDER_DISTANCE; + alias.increaseBorder(border); + Shape shape2 = new Ellipse2D.Double(alias.getX(), alias.getY(), alias.getWidth(), alias.getHeight()); + Stroke stroke = graphics.getStroke(); + graphics.setStroke(LineType.DOTTED.getStroke()); + graphics.draw(shape2); + graphics.setStroke(stroke); + alias.increaseBorder(-border); + } + + Shape shape = new Ellipse2D.Double(alias.getX(), alias.getY(), alias.getWidth(), alias.getHeight()); + Color c = graphics.getColor(); + graphics.setColor(alias.getColor()); + graphics.fill(shape); + graphics.setColor(c); + drawText(alias, graphics, params); + } + + @Override + public PathIterator getBoundPathIterator(final SpeciesAlias alias) { + throw new InvalidStateException("This class doesn't provide boundPath"); + } + + @Override + public Point2D getPointCoordinatesOnBorder(final SpeciesAlias alias, final double angle) { + if (alias.getWidth() == 0 && alias.getHeight() == 0) { + logger.warn("Looking for coordinates for unknown of 0 size"); + return alias.getCenter(); + } + Point2D result; + result = getEllipseTransformation().getPointOnEllipseByRadian(alias.getX(), alias.getY(), alias.getWidth(), alias.getHeight(), angle); + return result; + + } + +} diff --git a/converter-graphics/src/test/java/lcsb/mapviewer/converter/graphics/NormalImageGeneratorTest.java b/converter-graphics/src/test/java/lcsb/mapviewer/converter/graphics/NormalImageGeneratorTest.java index 80f0a3bfa9c4394f1fb98e7e17a9e1ec90f3ec01..59817921e0cb98a0dc2a0cf69148e66fa05980d7 100644 --- a/converter-graphics/src/test/java/lcsb/mapviewer/converter/graphics/NormalImageGeneratorTest.java +++ b/converter-graphics/src/test/java/lcsb/mapviewer/converter/graphics/NormalImageGeneratorTest.java @@ -26,8 +26,6 @@ import lcsb.mapviewer.model.map.layout.graphics.Layer; import lcsb.mapviewer.model.map.layout.graphics.LayerText; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelFullIndexed; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.GenericProtein; public class NormalImageGeneratorTest { static Logger logger = Logger.getLogger(NormalImageGenerator.class); @@ -66,7 +64,7 @@ public class NormalImageGeneratorTest { public void testComplexConversion() throws Exception { scale = null; try { - AliasConverter.addElementConverter(ComplexSpecies.class, new TmpComplexConverter()); + AliasConverter.addAliasConverter(ComplexAlias.class, new TmpComplexConverter()); Model model = createComplexModel(); new CreateHierarchyCommand(model, 2, 2).execute(); @@ -86,24 +84,16 @@ public class NormalImageGeneratorTest { model.setWidth(600); model.setHeight(600); - ComplexSpecies complex = new ComplexSpecies(); - complex.setName("a"); - complex.setElementId("c1"); - - ComplexAlias alias = new ComplexAlias(complex); - alias.setAliasId("1"); + ComplexAlias alias = new ComplexAlias("1"); + alias.setName("a"); alias.setX(10); alias.setY(10); alias.setWidth(200); alias.setHeight(50); model.addAlias(alias); - GenericProtein protein = new GenericProtein(); - protein.setName("b"); - protein.setElementId("s1"); - - SpeciesAlias a2 = new GenericProteinAlias(protein); - a2.setAliasId("2"); + SpeciesAlias a2 = new GenericProteinAlias("2"); + a2.setName("b"); a2.setX(10); a2.setY(100); a2.setWidth(200); @@ -159,12 +149,8 @@ public class NormalImageGeneratorTest { layer.addLayerLine(new PolylineData(new Point2D.Double(0, 0), new Point2D.Double(100, 100))); - ComplexSpecies complex = new ComplexSpecies(); - complex.setName("a"); - complex.setElementId("c1"); - - ComplexAlias alias = new ComplexAlias(complex); - alias.setAliasId("1"); + ComplexAlias alias = new ComplexAlias("1"); + alias.setName("a"); alias.setX(300); alias.setY(90); alias.setWidth(100); diff --git a/converter-graphics/src/test/java/lcsb/mapviewer/converter/graphics/PdfImageGeneratorTest.java b/converter-graphics/src/test/java/lcsb/mapviewer/converter/graphics/PdfImageGeneratorTest.java index 574b4bc41de36e98331f7405972cbeca486ff19a..eeef94d0f576fca1d4da142dbf4e02804e1dbf52 100644 --- a/converter-graphics/src/test/java/lcsb/mapviewer/converter/graphics/PdfImageGeneratorTest.java +++ b/converter-graphics/src/test/java/lcsb/mapviewer/converter/graphics/PdfImageGeneratorTest.java @@ -8,6 +8,10 @@ import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.io.File; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + import lcsb.mapviewer.commands.CreateHierarchyCommand; import lcsb.mapviewer.converter.graphics.AbstractImageGenerator.Params; import lcsb.mapviewer.model.graphics.PolylineData; @@ -16,11 +20,6 @@ import lcsb.mapviewer.model.map.layout.graphics.Layer; import lcsb.mapviewer.model.map.layout.graphics.LayerText; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelFullIndexed; -import lcsb.mapviewer.model.map.species.ComplexSpecies; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; public class PdfImageGeneratorTest { @@ -41,7 +40,7 @@ public class PdfImageGeneratorTest { if (f.exists()) { f.delete(); } - + assertFalse(f.exists()); Model model = createCompartmentModel(); @@ -89,12 +88,8 @@ public class PdfImageGeneratorTest { layer.addLayerLine(new PolylineData(new Point2D.Double(0, 0), new Point2D.Double(100, 100))); - ComplexSpecies complex = new ComplexSpecies(); - complex.setName("a"); - complex.setElementId("c1"); - - ComplexAlias alias = new ComplexAlias(complex); - alias.setAliasId("1"); + ComplexAlias alias = new ComplexAlias("1"); + alias.setName("a"); alias.setX(300); alias.setY(90); alias.setWidth(100); diff --git a/converter-graphics/src/test/java/lcsb/mapviewer/converter/graphics/placefinder/AllPlaceFinderTest.java b/converter-graphics/src/test/java/lcsb/mapviewer/converter/graphics/placefinder/AllPlaceFinderTest.java index 303a4e33799c6dbd0cf3416e1e4b20f59c83e18c..4acd4cebfd557b79f72e1b06f693ce0fd558f983 100644 --- a/converter-graphics/src/test/java/lcsb/mapviewer/converter/graphics/placefinder/AllPlaceFinderTest.java +++ b/converter-graphics/src/test/java/lcsb/mapviewer/converter/graphics/placefinder/AllPlaceFinderTest.java @@ -7,22 +7,21 @@ import java.awt.geom.Rectangle2D; import java.io.IOException; import java.util.Arrays; +import org.apache.log4j.Logger; +import org.junit.Test; + import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.SquareCompartmentAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelFullIndexed; -import org.apache.log4j.Logger; -import org.junit.Test; - public class AllPlaceFinderTest { - Logger logger = Logger.getLogger(AllPlaceFinderTest.class); - final String out = "map_images/testOutput"; - final String folder = "testFiles/placeFinderFiles/"; + Logger logger = Logger.getLogger(AllPlaceFinderTest.class); + final String out = "map_images/testOutput"; + final String folder = "testFiles/placeFinderFiles/"; - int id = 10; + int id = 10; @Test public void oneEmptyCompartments() throws InvalidXmlSchemaException, IOException { diff --git a/converter-graphics/src/test/java/lcsb/mapviewer/converter/graphics/species/SpeciesConverterTest.java b/converter-graphics/src/test/java/lcsb/mapviewer/converter/graphics/species/SpeciesConverterTest.java index cb172341f1132d1cb33d05a749dce897d4443042..1f93051927e9b9e84e60014f1c94dceeeee9b603 100644 --- a/converter-graphics/src/test/java/lcsb/mapviewer/converter/graphics/species/SpeciesConverterTest.java +++ b/converter-graphics/src/test/java/lcsb/mapviewer/converter/graphics/species/SpeciesConverterTest.java @@ -19,8 +19,6 @@ import lcsb.mapviewer.model.map.layout.ColorSchema; import lcsb.mapviewer.model.map.layout.GenericColorSchema; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; -import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.GenericProtein; public class SpeciesConverterTest { @@ -40,8 +38,7 @@ public class SpeciesConverterTest { return super.getResidueCoordinates(alias, angle); } } - GenericProtein protein = new GenericProtein(); - GenericProteinAlias alias = new GenericProteinAlias(protein); + GenericProteinAlias alias = new GenericProteinAlias("id"); alias.setX(135); alias.setY(194.0); alias.setWidth(130); @@ -180,9 +177,8 @@ public class SpeciesConverterTest { } private GenericProteinAlias createAlias() { - GenericProtein protein = new GenericProtein(); - protein.setName("NAME_OF_THE_ELEMENT"); - GenericProteinAlias alias = new GenericProteinAlias(protein); + GenericProteinAlias alias = new GenericProteinAlias("id"); + alias.setName("NAME_OF_THE_ELEMENT"); alias.setX(10); alias.setY(20); alias.setWidth(100); diff --git a/converter/src/test/java/lcsb/mapviewer/converter/ComplexZipConverterTest.java b/converter/src/test/java/lcsb/mapviewer/converter/ComplexZipConverterTest.java index ad071e18107b2ac411d7b3f03305dd368d90cb26..5abb11d2129a4b7dc3a5f1074d559467755e9917 100644 --- a/converter/src/test/java/lcsb/mapviewer/converter/ComplexZipConverterTest.java +++ b/converter/src/test/java/lcsb/mapviewer/converter/ComplexZipConverterTest.java @@ -22,6 +22,10 @@ import org.junit.Test; import lcsb.mapviewer.common.MimeType; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidClassException; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Phenotype; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; import lcsb.mapviewer.converter.zip.ModelZipEntryFile; import lcsb.mapviewer.converter.zip.ZipEntryFileFactory; import lcsb.mapviewer.model.map.InconsistentModelException; @@ -41,10 +45,6 @@ import lcsb.mapviewer.model.map.reaction.Product; import lcsb.mapviewer.model.map.reaction.Reactant; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.type.TransportReaction; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Phenotype; -import lcsb.mapviewer.model.map.species.Protein; public class ComplexZipConverterTest { private static Logger logger = Logger.getLogger(ComplexZipConverterTest.class); diff --git a/editor/src/main/java/lcsb/mapviewer/editor/gui/detailstab/CreateChangeFormerSymbolCommand.java b/editor/src/main/java/lcsb/mapviewer/editor/gui/detailstab/CreateChangeFormerSymbolCommand.java index a0a7ccd0eec7381ac5c3b717cb5b0a326bc8429c..e95dbc30215cfe5b547db62d861ac5098a8fb30c 100644 --- a/editor/src/main/java/lcsb/mapviewer/editor/gui/detailstab/CreateChangeFormerSymbolCommand.java +++ b/editor/src/main/java/lcsb/mapviewer/editor/gui/detailstab/CreateChangeFormerSymbolCommand.java @@ -1,49 +1,49 @@ -package lcsb.mapviewer.editor.gui.detailstab; - -import java.util.List; - -import javax.swing.JList; - -import lcsb.mapviewer.commands.ModelCommand; -import lcsb.mapviewer.commands.properties.AddElementFormerSymbolsCommand; -import lcsb.mapviewer.commands.properties.ChangeElementFormerSymbolCommand; -import lcsb.mapviewer.commands.properties.RemoveElementFormerSymbolsCommand; -import lcsb.mapviewer.model.map.layout.alias.Alias; -import lcsb.mapviewer.model.map.model.Model; - -/** - * Class that creates commands that modifies - * {@link lcsb.mapviewer.model.map.Element#formerSymbols} from gui input for - * given {@link Model} and {@link Alias}. - * - * @author Piotr Gawron - * - */ -public class CreateChangeFormerSymbolCommand extends CreateListPropertyChangeCommand<String> { - - /** - * Default constructor. - * - * @param list - * GUI input from which {@link ModelCommand} will be created - */ - CreateChangeFormerSymbolCommand(JList<String> list) { - super(list); - } - - @Override - protected ModelCommand createRemoveCommand(Model model, Alias alias, List<String> values) { - return new RemoveElementFormerSymbolsCommand(model, alias, values); - } - - @Override - protected ModelCommand createChangeCommand(Model model, Alias alias, String newValue, String oldValue) { - return new ChangeElementFormerSymbolCommand(model, alias, newValue, oldValue); - } - - @Override - protected ModelCommand createAddCommand(Model model, Alias alias, List<String> newValues) { - return new AddElementFormerSymbolsCommand(model, alias, newValues); - } - -} +package lcsb.mapviewer.editor.gui.detailstab; + +import java.util.List; + +import javax.swing.JList; + +import lcsb.mapviewer.commands.ModelCommand; +import lcsb.mapviewer.commands.properties.AddElementFormerSymbolsCommand; +import lcsb.mapviewer.commands.properties.ChangeElementFormerSymbolCommand; +import lcsb.mapviewer.commands.properties.RemoveElementFormerSymbolsCommand; +import lcsb.mapviewer.model.map.layout.alias.Alias; +import lcsb.mapviewer.model.map.model.Model; + +/** + * Class that creates commands that modifies + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#formerSymbols} from gui input for + * given {@link Model} and {@link Alias}. + * + * @author Piotr Gawron + * + */ +public class CreateChangeFormerSymbolCommand extends CreateListPropertyChangeCommand<String> { + + /** + * Default constructor. + * + * @param list + * GUI input from which {@link ModelCommand} will be created + */ + CreateChangeFormerSymbolCommand(JList<String> list) { + super(list); + } + + @Override + protected ModelCommand createRemoveCommand(Model model, Alias alias, List<String> values) { + return new RemoveElementFormerSymbolsCommand(model, alias, values); + } + + @Override + protected ModelCommand createChangeCommand(Model model, Alias alias, String newValue, String oldValue) { + return new ChangeElementFormerSymbolCommand(model, alias, newValue, oldValue); + } + + @Override + protected ModelCommand createAddCommand(Model model, Alias alias, List<String> newValues) { + return new AddElementFormerSymbolsCommand(model, alias, newValues); + } + +} diff --git a/editor/src/main/java/lcsb/mapviewer/editor/gui/detailstab/CreateChangeNameCommand.java b/editor/src/main/java/lcsb/mapviewer/editor/gui/detailstab/CreateChangeNameCommand.java index 693efb5cd6db651972d56cf0f3f32fb40a959e6a..fbfe2a23ada25416434c688e8305bdec6b88df50 100644 --- a/editor/src/main/java/lcsb/mapviewer/editor/gui/detailstab/CreateChangeNameCommand.java +++ b/editor/src/main/java/lcsb/mapviewer/editor/gui/detailstab/CreateChangeNameCommand.java @@ -1,31 +1,31 @@ -package lcsb.mapviewer.editor.gui.detailstab; - -import javax.swing.JTextField; -import javax.swing.text.JTextComponent; - -import lcsb.mapviewer.commands.ModelCommand; -import lcsb.mapviewer.commands.properties.ChangeElementNameCommand; -import lcsb.mapviewer.model.map.layout.alias.Alias; -import lcsb.mapviewer.model.map.model.Model; - -/** - * Class with method executed when text property of - * {@link lcsb.mapviewer.model.map.Element} is changed. - * - */ -public class CreateChangeNameCommand extends CreatePropertyChangeCommand { - /** - * Default constructor. - * - * @param field - * GUI input from which {@link ModelCommand} will be created - */ - CreateChangeNameCommand(JTextField field) { - super(field); - } - - @Override - public ModelCommand createCommand(Model model, Alias alias) { - return new ChangeElementNameCommand(model, alias, ((JTextComponent) getField()).getText()); - } -} +package lcsb.mapviewer.editor.gui.detailstab; + +import javax.swing.JTextField; +import javax.swing.text.JTextComponent; + +import lcsb.mapviewer.commands.ModelCommand; +import lcsb.mapviewer.commands.properties.ChangeElementNameCommand; +import lcsb.mapviewer.model.map.layout.alias.Alias; +import lcsb.mapviewer.model.map.model.Model; + +/** + * Class with method executed when text property of + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element} is changed. + * + */ +public class CreateChangeNameCommand extends CreatePropertyChangeCommand { + /** + * Default constructor. + * + * @param field + * GUI input from which {@link ModelCommand} will be created + */ + CreateChangeNameCommand(JTextField field) { + super(field); + } + + @Override + public ModelCommand createCommand(Model model, Alias alias) { + return new ChangeElementNameCommand(model, alias, ((JTextComponent) getField()).getText()); + } +} diff --git a/editor/src/main/java/lcsb/mapviewer/editor/gui/detailstab/CreateChangeSynonymCommand.java b/editor/src/main/java/lcsb/mapviewer/editor/gui/detailstab/CreateChangeSynonymCommand.java index 3ed3062e4a6edfff48cd20e7aa4cbd2f8a7edf60..e7aec33f5ae097c426b504eceb478beece62de56 100644 --- a/editor/src/main/java/lcsb/mapviewer/editor/gui/detailstab/CreateChangeSynonymCommand.java +++ b/editor/src/main/java/lcsb/mapviewer/editor/gui/detailstab/CreateChangeSynonymCommand.java @@ -1,49 +1,49 @@ -package lcsb.mapviewer.editor.gui.detailstab; - -import java.util.List; - -import javax.swing.JList; - -import lcsb.mapviewer.commands.ModelCommand; -import lcsb.mapviewer.commands.properties.AddElementSynonymsCommand; -import lcsb.mapviewer.commands.properties.ChangeElementSynonymCommand; -import lcsb.mapviewer.commands.properties.RemoveElementSynonymsCommand; -import lcsb.mapviewer.model.map.layout.alias.Alias; -import lcsb.mapviewer.model.map.model.Model; - -/** - * Class that creates commands that modifies - * {@link lcsb.mapviewer.model.map.Element#synonyms} from gui input for - * given {@link Model} and {@link Alias}. - * - * @author Piotr Gawron - * - */ -public class CreateChangeSynonymCommand extends CreateListPropertyChangeCommand<String> { - - /** - * Default constructor. - * - * @param list - * GUI input from which {@link ModelCommand} will be created - */ - CreateChangeSynonymCommand(JList<String> list) { - super(list); - } - - @Override - protected ModelCommand createRemoveCommand(Model model, Alias alias, List<String> values) { - return new RemoveElementSynonymsCommand(model, alias, values); - } - - @Override - protected ModelCommand createChangeCommand(Model model, Alias alias, String newValue, String oldValue) { - return new ChangeElementSynonymCommand(model, alias, newValue, oldValue); - } - - @Override - protected ModelCommand createAddCommand(Model model, Alias alias, List<String> newValues) { - return new AddElementSynonymsCommand(model, alias, newValues); - } - -} +package lcsb.mapviewer.editor.gui.detailstab; + +import java.util.List; + +import javax.swing.JList; + +import lcsb.mapviewer.commands.ModelCommand; +import lcsb.mapviewer.commands.properties.AddElementSynonymsCommand; +import lcsb.mapviewer.commands.properties.ChangeElementSynonymCommand; +import lcsb.mapviewer.commands.properties.RemoveElementSynonymsCommand; +import lcsb.mapviewer.model.map.layout.alias.Alias; +import lcsb.mapviewer.model.map.model.Model; + +/** + * Class that creates commands that modifies + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#synonyms} from gui input for + * given {@link Model} and {@link Alias}. + * + * @author Piotr Gawron + * + */ +public class CreateChangeSynonymCommand extends CreateListPropertyChangeCommand<String> { + + /** + * Default constructor. + * + * @param list + * GUI input from which {@link ModelCommand} will be created + */ + CreateChangeSynonymCommand(JList<String> list) { + super(list); + } + + @Override + protected ModelCommand createRemoveCommand(Model model, Alias alias, List<String> values) { + return new RemoveElementSynonymsCommand(model, alias, values); + } + + @Override + protected ModelCommand createChangeCommand(Model model, Alias alias, String newValue, String oldValue) { + return new ChangeElementSynonymCommand(model, alias, newValue, oldValue); + } + + @Override + protected ModelCommand createAddCommand(Model model, Alias alias, List<String> newValues) { + return new AddElementSynonymsCommand(model, alias, newValues); + } + +} diff --git a/editor/src/main/java/lcsb/mapviewer/editor/gui/detailstab/ElementDetailsPanel.java b/editor/src/main/java/lcsb/mapviewer/editor/gui/detailstab/ElementDetailsPanel.java index e544119e74b2d50294e19f9720d6a7aed05935b9..5c02dce6505ab6dc8ba5bf394191fc1758d235ca 100644 --- a/editor/src/main/java/lcsb/mapviewer/editor/gui/detailstab/ElementDetailsPanel.java +++ b/editor/src/main/java/lcsb/mapviewer/editor/gui/detailstab/ElementDetailsPanel.java @@ -74,12 +74,12 @@ public class ElementDetailsPanel extends JPanel { private final Logger logger = Logger.getLogger(ElementDetailsPanel.class); /** - * Label for {@link lcsb.mapviewer.model.map.Element#name} parameter. + * Label for {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#name} parameter. */ private JLabel nameLabel; /** - * Label for {@link lcsb.mapviewer.model.map.Element#getElementId()} + * Label for {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#getElementId()} * parameter. */ private JLabel idLabel; @@ -105,53 +105,53 @@ public class ElementDetailsPanel extends JPanel { private JLabel colorLabel; /** - * Label for {@link lcsb.mapviewer.model.map.Element#notes} parameter. + * Label for {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#notes} parameter. */ private JLabel notesLabel; /** - * Label for {@link lcsb.mapviewer.model.map.Element#symbol} parameter. + * Label for {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#symbol} parameter. */ private JLabel symbolLabel; /** - * Label for {@link lcsb.mapviewer.model.map.Element#fullName} parameter. + * Label for {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#fullName} parameter. */ private JLabel fullNameLabel; /** - * Label for {@link lcsb.mapviewer.model.map.Element#abbreviation} parameter. + * Label for {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#abbreviation} parameter. */ private JLabel abbreviationLabel; /** - * Label for {@link lcsb.mapviewer.model.map.Element#formula} parameter. + * Label for {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#formula} parameter. */ private JLabel formulaLabel; /** - * Label for {@link lcsb.mapviewer.model.map.Element#synonyms} parameter. + * Label for {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#synonyms} parameter. */ private JLabel synonymsLabel; /** - * Label for {@link lcsb.mapviewer.model.map.Element#formerSymbols} parameter. + * Label for {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#formerSymbols} parameter. */ private JLabel formerSymbolsLabel; /** - * Label for {@link lcsb.mapviewer.model.map.Element#symbol} parameter. + * Label for {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#symbol} parameter. */ private JLabel miriamDataLabel; /** - * {@link JTextField} for {@link lcsb.mapviewer.model.map.Element#name} + * {@link JTextField} for {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#name} * parameter. */ private JTextField nameText; /** - * {@link JTextField} for {@link lcsb.mapviewer.model.map.Element#name} + * {@link JTextField} for {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#name} * parameter. */ private JTextField idText; @@ -177,69 +177,69 @@ public class ElementDetailsPanel extends JPanel { private JButton colorButton; /** - * {@link JTextField} for {@link lcsb.mapviewer.model.map.Element#notes} + * {@link JTextField} for {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#notes} * parameter. */ private JTextArea notesText; /** - * {@link JTextField} for {@link lcsb.mapviewer.model.map.Element#symbol} + * {@link JTextField} for {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#symbol} * parameter. */ private JTextField symbolText; /** - * {@link JTextField} for {@link lcsb.mapviewer.model.map.Element#fullName} + * {@link JTextField} for {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#fullName} * parameter. */ private JTextField fullNameText; /** * {@link JTextField} for - * {@link lcsb.mapviewer.model.map.Element#abbreviation} parameter. + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#abbreviation} parameter. */ private JTextField abbreviationText; /** - * {@link JTextField} for {@link lcsb.mapviewer.model.map.Element#formula} + * {@link JTextField} for {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#formula} * parameter. */ private JTextField formulaText; /** - * {@link JList} for {@link lcsb.mapviewer.model.map.Element#synonyms} + * {@link JList} for {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#synonyms} * parameter. */ private JList<String> synonymsList; /** * {@link JList} for - * {@link lcsb.mapviewer.model.map.Element#formerSymbols} parameter. + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#formerSymbols} parameter. */ private JList<String> formerSymbolsList; /** - * {@link JList} for {@link lcsb.mapviewer.model.map.Element#miriamData} + * {@link JList} for {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#miriamData} * parameter. */ private JList<MiriamData> miriamDataList; /** - * List of synonyms in {@link lcsb.mapviewer.model.map.Element#synonyms}. + * List of synonyms in {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#synonyms}. * * @see {@link #synonymsList} */ private DefaultListModel<String> synonymsListModel = new DefaultListModel<>(); /** - * List of synonyms in {@link lcsb.mapviewer.model.map.Element#formerSymbols}. + * List of synonyms in {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#formerSymbols}. * * @see {@link #formerSymbolsList} */ private DefaultListModel<String> formerSymbolsListModel = new DefaultListModel<>(); /** - * List of synonyms in {@link lcsb.mapviewer.model.map.Element#miriamData}. + * List of synonyms in {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#miriamData}. * * @see {@link #miriamDataList} */ diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/ColorModelCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/ColorModelCommand.java index 8453b5d1653600ef9e61ffdb9562f6e994ec0d7a..fe7b37500cbba5ba95861dd327eddbbac078cc96 100644 --- a/model-command/src/main/java/lcsb/mapviewer/commands/ColorModelCommand.java +++ b/model-command/src/main/java/lcsb/mapviewer/commands/ColorModelCommand.java @@ -11,6 +11,7 @@ import org.apache.log4j.Logger; import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.graphics.ArrowTypeData; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; @@ -26,7 +27,6 @@ import lcsb.mapviewer.model.map.reaction.AbstractNode; import lcsb.mapviewer.model.map.reaction.Product; import lcsb.mapviewer.model.map.reaction.Reactant; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.Species; /** * This {@link ModelCommand} colors a model (nodes and reactions) according to diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/SubModelCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/SubModelCommand.java index 08a50071aa230fcb6bd2caaeb5b7bd48e51773a5..a5026776c0e36747f4d34cac2528ec7bfe4e5ada 100644 --- a/model-command/src/main/java/lcsb/mapviewer/commands/SubModelCommand.java +++ b/model-command/src/main/java/lcsb/mapviewer/commands/SubModelCommand.java @@ -7,7 +7,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/properties/AddElementFormerSymbolsCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/properties/AddElementFormerSymbolsCommand.java index d9d57309a5bf07217229071ac16732aafeef3774..e1cf4f0d1a0ed37e22aac858d120d692015f02c2 100644 --- a/model-command/src/main/java/lcsb/mapviewer/commands/properties/AddElementFormerSymbolsCommand.java +++ b/model-command/src/main/java/lcsb/mapviewer/commands/properties/AddElementFormerSymbolsCommand.java @@ -10,7 +10,7 @@ import org.apache.log4j.Logger; /** * {@link lcsb.mapviewer.commands.ModelCommand ModelCommand} that changes - * former sybmols of the {@link lcsb.mapviewer.model.map.Element Element} connected to + * former sybmols of the {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element Element} connected to * {@link Alias}. * * @author Piotr Gawron @@ -32,7 +32,7 @@ public class AddElementFormerSymbolsCommand extends AddElementPropertyListEntryC * @param alias * {@link ChangeElementPropertyCommand#alias} * @param values - * new {@link lcsb.mapviewer.model.map.Element#synonym} values to be + * new {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#synonym} values to be * added */ public AddElementFormerSymbolsCommand(Model model, Alias alias, List<String> values) { diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/properties/AddElementMiriamDataCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/properties/AddElementMiriamDataCommand.java index 3e5b2440e9d951dfcce349a1b8893ec2c2bd0d2f..2785204d23a2a3b91715a6f008b4c3f2e1fb380e 100644 --- a/model-command/src/main/java/lcsb/mapviewer/commands/properties/AddElementMiriamDataCommand.java +++ b/model-command/src/main/java/lcsb/mapviewer/commands/properties/AddElementMiriamDataCommand.java @@ -12,7 +12,7 @@ import org.apache.log4j.Logger; /** * {@link lcsb.mapviewer.commands.ModelCommand ModelCommand} that changes * {@link MiriamData annotations} of the - * {@link lcsb.mapviewer.model.map.Element Element} connected to {@link Alias}. + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element Element} connected to {@link Alias}. * * @author Piotr Gawron * diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/properties/AddElementPropertyListEntryCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/properties/AddElementPropertyListEntryCommand.java index 2b52484c703f5f1d66e2914b1cbee56335316ddd..dd2f07fe56c0304ddeb20686fbb3df13220a75ff 100644 --- a/model-command/src/main/java/lcsb/mapviewer/commands/properties/AddElementPropertyListEntryCommand.java +++ b/model-command/src/main/java/lcsb/mapviewer/commands/properties/AddElementPropertyListEntryCommand.java @@ -1,93 +1,93 @@ -package lcsb.mapviewer.commands.properties; - -import java.util.List; - -import lcsb.mapviewer.commands.CommandExecutionException; -import lcsb.mapviewer.commands.ModelCommand; -import lcsb.mapviewer.commands.ModelCommandStatus; -import lcsb.mapviewer.model.map.layout.alias.Alias; -import lcsb.mapviewer.model.map.model.Model; - -/** - * {@link lcsb.mapviewer.commands.ModelCommand ModelCommand} that add entries - * into a property of the {@link lcsb.mapviewer.model.map.Element Element} that - * is list. {@link lcsb.mapviewer.model.map.Element Element} is connected to - * {@link Alias}. - * - * @param <T> - * class of property to edit - * - * @author Piotr Gawron - * - */ -public abstract class AddElementPropertyListEntryCommand<T> extends ModelCommand { - - /** - * List of new values that should be added to property. - */ - private List<T> newValues; - - /** - * {@link Alias} for which we will change the property. - */ - private Alias alias; - - /** - * Default constructor. - * - * @param model - * model to move - * - * @param alias - * alias to be changed - * - * @param newValues - * new values of the element property that will be added - * - */ - public AddElementPropertyListEntryCommand(Model model, Alias alias, List<T> newValues) { - super(model); - this.alias = alias; - this.newValues = newValues; - } - - @Override - protected void redoImplementation() throws CommandExecutionException { - executeImplementation(); - setStatus(ModelCommandStatus.EXECUTED); - } - - /** - * @return the alias - * @see #alias - */ - protected Alias getAlias() { - return alias; - } - - /** - * @param alias - * the alias to set - * @see #alias - */ - protected void setAlias(Alias alias) { - this.alias = alias; - } - - /** - * @return the newValue - * @see #newValue - */ - protected List<T> getNewValues() { - return newValues; - } - - /** - * @param newValue - * the newValue to set - * @see #newValue - */ - protected void setNewValues(List<T> newValue) { - this.newValues = newValue; - } -} +package lcsb.mapviewer.commands.properties; + +import java.util.List; + +import lcsb.mapviewer.commands.CommandExecutionException; +import lcsb.mapviewer.commands.ModelCommand; +import lcsb.mapviewer.commands.ModelCommandStatus; +import lcsb.mapviewer.model.map.layout.alias.Alias; +import lcsb.mapviewer.model.map.model.Model; + +/** + * {@link lcsb.mapviewer.commands.ModelCommand ModelCommand} that add entries + * into a property of the {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element Element} that + * is list. {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element Element} is connected to + * {@link Alias}. + * + * @param <T> + * class of property to edit + * + * @author Piotr Gawron + * + */ +public abstract class AddElementPropertyListEntryCommand<T> extends ModelCommand { + + /** + * List of new values that should be added to property. + */ + private List<T> newValues; + + /** + * {@link Alias} for which we will change the property. + */ + private Alias alias; + + /** + * Default constructor. + * + * @param model + * model to move + * + * @param alias + * alias to be changed + * + * @param newValues + * new values of the element property that will be added + * + */ + public AddElementPropertyListEntryCommand(Model model, Alias alias, List<T> newValues) { + super(model); + this.alias = alias; + this.newValues = newValues; + } + + @Override + protected void redoImplementation() throws CommandExecutionException { + executeImplementation(); + setStatus(ModelCommandStatus.EXECUTED); + } + + /** + * @return the alias + * @see #alias + */ + protected Alias getAlias() { + return alias; + } + + /** + * @param alias + * the alias to set + * @see #alias + */ + protected void setAlias(Alias alias) { + this.alias = alias; + } + + /** + * @return the newValue + * @see #newValue + */ + protected List<T> getNewValues() { + return newValues; + } + + /** + * @param newValue + * the newValue to set + * @see #newValue + */ + protected void setNewValues(List<T> newValue) { + this.newValues = newValue; + } +} diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/properties/AddElementSynonymsCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/properties/AddElementSynonymsCommand.java index 059e33828fb5b06f2c694393cba7ca3f70363171..41a529447c641669f889fb76a4e24725e0a4a3da 100644 --- a/model-command/src/main/java/lcsb/mapviewer/commands/properties/AddElementSynonymsCommand.java +++ b/model-command/src/main/java/lcsb/mapviewer/commands/properties/AddElementSynonymsCommand.java @@ -10,7 +10,7 @@ import org.apache.log4j.Logger; /** * {@link lcsb.mapviewer.commands.ModelCommand ModelCommand} that changes - * synonyms of the {@link lcsb.mapviewer.model.map.Element Element} connected to + * synonyms of the {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element Element} connected to * {@link Alias}. * * @author Piotr Gawron @@ -32,7 +32,7 @@ public class AddElementSynonymsCommand extends AddElementPropertyListEntryComman * @param alias * {@link ChangeElementPropertyCommand#alias} * @param values - * new {@link lcsb.mapviewer.model.map.Element#synonym} values to be + * new {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#synonym} values to be * added */ public AddElementSynonymsCommand(Model model, Alias alias, List<String> values) { diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementFormerSymbolCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementFormerSymbolCommand.java index 025c586f4565b3a6ef7bc81ea8059c82a715d109..59c47fcbae14a43f2d0719ef440a7c4041a26b94 100644 --- a/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementFormerSymbolCommand.java +++ b/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementFormerSymbolCommand.java @@ -8,7 +8,7 @@ import org.apache.log4j.Logger; /** * {@link lcsb.mapviewer.commands.ModelCommand ModelCommand} that changes former - * symbol of the {@link lcsb.mapviewer.model.map.Element Element} connected to + * symbol of the {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element Element} connected to * {@link Alias}. * * @author Piotr Gawron @@ -30,9 +30,9 @@ public class ChangeElementFormerSymbolCommand extends ChangeElementPropertyListE * @param alias * {@link ChangeElementPropertyCommand#alias} * @param newValue - * new {@link lcsb.mapviewer.model.map.Element#synonym} value + * new {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#synonym} value * @param oldValue - * old {@link lcsb.mapviewer.model.map.Element#synonym} value + * old {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#synonym} value */ public ChangeElementFormerSymbolCommand(Model model, Alias alias, String newValue, String oldValue) { super(model, alias, newValue, oldValue); diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementFormulaCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementFormulaCommand.java index 56f6a1c96b4e7e15d0635d16e8127d642d0fd8c7..6f21ab50acbd590f7ddc4fa0d7abce7de0abbddf 100644 --- a/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementFormulaCommand.java +++ b/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementFormulaCommand.java @@ -28,7 +28,7 @@ public class ChangeElementFormulaCommand extends ChangeElementPropertyCommand<St * @param alias * {@link ChangeElementPropertyCommand#alias} * @param newName - * new {@link lcsb.mapviewer.model.map.Element#formula} value + * new {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#formula} value */ public ChangeElementFormulaCommand(Model model, Alias alias, String newName) { super(model, alias, newName); diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementFullNameCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementFullNameCommand.java index 7efafa6b99c5cadc2254df82249960b722469687..915eee3dda3cfa883cf8787c627f794ca346526c 100644 --- a/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementFullNameCommand.java +++ b/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementFullNameCommand.java @@ -28,7 +28,7 @@ public class ChangeElementFullNameCommand extends ChangeElementPropertyCommand<S * @param alias * {@link ChangeElementPropertyCommand#alias} * @param newName - * new {@link lcsb.mapviewer.model.map.Element#fullName} value + * new {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#fullName} value */ public ChangeElementFullNameCommand(Model model, Alias alias, String newName) { super(model, alias, newName); diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementMiriamDataCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementMiriamDataCommand.java index 26f59f8f10cfa9f182ca32ebecc6e5bddd6a6f89..dae2ea31ed9515508eb4f3f33fdbc16dc9f35d61 100644 --- a/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementMiriamDataCommand.java +++ b/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementMiriamDataCommand.java @@ -9,7 +9,7 @@ import org.apache.log4j.Logger; /** * {@link lcsb.mapviewer.commands.ModelCommand ModelCommand} that changes - * annotations of the {@link lcsb.mapviewer.model.map.Element Element} connected + * annotations of the {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element Element} connected * to {@link Alias}. * * @author Piotr Gawron diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementNotesCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementNotesCommand.java index 0c1a544e0bac442e127e60de12a96627139854e3..ecbf0aeadf2487206132737208c03c024175584d 100644 --- a/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementNotesCommand.java +++ b/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementNotesCommand.java @@ -28,7 +28,7 @@ public class ChangeElementNotesCommand extends ChangeElementPropertyCommand<Stri * @param alias * {@link ChangeElementPropertyCommand#alias} * @param newName - * new {@link lcsb.mapviewer.model.map.Element#notes} value + * new {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#notes} value */ public ChangeElementNotesCommand(Model model, Alias alias, String newName) { super(model, alias, newName); diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementPropertyListEntryCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementPropertyListEntryCommand.java index b83fa614b8c7e899a89d1061fb0ecbdf88854f13..49fd7ec140ca4f3ac9a73b7b4bf1c68741906abd 100644 --- a/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementPropertyListEntryCommand.java +++ b/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementPropertyListEntryCommand.java @@ -1,128 +1,128 @@ -package lcsb.mapviewer.commands.properties; - -import lcsb.mapviewer.commands.CommandExecutionException; -import lcsb.mapviewer.commands.ModelCommand; -import lcsb.mapviewer.commands.ModelCommandStatus; -import lcsb.mapviewer.model.map.layout.alias.Alias; -import lcsb.mapviewer.model.map.model.Model; - -/** - * {@link lcsb.mapviewer.commands.ModelCommand ModelCommand} that changes single - * entry in a property of the {@link lcsb.mapviewer.model.map.Element Element} - * that is list. {@link lcsb.mapviewer.model.map.Element Element} is connected - * to {@link Alias}. - * - * @param <T> - * class of property to edit - * - * @author Piotr Gawron - * - */ -public abstract class ChangeElementPropertyListEntryCommand<T> extends ModelCommand { - - /** - * New element property value. - */ - private T newValue; - - /** - * Old element property value. - */ - private T oldValue; - - /** - * {@link Alias} for which we will change the property. - */ - private Alias alias; - - /** - * Default constructor. - * - * @param model - * model to move - * - * @param alias - * alias to be changed - * - * @param newValue - * new value of the element property - * - * @param oldValue - * old value of the element property - */ - public ChangeElementPropertyListEntryCommand(Model model, Alias alias, T newValue, T oldValue) { - super(model); - this.alias = alias; - this.oldValue = oldValue; - this.newValue = newValue; - } - - @Override - protected void undoImplementation() throws CommandExecutionException { - T tmpNewValue = newValue; - T tmpOldValue = oldValue; - newValue = tmpOldValue; - oldValue = tmpNewValue; - executeImplementation(); - newValue = tmpNewValue; - oldValue = tmpOldValue; - setStatus(ModelCommandStatus.UNDONE); - } - - @Override - protected void redoImplementation() throws CommandExecutionException { - executeImplementation(); - setStatus(ModelCommandStatus.EXECUTED); - } - - /** - * @return the alias - * @see #alias - */ - protected Alias getAlias() { - return alias; - } - - /** - * @param alias - * the alias to set - * @see #alias - */ - protected void setAlias(Alias alias) { - this.alias = alias; - } - - /** - * @return the oldValue - * @see #oldValue - */ - protected T getOldValue() { - return oldValue; - } - - /** - * @param oldValue - * the oldValue to set - * @see #oldValue - */ - protected void setOldValue(T oldValue) { - this.oldValue = oldValue; - } - - /** - * @return the newValue - * @see #newValue - */ - protected T getNewValue() { - return newValue; - } - - /** - * @param newValue - * the newValue to set - * @see #newValue - */ - protected void setNewValue(T newValue) { - this.newValue = newValue; - } -} +package lcsb.mapviewer.commands.properties; + +import lcsb.mapviewer.commands.CommandExecutionException; +import lcsb.mapviewer.commands.ModelCommand; +import lcsb.mapviewer.commands.ModelCommandStatus; +import lcsb.mapviewer.model.map.layout.alias.Alias; +import lcsb.mapviewer.model.map.model.Model; + +/** + * {@link lcsb.mapviewer.commands.ModelCommand ModelCommand} that changes single + * entry in a property of the {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element Element} + * that is list. {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element Element} is connected + * to {@link Alias}. + * + * @param <T> + * class of property to edit + * + * @author Piotr Gawron + * + */ +public abstract class ChangeElementPropertyListEntryCommand<T> extends ModelCommand { + + /** + * New element property value. + */ + private T newValue; + + /** + * Old element property value. + */ + private T oldValue; + + /** + * {@link Alias} for which we will change the property. + */ + private Alias alias; + + /** + * Default constructor. + * + * @param model + * model to move + * + * @param alias + * alias to be changed + * + * @param newValue + * new value of the element property + * + * @param oldValue + * old value of the element property + */ + public ChangeElementPropertyListEntryCommand(Model model, Alias alias, T newValue, T oldValue) { + super(model); + this.alias = alias; + this.oldValue = oldValue; + this.newValue = newValue; + } + + @Override + protected void undoImplementation() throws CommandExecutionException { + T tmpNewValue = newValue; + T tmpOldValue = oldValue; + newValue = tmpOldValue; + oldValue = tmpNewValue; + executeImplementation(); + newValue = tmpNewValue; + oldValue = tmpOldValue; + setStatus(ModelCommandStatus.UNDONE); + } + + @Override + protected void redoImplementation() throws CommandExecutionException { + executeImplementation(); + setStatus(ModelCommandStatus.EXECUTED); + } + + /** + * @return the alias + * @see #alias + */ + protected Alias getAlias() { + return alias; + } + + /** + * @param alias + * the alias to set + * @see #alias + */ + protected void setAlias(Alias alias) { + this.alias = alias; + } + + /** + * @return the oldValue + * @see #oldValue + */ + protected T getOldValue() { + return oldValue; + } + + /** + * @param oldValue + * the oldValue to set + * @see #oldValue + */ + protected void setOldValue(T oldValue) { + this.oldValue = oldValue; + } + + /** + * @return the newValue + * @see #newValue + */ + protected T getNewValue() { + return newValue; + } + + /** + * @param newValue + * the newValue to set + * @see #newValue + */ + protected void setNewValue(T newValue) { + this.newValue = newValue; + } +} diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementSymbolCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementSymbolCommand.java index c54fd8d29ffce86c46d76a0f6cb07a97196b49ce..1958015498a17baece008c3145b6de05e33ad33b 100644 --- a/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementSymbolCommand.java +++ b/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementSymbolCommand.java @@ -28,7 +28,7 @@ public class ChangeElementSymbolCommand extends ChangeElementPropertyCommand<Str * @param alias * {@link ChangeElementPropertyCommand#alias} * @param newName - * new {@link lcsb.mapviewer.model.map.Element#symbol} value + * new {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#symbol} value */ public ChangeElementSymbolCommand(Model model, Alias alias, String newName) { super(model, alias, newName); diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementSynonymCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementSynonymCommand.java index 051f192af304c02ad873fa315104de1ea235d9f6..d9764839b353e617cc7c7da92028240cbbb159a9 100644 --- a/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementSynonymCommand.java +++ b/model-command/src/main/java/lcsb/mapviewer/commands/properties/ChangeElementSynonymCommand.java @@ -8,7 +8,7 @@ import org.apache.log4j.Logger; /** * {@link lcsb.mapviewer.commands.ModelCommand ModelCommand} that changes - * synonym of the {@link lcsb.mapviewer.model.map.Element Element} connected to + * synonym of the {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element Element} connected to * {@link Alias}. * * @author Piotr Gawron @@ -30,9 +30,9 @@ public class ChangeElementSynonymCommand extends ChangeElementPropertyListEntryC * @param alias * {@link ChangeElementPropertyCommand#alias} * @param newValue - * new {@link lcsb.mapviewer.model.map.Element#synonym} value + * new {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#synonym} value * @param oldValue - * old {@link lcsb.mapviewer.model.map.Element#synonym} value + * old {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#synonym} value */ public ChangeElementSynonymCommand(Model model, Alias alias, String newValue, String oldValue) { super(model, alias, newValue, oldValue); diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/properties/RemoveElementFormerSymbolsCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/properties/RemoveElementFormerSymbolsCommand.java index 2bc7e0d99ace0aec2c196eaaeaef581be2066588..1fdc63b9d1245b3bac2862578d2c4e605a11be33 100644 --- a/model-command/src/main/java/lcsb/mapviewer/commands/properties/RemoveElementFormerSymbolsCommand.java +++ b/model-command/src/main/java/lcsb/mapviewer/commands/properties/RemoveElementFormerSymbolsCommand.java @@ -10,7 +10,7 @@ import lcsb.mapviewer.model.map.model.Model; /** * {@link lcsb.mapviewer.commands.ModelCommand ModelCommand} that removes former - * symbols from {@link lcsb.mapviewer.model.map.Element Element} connected to + * symbols from {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element Element} connected to * {@link Alias}. * * @author Piotr Gawron @@ -32,7 +32,7 @@ public class RemoveElementFormerSymbolsCommand extends RemoveElementPropertyList * @param alias * {@link ChangeElementPropertyCommand#alias} * @param values - * {@link lcsb.mapviewer.model.map.Element#synonym} values to be + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#synonym} values to be * removed */ public RemoveElementFormerSymbolsCommand(Model model, Alias alias, List<String> values) { diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/properties/RemoveElementMiriamDataCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/properties/RemoveElementMiriamDataCommand.java index 619d01b1139269845b34669be361473b54dd2c55..b8264c8984c5241e6c0dee5d57483b7a1fa1d320 100644 --- a/model-command/src/main/java/lcsb/mapviewer/commands/properties/RemoveElementMiriamDataCommand.java +++ b/model-command/src/main/java/lcsb/mapviewer/commands/properties/RemoveElementMiriamDataCommand.java @@ -11,7 +11,7 @@ import org.apache.log4j.Logger; /** * {@link lcsb.mapviewer.commands.ModelCommand ModelCommand} that removes - * annotations from {@link lcsb.mapviewer.model.map.Element Element} connected + * annotations from {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element Element} connected * to {@link Alias}. * * @author Piotr Gawron @@ -33,7 +33,7 @@ public class RemoveElementMiriamDataCommand extends RemoveElementPropertyListEnt * @param alias * {@link ChangeElementPropertyCommand#alias} * @param values - * {@link lcsb.mapviewer.model.map.Element#synonym} values to be + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#synonym} values to be * removed */ public RemoveElementMiriamDataCommand(Model model, Alias alias, List<MiriamData> values) { diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/properties/RemoveElementPropertyListEntryCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/properties/RemoveElementPropertyListEntryCommand.java index 49c57fcf6e7dd764400e4a2fd7f168a8423ad7d7..285c3bb702f2f0ee672343abaeef23857a384c83 100644 --- a/model-command/src/main/java/lcsb/mapviewer/commands/properties/RemoveElementPropertyListEntryCommand.java +++ b/model-command/src/main/java/lcsb/mapviewer/commands/properties/RemoveElementPropertyListEntryCommand.java @@ -1,93 +1,93 @@ -package lcsb.mapviewer.commands.properties; - -import java.util.List; - -import lcsb.mapviewer.commands.CommandExecutionException; -import lcsb.mapviewer.commands.ModelCommand; -import lcsb.mapviewer.commands.ModelCommandStatus; -import lcsb.mapviewer.model.map.layout.alias.Alias; -import lcsb.mapviewer.model.map.model.Model; - -/** - * {@link lcsb.mapviewer.commands.ModelCommand ModelCommand} that removes - * entries from a property of the {@link lcsb.mapviewer.model.map.Element - * Element} that is list. {@link lcsb.mapviewer.model.map.Element Element} is - * connected to {@link Alias}. - * - * @param <T> - * class of property to edit - * - * @author Piotr Gawron - * - */ -public abstract class RemoveElementPropertyListEntryCommand<T> extends ModelCommand { - - /** - * Rlement property values to be removed. - */ - private List<T> values; - - /** - * {@link Alias} for which we will change the property. - */ - private Alias alias; - - /** - * Default constructor. - * - * @param model - * model to move - * - * @param alias - * alias to be changed - * - * @param values - * values of the element property to remove - */ - public RemoveElementPropertyListEntryCommand(Model model, Alias alias, List<T> values) { - super(model); - this.alias = alias; - this.values = values; - } - - @Override - protected void redoImplementation() throws CommandExecutionException { - executeImplementation(); - setStatus(ModelCommandStatus.EXECUTED); - } - - /** - * @return the alias - * @see #alias - */ - protected Alias getAlias() { - return alias; - } - - /** - * @param alias - * the alias to set - * @see #alias - */ - protected void setAlias(Alias alias) { - this.alias = alias; - } - - /** - * @return the values - * @see #values - */ - public List<T> getValues() { - return values; - } - - /** - * @param values - * the values to set - * @see #values - */ - public void setValues(List<T> values) { - this.values = values; - } - -} +package lcsb.mapviewer.commands.properties; + +import java.util.List; + +import lcsb.mapviewer.commands.CommandExecutionException; +import lcsb.mapviewer.commands.ModelCommand; +import lcsb.mapviewer.commands.ModelCommandStatus; +import lcsb.mapviewer.model.map.layout.alias.Alias; +import lcsb.mapviewer.model.map.model.Model; + +/** + * {@link lcsb.mapviewer.commands.ModelCommand ModelCommand} that removes + * entries from a property of the {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element + * Element} that is list. {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element Element} is + * connected to {@link Alias}. + * + * @param <T> + * class of property to edit + * + * @author Piotr Gawron + * + */ +public abstract class RemoveElementPropertyListEntryCommand<T> extends ModelCommand { + + /** + * Rlement property values to be removed. + */ + private List<T> values; + + /** + * {@link Alias} for which we will change the property. + */ + private Alias alias; + + /** + * Default constructor. + * + * @param model + * model to move + * + * @param alias + * alias to be changed + * + * @param values + * values of the element property to remove + */ + public RemoveElementPropertyListEntryCommand(Model model, Alias alias, List<T> values) { + super(model); + this.alias = alias; + this.values = values; + } + + @Override + protected void redoImplementation() throws CommandExecutionException { + executeImplementation(); + setStatus(ModelCommandStatus.EXECUTED); + } + + /** + * @return the alias + * @see #alias + */ + protected Alias getAlias() { + return alias; + } + + /** + * @param alias + * the alias to set + * @see #alias + */ + protected void setAlias(Alias alias) { + this.alias = alias; + } + + /** + * @return the values + * @see #values + */ + public List<T> getValues() { + return values; + } + + /** + * @param values + * the values to set + * @see #values + */ + public void setValues(List<T> values) { + this.values = values; + } + +} diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/properties/RemoveElementSynonymsCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/properties/RemoveElementSynonymsCommand.java index f54b5bf5609035a99c936d04c2e5be042c0ee0d9..31715dfab3ae1f690ad14609688ec1c7b6b37120 100644 --- a/model-command/src/main/java/lcsb/mapviewer/commands/properties/RemoveElementSynonymsCommand.java +++ b/model-command/src/main/java/lcsb/mapviewer/commands/properties/RemoveElementSynonymsCommand.java @@ -10,7 +10,7 @@ import org.apache.log4j.Logger; /** * {@link lcsb.mapviewer.commands.ModelCommand ModelCommand} that removes - * synonym from {@link lcsb.mapviewer.model.map.Element Element} connected to + * synonym from {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element Element} connected to * {@link Alias}. * * @author Piotr Gawron @@ -32,7 +32,7 @@ public class RemoveElementSynonymsCommand extends RemoveElementPropertyListEntry * @param alias * {@link ChangeElementPropertyCommand#alias} * @param values - * {@link lcsb.mapviewer.model.map.Element#synonym} values to be + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.Element#synonym} values to be * removed */ public RemoveElementSynonymsCommand(Model model, Alias alias, List<String> values) { diff --git a/model-command/src/test/java/lcsb/mapviewer/commands/ColorModelCommandTest.java b/model-command/src/test/java/lcsb/mapviewer/commands/ColorModelCommandTest.java index 99607c76960e775767fb2ea67bb8973ec387c02a..ffd2b86d58bff7bdd7d296361b3acb26cd1adde0 100644 --- a/model-command/src/test/java/lcsb/mapviewer/commands/ColorModelCommandTest.java +++ b/model-command/src/test/java/lcsb/mapviewer/commands/ColorModelCommandTest.java @@ -16,6 +16,7 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.Pair; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.ColorSchema; import lcsb.mapviewer.model.map.layout.GenericColorSchema; @@ -27,7 +28,6 @@ import lcsb.mapviewer.model.map.model.ModelFullIndexed; import lcsb.mapviewer.model.map.model.ModelSubmodelConnection; import lcsb.mapviewer.model.map.model.SubmodelType; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.GenericProtein; public class ColorModelCommandTest extends CommandTestFunctions { Logger logger = Logger.getLogger(ColorModelCommandTest.class); diff --git a/model-command/src/test/java/lcsb/mapviewer/commands/CommandTestFunctions.java b/model-command/src/test/java/lcsb/mapviewer/commands/CommandTestFunctions.java index 7ba119a6562bbe22d59ad062bc67ab3d16f77c7a..e99ef7701b15809c96c4f26053cbe786e71a1e77 100644 --- a/model-command/src/test/java/lcsb/mapviewer/commands/CommandTestFunctions.java +++ b/model-command/src/test/java/lcsb/mapviewer/commands/CommandTestFunctions.java @@ -9,13 +9,13 @@ import org.apache.log4j.Logger; import lcsb.mapviewer.converter.ConverterParams; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser; -import lcsb.mapviewer.model.map.agregator.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelFullIndexed; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.GenericProtein; public abstract class CommandTestFunctions { public double EPSILON = 1e-6; diff --git a/model-command/src/test/java/lcsb/mapviewer/commands/CopyCommandTest.java b/model-command/src/test/java/lcsb/mapviewer/commands/CopyCommandTest.java index d9eb113cfde4797fea416538575eb1f1cef54ca9..1463362ed6370c2a65dbf1d1d2022636b67b1a65 100644 --- a/model-command/src/test/java/lcsb/mapviewer/commands/CopyCommandTest.java +++ b/model-command/src/test/java/lcsb/mapviewer/commands/CopyCommandTest.java @@ -14,9 +14,12 @@ import org.junit.Test; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.converter.ConverterParams; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; import lcsb.mapviewer.model.map.OverviewImage; import lcsb.mapviewer.model.map.OverviewModelLink; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; @@ -29,9 +32,6 @@ import lcsb.mapviewer.model.map.model.ModelFullIndexed; import lcsb.mapviewer.model.map.model.ModelSubmodelConnection; import lcsb.mapviewer.model.map.model.SubmodelType; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Protein; public class CopyCommandTest extends CommandTestFunctions { diff --git a/model-command/src/test/java/lcsb/mapviewer/commands/MoveElementsCommandTest.java b/model-command/src/test/java/lcsb/mapviewer/commands/MoveElementsCommandTest.java index d239dfe232d97185608da5e46cfd8353bd764cec..72ba4c56efb66b2f21538ef211d2b7cbb3e533d2 100644 --- a/model-command/src/test/java/lcsb/mapviewer/commands/MoveElementsCommandTest.java +++ b/model-command/src/test/java/lcsb/mapviewer/commands/MoveElementsCommandTest.java @@ -12,11 +12,11 @@ import java.util.List; import lcsb.mapviewer.common.Configuration; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelComparator; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.Species; import org.junit.After; import org.junit.Before; diff --git a/model/src/main/java/lcsb/mapviewer/model/map/MiriamData.java b/model/src/main/java/lcsb/mapviewer/model/map/MiriamData.java index ca9957f456e9134a8affa4556dfcb4e40b89c78a..df0c5393d3afd997f8c3b51187385c0d56778c65 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/MiriamData.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/MiriamData.java @@ -6,11 +6,9 @@ import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; -import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.xml.bind.annotation.XmlRootElement; diff --git a/model/src/main/java/lcsb/mapviewer/model/map/MiriamType.java b/model/src/main/java/lcsb/mapviewer/model/map/MiriamType.java index fc08ab7123fac6ea06a81b6e2a2caa1e86068e6e..875ba57f5316b2b4f9420ea732d9803886fdb131 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/MiriamType.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/MiriamType.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.List; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.ChemicalAlias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; @@ -14,13 +13,6 @@ import lcsb.mapviewer.model.map.layout.alias.PhenotypeAlias; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.layout.alias.RnaAlias; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.Chemical; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Drug; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.Phenotype; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; /** * Type of known miriam annotation. diff --git a/model/src/main/java/lcsb/mapviewer/model/map/agregator/package-info.java b/model/src/main/java/lcsb/mapviewer/model/map/agregator/package-info.java deleted file mode 100644 index 168d49a4f5ab513477b79a4edf39b09876024724..0000000000000000000000000000000000000000 --- a/model/src/main/java/lcsb/mapviewer/model/map/agregator/package-info.java +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Contains structures used for compartment modeling. - */ -package lcsb.mapviewer.model.map.agregator; - diff --git a/model/src/main/java/lcsb/mapviewer/model/map/graph/DataMining.java b/model/src/main/java/lcsb/mapviewer/model/map/graph/DataMining.java index 360c1f1757a3007be093405bf57960e0fa0a3a23..bbeaa6515ff02bcb749e14c002f2e8a78b7e25a0 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/graph/DataMining.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/graph/DataMining.java @@ -1,212 +1,212 @@ -package lcsb.mapviewer.model.map.graph; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinTable; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; - -import lcsb.mapviewer.model.map.Element; -import lcsb.mapviewer.model.map.MiriamData; - -import org.hibernate.annotations.Cascade; -import org.hibernate.annotations.CascadeType; -import org.hibernate.annotations.IndexColumn; - -/** - * Entity representing data mining entry. - * - * @author Piotr Gawron - * - */ -@Entity -public class DataMining implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * Unique database identifier. - */ - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "idDb", unique = true, nullable = false) - private Integer id; - - /** - * For which element this entry was created. - */ - @ManyToOne(optional = false) - private Element element; - - /** - * List of the suggested connection. - */ - @Cascade({ CascadeType.ALL }) - @OneToMany(fetch = FetchType.EAGER) - @IndexColumn(name = "idx") - @JoinTable(name = "datamining_suggested_connections") - private List<MiriamData> suggestedConnections = new ArrayList<MiriamData>(); - - /** - * Short description of the connection. - */ - @Column(columnDefinition = "TEXT") - private String description; - - /** - * Where the data comes from. - */ - private DataMiningType type; - - /** - * List of reference links for this entry. - */ - @Cascade({ CascadeType.ALL }) - @OneToMany(fetch = FetchType.EAGER) - @IndexColumn(name = "idx") - private List<MiriamData> references = new ArrayList<MiriamData>(); - - /** - * Adds reference. - * - * @param md - * new reference link - * @see #references - */ - public void addReference(MiriamData md) { - references.add(md); - } - - /** - * @return the references - * @see #references - */ - public List<MiriamData> getReferences() { - return references; - } - - /** - * @param references - * the references to set - * @see #references - */ - public void setReferences(List<MiriamData> references) { - this.references = references; - } - - /** - * @return the type - * @see #type - */ - public DataMiningType getType() { - return type; - } - - /** - * @param type - * the type to set - * @see #type - */ - public void setType(DataMiningType type) { - this.type = type; - } - - /** - * @return the description - * @see #description - */ - public String getDescription() { - return description; - } - - /** - * @param description - * the description to set - * @see #description - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * @return the id - * @see #id - */ - public Integer getId() { - return id; - } - - /** - * @param id - * the id to set - * @see #id - */ - public void setId(Integer id) { - this.id = id; - } - - /** - * @return the element - * @see #element - */ - public Element getElement() { - return element; - } - - /** - * @param element - * the element to set - * @see #element - */ - public void setElement(Element element) { - this.element = element; - } - - /** - * @return the suggestedConnections - * @see #suggestedConnections - */ - public List<MiriamData> getSuggestedConnections() { - return suggestedConnections; - } - - /** - * @param suggestedConnections - * the suggestedConnections to set - * @see #suggestedConnections - */ - public void setSuggestedConnections(List<MiriamData> suggestedConnections) { - this.suggestedConnections = suggestedConnections; - } - - /** - * @param suggestedConnection - * the suggestedConnection to add - * @see #suggestedConnections - */ - public void addSuggestedConnection(MiriamData suggestedConnection) { - this.suggestedConnections.add(suggestedConnection); - } - - /** - * Adds references to {@link #references}. - * - * @param ref - * references to add - */ - public void addReferences(List<MiriamData> ref) { - references.addAll(ref); - } - -} +package lcsb.mapviewer.model.map.graph; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinTable; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; + +import org.hibernate.annotations.Cascade; +import org.hibernate.annotations.CascadeType; +import org.hibernate.annotations.IndexColumn; + +import lcsb.mapviewer.model.map.MiriamData; +import lcsb.mapviewer.model.map.layout.alias.Alias; + +/** + * Entity representing data mining entry. + * + * @author Piotr Gawron + * + */ +@Entity +public class DataMining implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Unique database identifier. + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "idDb", unique = true, nullable = false) + private Integer id; + + /** + * For which element this entry was created. + */ + @ManyToOne(optional = false) + private Alias element; + + /** + * List of the suggested connection. + */ + @Cascade({ CascadeType.ALL }) + @OneToMany(fetch = FetchType.EAGER) + @IndexColumn(name = "idx") + @JoinTable(name = "datamining_suggested_connections") + private List<MiriamData> suggestedConnections = new ArrayList<MiriamData>(); + + /** + * Short description of the connection. + */ + @Column(columnDefinition = "TEXT") + private String description; + + /** + * Where the data comes from. + */ + private DataMiningType type; + + /** + * List of reference links for this entry. + */ + @Cascade({ CascadeType.ALL }) + @OneToMany(fetch = FetchType.EAGER) + @IndexColumn(name = "idx") + private List<MiriamData> references = new ArrayList<MiriamData>(); + + /** + * Adds reference. + * + * @param md + * new reference link + * @see #references + */ + public void addReference(MiriamData md) { + references.add(md); + } + + /** + * @return the references + * @see #references + */ + public List<MiriamData> getReferences() { + return references; + } + + /** + * @param references + * the references to set + * @see #references + */ + public void setReferences(List<MiriamData> references) { + this.references = references; + } + + /** + * @return the type + * @see #type + */ + public DataMiningType getType() { + return type; + } + + /** + * @param type + * the type to set + * @see #type + */ + public void setType(DataMiningType type) { + this.type = type; + } + + /** + * @return the description + * @see #description + */ + public String getDescription() { + return description; + } + + /** + * @param description + * the description to set + * @see #description + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * @return the id + * @see #id + */ + public Integer getId() { + return id; + } + + /** + * @param id + * the id to set + * @see #id + */ + public void setId(Integer id) { + this.id = id; + } + + /** + * @return the element + * @see #element + */ + public Alias getElement() { + return element; + } + + /** + * @param element + * the element to set + * @see #element + */ + public void setElement(Alias element) { + this.element = element; + } + + /** + * @return the suggestedConnections + * @see #suggestedConnections + */ + public List<MiriamData> getSuggestedConnections() { + return suggestedConnections; + } + + /** + * @param suggestedConnections + * the suggestedConnections to set + * @see #suggestedConnections + */ + public void setSuggestedConnections(List<MiriamData> suggestedConnections) { + this.suggestedConnections = suggestedConnections; + } + + /** + * @param suggestedConnection + * the suggestedConnection to add + * @see #suggestedConnections + */ + public void addSuggestedConnection(MiriamData suggestedConnection) { + this.suggestedConnections.add(suggestedConnection); + } + + /** + * Adds references to {@link #references}. + * + * @param ref + * references to add + */ + public void addReferences(List<MiriamData> ref) { + references.addAll(ref); + } + +} diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/ColorSchema.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/ColorSchema.java index bbdb86ebfe85588960dd1a7406479b62588503f5..0493975e9a452e4d912ab6333c364d9a88796d62 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/ColorSchema.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/ColorSchema.java @@ -1,543 +1,543 @@ -package lcsb.mapviewer.model.map.layout; - -import java.awt.Color; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import lcsb.mapviewer.common.Pair; -import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.species.Species; - -/** - * Entry of coloring schema used for changing colors in the map. It allows to - * identify some elements by use of the filters (by name, type, etcs.) and - * contains information about the color that should be assigned to the fileter - * elements. - * - * @author Piotr Gawron - * - */ -public abstract class ColorSchema implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * Base of the hex representation. - */ - private static final int HEX_BASE = 16; - - /** - * Length of the string describing color in rgb: "#RRGGBB". - */ - private static final int COLOR_STRING_LENGTH = 7; - - /** - * Where starts description of red color in stirng representing color. - */ - private static final int COLOR_SUBSTRING_START_RED = 1; - - /** - * Where starts description of green color in stirng representing color. - */ - private static final int COLOR_SUBSTRING_START_GREEN = 3; - - /** - * Where starts description of blue color in stirng representing color. - */ - private static final int COLOR_SUBSTRING_START_BLUE = 5; - - /** - * Defines the maximum value of primary colors in RGB model (every color is - * from range 0..255). - */ - private static final int MAX_SINGLE_COLOR_VALUE_IN_RGB_FORMAT = 255; - - /** - * Name of the {@link lcsb.mapviewer.db.model.map.Element Element}. If null - * then this field will be skiped. - */ - private String name = null; - - /** - * Identifier of the reaction to change the color. - */ - private String reactionIdentifier = null; - - /** - * Should the direction of highlighted reaction be reversed. - */ - private Boolean reverseReaction = null; - - /** - * Width of the line in the reaction. - */ - private Double lineWidth = null; - - /** - * In which compartments (identified by name) the element can occur. - */ - private List<String> compartments = new ArrayList<String>(); - - /** - * What types of element should be identified by this entry. - */ - private List<Class<? extends Species>> types = new ArrayList<Class<? extends Species>>(); - - /** - * Value (-1..1 range) that is assigned to filtered elements (it will be - * transformed into color later on). Only one of the {@link #value} and - * {@link #color} can be set. - */ - private Double value = null; - - /** - * Color that is assigned to filtered elements. Only one of the {@link #value} - * and {@link #color} can be set. - */ - private Color color = null; - - /** - * General identifier that identifies the element. - */ - private String generalIdentifier = null; - - /** - * List of specific identifiers that filter the elements. - */ - private List<Pair<MiriamType, String>> identifierColumns = new ArrayList<Pair<MiriamType, String>>(); - - /** - * Number of elements matched by this entry. - */ - private int matches = 0; - - /** - * Short description of the entry. - */ - private String description; - - /** - * Default constructor. - */ - protected ColorSchema() { - } - - /** - * Initializes object by copying data from the parameter. - * - * @param original - * original object used for initialization - */ - protected ColorSchema(ColorSchema original) { - this.setName(original.getName()); - this.setReactionIdentifier(original.getReactionIdentifier()); - this.setReverseReaction(original.getReverseReaction()); - this.setLineWidth(original.getLineWidth()); - this.addCompartments(original.getCompartments()); - this.addTypes(original.getTypes()); - this.setValue(original.getValue()); - this.setColor(original.getColor()); - this.setGeneralIdentifier(original.getGeneralIdentifier()); - this.addIdentifierColumns(original.getIdentifierColumns()); - this.setMatches(original.getMatches()); - this.setDescription(original.getDescription()); - } - - /** - * Adds identifiers to {@link #identifierColumns} list. - * - * @param identifierColumnsList - * list of pairs defining type of identifier and the identifier value - */ - public void addIdentifierColumns(List<Pair<MiriamType, String>> identifierColumnsList) { - for (Pair<MiriamType, String> pair : identifierColumnsList) { - addIdentifierColumn(pair); - } - - } - - /** - * Adds class types to {@link #types} list. - * - * @param types2 - * list of classes to add - */ - public void addTypes(List<Class<? extends Species>> types2) { - for (Class<? extends Species> clazz : types2) { - addType(clazz); - } - } - - /** - * Adds compartment names to {@link #compartments} list. - * - * @param compartments2 - * elements to add - */ - public void addCompartments(String[] compartments2) { - for (String string : compartments2) { - compartments.add(string); - } - } - - /** - * Adds compartment names to {@link #compartments} list. - * - * @param compartments2 - * elements to add - */ - public void addCompartments(Collection<String> compartments2) { - for (String string : compartments2) { - compartments.add(string); - } - } - - /** - * Sets {@link #color} from the string. - * - * @param string - * color in text representation - * @throws InvalidColorSchemaException - * thrown when string describing color is invalid - */ - public void setColor(String string) throws InvalidColorSchemaException { - if (string.length() != COLOR_STRING_LENGTH) { - throw new InvalidColorSchemaException("Invalid color value: " + string + ". Correct format: #xxxxxx (where x is a hex value)"); - } - if (string.charAt(0) != '#') { - throw new InvalidColorSchemaException("Invalid color value: " + string + ". Correct format: #xxxxxx (where x is a hex value)"); - - } else { - setColor(new Color(Integer.valueOf(string.substring(COLOR_SUBSTRING_START_RED, COLOR_SUBSTRING_START_GREEN), HEX_BASE), // - Integer.valueOf(string.substring(COLOR_SUBSTRING_START_GREEN, COLOR_SUBSTRING_START_BLUE), HEX_BASE), // - Integer.valueOf(string.substring(COLOR_SUBSTRING_START_BLUE, COLOR_STRING_LENGTH), HEX_BASE))); - } - - } - - @Override - public String toString() { - StringBuilder result = new StringBuilder(); - result.append("["); - if (name != null) { - result.append(name + ","); - } - if (compartments.size() > 0) { - result.append("("); - for (String comp : compartments) { - result.append(comp + ","); - } - result.append("),"); - } - if (types.size() > 0) { - result.append("("); - for (Class<?> clazz : types) { - result.append(clazz.getSimpleName() + ","); - } - result.append("),"); - } - if (value != null) { - result.append(value + ","); - } - if (color != null) { - result.append(color + ","); - } - if (generalIdentifier != null) { - result.append(generalIdentifier + ","); - } - if (types.size() > 0) { - result.append("("); - for (Pair<MiriamType, String> pair : identifierColumns) { - result.append(pair.getLeft() + "-" + pair.getRight() + ","); - } - result.append("),"); - } - result.append(matches + "]"); - return result.toString(); - } - - /** - * @return the name - * @see #name - */ - public String getName() { - return name; - } - - /** - * @param name - * the name to set - * @see #name - */ - public void setName(String name) { - if (name == null) { - this.name = null; - } else { - this.name = name.trim(); - } - } - - /** - * @return the compartments - * @see #compartments - */ - public List<String> getCompartments() { - return compartments; - } - - /** - * @param compartments - * the compartments to set - * @see #compartments - */ - public void setCompartments(List<String> compartments) { - this.compartments = compartments; - } - - /** - * @return the types - * @see #types - */ - public List<Class<? extends Species>> getTypes() { - return types; - } - - /** - * @param types - * the types to set - * @see #types - */ - public void setTypes(List<Class<? extends Species>> types) { - this.types = types; - } - - /** - * @return the value - * @see #value - */ - public Double getValue() { - return value; - } - - /** - * @param value - * the value to set - * @see #value - */ - public void setValue(Double value) { - this.value = value; - } - - /** - * @return the color - * @see #color - */ - public Color getColor() { - return color; - } - - /** - * @param color - * the color to set - * @see #color - */ - public void setColor(Color color) { - this.color = color; - } - - /** - * @return the generalIdentifier - * @see #generalIdentifier - */ - public String getGeneralIdentifier() { - return generalIdentifier; - } - - /** - * @param generalIdentifier - * the generalIdentifier to set - * @see #generalIdentifier - */ - public void setGeneralIdentifier(String generalIdentifier) { - this.generalIdentifier = generalIdentifier; - } - - /** - * @return the identifierColumns - * @see #identifierColumns - */ - public List<Pair<MiriamType, String>> getIdentifierColumns() { - return identifierColumns; - } - - /** - * @param identifierColumns - * the identifierColumns to set - * @see #identifierColumns - */ - public void setIdentifierColumns(List<Pair<MiriamType, String>> identifierColumns) { - this.identifierColumns = identifierColumns; - } - - /** - * @return the matches - * @see #matches - */ - public int getMatches() { - return matches; - } - - /** - * @param matches - * the matches to set - * @see #matches - */ - public void setMatches(int matches) { - this.matches = matches; - } - - /** - * Adds identifier to {@link #identifierColumns} list. - * - * @param pair - * pair defining type of identifier and the identifier value - */ - public void addIdentifierColumn(Pair<MiriamType, String> pair) { - identifierColumns.add(pair); - - } - - /** - * @return the reactionIdentifier - * @see #reactionIdentifier - */ - public String getReactionIdentifier() { - return reactionIdentifier; - } - - /** - * @param reactionIdentifier - * the reactionIdentifier to set - * @see #reactionIdentifier - */ - public void setReactionIdentifier(String reactionIdentifier) { - this.reactionIdentifier = reactionIdentifier; - } - - /** - * @return the lineWidth - * @see #lineWidth - */ - public Double getLineWidth() { - return lineWidth; - } - - /** - * @param lineWidth - * the lineWidth to set - * @see #lineWidth - */ - public void setLineWidth(Double lineWidth) { - this.lineWidth = lineWidth; - } - - /** - * @return the reverseReaction - * @see #reverseReaction - */ - public Boolean getReverseReaction() { - return reverseReaction; - } - - /** - * @param reverseReaction - * the reverseReaction to set - * @see #reverseReaction - */ - public void setReverseReaction(Boolean reverseReaction) { - this.reverseReaction = reverseReaction; - } - - /** - * Adds compartment name to {@link #compartments}. - * - * @param name - * compartment name - */ - public void addCompartment(String name) { - compartments.add(name); - } - - /** - * Adds class type to {@link #types} list. - * - * @param clazz - * class to add - */ - public void addType(Class<? extends Species> clazz) { - this.types.add(clazz); - } - - /** - * Extracts color from {@link ColorSchema} object. - * - * @return color from {@link ColorSchema} object - */ - public Color getNormalizedColor() { - if (getColor() != null) { - return getColor(); - } else { - return getColorForValue(getValue()); - } - } - - /** - * Returns color from red - green scale for the given normalized double value - * (from range -1,1). - * - * @param value - * double value that should be converted into color - * @return color for the double value - */ - protected Color getColorForValue(Double value) { - if (value > 0) { - int val = (int) ((1 - value) * MAX_SINGLE_COLOR_VALUE_IN_RGB_FORMAT); - return new Color(val, MAX_SINGLE_COLOR_VALUE_IN_RGB_FORMAT, val); - } - if (value < 0) { - int val = (int) ((1 + value) * MAX_SINGLE_COLOR_VALUE_IN_RGB_FORMAT); - return new Color(MAX_SINGLE_COLOR_VALUE_IN_RGB_FORMAT, val, val); - } - return Color.WHITE; - } - - /** - * @return the description - * @see #description - */ - public String getDescription() { - return description; - } - - /** - * @param description - * the description to set - * @see #description - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Creates a copy of this object. - * - * @return copy of the object - */ - public abstract ColorSchema copy(); - -} +package lcsb.mapviewer.model.map.layout; + +import java.awt.Color; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import lcsb.mapviewer.common.Pair; +import lcsb.mapviewer.model.map.MiriamType; +import lcsb.mapviewer.model.map.layout.alias.Alias; + +/** + * Entry of coloring schema used for changing colors in the map. It allows to + * identify some elements by use of the filters (by name, type, etcs.) and + * contains information about the color that should be assigned to the fileter + * elements. + * + * @author Piotr Gawron + * + */ +public abstract class ColorSchema implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Base of the hex representation. + */ + private static final int HEX_BASE = 16; + + /** + * Length of the string describing color in rgb: "#RRGGBB". + */ + private static final int COLOR_STRING_LENGTH = 7; + + /** + * Where starts description of red color in stirng representing color. + */ + private static final int COLOR_SUBSTRING_START_RED = 1; + + /** + * Where starts description of green color in stirng representing color. + */ + private static final int COLOR_SUBSTRING_START_GREEN = 3; + + /** + * Where starts description of blue color in stirng representing color. + */ + private static final int COLOR_SUBSTRING_START_BLUE = 5; + + /** + * Defines the maximum value of primary colors in RGB model (every color is + * from range 0..255). + */ + private static final int MAX_SINGLE_COLOR_VALUE_IN_RGB_FORMAT = 255; + + /** + * Name of the {@link lcsb.mapviewer.db.model.map.Element Element}. If null + * then this field will be skiped. + */ + private String name = null; + + /** + * Identifier of the reaction to change the color. + */ + private String reactionIdentifier = null; + + /** + * Should the direction of highlighted reaction be reversed. + */ + private Boolean reverseReaction = null; + + /** + * Width of the line in the reaction. + */ + private Double lineWidth = null; + + /** + * In which compartments (identified by name) the element can occur. + */ + private List<String> compartments = new ArrayList<String>(); + + /** + * What types of element should be identified by this entry. + */ + private List<Class<? extends Alias>> types = new ArrayList<>(); + + /** + * Value (-1..1 range) that is assigned to filtered elements (it will be + * transformed into color later on). Only one of the {@link #value} and + * {@link #color} can be set. + */ + private Double value = null; + + /** + * Color that is assigned to filtered elements. Only one of the {@link #value} + * and {@link #color} can be set. + */ + private Color color = null; + + /** + * General identifier that identifies the element. + */ + private String generalIdentifier = null; + + /** + * List of specific identifiers that filter the elements. + */ + private List<Pair<MiriamType, String>> identifierColumns = new ArrayList<>(); + + /** + * Number of elements matched by this entry. + */ + private int matches = 0; + + /** + * Short description of the entry. + */ + private String description; + + /** + * Default constructor. + */ + protected ColorSchema() { + } + + /** + * Initializes object by copying data from the parameter. + * + * @param original + * original object used for initialization + */ + protected ColorSchema(ColorSchema original) { + this.setName(original.getName()); + this.setReactionIdentifier(original.getReactionIdentifier()); + this.setReverseReaction(original.getReverseReaction()); + this.setLineWidth(original.getLineWidth()); + this.addCompartments(original.getCompartments()); + this.addTypes(original.getTypes()); + this.setValue(original.getValue()); + this.setColor(original.getColor()); + this.setGeneralIdentifier(original.getGeneralIdentifier()); + this.addIdentifierColumns(original.getIdentifierColumns()); + this.setMatches(original.getMatches()); + this.setDescription(original.getDescription()); + } + + /** + * Adds identifiers to {@link #identifierColumns} list. + * + * @param identifierColumnsList + * list of pairs defining type of identifier and the identifier value + */ + public void addIdentifierColumns(List<Pair<MiriamType, String>> identifierColumnsList) { + for (Pair<MiriamType, String> pair : identifierColumnsList) { + addIdentifierColumn(pair); + } + + } + + /** + * Adds class types to {@link #types} list. + * + * @param types2 + * list of classes to add + */ + public void addTypes(List<Class<? extends Alias>> types2) { + for (Class<? extends Alias> clazz : types2) { + addType(clazz); + } + } + + /** + * Adds compartment names to {@link #compartments} list. + * + * @param compartments2 + * elements to add + */ + public void addCompartments(String[] compartments2) { + for (String string : compartments2) { + compartments.add(string); + } + } + + /** + * Adds compartment names to {@link #compartments} list. + * + * @param compartments2 + * elements to add + */ + public void addCompartments(Collection<String> compartments2) { + for (String string : compartments2) { + compartments.add(string); + } + } + + /** + * Sets {@link #color} from the string. + * + * @param string + * color in text representation + * @throws InvalidColorSchemaException + * thrown when string describing color is invalid + */ + public void setColor(String string) throws InvalidColorSchemaException { + if (string.length() != COLOR_STRING_LENGTH) { + throw new InvalidColorSchemaException("Invalid color value: " + string + ". Correct format: #xxxxxx (where x is a hex value)"); + } + if (string.charAt(0) != '#') { + throw new InvalidColorSchemaException("Invalid color value: " + string + ". Correct format: #xxxxxx (where x is a hex value)"); + + } else { + setColor(new Color(Integer.valueOf(string.substring(COLOR_SUBSTRING_START_RED, COLOR_SUBSTRING_START_GREEN), HEX_BASE), // + Integer.valueOf(string.substring(COLOR_SUBSTRING_START_GREEN, COLOR_SUBSTRING_START_BLUE), HEX_BASE), // + Integer.valueOf(string.substring(COLOR_SUBSTRING_START_BLUE, COLOR_STRING_LENGTH), HEX_BASE))); + } + + } + + @Override + public String toString() { + StringBuilder result = new StringBuilder(); + result.append("["); + if (name != null) { + result.append(name + ","); + } + if (compartments.size() > 0) { + result.append("("); + for (String comp : compartments) { + result.append(comp + ","); + } + result.append("),"); + } + if (types.size() > 0) { + result.append("("); + for (Class<?> clazz : types) { + result.append(clazz.getSimpleName() + ","); + } + result.append("),"); + } + if (value != null) { + result.append(value + ","); + } + if (color != null) { + result.append(color + ","); + } + if (generalIdentifier != null) { + result.append(generalIdentifier + ","); + } + if (types.size() > 0) { + result.append("("); + for (Pair<MiriamType, String> pair : identifierColumns) { + result.append(pair.getLeft() + "-" + pair.getRight() + ","); + } + result.append("),"); + } + result.append(matches + "]"); + return result.toString(); + } + + /** + * @return the name + * @see #name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + * @see #name + */ + public void setName(String name) { + if (name == null) { + this.name = null; + } else { + this.name = name.trim(); + } + } + + /** + * @return the compartments + * @see #compartments + */ + public List<String> getCompartments() { + return compartments; + } + + /** + * @param compartments + * the compartments to set + * @see #compartments + */ + public void setCompartments(List<String> compartments) { + this.compartments = compartments; + } + + /** + * @return the types + * @see #types + */ + public List<Class<? extends Alias>> getTypes() { + return types; + } + + /** + * @param types + * the types to set + * @see #types + */ + public void setTypes(List<Class<? extends Alias>> types) { + this.types = types; + } + + /** + * @return the value + * @see #value + */ + public Double getValue() { + return value; + } + + /** + * @param value + * the value to set + * @see #value + */ + public void setValue(Double value) { + this.value = value; + } + + /** + * @return the color + * @see #color + */ + public Color getColor() { + return color; + } + + /** + * @param color + * the color to set + * @see #color + */ + public void setColor(Color color) { + this.color = color; + } + + /** + * @return the generalIdentifier + * @see #generalIdentifier + */ + public String getGeneralIdentifier() { + return generalIdentifier; + } + + /** + * @param generalIdentifier + * the generalIdentifier to set + * @see #generalIdentifier + */ + public void setGeneralIdentifier(String generalIdentifier) { + this.generalIdentifier = generalIdentifier; + } + + /** + * @return the identifierColumns + * @see #identifierColumns + */ + public List<Pair<MiriamType, String>> getIdentifierColumns() { + return identifierColumns; + } + + /** + * @param identifierColumns + * the identifierColumns to set + * @see #identifierColumns + */ + public void setIdentifierColumns(List<Pair<MiriamType, String>> identifierColumns) { + this.identifierColumns = identifierColumns; + } + + /** + * @return the matches + * @see #matches + */ + public int getMatches() { + return matches; + } + + /** + * @param matches + * the matches to set + * @see #matches + */ + public void setMatches(int matches) { + this.matches = matches; + } + + /** + * Adds identifier to {@link #identifierColumns} list. + * + * @param pair + * pair defining type of identifier and the identifier value + */ + public void addIdentifierColumn(Pair<MiriamType, String> pair) { + identifierColumns.add(pair); + + } + + /** + * @return the reactionIdentifier + * @see #reactionIdentifier + */ + public String getReactionIdentifier() { + return reactionIdentifier; + } + + /** + * @param reactionIdentifier + * the reactionIdentifier to set + * @see #reactionIdentifier + */ + public void setReactionIdentifier(String reactionIdentifier) { + this.reactionIdentifier = reactionIdentifier; + } + + /** + * @return the lineWidth + * @see #lineWidth + */ + public Double getLineWidth() { + return lineWidth; + } + + /** + * @param lineWidth + * the lineWidth to set + * @see #lineWidth + */ + public void setLineWidth(Double lineWidth) { + this.lineWidth = lineWidth; + } + + /** + * @return the reverseReaction + * @see #reverseReaction + */ + public Boolean getReverseReaction() { + return reverseReaction; + } + + /** + * @param reverseReaction + * the reverseReaction to set + * @see #reverseReaction + */ + public void setReverseReaction(Boolean reverseReaction) { + this.reverseReaction = reverseReaction; + } + + /** + * Adds compartment name to {@link #compartments}. + * + * @param name + * compartment name + */ + public void addCompartment(String name) { + compartments.add(name); + } + + /** + * Adds class type to {@link #types} list. + * + * @param clazz + * class to add + */ + public void addType(Class<? extends Alias> clazz) { + this.types.add(clazz); + } + + /** + * Extracts color from {@link ColorSchema} object. + * + * @return color from {@link ColorSchema} object + */ + public Color getNormalizedColor() { + if (getColor() != null) { + return getColor(); + } else { + return getColorForValue(getValue()); + } + } + + /** + * Returns color from red - green scale for the given normalized double value + * (from range -1,1). + * + * @param value + * double value that should be converted into color + * @return color for the double value + */ + protected Color getColorForValue(Double value) { + if (value > 0) { + int val = (int) ((1 - value) * MAX_SINGLE_COLOR_VALUE_IN_RGB_FORMAT); + return new Color(val, MAX_SINGLE_COLOR_VALUE_IN_RGB_FORMAT, val); + } + if (value < 0) { + int val = (int) ((1 + value) * MAX_SINGLE_COLOR_VALUE_IN_RGB_FORMAT); + return new Color(MAX_SINGLE_COLOR_VALUE_IN_RGB_FORMAT, val, val); + } + return Color.WHITE; + } + + /** + * @return the description + * @see #description + */ + public String getDescription() { + return description; + } + + /** + * @param description + * the description to set + * @see #description + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * Creates a copy of this object. + * + * @return copy of the object + */ + public abstract ColorSchema copy(); + +} diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/AntisenseRnaAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/AntisenseRnaAlias.java index e678391031faa62a54ad46fa21f51d26619fb598..6ceb4fcff94afd2c51e67db91ba90497bc4d04ea 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/AntisenseRnaAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/AntisenseRnaAlias.java @@ -13,8 +13,6 @@ import org.hibernate.annotations.LazyCollection; import org.hibernate.annotations.LazyCollectionOption; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.AntisenseRna; -import lcsb.mapviewer.model.map.species.fields.AntisenseRnaRegion; @Entity @DiscriminatorValue("ANTISENSE_RNA_ALIAS") @@ -33,15 +31,6 @@ public class AntisenseRnaAlias extends SpeciesAlias { AntisenseRnaAlias() { } - public AntisenseRnaAlias(AntisenseRna antisenseRna) { - super(antisenseRna); - } - - public AntisenseRnaAlias(String aliasId, AntisenseRna antisenseRna) { - this(antisenseRna); - super.setAliasId(aliasId); - } - public AntisenseRnaAlias(AntisenseRnaAlias original) { super(original); for (AntisenseRnaRegionAlias region : original.getRegions()) { diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/AntisenseRnaRegionAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/AntisenseRnaRegionAlias.java index 6e7eb8fd716bd32714bdb8ba9430e2f905089b6e..b2f96d7a569a4ccc5edf24f5336004586f9834b8 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/AntisenseRnaRegionAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/AntisenseRnaRegionAlias.java @@ -18,13 +18,12 @@ import org.hibernate.annotations.CascadeType; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.model.map.species.fields.ModificationState; /** * This structure contains information about antisense rna region (rna fragment * of interest) for a specific - * {@link lcsb.mapviewer.model.map.species.AntisenseRna AntisenseRna}. + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRna + * AntisenseRna}. * * @author Piotr Gawron * @@ -41,7 +40,8 @@ public class AntisenseRnaRegionAlias implements Serializable { /** * Enum that enlists types of available modification regions in - * {@link lcsb.mapviewer.model.map.species.AntisenseRna AntisenseRna}. + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRna + * AntisenseRna}. * * @author Piotr Gawron * @@ -171,7 +171,7 @@ public class AntisenseRnaRegionAlias implements Serializable { @Cascade({ CascadeType.ALL }) @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "idSpeciesDb") - private AntisenseRnaAlias species; + private AntisenseRnaAlias species; /** * Default constructor. diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ChemicalAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ChemicalAlias.java index 1f5c88463fc99648eaad84f32cabd9db58f7d849..b9a0c730c23e60e0511ca34f06f4da401baf1869 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ChemicalAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ChemicalAlias.java @@ -4,8 +4,6 @@ import javax.persistence.Column; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; -import lcsb.mapviewer.model.map.species.Chemical; - @Entity @DiscriminatorValue("CHEMICAL_ALIAS") public abstract class ChemicalAlias extends SpeciesAlias { @@ -13,7 +11,7 @@ public abstract class ChemicalAlias extends SpeciesAlias { /** * */ - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; /** * <a href= @@ -21,7 +19,7 @@ public abstract class ChemicalAlias extends SpeciesAlias { * >Smiles</a> parameter for the chemical. */ @Column(name = "smiles", columnDefinition = "TEXT") - private String smiles; + private String smiles; /** * <a href= "http://en.wikipedia.org/wiki/International_Chemical_Identifier" > @@ -29,7 +27,7 @@ public abstract class ChemicalAlias extends SpeciesAlias { */ @Column(name = "inchi", columnDefinition = "TEXT") - private String inChI; + private String inChI; /** * <a href= @@ -37,15 +35,11 @@ public abstract class ChemicalAlias extends SpeciesAlias { * InChIKey</a> parameter for the chemical. */ - private String inChIKey; + private String inChIKey; ChemicalAlias() { } - public ChemicalAlias(Chemical chemical) { - super(chemical); - } - public ChemicalAlias(ChemicalAlias original) { super(original); smiles = original.getSmiles(); diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/CompartmentAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/CompartmentAlias.java index e5fa5e3f7c4fa2eef67308b8d721563d8a30a9f1..1971655bdddc7344e72901f92fd912b0003612cd 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/CompartmentAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/CompartmentAlias.java @@ -18,7 +18,6 @@ import org.hibernate.annotations.Type; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidStateException; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.agregator.Compartment; /** * This class defines alias for compartment in the model. @@ -116,22 +115,6 @@ public class CompartmentAlias extends Alias { setColor(DEFAULT_COLOR); } - /** - * Constructor that points on the compartment. - * - * @param compartment - * alias will reference to this compartment - */ - public CompartmentAlias(Compartment compartment) { - this(); - throw new NotImplementedException(); - } - - public CompartmentAlias(String aliasId, Compartment compartment) { - this(compartment); - setAliasId(aliasId); - } - public CompartmentAlias(String aliasId) { setAliasId(aliasId); } diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/CompartmentAliasComparator.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/CompartmentAliasComparator.java index 014897a76321c3fdfa39a61204afdf39c39723ae..fc7b054678526db32b919490a04223a300e17272 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/CompartmentAliasComparator.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/CompartmentAliasComparator.java @@ -11,8 +11,6 @@ import lcsb.mapviewer.common.comparator.DoubleComparator; import lcsb.mapviewer.common.comparator.IntegerComparator; import lcsb.mapviewer.common.comparator.PointComparator; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.agregator.CompartmentComparator; /** * This class implements comparator interface for CompartmentAlias. diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ComplexAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ComplexAlias.java index c9f6e4459ef0f687c8983666101fcac9da2db87f..44adf6647459f5c9263b3788e976e844e1449ffb 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ComplexAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ComplexAlias.java @@ -15,7 +15,6 @@ import org.hibernate.annotations.Cascade; import org.hibernate.annotations.CascadeType; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.ComplexSpecies; /** * Class that represents alias of a complex in the model. @@ -73,16 +72,6 @@ public class ComplexAlias extends SpeciesAlias { this.structuralState = original.getStructuralState(); } - /** - * Constructor that creates alias with reference to species. - * - * @param species - * rederence to this complex will be used by alias - */ - public ComplexAlias(ComplexSpecies species) { - super(species); - } - /** * Constructor that creates complex alias with given alias id. * @@ -93,11 +82,6 @@ public class ComplexAlias extends SpeciesAlias { super(aliasId); } - public ComplexAlias(String aliasId, ComplexSpecies cSpecies) { - this(cSpecies); - setAliasId(aliasId); - } - /** * Adds alias to the complex. * diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/DegradedAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/DegradedAlias.java index 9fa2c266d552e9c7063e740690700de6707554c4..02c923732ced336918870bebb88ad8844f3c2449 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/DegradedAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/DegradedAlias.java @@ -4,7 +4,6 @@ import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.Degraded; @Entity @DiscriminatorValue("DEGRADED_ALIAS") @@ -12,19 +11,10 @@ public class DegradedAlias extends SpeciesAlias { DegradedAlias() { } - public DegradedAlias(Degraded degraded) { - super(degraded); - } - public DegradedAlias(DegradedAlias original) { super(original); } - public DegradedAlias(String aliasId, Degraded degraded) { - super(degraded); - super.setAliasId(aliasId); - } - public DegradedAlias(String aliasId) { super.setAliasId(aliasId); } diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/DrugAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/DrugAlias.java index 7da88f1cf7b839ebbbc055d53352841a78cbb222..e54ed5fd71366a9c3db3065d87433c24ab0ca063 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/DrugAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/DrugAlias.java @@ -4,7 +4,6 @@ import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.Drug; @Entity @DiscriminatorValue("DRUG_ALIAS") @@ -12,10 +11,6 @@ public class DrugAlias extends SpeciesAlias { DrugAlias() { } - public DrugAlias(Drug drug) { - super(drug); - } - public DrugAlias(DrugAlias original) { super(original); } diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/GeneAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/GeneAlias.java index 93f516a48dda0c2910821ccab845fc697218ba9a..04e3b1fdb8cb1ea78e6666ee7ca7223332c67f88 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/GeneAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/GeneAlias.java @@ -13,7 +13,6 @@ import org.hibernate.annotations.LazyCollection; import org.hibernate.annotations.LazyCollectionOption; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.Gene; @Entity @DiscriminatorValue("GENE_ALIAS") @@ -35,10 +34,6 @@ public class GeneAlias extends SpeciesAlias { GeneAlias() { } - public GeneAlias(Gene gene) { - super(gene); - } - public GeneAlias(GeneAlias original) { super(original); for (ModificationResidueAlias mr : original.getModificationResidues()) { @@ -52,11 +47,6 @@ public class GeneAlias extends SpeciesAlias { } - public GeneAlias(String aliasId, Gene gene) { - super(gene); - super.setAliasId(aliasId); - } - public GeneAlias(String aliasId) { setAliasId(aliasId); } diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/GenericProteinAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/GenericProteinAlias.java index 20a95c4291ad0079aa463bda014658cb3b25a6aa..aa33839f1f4d787a781da0f94e953cdba59250ed 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/GenericProteinAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/GenericProteinAlias.java @@ -4,7 +4,6 @@ import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.GenericProtein; @Entity @DiscriminatorValue("GENERIC_PROTEIN_ALIAS") @@ -12,14 +11,6 @@ public class GenericProteinAlias extends ProteinAlias { GenericProteinAlias() { } - public GenericProteinAlias(GenericProtein genericProtein) { - super(genericProtein); - } - - public GenericProteinAlias(String aliasId, GenericProtein genericProtein) { - super(aliasId, genericProtein); - } - public GenericProteinAlias(String aliasId) { super(aliasId); } diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/IonAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/IonAlias.java index 6bf65a70a41e2111178d3b7c5abe275960bcd690..9a76148e33b7e5d4dbc9d34e1a10d0eafce2a6cf 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/IonAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/IonAlias.java @@ -4,7 +4,6 @@ import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.Ion; @Entity @DiscriminatorValue("ION_ALIAS") @@ -12,13 +11,10 @@ public class IonAlias extends ChemicalAlias { IonAlias() { } - public IonAlias(Ion ion) { - super(ion); - } - public IonAlias(IonAlias original) { super(original); } + public IonAlias(String aliasId) { setAliasId(aliasId); } diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/IonChannelProteinAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/IonChannelProteinAlias.java index 1b90bc3a7a5bbbb9a54844204ccb2a055b87acd3..820cfd5b95af53c1ef0a2425559764a4cf64bc90 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/IonChannelProteinAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/IonChannelProteinAlias.java @@ -4,7 +4,6 @@ import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.IonChannelProtein; @Entity @DiscriminatorValue("ION_CHANNEL_PROTEIN_ALIAS") @@ -12,10 +11,6 @@ public class IonChannelProteinAlias extends ProteinAlias { IonChannelProteinAlias() { } - public IonChannelProteinAlias(IonChannelProtein ionChannelProtein) { - super(ionChannelProtein); - } - public IonChannelProteinAlias(IonChannelProteinAlias original) { super(original); } diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ModificationResidueAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ModificationResidueAlias.java index cd0a2e7fbf1f4766fef7abfbf7393ea2fa6c90c1..475464ccceff9efd6f2ed4194333d53dd2ef26e4 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ModificationResidueAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ModificationResidueAlias.java @@ -16,7 +16,6 @@ import org.apache.log4j.Logger; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.fields.ModificationState; /** * This class represent modification residue in protein and gene. However, it is diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/fields/ModificationState.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ModificationState.java similarity index 94% rename from model/src/main/java/lcsb/mapviewer/model/map/species/fields/ModificationState.java rename to model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ModificationState.java index f18e6182fea88b9a4f03c77307020e1c520f33e7..5fa20a125aa2fc686fea35e84bc08e012abc2ff6 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/fields/ModificationState.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ModificationState.java @@ -1,152 +1,152 @@ -package lcsb.mapviewer.model.map.species.fields; - -/** - * Defines a type of modification (in protein or rna). Possible values are: - * <ul> - * <li>{@link ModificationState#ACETYLATED ACETYLATED},</li> - * <li>{@link ModificationState#DONT_CARE DON'T CARE},</li> - * <li>{@link ModificationState#EMPTY EMPTY},</li> - * <li>{@link ModificationState#GLYCOSYLATED GLYCOSYLATED},</li> - * <li>{@link ModificationState#HYDROXYLATED HYDROXYLATED},</li> - * <li>{@link ModificationState#METHYLATED METHYLATED},</li> - * <li>{@link ModificationState#MYRISTOYLATED MYRISTOYLATED},</li> - * <li>{@link ModificationState#PALMYTOYLATED PALMYTOYLATED},</li> - * <li>{@link ModificationState#PHOSPHORYLATED PHOSPHORYLATED},</li> - * <li>{@link ModificationState#PRENYLATED PRENYLATED},</li> - * <li>{@link ModificationState#PROTONATED PROTONATED},</li> - * <li>{@link ModificationState#SULFATED SULFATED},</li> - * <li>{@link ModificationState#UBIQUITINATED UBIQUITINATED},</li> - * <li>{@link ModificationState#UNKNOWN UNKNOWN}.</li> - * </ul> - * - * @author Piotr Gawron - * - */ -public enum ModificationState { - - /** - * Phosporylated state. - */ - PHOSPHORYLATED("phosphorylated", "P"), // - - /** - * Acetylated state. - */ - ACETYLATED("acetylated", "Ac"), // - - /** - * Ubiquitinated state. - */ - UBIQUITINATED("ubiquitinated", "Ub"), // - - /** - * Methylated state. - */ - METHYLATED("methylated", "Me"), // - - /** - * Hydroxylated state. - */ - HYDROXYLATED("hydroxylated", "OH"), // - - /** - * Myristoylated state. - */ - MYRISTOYLATED("myristoylated", "My"), // - - /** - * Sulfated state. - */ - SULFATED("sulfated", "S"), // - - /** - * Prenylated state. - */ - PRENYLATED("prenylated", "Pr"), // - - /** - * Glycosylated state. - */ - GLYCOSYLATED("glycosylated", "G"), // - - /** - * Palmytoylated state. - */ - PALMYTOYLATED("palmytoylated", "Pa"), // - - /** - * Unknown state. - */ - UNKNOWN("unknown", "?"), // - - /** - * Empty state. - */ - EMPTY("empty", ""), // - - /** - * Protonated state. - */ - PROTONATED("protonated", "H"), // - - /** - * We don't care in which state it is. - */ - DONT_CARE("don't care", "*"); - - /** - * Full name of the modification. - */ - - private String fullName; - /** - * Abbreviation used for the modification. - */ - private String abbreviation; - - /** - * Default constructor with the name and abbreviation. - * - * @param name - * name used for this state - * @param abbreviation - * abbreviation used in this state - */ - ModificationState(String name, String abbreviation) { - this.fullName = name; - this.abbreviation = abbreviation; - } - - /** - * @return the fullName - * @see #fullName - */ - public String getFullName() { - return fullName; - } - - /** - * @return the abbreviation - * @see #abbreviation - */ - public String getAbbreviation() { - return abbreviation; - } - - /** - * Returns {@link ModificationState} identified by the full name. - * - * @param name - * full name of the state - * @return {@link ModificationState} identified by the full name - */ - public static ModificationState getByName(String name) { - for (ModificationState state : values()) { - if (state.getFullName().equalsIgnoreCase(name)) { - return state; - } - } - return null; - } - -} +package lcsb.mapviewer.model.map.layout.alias; + +/** + * Defines a type of modification (in protein or rna). Possible values are: + * <ul> + * <li>{@link ModificationState#ACETYLATED ACETYLATED},</li> + * <li>{@link ModificationState#DONT_CARE DON'T CARE},</li> + * <li>{@link ModificationState#EMPTY EMPTY},</li> + * <li>{@link ModificationState#GLYCOSYLATED GLYCOSYLATED},</li> + * <li>{@link ModificationState#HYDROXYLATED HYDROXYLATED},</li> + * <li>{@link ModificationState#METHYLATED METHYLATED},</li> + * <li>{@link ModificationState#MYRISTOYLATED MYRISTOYLATED},</li> + * <li>{@link ModificationState#PALMYTOYLATED PALMYTOYLATED},</li> + * <li>{@link ModificationState#PHOSPHORYLATED PHOSPHORYLATED},</li> + * <li>{@link ModificationState#PRENYLATED PRENYLATED},</li> + * <li>{@link ModificationState#PROTONATED PROTONATED},</li> + * <li>{@link ModificationState#SULFATED SULFATED},</li> + * <li>{@link ModificationState#UBIQUITINATED UBIQUITINATED},</li> + * <li>{@link ModificationState#UNKNOWN UNKNOWN}.</li> + * </ul> + * + * @author Piotr Gawron + * + */ +public enum ModificationState { + + /** + * Phosporylated state. + */ + PHOSPHORYLATED("phosphorylated", "P"), // + + /** + * Acetylated state. + */ + ACETYLATED("acetylated", "Ac"), // + + /** + * Ubiquitinated state. + */ + UBIQUITINATED("ubiquitinated", "Ub"), // + + /** + * Methylated state. + */ + METHYLATED("methylated", "Me"), // + + /** + * Hydroxylated state. + */ + HYDROXYLATED("hydroxylated", "OH"), // + + /** + * Myristoylated state. + */ + MYRISTOYLATED("myristoylated", "My"), // + + /** + * Sulfated state. + */ + SULFATED("sulfated", "S"), // + + /** + * Prenylated state. + */ + PRENYLATED("prenylated", "Pr"), // + + /** + * Glycosylated state. + */ + GLYCOSYLATED("glycosylated", "G"), // + + /** + * Palmytoylated state. + */ + PALMYTOYLATED("palmytoylated", "Pa"), // + + /** + * Unknown state. + */ + UNKNOWN("unknown", "?"), // + + /** + * Empty state. + */ + EMPTY("empty", ""), // + + /** + * Protonated state. + */ + PROTONATED("protonated", "H"), // + + /** + * We don't care in which state it is. + */ + DONT_CARE("don't care", "*"); + + /** + * Full name of the modification. + */ + + private String fullName; + /** + * Abbreviation used for the modification. + */ + private String abbreviation; + + /** + * Default constructor with the name and abbreviation. + * + * @param name + * name used for this state + * @param abbreviation + * abbreviation used in this state + */ + ModificationState(String name, String abbreviation) { + this.fullName = name; + this.abbreviation = abbreviation; + } + + /** + * @return the fullName + * @see #fullName + */ + public String getFullName() { + return fullName; + } + + /** + * @return the abbreviation + * @see #abbreviation + */ + public String getAbbreviation() { + return abbreviation; + } + + /** + * Returns {@link ModificationState} identified by the full name. + * + * @param name + * full name of the state + * @return {@link ModificationState} identified by the full name + */ + public static ModificationState getByName(String name) { + for (ModificationState state : values()) { + if (state.getFullName().equalsIgnoreCase(name)) { + return state; + } + } + return null; + } + +} diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/PhenotypeAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/PhenotypeAlias.java index c9a84b72de720c8dcd494e71d969b6a2b9baf5cd..49526e06a8f47b5cc1d9f55d2cabb42e5b514ece 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/PhenotypeAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/PhenotypeAlias.java @@ -4,7 +4,6 @@ import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.Phenotype; @Entity @DiscriminatorValue("PHENTOYPE_ALIAS") @@ -13,10 +12,6 @@ public class PhenotypeAlias extends SpeciesAlias { PhenotypeAlias() { } - public PhenotypeAlias(Phenotype phenotype) { - super(phenotype); - } - public PhenotypeAlias(PhenotypeAlias original) { super(original); } diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/fields/PositionToCompartment.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/PositionToCompartment.java similarity index 78% rename from model/src/main/java/lcsb/mapviewer/model/map/species/fields/PositionToCompartment.java rename to model/src/main/java/lcsb/mapviewer/model/map/layout/alias/PositionToCompartment.java index a8467cae90d8b06887b38b74d09e49665e91010e..cb512ced9cc58d51de06cabd95ac96d7b2b26f7e 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/fields/PositionToCompartment.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/PositionToCompartment.java @@ -1,75 +1,76 @@ -package lcsb.mapviewer.model.map.species.fields; - -/** - * Defines possible position of {@link lcsb.mapviewer.model.map.species.Species} - * on {@link lcsb.mapviewer.model.map.agregator.Compartment}. - * - * @author Piotr Gawron - * - */ -public enum PositionToCompartment { - - /** - * Species is inside compartment. - */ - INSIDE("inside"), - - /** - * Species is inside the border. - */ - INSIDE_OF_MEMBRANE("insideOfMembrane"), - - /** - * Species is crossing the border. - */ - TRANSMEMBRANE("transmembrane"), - - /** - * Species is on outer border of compartment. - */ - OUTER_SURFACE("outerSurface"), - - /** - * Species is on inner border of compartment. - */ - INNER_SURFACE("innerSurface"); - - /** - * String representing the position. - */ - private String stringName; - - /** - * Default constructor. - * - * @param stringName - * {@link #stringName} - */ - PositionToCompartment(String stringName) { - this.stringName = stringName; - } - - /** - * @return the stringName - * @see #stringName - */ - public String getStringName() { - return stringName; - } - - /** - * Returns {@link PositionToCompartment} based on the {@link #stringName}. - * - * @param string - * {@link #stringName} - * @return {@link PositionToCompartment} based on the {@link #stringName} - */ - public static PositionToCompartment getByString(String string) { - for (PositionToCompartment pos : PositionToCompartment.values()) { - if (pos.getStringName().equalsIgnoreCase(string)) { - return pos; - } - } - return null; - } -} +package lcsb.mapviewer.model.map.layout.alias; + +/** + * Defines possible position of + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.Species} on + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.Compartment}. + * + * @author Piotr Gawron + * + */ +public enum PositionToCompartment { + + /** + * Species is inside compartment. + */ + INSIDE("inside"), + + /** + * Species is inside the border. + */ + INSIDE_OF_MEMBRANE("insideOfMembrane"), + + /** + * Species is crossing the border. + */ + TRANSMEMBRANE("transmembrane"), + + /** + * Species is on outer border of compartment. + */ + OUTER_SURFACE("outerSurface"), + + /** + * Species is on inner border of compartment. + */ + INNER_SURFACE("innerSurface"); + + /** + * String representing the position. + */ + private String stringName; + + /** + * Default constructor. + * + * @param stringName + * {@link #stringName} + */ + PositionToCompartment(String stringName) { + this.stringName = stringName; + } + + /** + * @return the stringName + * @see #stringName + */ + public String getStringName() { + return stringName; + } + + /** + * Returns {@link PositionToCompartment} based on the {@link #stringName}. + * + * @param string + * {@link #stringName} + * @return {@link PositionToCompartment} based on the {@link #stringName} + */ + public static PositionToCompartment getByString(String string) { + for (PositionToCompartment pos : PositionToCompartment.values()) { + if (pos.getStringName().equalsIgnoreCase(string)) { + return pos; + } + } + return null; + } +} diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ProteinAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ProteinAlias.java index 82ff4592462ed9914492bdbc45f3ccaf47a129a2..673f8b0b686d0932912b96308780408cd81ffe44 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ProteinAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ProteinAlias.java @@ -12,8 +12,6 @@ import org.hibernate.annotations.CascadeType; import org.hibernate.annotations.LazyCollection; import org.hibernate.annotations.LazyCollectionOption; -import lcsb.mapviewer.model.map.species.Protein; - @Entity @DiscriminatorValue("PROTEIN_ALIAS") public abstract class ProteinAlias extends SpeciesAlias { @@ -39,15 +37,6 @@ public abstract class ProteinAlias extends SpeciesAlias { ProteinAlias() { } - public ProteinAlias(String aliasId, Protein protein) { - super(protein); - this.setAliasId(aliasId); - } - - public ProteinAlias(Protein protein) { - super(protein); - } - public ProteinAlias(ProteinAlias original) { super(original); this.structuralState = original.getStructuralState(); diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ReceptorProteinAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ReceptorProteinAlias.java index 9b5bdb4aa6151fd10ea58332d957b35ef451344b..ea4ed552176dda179964e99dc5a9fc301865bcf0 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ReceptorProteinAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/ReceptorProteinAlias.java @@ -4,7 +4,6 @@ import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.ReceptorProtein; @Entity @DiscriminatorValue("RECEPTOR_PROTEIN_ALIAS") @@ -12,10 +11,6 @@ public class ReceptorProteinAlias extends ProteinAlias { ReceptorProteinAlias() { } - public ReceptorProteinAlias(ReceptorProtein receptorProtein) { - super(receptorProtein); - } - public ReceptorProteinAlias(ReceptorProteinAlias original) { super(original); } diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/RnaAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/RnaAlias.java index 79cbbd71a4d119012d8bf924e0f401df122ee783..38ce0e289b60489f62ef6caa5d20f9be9d86f3c5 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/RnaAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/RnaAlias.java @@ -13,7 +13,6 @@ import org.hibernate.annotations.LazyCollection; import org.hibernate.annotations.LazyCollectionOption; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.Rna; @Entity @DiscriminatorValue("RNA_ALIAS") @@ -23,7 +22,7 @@ public class RnaAlias extends SpeciesAlias { * */ private static final long serialVersionUID = 1L; - + /** * List of rna regions (some rna sequences) in this object. */ @@ -35,10 +34,6 @@ public class RnaAlias extends SpeciesAlias { RnaAlias() { } - public RnaAlias(Rna rna) { - super(rna); - } - public RnaAlias(RnaAlias original) { super(original); for (RnaRegionAlias region : original.getRegions()) { diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/RnaRegionAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/RnaRegionAlias.java index e2200da4d1808d16f63b6dbcbca7e7da32329f33..ee5053a3241e8a38e8b1dca4819b77f1d8c66b80 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/RnaRegionAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/RnaRegionAlias.java @@ -15,12 +15,11 @@ import javax.persistence.Table; import org.apache.log4j.Logger; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.model.map.species.fields.ModificationState; /** * This structure contains information about rna region (rna fragment of - * interest) for a specific {@link lcsb.mapviewer.model.map.species.Rna Rna}. + * interest) for a specific + * {@link lcsb.mapviewer.converter.model.celldesigner.structure.Rna Rna}. * * @author Piotr Gawron * @@ -103,7 +102,7 @@ public class RnaRegionAlias implements Serializable { */ @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "idSpeciesDb") - private RnaAlias species; + private RnaAlias species; /** * Default constructor. diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/SimpleMoleculeAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/SimpleMoleculeAlias.java index 8072a549ae361aea1bbcef7e52021ecc740f0059..95a4002f7e08d033b4846ea8c13ac24a0113afa1 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/SimpleMoleculeAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/SimpleMoleculeAlias.java @@ -4,7 +4,6 @@ import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.SimpleMolecule; @Entity @DiscriminatorValue("SIMPLE_MOLECULE_ALIAS") @@ -12,19 +11,10 @@ public class SimpleMoleculeAlias extends ChemicalAlias { SimpleMoleculeAlias() { } - public SimpleMoleculeAlias(SimpleMolecule simpleMolecule) { - super(simpleMolecule); - } - public SimpleMoleculeAlias(SimpleMoleculeAlias original) { super(original); } - public SimpleMoleculeAlias(String aliasId, SimpleMolecule species) { - super(species); - super.setAliasId(aliasId); - } - public SimpleMoleculeAlias(String aliasId) { setAliasId(aliasId); } diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/SpeciesAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/SpeciesAlias.java index 9104251a218e306f570a34c81104a22086f0ff96..d5c353c94b2402191f670f6a67242feb1b23487e 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/SpeciesAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/SpeciesAlias.java @@ -16,10 +16,7 @@ import org.apache.log4j.Logger; import org.hibernate.annotations.Cascade; import org.hibernate.annotations.CascadeType; -import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.model.map.reaction.ReactionNode; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.model.map.species.fields.PositionToCompartment; /** * {@link Alias} structure used for representing {@link Species}. @@ -145,17 +142,6 @@ public abstract class SpeciesAlias extends Alias { state = "usual"; } - /** - * Constructor with species to which alias will refer. - * - * @param species - * {@link #species} - */ - public SpeciesAlias(Species species) { - this(); - throw new NotImplementedException(); - } - /** * Constructor that initializes data with the information given in the * parameter. diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/SpeciesAliasComparator.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/SpeciesAliasComparator.java index fd18b76c3dad035de932be7ccea48f2ba4bc8687..d9ebdf31f686170af9337c44eb033711ef8db403 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/SpeciesAliasComparator.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/SpeciesAliasComparator.java @@ -10,8 +10,6 @@ import lcsb.mapviewer.common.comparator.DoubleComparator; import lcsb.mapviewer.common.comparator.IntegerComparator; import lcsb.mapviewer.common.comparator.StringComparator; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.ElementComparator; -import lcsb.mapviewer.model.map.species.SpeciesComparator; /** * This class implements comparator interface for SpeciesAlias. It also handles @@ -133,7 +131,6 @@ public class SpeciesAliasComparator implements Comparator<SpeciesAlias> { DoubleComparator doubleComparator = new DoubleComparator(epsilon); BooleanComparator booleanComparator = new BooleanComparator(); - SpeciesComparator speciesComparator = new SpeciesComparator(epsilon); IntegerComparator integerComparator = new IntegerComparator(); if (booleanComparator.compare(arg0.getActivity(), arg1.getActivity()) != 0) { @@ -156,7 +153,6 @@ public class SpeciesAliasComparator implements Comparator<SpeciesAlias> { return stringComparator.compare(arg0.getAliasStatePrefix(), arg1.getAliasStatePrefix()); } - if (integerComparator.compare(arg0.getInitialAmount(), arg1.getInitialAmount()) != 0) { logger.debug("Initial amount different: " + arg0.getInitialAmount() + ", " + arg1.getInitialAmount()); return integerComparator.compare(arg0.getInitialAmount(), arg1.getInitialAmount()); @@ -196,7 +192,7 @@ public class SpeciesAliasComparator implements Comparator<SpeciesAlias> { logger.debug("Hypothetical different: \"" + arg0.isHypothetical() + "\", \"" + arg1.isHypothetical() + "\""); return booleanComparator.compare(arg0.isHypothetical(), arg1.isHypothetical()); } - + return 0; } } diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/TruncatedProteinAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/TruncatedProteinAlias.java index e2d5eb4c9b21ff54db8a39494491cae5cf152ef2..2e14310c2e1f130ac314805d3df6c2ac62435bbe 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/TruncatedProteinAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/TruncatedProteinAlias.java @@ -4,7 +4,6 @@ import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.TruncatedProtein; @Entity @DiscriminatorValue("TRUNCATED_PROTEIN_ALIAS") @@ -12,10 +11,6 @@ public class TruncatedProteinAlias extends ProteinAlias { TruncatedProteinAlias() { } - public TruncatedProteinAlias(TruncatedProtein truncateProtein) { - super(truncateProtein); - } - public TruncatedProteinAlias(TruncatedProteinAlias original) { super(original); } diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/UnknownAlias.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/UnknownAlias.java index 85e8f6fa8e77b21ecf21796036f1940c0dc7da91..40eb9098803b72f1892e7a157532d83f099e4980 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/UnknownAlias.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/alias/UnknownAlias.java @@ -4,7 +4,6 @@ import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.Unknown; @Entity @DiscriminatorValue("UNKNOWN_ALIAS") @@ -12,10 +11,6 @@ public class UnknownAlias extends SpeciesAlias { UnknownAlias() { } - public UnknownAlias(Unknown degraded) { - super(degraded); - } - public UnknownAlias(UnknownAlias original) { super(original); } diff --git a/model/src/main/java/lcsb/mapviewer/model/map/model/Model.java b/model/src/main/java/lcsb/mapviewer/model/map/model/Model.java index 2c8deaf5f4fee55fa8a28bdbeb2846bee60d0b79..29676b32104f4930ba60851b12879a2a816b3016 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/model/Model.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/model/Model.java @@ -10,10 +10,8 @@ import org.apache.log4j.Appender; import lcsb.mapviewer.common.EventStorageLoggerAppender; import lcsb.mapviewer.model.Project; import lcsb.mapviewer.model.map.AnnotatedObject; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.OverviewImage; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.graph.DataMiningSet; import lcsb.mapviewer.model.map.layout.Layout; import lcsb.mapviewer.model.map.layout.alias.Alias; @@ -24,7 +22,6 @@ import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.layout.graphics.Layer; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.Species; /** * This interface defines functionality that the model container class should @@ -342,7 +339,7 @@ public interface Model { * @return collection of species aliases */ Collection<SpeciesAlias> getNotComplexSpeciesAliases(); - + List<SpeciesAlias> getSpeciesAliases(); /** @@ -368,7 +365,7 @@ public interface Model { * @return list of elements */ Set<AnnotatedObject> getElementsByAnnotation(MiriamData miriamData); - + List<Alias> getAliasByName(String name); /** @@ -660,7 +657,7 @@ public interface Model { /** * Return list od all {@link AnnotatedObject} in the map. This includes all - * {@link Reaction reactions} and {@link Element elements}. + * {@link Reaction reactions} and {@link Alias elements}. * * @return list od all {@link AnnotatedObject} in the map */ diff --git a/model/src/main/java/lcsb/mapviewer/model/map/model/ModelComparator.java b/model/src/main/java/lcsb/mapviewer/model/map/model/ModelComparator.java index 0c47df44c744ffe53873c154c17f85f4877aa888..7eba1e40b509e73bfb7ce164d58ccc27720ec35d 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/model/ModelComparator.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/model/ModelComparator.java @@ -14,13 +14,8 @@ import lcsb.mapviewer.common.comparator.BooleanComparator; import lcsb.mapviewer.common.comparator.DoubleComparator; import lcsb.mapviewer.common.comparator.IntegerComparator; import lcsb.mapviewer.common.comparator.StringComparator; -import lcsb.mapviewer.common.exception.InvalidClassException; -import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.Element; -import lcsb.mapviewer.model.map.ElementComparator; import lcsb.mapviewer.model.map.OverviewImage; import lcsb.mapviewer.model.map.OverviewImageComparator; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.graph.DataMiningSetComparator; import lcsb.mapviewer.model.map.layout.Layout; import lcsb.mapviewer.model.map.layout.LayoutComparator; @@ -30,7 +25,6 @@ import lcsb.mapviewer.model.map.layout.graphics.Layer; import lcsb.mapviewer.model.map.layout.graphics.LayerComparator; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.ReactionComparator; -import lcsb.mapviewer.model.map.species.Species; /** * Comparator for {@link Model} class. @@ -266,71 +260,6 @@ public class ModelComparator implements Comparator<Model> { return 0; } - /** - * Compares two sets of elements. - * - * @param elements - * first set of elements - * @param elements2 - * second set of elements - * @return if sets are equal then returns 0. If they are different then -1/1 - * is returned. - */ - private int compareElements(Set<Element> elements, Set<Element> elements2) { - ElementComparator comparator = new ElementComparator(epsilon); - - Map<String, Element> map = new HashMap<String, Element>(); - Map<String, Element> map2 = new HashMap<String, Element>(); - for (Element element : elements) { - if (element instanceof Species) { - map.put(((Species) element).getElementId(), element); - } else if (element instanceof Compartment) { - map.put(((Compartment) element).getElementId(), element); - } else { - throw new InvalidClassException("Unknown class type..."); - } - } - - for (Element element : elements2) { - if (element instanceof Species) { - map2.put(((Species) element).getElementId(), element); - } else if (element instanceof Compartment) { - map2.put(((Compartment) element).getElementId(), element); - } else { - throw new InvalidClassException("Unknown class type..."); - } - } - - for (Element element : elements) { - String id = ""; - if (element instanceof Species) { - id = ((Species) element).getElementId(); - } else if (element instanceof Compartment) { - id = ((Compartment) element).getElementId(); - } - int status = comparator.compare(element, map2.get(id)); - if (status != 0) { - logger.debug("Element with id " + id + " (" + element.getClass() + ") different"); - return status; - } - } - - for (Element element : elements2) { - String id = ""; - if (element instanceof Species) { - id = ((Species) element).getElementId(); - } else if (element instanceof Compartment) { - id = ((Compartment) element).getElementId(); - } - int status = comparator.compare(element, map.get(id)); - if (status != 0) { - logger.debug("Element with id " + id + "(" + element.getClass() + ") different"); - return status; - } - } - return 0; - } - /** * Compares two sets of layers. * diff --git a/model/src/main/java/lcsb/mapviewer/model/map/model/ModelData.java b/model/src/main/java/lcsb/mapviewer/model/map/model/ModelData.java index 21a88ba3d09f9261b705d8210e3c7ef12b98a45e..6041b053120676b1e847eee32938b25995994d88 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/model/ModelData.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/model/ModelData.java @@ -21,9 +21,12 @@ import javax.persistence.Table; import javax.persistence.Transient; import javax.xml.bind.annotation.XmlTransient; +import org.apache.log4j.Logger; +import org.hibernate.annotations.Cascade; +import org.hibernate.annotations.CascadeType; + import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.model.Project; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.OverviewImage; import lcsb.mapviewer.model.map.graph.DataMiningSet; import lcsb.mapviewer.model.map.layout.Layout; @@ -33,10 +36,6 @@ import lcsb.mapviewer.model.map.layout.alias.BlockDiagram; import lcsb.mapviewer.model.map.layout.graphics.Layer; import lcsb.mapviewer.model.map.reaction.Reaction; -import org.apache.log4j.Logger; -import org.hibernate.annotations.Cascade; -import org.hibernate.annotations.CascadeType; - /** * Representation of the model data. It contains all information about single * map: diff --git a/model/src/main/java/lcsb/mapviewer/model/map/model/ModelFullIndexed.java b/model/src/main/java/lcsb/mapviewer/model/map/model/ModelFullIndexed.java index 27c547eb3d877ac5d31a6fa1af253043739cc9f1..b04c10636f5dc84993f5461c512868c92bf45170 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/model/ModelFullIndexed.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/model/ModelFullIndexed.java @@ -17,25 +17,20 @@ import lcsb.mapviewer.common.EventStorageLoggerAppender; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.model.Project; import lcsb.mapviewer.model.map.AnnotatedObject; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.OverviewImage; import lcsb.mapviewer.model.map.OverviewImageLink; import lcsb.mapviewer.model.map.OverviewLink; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.graph.DataMiningSet; import lcsb.mapviewer.model.map.layout.Layout; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.AliasGroup; -import lcsb.mapviewer.model.map.layout.alias.ArtifitialCompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.BlockDiagram; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.layout.graphics.Layer; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Species; /** * This class implemets {@link Model} interface. It's is very simple @@ -50,35 +45,35 @@ public class ModelFullIndexed implements Model { /** * Default class logger. */ - private static Logger logger = Logger.getLogger(ModelFullIndexed.class); + private static Logger logger = Logger.getLogger(ModelFullIndexed.class); /** * Object that map {@link Alias#aliasId alias identifier} into {@link Alias}. */ - private Map<String, Alias> aliasByAliasId = new HashMap<String, Alias>(); + private Map<String, Alias> aliasByAliasId = new HashMap<String, Alias>(); /** * Object that map {@link Alias#id alias database identifier} into * {@link Alias}. */ - private Map<Integer, Alias> aliasByDbId = new HashMap<Integer, Alias>(); + private Map<Integer, Alias> aliasByDbId = new HashMap<Integer, Alias>(); /** * Object that map {@link Reaction#idReaction reaction identifier} into * {@link Reaction}. */ - private Map<String, Reaction> reactionByReactionId = new HashMap<String, Reaction>(); + private Map<String, Reaction> reactionByReactionId = new HashMap<String, Reaction>(); /** * Object that map {@link Reaction#id reaction database identifier} into * {@link Reaction}. */ - private Map<Integer, Reaction> reactionByDbId = new HashMap<Integer, Reaction>(); + private Map<Integer, Reaction> reactionByDbId = new HashMap<Integer, Reaction>(); /** * {@link ModelData} object containing "raw" data about the model. */ - private ModelData modelData = null; + private ModelData modelData = null; /** * Default constructor. @@ -471,7 +466,7 @@ public class ModelFullIndexed implements Model { CompartmentAlias ca = alias.getCompartmentAlias(); ca.removeAlias(alias); } - + if (alias instanceof SpeciesAlias) { SpeciesAlias al = (SpeciesAlias) alias; if (al.getComplexAlias() != null) { diff --git a/model/src/main/java/lcsb/mapviewer/model/map/modifier/Catalysis.java b/model/src/main/java/lcsb/mapviewer/model/map/modifier/Catalysis.java index e5060d591481d90dbb5e1864e89455e3408b02bf..616e6fa8438dec59fd8fb68f0b436f0ad9711b7c 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/modifier/Catalysis.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/modifier/Catalysis.java @@ -4,7 +4,6 @@ import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.reaction.Modifier; @@ -35,8 +34,6 @@ public class Catalysis extends Modifier { * * @param alias * alias object to which this modifiar is assigned - * @param element - * element to which this modifier is assigned */ public Catalysis(SpeciesAlias alias) { super(alias); diff --git a/model/src/main/java/lcsb/mapviewer/model/map/modifier/Inhibition.java b/model/src/main/java/lcsb/mapviewer/model/map/modifier/Inhibition.java index d70b8c508349dbfe0ac76a862262ac5ab4f50b0a..d6e36305cc220c2d787849e25f0727eb7982d683 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/modifier/Inhibition.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/modifier/Inhibition.java @@ -34,8 +34,6 @@ public class Inhibition extends Modifier { * * @param alias * alias object to which this modifiar is assigned - * @param element - * element to which this modifier is assigned */ public Inhibition(SpeciesAlias alias) { super(alias); diff --git a/model/src/main/java/lcsb/mapviewer/model/map/modifier/Modulation.java b/model/src/main/java/lcsb/mapviewer/model/map/modifier/Modulation.java index f3f6f141c5c6e9b9f61bc56b358ab91df4807c05..7a5d19d33a4a86a84a2967f7ed12ebbfcdd709d9 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/modifier/Modulation.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/modifier/Modulation.java @@ -4,7 +4,6 @@ import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.reaction.Modifier; @@ -21,7 +20,7 @@ public class Modulation extends Modifier { /** * */ - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; /** * Default constructor. @@ -35,8 +34,6 @@ public class Modulation extends Modifier { * * @param alias * alias object to which this modifiar is assigned - * @param element - * element to which this modifier is assigned */ public Modulation(SpeciesAlias alias) { super(alias); diff --git a/model/src/main/java/lcsb/mapviewer/model/map/modifier/PhysicalStimulation.java b/model/src/main/java/lcsb/mapviewer/model/map/modifier/PhysicalStimulation.java index 28ae11af873c5adf164d454e39469eb52737f3cc..187bc27cb09e1136dfdf7717f0dbe899ef3a8f7b 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/modifier/PhysicalStimulation.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/modifier/PhysicalStimulation.java @@ -4,7 +4,6 @@ import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.reaction.Modifier; @@ -36,8 +35,6 @@ public class PhysicalStimulation extends Modifier { * * @param alias * alias object to which this modifiar is assigned - * @param element - * element to which this modifier is assigned */ public PhysicalStimulation(SpeciesAlias alias) { super(alias); diff --git a/model/src/main/java/lcsb/mapviewer/model/map/modifier/Trigger.java b/model/src/main/java/lcsb/mapviewer/model/map/modifier/Trigger.java index 9739ea7983f43b93fd4ea465fd53199ad6dba315..877a6d7147ea9868679bf9f8f11f836b4969fc1a 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/modifier/Trigger.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/modifier/Trigger.java @@ -4,7 +4,6 @@ import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.reaction.Modifier; @@ -21,7 +20,7 @@ public class Trigger extends Modifier { /** * */ - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; /** * Default constructor. @@ -35,8 +34,6 @@ public class Trigger extends Modifier { * * @param alias * alias object to which this modifiar is assigned - * @param element - * element to which this modifier is assigned */ public Trigger(SpeciesAlias alias) { super(alias); diff --git a/model/src/main/java/lcsb/mapviewer/model/map/modifier/UnknownCatalysis.java b/model/src/main/java/lcsb/mapviewer/model/map/modifier/UnknownCatalysis.java index c57d25336dc592f5415b13574734eb416296d191..3e2b0d8fb445321b088e15e9b3a883a37cf7344a 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/modifier/UnknownCatalysis.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/modifier/UnknownCatalysis.java @@ -4,7 +4,6 @@ import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.reaction.Modifier; @@ -36,8 +35,6 @@ public class UnknownCatalysis extends Modifier { * * @param alias * alias object to which this modifiar is assigned - * @param element - * element to which this modifier is assigned */ public UnknownCatalysis(SpeciesAlias alias) { super(alias); diff --git a/model/src/main/java/lcsb/mapviewer/model/map/modifier/UnknownInhibition.java b/model/src/main/java/lcsb/mapviewer/model/map/modifier/UnknownInhibition.java index 112a10b0192276369b9530873a99d88235acdc56..511ebf6877ab53da3e2ca84881e0e94c95317c5d 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/modifier/UnknownInhibition.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/modifier/UnknownInhibition.java @@ -4,7 +4,6 @@ import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.reaction.Modifier; @@ -36,8 +35,6 @@ public class UnknownInhibition extends Modifier { * * @param alias * alias object to which this modifiar is assigned - * @param element - * element to which this modifier is assigned */ public UnknownInhibition(SpeciesAlias alias) { super(alias); diff --git a/model/src/main/java/lcsb/mapviewer/model/map/reaction/Modifier.java b/model/src/main/java/lcsb/mapviewer/model/map/reaction/Modifier.java index a9c922226a7eb649bf6323a6438dd314ec8b04c6..f61570b290c45324a599a19dd03b0469b84cd775 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/reaction/Modifier.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/reaction/Modifier.java @@ -4,7 +4,6 @@ import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; /** @@ -31,15 +30,13 @@ public class Modifier extends ReactionNode { } /** - * Constructor that creates modifier for given {@link SpeciesAlias} and - * {@link Element}. These elements reference to the objects in the + * Constructor that creates modifier for given {@link SpeciesAlias}. These + * elements reference to the objects in the * {@link lcsb.mapviewer.model.map.model.db.model.map.Model Model} that * represents this modifier. * * @param alias * alias that represent this modifier - * @param element - * element that represent this modifier */ public Modifier(SpeciesAlias alias) { super(alias); diff --git a/model/src/main/java/lcsb/mapviewer/model/map/reaction/Product.java b/model/src/main/java/lcsb/mapviewer/model/map/reaction/Product.java index df3298b930a2c93f59193712111c4e04916fd47b..2e7c9dbbd18410585db4d784bc82ea3aad51290a 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/reaction/Product.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/reaction/Product.java @@ -4,7 +4,6 @@ import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; /** @@ -30,15 +29,13 @@ public class Product extends ReactionNode { } /** - * Constructor that creates product for given {@link SpeciesAlias} and - * {@link Element}. These elements reference to the objects in the + * Constructor that creates product for given {@link SpeciesAlias}. These + * elements reference to the objects in the * {@link lcsb.mapviewer.model.map.model.db.model.map.Model Model} that * represents this product. * * @param alias * alias that represent this product - * @param element - * element that represent this product */ public Product(SpeciesAlias alias) { super(alias); diff --git a/model/src/main/java/lcsb/mapviewer/model/map/reaction/Reactant.java b/model/src/main/java/lcsb/mapviewer/model/map/reaction/Reactant.java index dcbe8da7e119de4eef754c9972e4a4c4ac043b8e..f553d769f5cfe849c644f9e0bc2fdfed0b9e3bd5 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/reaction/Reactant.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/reaction/Reactant.java @@ -4,7 +4,6 @@ import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; /** @@ -30,15 +29,13 @@ public class Reactant extends ReactionNode { } /** - * Constructor that creates reactant for a given {@link SpeciesAlias} and - * {@link Element}. These elements reference to the objects in the + * Constructor that creates reactant for a given {@link SpeciesAlias}. These + * elements reference to the objects in the * {@link lcsb.mapviewer.model.map.model.db.model.map.Model Model} that * represents this reactant. * * @param alias * alias that represent this reactant - * @param element - * element that represent this reactant */ public Reactant(SpeciesAlias alias) { super(alias); diff --git a/model/src/main/java/lcsb/mapviewer/model/map/reaction/Reaction.java b/model/src/main/java/lcsb/mapviewer/model/map/reaction/Reaction.java index 0f3de039cc9d2c7f8ffc9d5054f5af548fcead66..16fa2d5e4c98b7ec18fb16611f0600e2d4dc5257 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/reaction/Reaction.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/reaction/Reaction.java @@ -39,7 +39,6 @@ import org.hibernate.annotations.IndexColumn; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.common.geometry.LineTransformation; import lcsb.mapviewer.model.map.AnnotatedObject; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.model.Model; @@ -517,7 +516,7 @@ public class Reaction implements AnnotatedObject { /** * Check if one of the nodes reference to the element. * - * @param element + * @param alias * element to be checked * @return <code>true</code> if element is part of the reaction, * <code>false</code> otherwise diff --git a/model/src/main/java/lcsb/mapviewer/model/map/reaction/ReactionNode.java b/model/src/main/java/lcsb/mapviewer/model/map/reaction/ReactionNode.java index 4902211d6f8469cff849ab9e1111318c3a8a8494..23643d2030bfbda6c55dc7b1fabb9871eb0e0fb7 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/reaction/ReactionNode.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/reaction/ReactionNode.java @@ -4,7 +4,6 @@ import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import javax.persistence.ManyToOne; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.Alias; /** @@ -13,9 +12,9 @@ import lcsb.mapviewer.model.map.layout.alias.Alias; * {@link #alias} define which element on the map correspond to this node. There * are three known subclasses: * <ul> - * <li> {@link Reactant} - input of the reaction,</li> - * <li> {@link Product} - output of the reaction,</li> - * <li> {@link Modifier} - some modifier of the reaction.</li> + * <li>{@link Reactant} - input of the reaction,</li> + * <li>{@link Product} - output of the reaction,</li> + * <li>{@link Modifier} - some modifier of the reaction.</li> * </ul> * * @@ -29,13 +28,13 @@ public abstract class ReactionNode extends AbstractNode { /** * */ - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; /** * {@link SpecisAlias} that represents this node in the model. */ @ManyToOne - private Alias alias; + private Alias alias; /** * Default constructor. @@ -61,8 +60,6 @@ public abstract class ReactionNode extends AbstractNode { * * @param alias * {@link Alias} to which this node refer to - * @param element - * {@link Element} to which this node refer to */ public ReactionNode(Alias alias) { this.alias = alias; @@ -77,7 +74,8 @@ public abstract class ReactionNode extends AbstractNode { } /** - * @param alias the alias to set + * @param alias + * the alias to set * @see #alias */ public void setAlias(Alias alias) { diff --git a/model/src/main/java/lcsb/mapviewer/model/map/reaction/ReactionNodeComparator.java b/model/src/main/java/lcsb/mapviewer/model/map/reaction/ReactionNodeComparator.java index 25dd159e5b01dddca23d15c18764733a2a0e2994..1efc5fba8143865be182a85e08f51b7322745a3c 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/reaction/ReactionNodeComparator.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/reaction/ReactionNodeComparator.java @@ -5,7 +5,6 @@ import java.util.Comparator; import org.apache.log4j.Logger; import lcsb.mapviewer.common.Configuration; -import lcsb.mapviewer.model.map.ElementComparator; import lcsb.mapviewer.model.map.layout.alias.AliasComparator; /** @@ -78,7 +77,6 @@ public class ReactionNodeComparator implements Comparator<ReactionNode> { */ private int internalCompare(ReactionNode arg0, ReactionNode arg1) { AbstractNodeComparator anComparator = new AbstractNodeComparator(epsilon); - ElementComparator elementComparator = new ElementComparator(epsilon); AliasComparator aliasComparator = new AliasComparator(epsilon); int result = anComparator.internalCompare(arg0, arg1); diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/Phenotype.java b/model/src/main/java/lcsb/mapviewer/model/map/species/Phenotype.java deleted file mode 100644 index ccac5bd6f062c1971bd820c636ad1f76d179e5bd..0000000000000000000000000000000000000000 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/Phenotype.java +++ /dev/null @@ -1,117 +0,0 @@ -package lcsb.mapviewer.model.map.species; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; -import javax.persistence.OneToMany; - -import org.hibernate.annotations.Cascade; -import org.hibernate.annotations.CascadeType; -import org.hibernate.annotations.LazyCollection; -import org.hibernate.annotations.LazyCollectionOption; - -import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.layout.alias.PhenotypeAlias; -import lcsb.mapviewer.model.map.species.fields.AssociatedElement; - -/** - * Class representing phenotype in the model. - * - * @author Piotr Gawron - * - */ -@Entity -@DiscriminatorValue("Phenotype") -public class Phenotype extends Species<PhenotypeAlias> { - - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * List of associated with this phenotape elements. - */ - @Cascade({ CascadeType.ALL }) - @OneToMany(mappedBy = "phenotype", orphanRemoval = true) - @LazyCollection(LazyCollectionOption.FALSE) - private List<AssociatedElement> associatedElements = new ArrayList<AssociatedElement>(); - - /** - * Constructor that initializes phenotype with the data passed in the - * argument. - * - * @param species - * original species used for data initialization - */ - public Phenotype(Species species) { - super(species); - if (species instanceof Phenotype) { - Phenotype phenotype = (Phenotype) species; - for (AssociatedElement ae : phenotype.getAssociatedElements()) { - addAssociatedElement(new AssociatedElement(ae)); - } - } - } - - /** - * Default constructor. - */ - public Phenotype() { - } - - @Override - public Phenotype copy() { - if (this.getClass() == Phenotype.class) { - return new Phenotype(this); - } else { - throw new NotImplementedException("Method copy() should be overriden in class " + this.getClass()); - } - } - - @Override - public String getStringType() { - return "Phenotype"; - } - - /** - * Adds associated element to the phenotype. - * - * @param ae - * associated element to add - */ - public void addAssociatedElement(AssociatedElement ae) { - associatedElements.add(ae); - ae.setPhenotype(this); - } - - /** - * @return the associatedElements - * @see #associatedElements - */ - public List<AssociatedElement> getAssociatedElements() { - return associatedElements; - } - - /** - * @param associatedElements - * the associatedElements to set - * @see #associatedElements - */ - public void setAssociatedElements(List<AssociatedElement> associatedElements) { - this.associatedElements = associatedElements; - } - - @Override - public PhenotypeAlias createAlias(String aliasId) { - PhenotypeAlias result = new PhenotypeAlias(aliasId); - if (associatedElements.size() > 0) { - throw new NotImplementedException(); - } - super.setAliasFields(result); - return result; - } - -} diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/fields/AssociatedElement.java b/model/src/main/java/lcsb/mapviewer/model/map/species/fields/AssociatedElement.java deleted file mode 100644 index 72065eeb7836f337b180feb4374fc2e0e635da7c..0000000000000000000000000000000000000000 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/fields/AssociatedElement.java +++ /dev/null @@ -1,150 +0,0 @@ -package lcsb.mapviewer.model.map.species.fields; - -import java.io.Serializable; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.OneToOne; -import javax.persistence.Table; - -import lcsb.mapviewer.model.map.MiriamData; -import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.species.Phenotype; - -import org.hibernate.annotations.Cascade; -import org.hibernate.annotations.CascadeType; - -/** - * This class defines object that is associated with the phenotype. By - * definition phenotype can contain set of elements with whom there is a kind of - * association. This association are taken from different databases (or are - * curated by human). - * - * @author Piotr Gawron - * - */ -@Entity -@Table(name = "associated_phenotype_element_table") -public class AssociatedElement implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * Unique identifier in the database. - */ - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "idDb", unique = true, nullable = false) - private int id; - - /** - * Where this association comes from. - */ - private MiriamType source = MiriamType.UNKNOWN; - - /** - * Description of this association in the form of Miriam object. - */ - @Cascade({ CascadeType.ALL }) - @OneToOne - private MiriamData data; - - /** - * Parent Phenotype object that contains this association. - */ - @ManyToOne - private Phenotype phenotype; - - /** - * Default constructor. - */ - public AssociatedElement() { - } - - /** - * Constructor that initialize the object with the data given in parameter. - * - * @param ae - * object from which the data is initialized - */ - public AssociatedElement(AssociatedElement ae) { - this.source = ae.source; - this.data = new MiriamData(ae.getData()); - } - - /** - * @return the id - * @see #id - */ - public int getId() { - return id; - } - - /** - * @param id - * the id to set - * @see #id - */ - public void setId(int id) { - this.id = id; - } - - /** - * @return the source - * @see #source - */ - public MiriamType getSource() { - return source; - } - - /** - * @param source - * the source to set - * @see #source - */ - public void setSource(MiriamType source) { - this.source = source; - } - - /** - * @return the data - * @see #data - */ - public MiriamData getData() { - return data; - } - - /** - * @param data - * the data to set - * @see #data - */ - public void setData(MiriamData data) { - this.data = data; - } - - /** - * @return the phenotype - * @see #phenotype - */ - public Phenotype getPhenotype() { - return phenotype; - } - - /** - * @param phenotype - * the phenotype to set - * @see #phenotype - */ - public void setPhenotype(Phenotype phenotype) { - this.phenotype = phenotype; - } - -} diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/fields/AssociatedElementComparator.java b/model/src/main/java/lcsb/mapviewer/model/map/species/fields/AssociatedElementComparator.java deleted file mode 100644 index 31dabfe521239eb5ff21d9d3e797370687f0025b..0000000000000000000000000000000000000000 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/fields/AssociatedElementComparator.java +++ /dev/null @@ -1,90 +0,0 @@ -package lcsb.mapviewer.model.map.species.fields; - -import java.util.Comparator; - -import lcsb.mapviewer.common.comparator.StringComparator; -import lcsb.mapviewer.common.exception.InvalidClassException; - -import org.apache.log4j.Logger; - -/** - * This class implements comparator interface for AssociatedElement. It compares - * the content, but skip database identifier and parent object reference. - * - * @author Piotr Gawron - * - */ -public class AssociatedElementComparator implements Comparator<AssociatedElement> { - /** - * Default class logger. - */ - private Logger logger = Logger.getLogger(AssociatedElementComparator.class); - - @Override - public int compare(AssociatedElement arg0, AssociatedElement arg1) { - if (arg0 == null) { - if (arg1 == null) { - return 0; - } else { - return 1; - } - } else if (arg1 == null) { - return -1; - } - - if (arg0.getClass().equals(arg1.getClass())) { - if (arg0.getClass().equals(AssociatedElement.class)) { - return internalCompare(arg0, arg1); - } else { - throw new InvalidClassException("Don't know how to compare classes: " + arg0.getClass()); - } - } else { - return -1; - } - } - - /** - * This method compares only the fields that are defined in AssociatedElement - * class in inheritence tree. - * - * @param arg0 - * first object to compare - * @param arg1 - * second object to compare - * @return if all fields are qual then returns 0. If they are different then - * -1/1 is returned. - */ - private int internalCompare(AssociatedElement arg0, AssociatedElement arg1) { - if (arg0.getSource() != arg1.getSource()) { - logger.debug("Source different: \"" + arg0.getSource() + "\", \"" + arg1.getSource() + "\""); - if (arg0.getSource() == null) { - return -1; - } else { - return arg0.getSource().compareTo(arg1.getSource()); - } - } - - if (arg0.getData() == null) { - if (arg1.getData() == null) { - return 0; - } else { - logger.debug("Miriam data different"); - return 1; - } - } else { - if (arg1.getData() == null) { - logger.debug("Miriam data different"); - return -1; - } else { - String hash1 = arg0.getData().getRelationType() + " " + arg0.getData().getDataType() + " " + arg0.getData().getResource(); - String hash2 = arg1.getData().getRelationType() + " " + arg1.getData().getDataType() + " " + arg1.getData().getResource(); - StringComparator stringComparator = new StringComparator(); - if (stringComparator.compare(hash1, hash2) != 0) { - logger.debug("Miriam data different: \n" + hash1 + "\n" + hash2); - return stringComparator.compare(hash1, hash2); - } - } - } - return 0; - } -} diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/fields/package-info.java b/model/src/main/java/lcsb/mapviewer/model/map/species/fields/package-info.java deleted file mode 100644 index 9fc9c50361b50b05dc6794bfc7fa40d47232ee3c..0000000000000000000000000000000000000000 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/fields/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Provides data structure for complicated - * {@link lcsb.mapviewer.model.map.species.Species Species} implementation. - * These structures contain some additional structural information about - * elements. - */ -package lcsb.mapviewer.model.map.species.fields; - diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/package-info.java b/model/src/main/java/lcsb/mapviewer/model/map/species/package-info.java deleted file mode 100644 index e67728b2521fd48fda03b3be7b7b397d677e85aa..0000000000000000000000000000000000000000 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Provides data structure for species on the map. The generic class from which - * all element classes inherit data is - * {@link lcsb.mapviewer.db.model.map.Element Element}. However, for species - * there is another class that inherits from this class: - * {@link lcsb.mapviewer.model.map.species.Species}. The package also - * contains comparators for these elements that compare the data of the - * structures, but ignore database-related information (like identifiers). - */ -package lcsb.mapviewer.model.map.species; - diff --git a/model/src/main/java/lcsb/mapviewer/modelutils/map/ElementUtils.java b/model/src/main/java/lcsb/mapviewer/modelutils/map/ElementUtils.java index 61e1ead208286aceb246cf2f249edcb6f41632a2..0ed029d9d2648cc691e2ef852e3464e98646c217 100644 --- a/model/src/main/java/lcsb/mapviewer/modelutils/map/ElementUtils.java +++ b/model/src/main/java/lcsb/mapviewer/modelutils/map/ElementUtils.java @@ -13,7 +13,6 @@ import org.reflections.Reflections; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.model.map.AnnotatedObject; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.reaction.Reaction; @@ -33,9 +32,9 @@ public final class ElementUtils { /** * Map between class names (used as user input) and implementation of - * {@link Element} class. + * {@link Alias} class. */ - private static Map<String, Class<? extends Element>> elementClasses = null; + private static Map<String, Class<? extends Alias>> elementClasses = null; /** * Map between class names (used as user input) and implementation of @@ -144,14 +143,14 @@ public final class ElementUtils { } /** - * Returns list of classes that extends {@link Element} class, but don't have + * Returns list of classes that extends {@link Alias} class, but don't have * children (leaves in the hierarchy tree). * - * @return list of classes that extends {@link Element} class, but don't have + * @return list of classes that extends {@link Alias} class, but don't have * children (leaves in the hierarchy tree) */ - public List<Class<? extends Element>> getAvailableElementSubclasses() { - List<Class<? extends Element>> result = new ArrayList<Class<? extends Element>>(); + public List<Class<? extends Alias>> getAvailableElementSubclasses() { + List<Class<? extends Alias>> result = new ArrayList<Class<? extends Alias>>(); if (elementClasses == null) { refreshClasses(); } @@ -161,18 +160,18 @@ public final class ElementUtils { } /** - * Refresh list of known implementation of {@link Element} class. + * Refresh list of known implementation of {@link Alias} class. */ protected void refreshClasses() { - List<Class<? extends Element>> tmp = new ArrayList<Class<? extends Element>>(); + List<Class<? extends Alias>> tmp = new ArrayList<>(); Reflections reflections = new Reflections("lcsb.mapviewer.model.map"); - elementClasses = new HashMap<String, Class<? extends Element>>(); - Set<Class<? extends Element>> classes = reflections.getSubTypesOf(Element.class); + elementClasses = new HashMap<String, Class<? extends Alias>>(); + Set<Class<? extends Alias>> classes = reflections.getSubTypesOf(Alias.class); Set<Class<?>> toRemove = new HashSet<Class<?>>(); - for (Class<? extends Element> class1 : classes) { + for (Class<? extends Alias> class1 : classes) { if (class1.isAnonymousClass() || class1.isMemberClass() || class1.isLocalClass()) { continue; } @@ -182,7 +181,7 @@ public final class ElementUtils { for (Class<?> clazz : toRemove) { tmp.remove(clazz); } - for (Class<? extends Element> class1 : tmp) { + for (Class<? extends Alias> class1 : tmp) { elementClasses.put(class1.getSimpleName(), class1); } @@ -249,7 +248,7 @@ public final class ElementUtils { * the elementClasses to set * @see #elementClasses */ - protected static void setElementClasses(Map<String, Class<? extends Element>> elementClasses) { + protected static void setElementClasses(Map<String, Class<? extends Alias>> elementClasses) { ElementUtils.elementClasses = elementClasses; } @@ -262,8 +261,4 @@ public final class ElementUtils { ElementUtils.reactionClasses = reactionClasses; } - public String getElementTag(Element element) { - return "[" + element.getClass().getSimpleName() + " " + element.getElementId() + "]\t"; - } - } diff --git a/model/src/main/java/lcsb/mapviewer/modelutils/map/RequireAnnotationMap.java b/model/src/main/java/lcsb/mapviewer/modelutils/map/RequireAnnotationMap.java index f1ec89c13eacceb7f4e7fa4f79ba3cc52090aa66..14364ccac38c34ece329b99c3b9c8eb279aaa8ef 100644 --- a/model/src/main/java/lcsb/mapviewer/modelutils/map/RequireAnnotationMap.java +++ b/model/src/main/java/lcsb/mapviewer/modelutils/map/RequireAnnotationMap.java @@ -10,14 +10,6 @@ import lcsb.mapviewer.model.map.layout.alias.PhenotypeAlias; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.layout.alias.RnaAlias; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.AntisenseRna; -import lcsb.mapviewer.model.map.species.Chemical; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Drug; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.Phenotype; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; /** * List of {@link AnnotatedObject} that must be annototed with at least one diff --git a/model/src/test/java/lcsb/mapviewer/model/map/AllMapTests.java b/model/src/test/java/lcsb/mapviewer/model/map/AllMapTests.java index f0d48eeb973104d8b662f34d669616bab527e10d..d56d039a131487b2cd37a9ef32f469778a4d9d0c 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/AllMapTests.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/AllMapTests.java @@ -4,30 +4,24 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import lcsb.mapviewer.model.map.agregator.AllAgregatorTests; import lcsb.mapviewer.model.map.graph.AllGraphTests; import lcsb.mapviewer.model.map.layout.AllLayoutTests; import lcsb.mapviewer.model.map.layout.graphics.AllGraphicsTests; import lcsb.mapviewer.model.map.model.AllModelTests; import lcsb.mapviewer.model.map.modifier.AllModifierTests; import lcsb.mapviewer.model.map.reaction.AllReactionTests; -import lcsb.mapviewer.model.map.species.AllSpeciesTests; import lcsb.mapviewer.model.map.statistics.AllStatisticsTests; @RunWith(Suite.class) @SuiteClasses({ AliasInFewParentsExceptionTest.class, // - AllAgregatorTests.class, // AllGraphTests.class, // AllGraphicsTests.class, // AllLayoutTests.class, // AllModelTests.class, // AllModifierTests.class, // AllReactionTests.class, // - AllSpeciesTests.class, // AllStatisticsTests.class, // CommentTest.class, // - ElementComparatorTest.class, // - ElementTest.class, // InconsistentModelExceptionTest.class, // LayoutComparatorTest.class, // MiriamDataTest.class, // diff --git a/model/src/test/java/lcsb/mapviewer/model/map/MiriamDataTest.java b/model/src/test/java/lcsb/mapviewer/model/map/MiriamDataTest.java index e2da6fcea22bccb8b93253c38aa51f77a612c535..c17ab9a40be2fe1de0e853a6e6c0cf9ad8254c8a 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/MiriamDataTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/MiriamDataTest.java @@ -13,7 +13,6 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.species.Species; public class MiriamDataTest { @@ -76,7 +75,7 @@ public class MiriamDataTest { MiriamData md = new MiriamData(); md.setResource(null); assertNull(md.getResource()); - + md.setId(id); assertEquals(id, md.getId()); @@ -90,7 +89,7 @@ public class MiriamDataTest { public void testToString() { try { assertNotNull(new MiriamData().toString()); - assertNotNull(new MiriamData(MiriamType.CAS,"a").toString()); + assertNotNull(new MiriamData(MiriamType.CAS, "a").toString()); } catch (Exception e) { e.printStackTrace(); diff --git a/model/src/test/java/lcsb/mapviewer/model/map/agregator/AllAgregatorTests.java b/model/src/test/java/lcsb/mapviewer/model/map/agregator/AllAgregatorTests.java deleted file mode 100644 index e344d0983f2897be998c636ccc32744a1f662468..0000000000000000000000000000000000000000 --- a/model/src/test/java/lcsb/mapviewer/model/map/agregator/AllAgregatorTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package lcsb.mapviewer.model.map.agregator; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; - -@RunWith(Suite.class) -@SuiteClasses({ CompartmentComparatorTest.class,// - CompartmentTest.class,// -}) -public class AllAgregatorTests { - -} diff --git a/model/src/test/java/lcsb/mapviewer/model/map/graph/DataMiningTest.java b/model/src/test/java/lcsb/mapviewer/model/map/graph/DataMiningTest.java index c93c0dd1efc31f16d879f7d65a457f0d19a4b8d9..bd6ed6c44c531dc04688feede68f98fea4fd531d 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/graph/DataMiningTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/graph/DataMiningTest.java @@ -1,93 +1,94 @@ -package lcsb.mapviewer.model.map.graph; - -import static org.junit.Assert.assertEquals; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.SerializationUtils; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import lcsb.mapviewer.model.map.Element; -import lcsb.mapviewer.model.map.MiriamData; -import lcsb.mapviewer.model.map.species.Species; - -public class DataMiningTest { - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testSerialization() { - try { - SerializationUtils.serialize(new DataMining()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testGetters() { - try { - DataMining dm = new DataMining(); - String description = "xdg"; - Element element = new Species(); - Integer id = 61; - List<MiriamData> references = new ArrayList<>(); - List<MiriamData> suggestedConnections = new ArrayList<>(); - DataMiningType type = DataMiningType.STRUCTURE_ANALYSIS; - - dm.setDescription(description); - assertEquals(description, dm.getDescription()); - dm.setElement(element); - assertEquals(element, dm.getElement()); - dm.setId(id); - assertEquals(id, dm.getId()); - dm.setReferences(references); - assertEquals(references, dm.getReferences()); - dm.setSuggestedConnections(suggestedConnections); - assertEquals(suggestedConnections, dm.getSuggestedConnections()); - dm.setType(type); - assertEquals(type, dm.getType()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testAddReference() { - try { - DataMining dm = new DataMining(); - List<MiriamData> references = new ArrayList<>(); - references.add(new MiriamData()); - references.add(new MiriamData()); - dm.addReferences(references); - assertEquals(2, dm.getReferences().size()); - dm.addReference(new MiriamData()); - assertEquals(3, dm.getReferences().size()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - @Test - public void testAddSuggestedConnections() { - try { - DataMining dm = new DataMining(); - dm.addSuggestedConnection(new MiriamData()); - assertEquals(1, dm.getSuggestedConnections().size()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } -} +package lcsb.mapviewer.model.map.graph; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.SerializationUtils; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import lcsb.mapviewer.model.map.MiriamData; +import lcsb.mapviewer.model.map.layout.alias.Alias; +import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; + +public class DataMiningTest { + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testSerialization() { + try { + SerializationUtils.serialize(new DataMining()); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testGetters() { + try { + DataMining dm = new DataMining(); + String description = "xdg"; + Alias element = new GenericProteinAlias("id"); + Integer id = 61; + List<MiriamData> references = new ArrayList<>(); + List<MiriamData> suggestedConnections = new ArrayList<>(); + DataMiningType type = DataMiningType.STRUCTURE_ANALYSIS; + + dm.setDescription(description); + assertEquals(description, dm.getDescription()); + dm.setElement(element); + assertEquals(element, dm.getElement()); + dm.setId(id); + assertEquals(id, dm.getId()); + dm.setReferences(references); + assertEquals(references, dm.getReferences()); + dm.setSuggestedConnections(suggestedConnections); + assertEquals(suggestedConnections, dm.getSuggestedConnections()); + dm.setType(type); + assertEquals(type, dm.getType()); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testAddReference() { + try { + DataMining dm = new DataMining(); + List<MiriamData> references = new ArrayList<>(); + references.add(new MiriamData()); + references.add(new MiriamData()); + dm.addReferences(references); + assertEquals(2, dm.getReferences().size()); + dm.addReference(new MiriamData()); + assertEquals(3, dm.getReferences().size()); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testAddSuggestedConnections() { + try { + DataMining dm = new DataMining(); + dm.addSuggestedConnection(new MiriamData()); + assertEquals(1, dm.getSuggestedConnections().size()); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } +} diff --git a/model/src/test/java/lcsb/mapviewer/model/map/layout/ColorSchemaTest.java b/model/src/test/java/lcsb/mapviewer/model/map/layout/ColorSchemaTest.java index 7262b65932c4523251012c7eefb454bfad6f375f..b16bec7df7f38e483c53b13f1d739907112e7108 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/layout/ColorSchemaTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/layout/ColorSchemaTest.java @@ -14,8 +14,9 @@ import org.junit.Test; import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Species; +import lcsb.mapviewer.model.map.layout.alias.Alias; +import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; +import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; public class ColorSchemaTest { @@ -32,7 +33,7 @@ public class ColorSchemaTest { try { ColorSchema cs = new GenericColorSchema(); List<String> compartments = new ArrayList<>(); - List<Class<? extends Species>> types = new ArrayList<>(); + List<Class<? extends Alias>> types = new ArrayList<>(); String name = "S"; String generalIdentifier = "id"; List<Pair<MiriamType, String>> identifierColumns = new ArrayList<>(); @@ -148,7 +149,7 @@ public class ColorSchemaTest { assertNotNull(cs.toString()); cs.setName("gene name"); cs.addCompartment("A"); - cs.addType(Species.class); + cs.addType(SpeciesAlias.class); cs.setValue(1.2); cs.setColor(Color.BLACK); cs.setGeneralIdentifier("a"); @@ -191,7 +192,7 @@ public class ColorSchemaTest { public void testAddIdentifgierColumns() throws Exception { try { ColorSchema cs = new GenericColorSchema(); - List<Pair<MiriamType,String>> compartments = new ArrayList<>(); + List<Pair<MiriamType, String>> compartments = new ArrayList<>(); compartments.add(new Pair<MiriamType, String>(MiriamType.CAS, "x")); cs.addIdentifierColumns(compartments); assertEquals(1, cs.getIdentifierColumns().size()); @@ -205,9 +206,9 @@ public class ColorSchemaTest { public void testAddTypes() throws Exception { try { ColorSchema cs = new GenericColorSchema(); - List<Class<? extends Species>> compartments = new ArrayList<>(); - compartments.add(Species.class); - compartments.add(Protein.class); + List<Class<? extends Alias>> compartments = new ArrayList<>(); + compartments.add(SpeciesAlias.class); + compartments.add(ProteinAlias.class); cs.addTypes(compartments); assertEquals(2, cs.getTypes().size()); } catch (Exception e) { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/AliasComparatorTest.java b/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/AliasComparatorTest.java index 10cc64c503db1489b66e6d29173f7e65ca550a8c..802c590322de0a9d913dd524b0647b58ef098d3d 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/AliasComparatorTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/AliasComparatorTest.java @@ -11,16 +11,13 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; -import lcsb.mapviewer.common.exception.InvalidClassException; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.graphics.Layer; import lcsb.mapviewer.model.map.model.AliasSubmodelConnection; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelFullIndexed; import lcsb.mapviewer.model.map.model.SubmodelType; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.GenericProtein; public class AliasComparatorTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/AliasGroupTest.java b/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/AliasGroupTest.java index 048cf4261efac5f76980c1192ac9da71048e90c8..d9502c7273113896106719df30a32249fe8defa4 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/AliasGroupTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/AliasGroupTest.java @@ -10,8 +10,6 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -import lcsb.mapviewer.model.map.species.GenericProtein; - public class AliasGroupTest { @Before diff --git a/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/CompartmentAliasComparatorTest.java b/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/CompartmentAliasComparatorTest.java index b9acbc1fab72d699c8aa5d3f64230c868fbc67d8..1cf0304bcf5184b32faa4e822d4339c6075e524e 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/CompartmentAliasComparatorTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/CompartmentAliasComparatorTest.java @@ -12,8 +12,6 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.agregator.Compartment; -import lcsb.mapviewer.model.map.species.GenericProtein; public class CompartmentAliasComparatorTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/CompartmentAliasTest.java b/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/CompartmentAliasTest.java index 2434709faa5f0b159bd945c57e1619d3d91e551d..6600e5b85a4239e18c0519162ca762a1f0f3a6ef 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/CompartmentAliasTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/CompartmentAliasTest.java @@ -3,7 +3,6 @@ package lcsb.mapviewer.model.map.layout.alias; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -20,12 +19,8 @@ import lcsb.mapviewer.common.Configuration; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidStateException; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelFullIndexed; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.SimpleMolecule; public class CompartmentAliasTest { Logger logger = Logger.getLogger(CompartmentAliasTest.class); @@ -137,7 +132,7 @@ public class CompartmentAliasTest { alias.setName("AS"); assertFalse(alias.containsIdenticalSpecies()); - + SpeciesAlias sAlias = new GenericProteinAlias(); sAlias.setName("AS"); diff --git a/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/ComplexAliasComparatorTest.java b/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/ComplexAliasComparatorTest.java index 82996f5f7c772812e73b597ba14bec67fbeb5fb8..2577ab598ddc3ceccb86baa57b59a2c17932f91b 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/ComplexAliasComparatorTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/ComplexAliasComparatorTest.java @@ -12,9 +12,6 @@ import org.junit.Test; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Species; public class ComplexAliasComparatorTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/ComplexAliasTest.java b/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/ComplexAliasTest.java index 2bacb3a01b8413e2eafa600216edd6178e4841ea..2390121c6d1c8d3301260d2d92b0e47586f40e6c 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/ComplexAliasTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/ComplexAliasTest.java @@ -10,7 +10,6 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.ComplexSpecies; public class ComplexAliasTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/fields/ModificationStateTest.java b/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/ModificationStateTest.java similarity index 81% rename from model/src/test/java/lcsb/mapviewer/model/map/species/fields/ModificationStateTest.java rename to model/src/test/java/lcsb/mapviewer/model/map/layout/alias/ModificationStateTest.java index 7e292cc131d5de827daaa8043e5749d6b4d92081..d122a41327e704cfe5fb14c5df45790d6fd24baf 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/fields/ModificationStateTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/ModificationStateTest.java @@ -1,38 +1,40 @@ -package lcsb.mapviewer.model.map.species.fields; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class ModificationStateTest { - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testValidValues() { - for (ModificationState type : ModificationState.values()) { - assertNotNull(type); - - // for coverage tests - ModificationState.valueOf(type.toString()); - assertNotNull(type.getFullName()); - assertNotNull(type.getAbbreviation()); - } - } - - @Test - public void testGetByName() { - assertNull(ModificationState.getByName("Adasd")); - assertNotNull(ModificationState.getByName("protonated")); - } - -} +package lcsb.mapviewer.model.map.layout.alias; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import lcsb.mapviewer.converter.model.celldesigner.structure.ModificationState; + +public class ModificationStateTest { + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testValidValues() { + for (ModificationState type : ModificationState.values()) { + assertNotNull(type); + + // for coverage tests + ModificationState.valueOf(type.toString()); + assertNotNull(type.getFullName()); + assertNotNull(type.getAbbreviation()); + } + } + + @Test + public void testGetByName() { + assertNull(ModificationState.getByName("Adasd")); + assertNotNull(ModificationState.getByName("protonated")); + } + +} diff --git a/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/SpeciesAliasComparatorTest.java b/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/SpeciesAliasComparatorTest.java index 95a58815890c454b1705a595628e66d01ba5c711..ffbafe9f435a8b135507616fe38f38a4b7de1026 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/SpeciesAliasComparatorTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/SpeciesAliasComparatorTest.java @@ -9,10 +9,9 @@ import java.awt.Color; import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.mockito.Mockito; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Species; public class SpeciesAliasComparatorTest { @@ -47,22 +46,9 @@ public class SpeciesAliasComparatorTest { @Test public void testCompareInvalid() { try { - class Tmp extends GenericProteinAlias { - - public Tmp() { - super(null, null); - } - - /** - * - */ - private static final long serialVersionUID = 1L; - } - ; - - Tmp alias1 = new Tmp(); - Tmp alias2 = new Tmp(); - comparator.compare(alias1, alias2); + + SpeciesAlias alias = Mockito.mock(SpeciesAlias.class); + comparator.compare(alias, alias); fail("Exception expected"); } catch (NotImplementedException e) { @@ -75,7 +61,7 @@ public class SpeciesAliasComparatorTest { private SpeciesAlias createSpeciesAlias() { GenericProteinAlias result = new GenericProteinAlias(); result.setName("a"); - + result.setAliasId("asd"); result.setX(12.0); result.setY(123.0); diff --git a/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/SpeciesAliasTest.java b/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/SpeciesAliasTest.java index 10ade68cb5b5abfeaf8ed0035db659a3cca27dcb..d2aa04e7f6d43a3179587426179ecaf57ec85242 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/SpeciesAliasTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/layout/alias/SpeciesAliasTest.java @@ -1,18 +1,14 @@ package lcsb.mapviewer.model.map.layout.alias; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; import java.util.HashSet; import java.util.Set; -import org.apache.commons.lang3.SerializationUtils; import org.junit.After; import org.junit.Before; import org.junit.Test; -import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.model.map.reaction.ReactionNode; public class SpeciesAliasTest { @@ -29,7 +25,7 @@ public class SpeciesAliasTest { public void testGetter() { try { SpeciesAlias alias = new SpeciesAlias() { - + @Override public SpeciesAlias copy() { return null; diff --git a/model/src/test/java/lcsb/mapviewer/model/map/model/AliasSubmodelConnectionComparatorTest.java b/model/src/test/java/lcsb/mapviewer/model/map/model/AliasSubmodelConnectionComparatorTest.java index a8260e570615c78625c19a63a318088fe7075e3f..3649aed8469303aee7b027684351e949aa8634c4 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/model/AliasSubmodelConnectionComparatorTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/model/AliasSubmodelConnectionComparatorTest.java @@ -9,15 +9,11 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; -import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.layout.graphics.Layer; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Protein; public class AliasSubmodelConnectionComparatorTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/model/ModelComparatorTest.java b/model/src/test/java/lcsb/mapviewer/model/map/model/ModelComparatorTest.java index 0b23a9932f9963ab3c5f0acf57f0720f8715ecc9..c2076026bb3142a0b11bd49dc611be99bbda3b22 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/model/ModelComparatorTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/model/ModelComparatorTest.java @@ -11,14 +11,11 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; -import lcsb.mapviewer.common.exception.InvalidClassException; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.OverviewImage; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.graph.DataMiningSet; import lcsb.mapviewer.model.map.layout.Layout; import lcsb.mapviewer.model.map.layout.alias.ArtifitialCompartmentAlias; @@ -28,9 +25,6 @@ import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.layout.graphics.Layer; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.type.TransportReaction; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Species; public class ModelComparatorTest { Logger logger = Logger.getLogger(ModelComparatorTest.class); @@ -151,10 +145,10 @@ public class ModelComparatorTest { Model model1 = getModel(); Model model2 = getModel(); - SpeciesAlias mockAlias =Mockito.mock(SpeciesAlias.class); + SpeciesAlias mockAlias = Mockito.mock(SpeciesAlias.class); when(mockAlias.getAliasId()).thenReturn("1"); model1.addAlias(mockAlias); - + model2.addAlias(mockAlias); try { @@ -177,7 +171,6 @@ public class ModelComparatorTest { } } - @Test public void testDifferent() throws Exception { try { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/model/ModelDataTest.java b/model/src/test/java/lcsb/mapviewer/model/map/model/ModelDataTest.java index 9d768b0fa4d88c602cbbb67edaae5c02e0ecc9ec..56c1808e30a3a8fc0a87b18c5b3d6d18af97c16c 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/model/ModelDataTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/model/ModelDataTest.java @@ -18,7 +18,6 @@ import org.junit.Test; import lcsb.mapviewer.common.Configuration; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.model.Project; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.OverviewImage; import lcsb.mapviewer.model.map.graph.DataMiningSet; import lcsb.mapviewer.model.map.layout.Layout; @@ -27,7 +26,6 @@ import lcsb.mapviewer.model.map.layout.alias.BlockDiagram; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.graphics.Layer; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.Species; public class ModelDataTest { @@ -326,7 +324,6 @@ public class ModelDataTest { try { ModelData md = new ModelData(); Set<Alias> aliases = new HashSet<>(); - Set<Element> elements = new HashSet<>(); List<Layout> layouts = new ArrayList<>(); Set<Layer> layers = new HashSet<>(); Set<Reaction> reactions = new HashSet<>(); diff --git a/model/src/test/java/lcsb/mapviewer/model/map/model/ModelFullIndexedTest.java b/model/src/test/java/lcsb/mapviewer/model/map/model/ModelFullIndexedTest.java index 14cba9e260c0e399b6c3b4cab537062b52e760c2..bcadff7289f7baa256691b8c700efadc1ab836ac 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/model/ModelFullIndexedTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/model/ModelFullIndexedTest.java @@ -25,12 +25,10 @@ import lcsb.mapviewer.common.EventStorageLoggerAppender; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.model.Project; import lcsb.mapviewer.model.map.AnnotatedObject; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.OverviewImage; import lcsb.mapviewer.model.map.OverviewImageLink; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.graph.DataMiningSet; import lcsb.mapviewer.model.map.layout.Layout; import lcsb.mapviewer.model.map.layout.alias.Alias; @@ -44,9 +42,6 @@ import lcsb.mapviewer.model.map.reaction.Product; import lcsb.mapviewer.model.map.reaction.Reactant; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.type.TransportReaction; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Species; import lcsb.mapviewer.model.user.User; public class ModelFullIndexedTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/model/ModelSubmodelConnectionComparatorTest.java b/model/src/test/java/lcsb/mapviewer/model/map/model/ModelSubmodelConnectionComparatorTest.java index 63ee6dfd8d26ddec8a0e0f89423a24f8ec36e0c7..ad3ac46f5e15974446df6de39aa04912837005af 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/model/ModelSubmodelConnectionComparatorTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/model/ModelSubmodelConnectionComparatorTest.java @@ -7,13 +7,11 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.layout.graphics.Layer; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.GenericProtein; public class ModelSubmodelConnectionComparatorTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/model/ModelTest.java b/model/src/test/java/lcsb/mapviewer/model/map/model/ModelTest.java index 26065e19bad8d772d97c9393cadfe138ac429a1c..6d33781d45adea68b695d421795adf8733d75bcc 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/model/ModelTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/model/ModelTest.java @@ -14,12 +14,10 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.model.map.AnnotatedObject; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; @@ -27,9 +25,6 @@ import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.layout.graphics.Layer; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Species; public class ModelTest { Logger logger = Logger.getLogger(ModelTest.class); @@ -161,28 +156,23 @@ public class ModelTest { private Model createModel() { Model model = new ModelFullIndexed(null); - SpeciesAlias proteinAlias = new GenericProteinAlias("sa1"); proteinAlias.setName("s1"); model.addAlias(proteinAlias); - SpeciesAlias proteinAlias2 = new GenericProteinAlias("sa2"); proteinAlias2.setName("s1"); model.addAlias(proteinAlias2); - SpeciesAlias proteinAlias3 = new GenericProteinAlias("sa3"); proteinAlias3.setName("s1"); model.addAlias(proteinAlias3); - SpeciesAlias proteinAlias4 = new GenericProteinAlias("sa4"); proteinAlias4.setName("s5"); proteinAlias4.addMiriamData(new MiriamData(MiriamRelationType.BQ_MODEL_IS, MiriamType.CHEMBL_TARGET, "CHEMBL12345")); model.addAlias(proteinAlias4); - CompartmentAlias compartmentAlias = new CompartmentAlias("cca"); compartmentAlias.setName("c1"); compartmentAlias.addMiriamData(new MiriamData(MiriamRelationType.BQ_MODEL_IS, MiriamType.CHEBI, "CHEBI:12")); @@ -197,7 +187,6 @@ public class ModelTest { try { Model model = new ModelFullIndexed(null); - SpeciesAlias alias = new GenericProteinAlias("2"); alias.setWidth(100); alias.setHeight(100); diff --git a/model/src/test/java/lcsb/mapviewer/model/map/model/SubmodelConnectionComparatorTest.java b/model/src/test/java/lcsb/mapviewer/model/map/model/SubmodelConnectionComparatorTest.java index 70566deae539d802adc5676c467f3a289d39336d..daf95263a3d96623536d67c95ee8cb52877f5d14 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/model/SubmodelConnectionComparatorTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/model/SubmodelConnectionComparatorTest.java @@ -9,13 +9,11 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.layout.graphics.Layer; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.GenericProtein; public class SubmodelConnectionComparatorTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/modifier/CatalysisTest.java b/model/src/test/java/lcsb/mapviewer/model/map/modifier/CatalysisTest.java index a4dfad66ad525c2dd65da00e1a53470ff8aede87..0d8269a0e6246038accdf582cdefd7f7d0db2348 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/modifier/CatalysisTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/modifier/CatalysisTest.java @@ -11,8 +11,6 @@ import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.model.graphics.PolylineData; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaAlias; -import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.Species; public class CatalysisTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/modifier/InhibitionTest.java b/model/src/test/java/lcsb/mapviewer/model/map/modifier/InhibitionTest.java index 11824c36dd9e8aee5c92ef7b3fd92e6a2bc7cb94..c3818fc0da9f2044f28cb0906d0020af8bc1107a 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/modifier/InhibitionTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/modifier/InhibitionTest.java @@ -11,7 +11,6 @@ import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.model.graphics.PolylineData; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; -import lcsb.mapviewer.model.map.species.Species; public class InhibitionTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/modifier/ModulationTest.java b/model/src/test/java/lcsb/mapviewer/model/map/modifier/ModulationTest.java index db46dc85f4323a575ec34ecb93a56f53e32ff300..5508d9c5a4af8f4472b807f18dc92060595693b7 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/modifier/ModulationTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/modifier/ModulationTest.java @@ -11,7 +11,6 @@ import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.model.graphics.PolylineData; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; -import lcsb.mapviewer.model.map.species.Species; public class ModulationTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/modifier/PhysicalStimulationTest.java b/model/src/test/java/lcsb/mapviewer/model/map/modifier/PhysicalStimulationTest.java index 7cacc0a727f9609b3697380d594f6cd6ef73330a..b6f2ca0e754d648808ef4a45bb2337c63892d982 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/modifier/PhysicalStimulationTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/modifier/PhysicalStimulationTest.java @@ -11,7 +11,6 @@ import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.model.graphics.PolylineData; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; -import lcsb.mapviewer.model.map.species.Species; public class PhysicalStimulationTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/modifier/TriggerTest.java b/model/src/test/java/lcsb/mapviewer/model/map/modifier/TriggerTest.java index 89726e7ee09a118f65f896227ecbd4b29d8cbaaa..f6ea1e96e48b302ae1ff00aa99e4b663e9e48620 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/modifier/TriggerTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/modifier/TriggerTest.java @@ -11,7 +11,6 @@ import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.model.graphics.PolylineData; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; -import lcsb.mapviewer.model.map.species.Species; public class TriggerTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/modifier/UnknownInhibitionTest.java b/model/src/test/java/lcsb/mapviewer/model/map/modifier/UnknownInhibitionTest.java index b04c967961feb85a8c7dccc1aaf9d2a9d497ff73..9d6214a9202c3b3962ff642fcf1cb9ebb0b47d5e 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/modifier/UnknownInhibitionTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/modifier/UnknownInhibitionTest.java @@ -11,7 +11,6 @@ import org.junit.Test; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.model.graphics.PolylineData; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; -import lcsb.mapviewer.model.map.species.Species; public class UnknownInhibitionTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/reaction/NodeOperatorComparatorTest.java b/model/src/test/java/lcsb/mapviewer/model/map/reaction/NodeOperatorComparatorTest.java index 3550a0a748f65910cb0c29f446b34063b29f9f48..3b161e91520529d19e2729e669d6636983cfec88 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/reaction/NodeOperatorComparatorTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/reaction/NodeOperatorComparatorTest.java @@ -2,7 +2,6 @@ package lcsb.mapviewer.model.map.reaction; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; import java.awt.geom.Point2D; @@ -14,10 +13,6 @@ import lcsb.mapviewer.model.graphics.PolylineData; import lcsb.mapviewer.model.map.layout.alias.GeneAlias; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Species; public class NodeOperatorComparatorTest { @@ -105,7 +100,6 @@ public class NodeOperatorComparatorTest { private NodeOperator createNodeOperator() { AndOperator result = new AndOperator(); - SpeciesAlias alias0 = new GenericProteinAlias("id0"); alias0.setName("protein a"); alias0.setX(12.0); @@ -117,7 +111,6 @@ public class NodeOperatorComparatorTest { result.addOutput(product); - SpeciesAlias alias1 = new GenericProteinAlias("id1"); alias1.setName("protein b"); alias1.setX(120.0); @@ -129,7 +122,6 @@ public class NodeOperatorComparatorTest { result.addInput(reactant); - SpeciesAlias alias2 = new GeneAlias("id2"); alias2.setName("gene b"); alias2.setX(320.0); diff --git a/model/src/test/java/lcsb/mapviewer/model/map/reaction/ReactionComparatorTest.java b/model/src/test/java/lcsb/mapviewer/model/map/reaction/ReactionComparatorTest.java index c159a40985cd148f9df74199558be65e2b1bfedb..1c987b9b18e7cca8d9dc1585643a2b84847cd393 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/reaction/ReactionComparatorTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/reaction/ReactionComparatorTest.java @@ -2,7 +2,6 @@ package lcsb.mapviewer.model.map.reaction; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; import java.awt.geom.Point2D; @@ -21,9 +20,6 @@ import lcsb.mapviewer.model.map.layout.alias.UnknownAlias; import lcsb.mapviewer.model.map.modifier.Catalysis; import lcsb.mapviewer.model.map.reaction.type.StateTransitionReaction; import lcsb.mapviewer.model.map.reaction.type.TransportReaction; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.SimpleMolecule; -import lcsb.mapviewer.model.map.species.Unknown; public class ReactionComparatorTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/reaction/ReactionNodeComparatorTest.java b/model/src/test/java/lcsb/mapviewer/model/map/reaction/ReactionNodeComparatorTest.java index b43140b0aaaffbcaebf8116e52e7a79ed902245d..89c180e1e82caaf6897f6c9aad2ec6b05dddd34a 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/reaction/ReactionNodeComparatorTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/reaction/ReactionNodeComparatorTest.java @@ -2,7 +2,6 @@ package lcsb.mapviewer.model.map.reaction; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; import java.awt.geom.Point2D; @@ -14,10 +13,6 @@ import lcsb.mapviewer.model.graphics.PolylineData; import lcsb.mapviewer.model.map.layout.alias.GeneAlias; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Species; public class ReactionNodeComparatorTest { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/reaction/ReactionTest.java b/model/src/test/java/lcsb/mapviewer/model/map/reaction/ReactionTest.java index 53c0047ccf981b115a4e224581f7e354b5ddcbc9..11cf8a18e859d65cefef7475c16da97431caa3ee 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/reaction/ReactionTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/reaction/ReactionTest.java @@ -34,13 +34,12 @@ import lcsb.mapviewer.model.map.model.ModelFullIndexed; import lcsb.mapviewer.model.map.modifier.Catalysis; import lcsb.mapviewer.model.map.reaction.type.DissociationReaction; import lcsb.mapviewer.model.map.reaction.type.HeterodimerAssociationReaction; -import lcsb.mapviewer.model.map.species.GenericProtein; public class ReactionTest extends ModelTestFunctions { - Logger logger = Logger.getLogger(ReactantTest.class); + Logger logger = Logger.getLogger(ReactantTest.class); - private SpeciesAlias alias; + private SpeciesAlias alias; @Before public void setUp() throws Exception { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/AllSpeciesTests.java b/model/src/test/java/lcsb/mapviewer/model/map/species/AllSpeciesTests.java deleted file mode 100644 index 48cabcfeb5a5143b73dc780ae770c956c0ce9996..0000000000000000000000000000000000000000 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/AllSpeciesTests.java +++ /dev/null @@ -1,42 +0,0 @@ -package lcsb.mapviewer.model.map.species; - -import lcsb.mapviewer.model.map.species.fields.AllSpeciesFieldsTests; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; - -@RunWith(Suite.class) -@SuiteClasses({ AllSpeciesFieldsTests.class,// - AntisenseRnaComparatorTest.class, // - AntisenseRnaTest.class, // - ComplexSpeciesComparatorTest.class, // - ComplexSpeciesTest.class,// - DegradedComparatorTest.class, // - DegradedTest.class, // - DrugComparatorTest.class, // - DrugTest.class, // - GeneComparatorTest.class, // - GenericProteinTest.class,// - GeneTest.class, // - IonChannelProteinTest.class, // - IonComparatorTest.class, // - IonTest.class, // - PhenotypeComparatorTest.class, // - PhenotypeTest.class,// - ProteinComparatorTest.class, // - ProteinTest.class, // - ReceptorProteinTest.class, // - RnaComparatorTest.class, // - RnaTest.class, // - SimpleMoleculeComparatorTest.class,// - SimpleMoleculeTest.class, // - SpeciesComparatorTest.class, // - SpeciesTest.class, // - TruncatedProteinTest.class, // - UnknownComparatorTest.class, // - UnknownTest.class,// -}) -public class AllSpeciesTests { - -} diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/fields/AllSpeciesFieldsTests.java b/model/src/test/java/lcsb/mapviewer/model/map/species/fields/AllSpeciesFieldsTests.java deleted file mode 100644 index a6a40ca86239ad9b380df4fa7d26f96d92cd9f19..0000000000000000000000000000000000000000 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/fields/AllSpeciesFieldsTests.java +++ /dev/null @@ -1,19 +0,0 @@ -package lcsb.mapviewer.model.map.species.fields; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; - -@RunWith(Suite.class) -@SuiteClasses({ AntisenseRnaRegionTest.class, // - AssociatedElementComparatorTest.class, // - AssociatedElementTest.class, // - ModificationResidueTest.class, // - ModificationStateTest.class, // - PositionToCompartmentTest.class, // - RnaRegionTest.class,// - -}) -public class AllSpeciesFieldsTests { - -} diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/fields/AssociatedElementComparatorTest.java b/model/src/test/java/lcsb/mapviewer/model/map/species/fields/AssociatedElementComparatorTest.java deleted file mode 100644 index 983ff68bbf1e43fa74d6e555c2b3611ff6ec1b5c..0000000000000000000000000000000000000000 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/fields/AssociatedElementComparatorTest.java +++ /dev/null @@ -1,111 +0,0 @@ -package lcsb.mapviewer.model.map.species.fields; - -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import lcsb.mapviewer.common.exception.InvalidClassException; -import lcsb.mapviewer.model.map.MiriamData; -import lcsb.mapviewer.model.map.MiriamType; - -public class AssociatedElementComparatorTest { - - AssociatedElementComparator comparator = new AssociatedElementComparator(); - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testCompareEquals() { - try { - AssociatedElement ae1 = new AssociatedElement(); - AssociatedElement ae2 = new AssociatedElement(); - assertTrue(comparator.compare(ae1, ae2) == 0); - - ae1 = new AssociatedElement(); - ae2 = new AssociatedElement(); - ae1.setData(new MiriamData(MiriamType.CAS,"TE")); - ae2.setData(new MiriamData(MiriamType.CAS,"TE")); - assertTrue(comparator.compare(ae1, ae2) == 0); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - - } - - @Test - public void testCompareDifferent() { - try { - AssociatedElement ae1 = new AssociatedElement(); - AssociatedElement ae2 = new AssociatedElement(); - ae2.setSource(MiriamType.CHEBI); - assertTrue(comparator.compare(ae1, ae2) != 0); - assertTrue(comparator.compare(ae2, ae1) != 0); - assertTrue(comparator.compare(null, ae2) != 0); - assertTrue(comparator.compare(ae1, null) != 0); - assertTrue(comparator.compare(null, null) == 0); - - ae1 = new AssociatedElement(); - ae2 = new AssociatedElement(); - ae1.setSource(null); - assertTrue(comparator.compare(ae1, ae2) != 0); - - ae1 = new AssociatedElement(); - ae2 = new AssociatedElement(); - ae1.setData(new MiriamData(MiriamType.CAS,"TE")); - assertTrue(comparator.compare(ae1, ae2) != 0); - assertTrue(comparator.compare(ae2, ae1) != 0); - - ae1 = new AssociatedElement(); - ae2 = new AssociatedElement(); - ae1.setData(new MiriamData(MiriamType.CAS,"TE")); - ae2.setData(new MiriamData(MiriamType.CAS,"TE2")); - assertTrue(comparator.compare(ae1, ae2) != 0); - assertTrue(comparator.compare(ae2, ae1) != 0); - - AssociatedElement ae3 = new AssociatedElement() { - - /** - * - */ - private static final long serialVersionUID = 1L; - }; - assertTrue(comparator.compare(ae1, ae3) != 0); - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - - } - - @Test - public void testCompareInvalid() { - try { - AssociatedElement ae3 = new AssociatedElement() { - - /** - * - */ - private static final long serialVersionUID = 1L; - }; - comparator.compare(ae3, ae3); - fail("Exception expected"); - } catch (InvalidClassException e) { - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - - } - -} diff --git a/model/src/test/java/lcsb/mapviewer/model/map/species/fields/AssociatedElementTest.java b/model/src/test/java/lcsb/mapviewer/model/map/species/fields/AssociatedElementTest.java deleted file mode 100644 index 543436256d343bd227fdfbb7aa4cdbb3ab0e069f..0000000000000000000000000000000000000000 --- a/model/src/test/java/lcsb/mapviewer/model/map/species/fields/AssociatedElementTest.java +++ /dev/null @@ -1,62 +0,0 @@ -package lcsb.mapviewer.model.map.species.fields; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.apache.commons.lang3.SerializationUtils; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import lcsb.mapviewer.model.map.MiriamData; -import lcsb.mapviewer.model.map.species.Phenotype; - -public class AssociatedElementTest { - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testSerialization() { - try { - SerializationUtils.serialize(new AssociatedElement()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testConstructor() { - try { - AssociatedElement original = new AssociatedElement(); - original.setData(new MiriamData()); - AssociatedElement copy = new AssociatedElement(original); - assertNotNull(copy); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - @Test - public void testGetters() { - try { - AssociatedElement copy = new AssociatedElement(); - int id = 23; - Phenotype phenotype = new Phenotype(); - copy.setId(id); - copy.setPhenotype(phenotype); - - assertEquals(id, copy.getId()); - assertEquals(phenotype, copy.getPhenotype()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } -} diff --git a/model/src/test/java/lcsb/mapviewer/modelutils/map/ElementUtilsTest.java b/model/src/test/java/lcsb/mapviewer/modelutils/map/ElementUtilsTest.java index 742bf312367a18f4d553397715218d24c7050bd6..0bc877fd6c4be9268fcdbc642e3d8e1911ed3570 100644 --- a/model/src/test/java/lcsb/mapviewer/modelutils/map/ElementUtilsTest.java +++ b/model/src/test/java/lcsb/mapviewer/modelutils/map/ElementUtilsTest.java @@ -16,10 +16,12 @@ import org.junit.Before; import org.junit.Test; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.model.map.layout.alias.Alias; +import lcsb.mapviewer.model.map.layout.alias.IonAlias; +import lcsb.mapviewer.model.map.layout.alias.IonChannelProteinAlias; +import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.type.UnknownNegativeInfluenceReaction; -import lcsb.mapviewer.model.map.species.Ion; public class ElementUtilsTest { Logger logger = Logger.getLogger(ElementUtilsTest.class); @@ -91,9 +93,9 @@ public class ElementUtilsTest { try { ElementUtils elementUtils = new ElementUtils(); - List<Class<? extends Element>> list = elementUtils.getAvailableElementSubclasses(); - assertTrue(list.contains(lcsb.mapviewer.model.map.species.IonChannelProtein.class)); - assertFalse(list.contains(lcsb.mapviewer.model.map.species.Protein.class)); + List<Class<? extends Alias>> list = elementUtils.getAvailableElementSubclasses(); + assertTrue(list.contains(IonChannelProteinAlias.class)); + assertFalse(list.contains(ProteinAlias.class)); } catch (Exception e) { e.printStackTrace(); throw e; @@ -104,8 +106,8 @@ public class ElementUtilsTest { public void tesClassByName() throws Exception { try { ElementUtils elementUtils = new ElementUtils(); - assertEquals(Ion.class, elementUtils.getClassByName(Ion.class.getSimpleName())); - assertEquals(Ion.class, elementUtils.getClassByName("Ion")); + assertEquals(IonAlias.class, elementUtils.getClassByName(IonAlias.class.getSimpleName())); + assertEquals(IonAlias.class, elementUtils.getClassByName("Ion")); assertNull(elementUtils.getClassByName("unknown class name")); } catch (Exception e) { diff --git a/pathvisio/src/main/java/lcsb/mapviewer/wikipathway/XML/ModelContructor.java b/pathvisio/src/main/java/lcsb/mapviewer/wikipathway/XML/ModelContructor.java index 1c7ad1086171bc740147003f37bb6ec80ee7c76c..10756d049db84388b5ae6ef1ac3f7eb4853d001e 100644 --- a/pathvisio/src/main/java/lcsb/mapviewer/wikipathway/XML/ModelContructor.java +++ b/pathvisio/src/main/java/lcsb/mapviewer/wikipathway/XML/ModelContructor.java @@ -22,11 +22,14 @@ import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidStateException; import lcsb.mapviewer.converter.ConverterException; import lcsb.mapviewer.converter.model.celldesigner.reaction.ReactionLineData; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; +import lcsb.mapviewer.converter.model.celldesigner.structure.Unknown; import lcsb.mapviewer.converter.model.celldesigner.types.ModifierType; import lcsb.mapviewer.converter.model.celldesigner.types.ModifierTypeUtils; import lcsb.mapviewer.model.graphics.PolylineData; import lcsb.mapviewer.model.map.MiriamData; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; @@ -61,9 +64,6 @@ import lcsb.mapviewer.model.map.reaction.type.HeterodimerAssociationReaction; import lcsb.mapviewer.model.map.reaction.type.ReducedNotation; import lcsb.mapviewer.model.map.reaction.type.TwoReactantReactionInterface; import lcsb.mapviewer.model.map.reaction.type.UnknownTransitionReaction; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.model.map.species.Unknown; import lcsb.mapviewer.modelutils.map.ElementUtils; import lcsb.mapviewer.wikipathway.model.DataNode; import lcsb.mapviewer.wikipathway.model.Edge; diff --git a/pathvisio/src/main/java/lcsb/mapviewer/wikipathway/model/GpmlModificationType.java b/pathvisio/src/main/java/lcsb/mapviewer/wikipathway/model/GpmlModificationType.java index 8be492885840ab1cd368bf93488744884312e756..28c1614bd069403c308d8838555bc08cc6376bac 100644 --- a/pathvisio/src/main/java/lcsb/mapviewer/wikipathway/model/GpmlModificationType.java +++ b/pathvisio/src/main/java/lcsb/mapviewer/wikipathway/model/GpmlModificationType.java @@ -1,136 +1,136 @@ -package lcsb.mapviewer.wikipathway.model; - -import lcsb.mapviewer.model.map.species.fields.ModificationState; - -/** - * This enum represents type of line in GPML format. - * - * @author Piotr Gawron - * - */ -public enum GpmlModificationType { - - /** - * Gpml type representing: {@link ModificationState#PHOSPHORYLATED}. - */ - PHOSPHORYLATED("P", ModificationState.PHOSPHORYLATED), // - - /** - * Gpml type representing: {@link ModificationState#ACETYLATED}. - */ - ACETYLATED("Ac", ModificationState.ACETYLATED), // - - /** - * Gpml type representing: {@link ModificationState#UBIQUITINATED}. - */ - UBIQUITINATED("Ub", ModificationState.UBIQUITINATED), // - - /** - * Gpml type representing: {@link ModificationState#METHYLATED}. - */ - METHYLATED("Me", ModificationState.METHYLATED), // - - /** - * Gpml type representing: {@link ModificationState#HYDROXYLATED}. - */ - HYDROXYLATED("OH", ModificationState.HYDROXYLATED), // - - /** - * Gpml type representing: {@link ModificationState#MYRISTOYLATED}. - */ - MYRISTOYLATED("My", ModificationState.MYRISTOYLATED), // - - /** - * Gpml type representing: {@link ModificationState#SULFATED}. - */ - SULFATED("S", ModificationState.SULFATED), // - - /** - * Gpml type representing: {@link ModificationState#PRENYLATED}. - */ - PRENYLATED("Pr", ModificationState.PRENYLATED), // - - /** - * Gpml type representing: {@link ModificationState#GLYCOSYLATED}. - */ - GLYCOSYLATED("G", ModificationState.GLYCOSYLATED), // - - /** - * Gpml type representing: {@link ModificationState#PALMYTOYLATED}. - */ - PALMYTOYLATED("Pa", ModificationState.PALMYTOYLATED), // - - /** - * Gpml type representing: {@link ModificationState#UNKNOWN}. - */ - UNKOWN("", ModificationState.UNKNOWN), // - - /** - * Gpml type representing: {@link ModificationState#PROTONATED}. - */ - PROTONATED("H", ModificationState.PROTONATED); - - /** - * Default constructor. - * - * @param gpmlString - * {@link #gpmlString} - * @param correspondingModificationState - * {@link #correspondingModificationState} - */ - GpmlModificationType(String gpmlString, ModificationState correspondingModificationState) { - this.gpmlString = gpmlString; - this.correspondingModificationState = correspondingModificationState; - } - - /** - * String in GPML format representig this type. - */ - private String gpmlString; - - /** - * Which {@link ModificationState} in our model should be used for this GPML - * modification type. - */ - private ModificationState correspondingModificationState; - - /** - * @return the gpmlString - * @see #gpmlString - */ - public String getGpmlString() { - return gpmlString; - } - - /** - * Returns {@link GpmlModificationType type} identified by {@link #gpmlName - * gpml string} identifing the type. - * - * @param gpmlName - * {@link #gpmlString} - * @return {@link GpmlModificationType type} identified by {@link #gpmlName - * gpml string} identifing the type - * @throws UnknownTypeException - * thrown when type cannot be found - */ - public static GpmlModificationType getByGpmlName(String gpmlName) throws UnknownTypeException { - for (GpmlModificationType type : values()) { - if (type.getGpmlString() == null) { - if (gpmlName == null) { - return type; - } - } else if (type.getGpmlString().equalsIgnoreCase(gpmlName)) { - return type; - } - } - throw new UnknownTypeException("Unknown state type: " + gpmlName); - } - - /** - * @return the correspondingModificationState - * @see #correspondingModificationState - */ - public ModificationState getCorrespondingModificationState() { - return correspondingModificationState; - } -} +package lcsb.mapviewer.wikipathway.model; + +import lcsb.mapviewer.model.map.layout.alias.ModificationState; + +/** + * This enum represents type of line in GPML format. + * + * @author Piotr Gawron + * + */ +public enum GpmlModificationType { + + /** + * Gpml type representing: {@link ModificationState#PHOSPHORYLATED}. + */ + PHOSPHORYLATED("P", ModificationState.PHOSPHORYLATED), // + + /** + * Gpml type representing: {@link ModificationState#ACETYLATED}. + */ + ACETYLATED("Ac", ModificationState.ACETYLATED), // + + /** + * Gpml type representing: {@link ModificationState#UBIQUITINATED}. + */ + UBIQUITINATED("Ub", ModificationState.UBIQUITINATED), // + + /** + * Gpml type representing: {@link ModificationState#METHYLATED}. + */ + METHYLATED("Me", ModificationState.METHYLATED), // + + /** + * Gpml type representing: {@link ModificationState#HYDROXYLATED}. + */ + HYDROXYLATED("OH", ModificationState.HYDROXYLATED), // + + /** + * Gpml type representing: {@link ModificationState#MYRISTOYLATED}. + */ + MYRISTOYLATED("My", ModificationState.MYRISTOYLATED), // + + /** + * Gpml type representing: {@link ModificationState#SULFATED}. + */ + SULFATED("S", ModificationState.SULFATED), // + + /** + * Gpml type representing: {@link ModificationState#PRENYLATED}. + */ + PRENYLATED("Pr", ModificationState.PRENYLATED), // + + /** + * Gpml type representing: {@link ModificationState#GLYCOSYLATED}. + */ + GLYCOSYLATED("G", ModificationState.GLYCOSYLATED), // + + /** + * Gpml type representing: {@link ModificationState#PALMYTOYLATED}. + */ + PALMYTOYLATED("Pa", ModificationState.PALMYTOYLATED), // + + /** + * Gpml type representing: {@link ModificationState#UNKNOWN}. + */ + UNKOWN("", ModificationState.UNKNOWN), // + + /** + * Gpml type representing: {@link ModificationState#PROTONATED}. + */ + PROTONATED("H", ModificationState.PROTONATED); + + /** + * Default constructor. + * + * @param gpmlString + * {@link #gpmlString} + * @param correspondingModificationState + * {@link #correspondingModificationState} + */ + GpmlModificationType(String gpmlString, ModificationState correspondingModificationState) { + this.gpmlString = gpmlString; + this.correspondingModificationState = correspondingModificationState; + } + + /** + * String in GPML format representig this type. + */ + private String gpmlString; + + /** + * Which {@link ModificationState} in our model should be used for this GPML + * modification type. + */ + private ModificationState correspondingModificationState; + + /** + * @return the gpmlString + * @see #gpmlString + */ + public String getGpmlString() { + return gpmlString; + } + + /** + * Returns {@link GpmlModificationType type} identified by {@link #gpmlName + * gpml string} identifing the type. + * + * @param gpmlName + * {@link #gpmlString} + * @return {@link GpmlModificationType type} identified by {@link #gpmlName + * gpml string} identifing the type + * @throws UnknownTypeException + * thrown when type cannot be found + */ + public static GpmlModificationType getByGpmlName(String gpmlName) throws UnknownTypeException { + for (GpmlModificationType type : values()) { + if (type.getGpmlString() == null) { + if (gpmlName == null) { + return type; + } + } else if (type.getGpmlString().equalsIgnoreCase(gpmlName)) { + return type; + } + } + throw new UnknownTypeException("Unknown state type: " + gpmlName); + } + + /** + * @return the correspondingModificationState + * @see #correspondingModificationState + */ + public ModificationState getCorrespondingModificationState() { + return correspondingModificationState; + } +} diff --git a/pathvisio/src/main/java/lcsb/mapviewer/wikipathway/model/State.java b/pathvisio/src/main/java/lcsb/mapviewer/wikipathway/model/State.java index 915754779e208ca505d6d167847196ed6a04de6d..d0023f471509b94d2692ed35bdd942477d2ef236 100644 --- a/pathvisio/src/main/java/lcsb/mapviewer/wikipathway/model/State.java +++ b/pathvisio/src/main/java/lcsb/mapviewer/wikipathway/model/State.java @@ -1,258 +1,258 @@ -package lcsb.mapviewer.wikipathway.model; - -import java.awt.geom.Rectangle2D; -import java.util.ArrayList; -import java.util.List; - -import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.MiriamData; -import lcsb.mapviewer.model.map.species.fields.ModificationState; - -/** - * Class used to store data about {@link DataNode} state from .gpml. - * - * @author Piotr Gawron - * - */ -public class State extends GraphicalPathwayElement { - - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * Shape of the element. - */ - private String shape; - - /** - * References for given edge. - */ - private List<MiriamData> references = new ArrayList<>(); - - /** - * Object where this state is placed. - */ - private String graphRef; - - /** - * State correspondig to {@link lcsb.mapviewer.model.map.species.Protein#structuralState protein structural state}. - */ - private String structuralState; - - /** - * Type of the modification. - */ - private ModificationState type; - - /** - * X position on {@link #graphRef} element. - */ - private Double relX; - - /** - * Y position on {@link #graphRef} element. - */ - private Double relY; - - /** - * Width of the element. - */ - private Double width; - - /** - * Heightof the element. - */ - private Double height; - - /** - * Default constructor. - * - * @param graphId - * {@link PathwayElement#graphId} - */ - public State(String graphId) { - super(graphId); - } - - /** - * Empty constructor that should be used only by serialization tools and - * subclasses. - */ - protected State() { - } - - @Override - String getName() { - throw new NotImplementedException(); - } - - @Override - public Rectangle2D getRectangle() { - throw new NotImplementedException(); - } - - /** - * @return the shape - * @see #shape - */ - public String getShape() { - return shape; - } - - /** - * @param shape - * the shape to set - * @see #shape - */ - public void setShape(String shape) { - this.shape = shape; - } - - /** - * @return the relX - * @see #relX - */ - public Double getRelX() { - return relX; - } - - /** - * @param relX - * the relX to set - * @see #relX - */ - public void setRelX(Double relX) { - this.relX = relX; - } - - /** - * @return the relY - * @see #relY - */ - public Double getRelY() { - return relY; - } - - /** - * @param relY - * the relY to set - * @see #relY - */ - public void setRelY(Double relY) { - this.relY = relY; - } - - /** - * @return the width - * @see #width - */ - public Double getWidth() { - return width; - } - - /** - * @param width - * the width to set - * @see #width - */ - public void setWidth(Double width) { - this.width = width; - } - - /** - * @return the height - * @see #height - */ - public Double getHeight() { - return height; - } - - /** - * @param height - * the height to set - * @see #height - */ - public void setHeight(Double height) { - this.height = height; - } - - /** - * @return the graphRef - * @see #graphRef - */ - public String getGraphRef() { - return graphRef; - } - - /** - * @param graphRef - * the graphRef to set - * @see #graphRef - */ - public void setGraphRef(String graphRef) { - this.graphRef = graphRef; - } - - /** - * @return the references - * @see #references - */ - public List<MiriamData> getReferences() { - return references; - } - - /** - * @param references - * the references to set - * @see #references - */ - public void setReferences(List<MiriamData> references) { - this.references = references; - } - - /** - * Adds reference to object. - * - * @param reference - * reference to add - */ - public void addReference(MiriamData reference) { - this.references.add(reference); - } - - /** - * @return the type - * @see #type - */ - public ModificationState getType() { - return type; - } - - /** - * @param type - * the type to set - * @see #type - */ - public void setType(ModificationState type) { - this.type = type; - } - - /** - * @return the structuralState - * @see #structuralState - */ - public String getStructuralState() { - return structuralState; - } - - /** - * @param structuralState the structuralState to set - * @see #structuralState - */ - public void setStructuralState(String structuralState) { - this.structuralState = structuralState; - } - -} +package lcsb.mapviewer.wikipathway.model; + +import java.awt.geom.Rectangle2D; +import java.util.ArrayList; +import java.util.List; + +import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.model.map.MiriamData; +import lcsb.mapviewer.model.map.layout.alias.ModificationState; + +/** + * Class used to store data about {@link DataNode} state from .gpml. + * + * @author Piotr Gawron + * + */ +public class State extends GraphicalPathwayElement { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Shape of the element. + */ + private String shape; + + /** + * References for given edge. + */ + private List<MiriamData> references = new ArrayList<>(); + + /** + * Object where this state is placed. + */ + private String graphRef; + + /** + * State correspondig to {@link lcsb.mapviewer.converter.model.celldesigner.structure.Protein#structuralState protein structural state}. + */ + private String structuralState; + + /** + * Type of the modification. + */ + private ModificationState type; + + /** + * X position on {@link #graphRef} element. + */ + private Double relX; + + /** + * Y position on {@link #graphRef} element. + */ + private Double relY; + + /** + * Width of the element. + */ + private Double width; + + /** + * Heightof the element. + */ + private Double height; + + /** + * Default constructor. + * + * @param graphId + * {@link PathwayElement#graphId} + */ + public State(String graphId) { + super(graphId); + } + + /** + * Empty constructor that should be used only by serialization tools and + * subclasses. + */ + protected State() { + } + + @Override + String getName() { + throw new NotImplementedException(); + } + + @Override + public Rectangle2D getRectangle() { + throw new NotImplementedException(); + } + + /** + * @return the shape + * @see #shape + */ + public String getShape() { + return shape; + } + + /** + * @param shape + * the shape to set + * @see #shape + */ + public void setShape(String shape) { + this.shape = shape; + } + + /** + * @return the relX + * @see #relX + */ + public Double getRelX() { + return relX; + } + + /** + * @param relX + * the relX to set + * @see #relX + */ + public void setRelX(Double relX) { + this.relX = relX; + } + + /** + * @return the relY + * @see #relY + */ + public Double getRelY() { + return relY; + } + + /** + * @param relY + * the relY to set + * @see #relY + */ + public void setRelY(Double relY) { + this.relY = relY; + } + + /** + * @return the width + * @see #width + */ + public Double getWidth() { + return width; + } + + /** + * @param width + * the width to set + * @see #width + */ + public void setWidth(Double width) { + this.width = width; + } + + /** + * @return the height + * @see #height + */ + public Double getHeight() { + return height; + } + + /** + * @param height + * the height to set + * @see #height + */ + public void setHeight(Double height) { + this.height = height; + } + + /** + * @return the graphRef + * @see #graphRef + */ + public String getGraphRef() { + return graphRef; + } + + /** + * @param graphRef + * the graphRef to set + * @see #graphRef + */ + public void setGraphRef(String graphRef) { + this.graphRef = graphRef; + } + + /** + * @return the references + * @see #references + */ + public List<MiriamData> getReferences() { + return references; + } + + /** + * @param references + * the references to set + * @see #references + */ + public void setReferences(List<MiriamData> references) { + this.references = references; + } + + /** + * Adds reference to object. + * + * @param reference + * reference to add + */ + public void addReference(MiriamData reference) { + this.references.add(reference); + } + + /** + * @return the type + * @see #type + */ + public ModificationState getType() { + return type; + } + + /** + * @param type + * the type to set + * @see #type + */ + public void setType(ModificationState type) { + this.type = type; + } + + /** + * @return the structuralState + * @see #structuralState + */ + public String getStructuralState() { + return structuralState; + } + + /** + * @param structuralState the structuralState to set + * @see #structuralState + */ + public void setStructuralState(String structuralState) { + this.structuralState = structuralState; + } + +} diff --git a/pathvisio/src/test/java/lcsb/mapviewer/wikipathway/XML/StateParserTest.java b/pathvisio/src/test/java/lcsb/mapviewer/wikipathway/XML/StateParserTest.java index 5332f30cbf8dd40ac2ac64aab1a1787ca90072a7..e4b453e25bbd4339b738b6e6b0014da61cb36c46 100644 --- a/pathvisio/src/test/java/lcsb/mapviewer/wikipathway/XML/StateParserTest.java +++ b/pathvisio/src/test/java/lcsb/mapviewer/wikipathway/XML/StateParserTest.java @@ -8,7 +8,7 @@ import org.junit.Test; import org.w3c.dom.Element; import lcsb.mapviewer.common.Configuration; -import lcsb.mapviewer.model.map.species.fields.ModificationState; +import lcsb.mapviewer.model.map.layout.alias.ModificationState; import lcsb.mapviewer.wikipathway.WikipathwaysTestFunctions; import lcsb.mapviewer.wikipathway.model.State; diff --git a/persist/src/main/java/lcsb/mapviewer/persist/dao/map/graph/DataMiningDao.java b/persist/src/main/java/lcsb/mapviewer/persist/dao/map/graph/DataMiningDao.java index 7d9262afd61c32b5c985e768e061cf01f97df9b0..0348b5ed205f815a669732499c3850daac8bbafb 100644 --- a/persist/src/main/java/lcsb/mapviewer/persist/dao/map/graph/DataMiningDao.java +++ b/persist/src/main/java/lcsb/mapviewer/persist/dao/map/graph/DataMiningDao.java @@ -1,55 +1,55 @@ -package lcsb.mapviewer.persist.dao.map.graph; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import lcsb.mapviewer.model.map.Element; -import lcsb.mapviewer.model.map.graph.DataMining; -import lcsb.mapviewer.persist.dao.BaseDao; - -import org.apache.log4j.Logger; -import org.hibernate.Query; - -/** - * Data access object for {@link DataMining} class. - * - * @author Piotr Gawron - * - */ -public class DataMiningDao extends BaseDao<DataMining> { - - /** - * Default class logger. - */ - @SuppressWarnings("unused") - private static Logger logger = Logger.getLogger(DataMiningDao.class); - - /** - * Default constructor. - */ - - public DataMiningDao() { - super(DataMining.class); - } - - /** - * Returns the data mining elements for unified node. - * - * @param node - * node for which data mining entries should be returned - * @return the data mining elements for unified node - */ - public Collection<DataMining> getMissingConnectionForElement(Element node) { - if (node.getId() == 0) { - return new ArrayList<DataMining>(); - } else { - String queryString = "from " + this.getClazz().getSimpleName() + " where element=:node"; - Query query = getSession().createQuery(queryString); - @SuppressWarnings("unchecked") - List<DataMining> list = query.setParameter("node", node).list(); - return list; - } - } - -} +package lcsb.mapviewer.persist.dao.map.graph; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.model.map.graph.DataMining; +import lcsb.mapviewer.persist.dao.BaseDao; + +import org.apache.log4j.Logger; +import org.hibernate.Query; + +/** + * Data access object for {@link DataMining} class. + * + * @author Piotr Gawron + * + */ +public class DataMiningDao extends BaseDao<DataMining> { + + /** + * Default class logger. + */ + @SuppressWarnings("unused") + private static Logger logger = Logger.getLogger(DataMiningDao.class); + + /** + * Default constructor. + */ + + public DataMiningDao() { + super(DataMining.class); + } + + /** + * Returns the data mining elements for unified node. + * + * @param node + * node for which data mining entries should be returned + * @return the data mining elements for unified node + */ + public Collection<DataMining> getMissingConnectionForElement(Element node) { + if (node.getId() == 0) { + return new ArrayList<DataMining>(); + } else { + String queryString = "from " + this.getClazz().getSimpleName() + " where element=:node"; + Query query = getSession().createQuery(queryString); + @SuppressWarnings("unchecked") + List<DataMining> list = query.setParameter("node", node).list(); + return list; + } + } + +} diff --git a/persist/src/main/java/lcsb/mapviewer/persist/dao/map/species/SpeciesDao.java b/persist/src/main/java/lcsb/mapviewer/persist/dao/map/species/SpeciesDao.java index 5682bd9724518ee5d89580b964c67cdfe92c9316..44c220b83d94e49e8a36d43cc1ea166bb8d9cc29 100644 --- a/persist/src/main/java/lcsb/mapviewer/persist/dao/map/species/SpeciesDao.java +++ b/persist/src/main/java/lcsb/mapviewer/persist/dao/map/species/SpeciesDao.java @@ -1,21 +1,21 @@ -package lcsb.mapviewer.persist.dao.map.species; - -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.persist.dao.BaseDao; - -/** - * Data access object for {@link Species} class. - * - * @author Piotr Gawron - * - */ -public class SpeciesDao extends BaseDao<Species> { - - /** - * Default constructor. - */ - public SpeciesDao() { - super(Species.class); - } - -} +package lcsb.mapviewer.persist.dao.map.species; + +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; +import lcsb.mapviewer.persist.dao.BaseDao; + +/** + * Data access object for {@link Species} class. + * + * @author Piotr Gawron + * + */ +public class SpeciesDao extends BaseDao<Species> { + + /** + * Default constructor. + */ + public SpeciesDao() { + super(Species.class); + } + +} diff --git a/persist/src/test/java/lcsb/mapviewer/persist/dao/ProjectDaoTest.java b/persist/src/test/java/lcsb/mapviewer/persist/dao/ProjectDaoTest.java index 2d82e972efa40c4190185b638278b8f02f361da3..cbead2d998580f1cd453c6494579c3800de3ab02 100644 --- a/persist/src/test/java/lcsb/mapviewer/persist/dao/ProjectDaoTest.java +++ b/persist/src/test/java/lcsb/mapviewer/persist/dao/ProjectDaoTest.java @@ -11,10 +11,12 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; import lcsb.mapviewer.model.Project; import lcsb.mapviewer.model.map.OverviewImage; import lcsb.mapviewer.model.map.OverviewModelLink; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; import lcsb.mapviewer.model.map.layout.alias.SimpleMoleculeAlias; @@ -22,8 +24,6 @@ import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelComparator; import lcsb.mapviewer.model.map.model.ModelFullIndexed; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.SimpleMolecule; import lcsb.mapviewer.persist.PersistTestFunctions; public class ProjectDaoTest extends PersistTestFunctions { diff --git a/persist/src/test/java/lcsb/mapviewer/persist/dao/map/CommentDaoTest.java b/persist/src/test/java/lcsb/mapviewer/persist/dao/map/CommentDaoTest.java index 76ef37ae06c6b3d19eb9e6013c1508b0d78aba5c..6f1fe10e3e4846f1d6d43e21762dd2974c33707e 100644 --- a/persist/src/test/java/lcsb/mapviewer/persist/dao/map/CommentDaoTest.java +++ b/persist/src/test/java/lcsb/mapviewer/persist/dao/map/CommentDaoTest.java @@ -8,12 +8,16 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.ModificationResidue; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; import lcsb.mapviewer.model.Project; import lcsb.mapviewer.model.map.Comment; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; import lcsb.mapviewer.model.map.layout.alias.GenericProteinAlias; @@ -27,10 +31,6 @@ import lcsb.mapviewer.model.map.reaction.Product; import lcsb.mapviewer.model.map.reaction.Reactant; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.type.TransportReaction; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; import lcsb.mapviewer.persist.PersistTestFunctions; public class CommentDaoTest extends PersistTestFunctions { diff --git a/persist/src/test/java/lcsb/mapviewer/persist/dao/map/LayoutDaoTest.java b/persist/src/test/java/lcsb/mapviewer/persist/dao/map/LayoutDaoTest.java index a492589bc416da97f57823924ad84ed289cc2f4b..a4895a89536fb2533bca094c29941f44d57d6181 100644 --- a/persist/src/test/java/lcsb/mapviewer/persist/dao/map/LayoutDaoTest.java +++ b/persist/src/test/java/lcsb/mapviewer/persist/dao/map/LayoutDaoTest.java @@ -13,12 +13,13 @@ import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; import lcsb.mapviewer.model.Project; import lcsb.mapviewer.model.cache.UploadedFileEntry; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.Layout; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; @@ -34,7 +35,6 @@ import lcsb.mapviewer.model.map.reaction.Product; import lcsb.mapviewer.model.map.reaction.Reactant; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.type.TransportReaction; -import lcsb.mapviewer.model.map.species.ComplexSpecies; import lcsb.mapviewer.persist.PersistTestFunctions; public class LayoutDaoTest extends PersistTestFunctions { diff --git a/persist/src/test/java/lcsb/mapviewer/persist/dao/map/ModelDaoTest.java b/persist/src/test/java/lcsb/mapviewer/persist/dao/map/ModelDaoTest.java index 3f11429473c9df1bd5ef0cfdff3295a74ece93a1..4cefbcc14f6705ab69ac193ae9521c95afca47d3 100644 --- a/persist/src/test/java/lcsb/mapviewer/persist/dao/map/ModelDaoTest.java +++ b/persist/src/test/java/lcsb/mapviewer/persist/dao/map/ModelDaoTest.java @@ -13,12 +13,17 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.ModificationResidue; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.Project; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.graph.DataMiningSet; import lcsb.mapviewer.model.map.layout.Layout; import lcsb.mapviewer.model.map.layout.alias.Alias; @@ -37,11 +42,6 @@ import lcsb.mapviewer.model.map.reaction.Product; import lcsb.mapviewer.model.map.reaction.Reactant; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.type.TransportReaction; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; import lcsb.mapviewer.persist.PersistTestFunctions; public class ModelDaoTest extends PersistTestFunctions { diff --git a/persist/src/test/java/lcsb/mapviewer/persist/dao/map/graph/DataMiningDaoTest.java b/persist/src/test/java/lcsb/mapviewer/persist/dao/map/graph/DataMiningDaoTest.java index 3e03f099b287c05d9af5f71681be45e9dc2189e3..7b6ada7d530f3b3ae02dff4e0c5f07cc44bdae06 100644 --- a/persist/src/test/java/lcsb/mapviewer/persist/dao/map/graph/DataMiningDaoTest.java +++ b/persist/src/test/java/lcsb/mapviewer/persist/dao/map/graph/DataMiningDaoTest.java @@ -1,38 +1,38 @@ -package lcsb.mapviewer.persist.dao.map.graph; - -import static org.junit.Assert.assertEquals; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; - -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.persist.PersistTestFunctions; - -public class DataMiningDaoTest extends PersistTestFunctions { - - @Autowired - private DataMiningDao dataMiningDao; - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testGetConnections() { - assertEquals(0, dataMiningDao.getMissingConnectionForElement(new Species()).size()); - } - - @Test - public void testGetConnections2() { - Species species = new Species(); - species.setId(1); - assertEquals(0, dataMiningDao.getMissingConnectionForElement(species).size()); - } - -} +package lcsb.mapviewer.persist.dao.map.graph; + +import static org.junit.Assert.assertEquals; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; +import lcsb.mapviewer.persist.PersistTestFunctions; + +public class DataMiningDaoTest extends PersistTestFunctions { + + @Autowired + private DataMiningDao dataMiningDao; + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testGetConnections() { + assertEquals(0, dataMiningDao.getMissingConnectionForElement(new Species()).size()); + } + + @Test + public void testGetConnections2() { + Species species = new Species(); + species.setId(1); + assertEquals(0, dataMiningDao.getMissingConnectionForElement(species).size()); + } + +} diff --git a/persist/src/test/java/lcsb/mapviewer/persist/dao/map/layout/alias/AliasDaoTest.java b/persist/src/test/java/lcsb/mapviewer/persist/dao/map/layout/alias/AliasDaoTest.java index 88a87b9c0541200180812ad0785380a79ad3c8f3..b3a651bda420310a9effe4fa2b6b4fcb6bc0c978 100644 --- a/persist/src/test/java/lcsb/mapviewer/persist/dao/map/layout/alias/AliasDaoTest.java +++ b/persist/src/test/java/lcsb/mapviewer/persist/dao/map/layout/alias/AliasDaoTest.java @@ -7,8 +7,11 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.Project; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; @@ -19,9 +22,6 @@ import lcsb.mapviewer.model.map.model.AliasSubmodelConnection; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelFullIndexed; import lcsb.mapviewer.model.map.model.SubmodelType; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.SimpleMolecule; -import lcsb.mapviewer.model.map.species.Species; import lcsb.mapviewer.persist.PersistTestFunctions; public class AliasDaoTest extends PersistTestFunctions { diff --git a/persist/src/test/java/lcsb/mapviewer/persist/dao/map/layout/alias/AliasDaoTest2.java b/persist/src/test/java/lcsb/mapviewer/persist/dao/map/layout/alias/AliasDaoTest2.java index 19ad3cdfb5c8209aac1718900e1be5c10491eb8b..5f5e3fabadc2fe12af34bcf16a48daf83f8babd8 100644 --- a/persist/src/test/java/lcsb/mapviewer/persist/dao/map/layout/alias/AliasDaoTest2.java +++ b/persist/src/test/java/lcsb/mapviewer/persist/dao/map/layout/alias/AliasDaoTest2.java @@ -10,6 +10,8 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import lcsb.mapviewer.converter.model.celldesigner.structure.ModificationState; +import lcsb.mapviewer.converter.model.celldesigner.structure.Phenotype; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; @@ -26,8 +28,6 @@ import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.layout.alias.RnaAlias; import lcsb.mapviewer.model.map.layout.alias.RnaRegionAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.species.Phenotype; -import lcsb.mapviewer.model.map.species.fields.ModificationState; import lcsb.mapviewer.persist.PersistTestFunctions; public class AliasDaoTest2 extends PersistTestFunctions { diff --git a/persist/src/test/java/lcsb/mapviewer/persist/dao/map/species/AntisenseRnaTest.java b/persist/src/test/java/lcsb/mapviewer/persist/dao/map/species/AntisenseRnaTest.java index 630962b826ad150b277e2f7e9ccb24283474d619..82f3c6ee3143d3be51d4a9ec31375aaf866ccacd 100644 --- a/persist/src/test/java/lcsb/mapviewer/persist/dao/map/species/AntisenseRnaTest.java +++ b/persist/src/test/java/lcsb/mapviewer/persist/dao/map/species/AntisenseRnaTest.java @@ -10,16 +10,16 @@ import org.junit.Before; import org.junit.Test; import org.springframework.test.annotation.Rollback; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRna; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRnaRegion; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; import lcsb.mapviewer.model.Project; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaAlias; import lcsb.mapviewer.model.map.layout.alias.AntisenseRnaRegionAlias; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelFullIndexed; -import lcsb.mapviewer.model.map.species.AntisenseRna; -import lcsb.mapviewer.model.map.species.fields.AntisenseRnaRegion; import lcsb.mapviewer.persist.PersistTestFunctions; @Rollback(true) diff --git a/persist/src/test/java/lcsb/mapviewer/persist/dao/user/UserDaoTest.java b/persist/src/test/java/lcsb/mapviewer/persist/dao/user/UserDaoTest.java index ea4ad85954c495306d4e822088a413c1149898fc..64af4ecedf8e79efa8436745c3071c7d6a79fd1a 100644 --- a/persist/src/test/java/lcsb/mapviewer/persist/dao/user/UserDaoTest.java +++ b/persist/src/test/java/lcsb/mapviewer/persist/dao/user/UserDaoTest.java @@ -1,281 +1,281 @@ -package lcsb.mapviewer.persist.dao.user; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import org.apache.log4j.Logger; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.crypto.password.PasswordEncoder; - -import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.model.user.User; -import lcsb.mapviewer.model.user.UserAnnotationSchema; -import lcsb.mapviewer.model.user.UserClassAnnotators; -import lcsb.mapviewer.model.user.UserClassValidAnnotations; -import lcsb.mapviewer.persist.PersistTestFunctions; - -public class UserDaoTest extends PersistTestFunctions { - - @Autowired - protected PasswordEncoder passwordEncoder; - - protected Logger logger = Logger.getLogger(UserDaoTest.class.getName()); - String testLogin = "test_login123"; - String testEmail = "a@a.pl"; - String testPasswd = "pwd"; - String testLogin2 = "test_login_tmp"; - String testName = "John"; - String testSurname = "Doe"; - - @Before - public void setUp() throws Exception { - Map<String, Object> params = new HashMap<String, Object>(); - params.put("login_param", testLogin); - params.put("login_param2", testLogin2); - dbUtils.executeSqlQuery("delete from user_table where login = :login_param or login = :login_param2", params); - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testAddUpdateDelete() { - try { - User user = userDao.getUserByLogin(testLogin); - assertNull(user); - - long counter = userDao.getCount(); - - user = new User(); - user.setLogin(testLogin); - userDao.add(user); - - long counter2 = userDao.getCount(); - assertEquals(counter + 1, counter2); - - user.setLogin(testLogin2); - userDao.update(user); - - User user2 = userDao.getUserByLogin(testLogin2); - assertNotNull(user2); - - userDao.delete(user); - - user2 = userDao.getUserByLogin(testLogin2); - assertNull(user2); - counter2 = userDao.getCount(); - assertEquals(counter, counter2); - - } catch (Exception e) { - e.printStackTrace(); - fail("Unexpected exception occured"); - } - } - - @Test - public void testAddDeleteAdd() { - try { - User user = userDao.getUserByLogin(testLogin); - assertNull(user); - - long counter = userDao.getCount(); - - user = new User(); - user.setLogin(testLogin); - userDao.add(user); - - long counter2 = userDao.getCount(); - assertEquals(counter + 1, counter2); - - userDao.delete(user); - - User user2 = userDao.getUserByLogin(testLogin); - assertNull(user2); - - user2 = new User(); - user2.setLogin(testLogin); - userDao.add(user2); - - assertNotNull(userDao.getUserByLogin(testLogin)); - - userDao.delete(user2); - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testGetUserByLoginAndPassword() throws Exception { - try { - User user = new User(); - user.setCryptedPassword(passwordEncoder.encode(testPasswd)); - user.setLogin(testLogin); - userDao.add(user); - User user2 = userDao.getUserByLoginAndPassword(testLogin, testPasswd); - assertNotNull(user2); - assertEquals(user2.getId(), user.getId()); - assertEquals(user2.getLogin(), user.getLogin()); - assertEquals(user2.getCryptedPassword(), user.getCryptedPassword()); - userDao.delete(user); - // after we remove it we shouldn't be able to get it - User user3 = userDao.getUserByLoginAndPassword(testLogin, testPasswd); - assertNull(user3); - - // after we remove it we shouldn't be able to get the removed and modified - // object - User user4 = userDao.getUserByLoginAndPassword(user2.getLogin(), testPasswd); - assertNull(user4); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testGetUserByLoginAndEmptyPassword() throws Exception { - try { - User user = new User(); - user.setCryptedPassword(passwordEncoder.encode(testPasswd)); - user.setLogin(testLogin); - userDao.add(user); - User user2 = userDao.getUserByLoginAndPassword(testLogin, null); - assertNull(user2); - userDao.delete(user); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testGetUserByLogin() throws Exception { - try { - User user = new User(); - user.setCryptedPassword(passwordEncoder.encode(testPasswd)); - user.setLogin(testLogin); - userDao.add(user); - User user2 = userDao.getUserByLogin(testLogin); - assertNotNull(user2); - assertEquals(user2.getId(), user.getId()); - assertEquals(user2.getLogin(), user.getLogin()); - assertEquals(user2.getCryptedPassword(), user.getCryptedPassword()); - user2 = userDao.getUserByLogin(testLogin2); - assertNull(user2); - userDao.delete(user); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testGetUserByEmail() throws Exception { - try { - User user = new User(); - user.setCryptedPassword(passwordEncoder.encode(testPasswd)); - user.setLogin(testLogin); - user.setEmail(testEmail); - userDao.add(user); - User user2 = userDao.getUserByEmail(testEmail); - assertNotNull(user2); - assertEquals(user2.getId(), user.getId()); - assertEquals(user2.getLogin(), user.getLogin()); - assertEquals(user2.getCryptedPassword(), user.getCryptedPassword()); - user2 = userDao.getUserByEmail(testEmail + "sadas"); - assertNull(user2); - userDao.delete(user); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testGetUserByNameSurname() throws Exception { - try { - User user = new User(); - user.setCryptedPassword(passwordEncoder.encode(testPasswd)); - user.setLogin(testLogin); - user.setEmail(testEmail); - user.setName(testName); - user.setSurname(testSurname); - userDao.add(user); - User user2 = userDao.getUserByNameSurname(testName + " " + testSurname); - assertNotNull(user2); - user2 = userDao.getUserByNameSurname(testName + " " + testSurname); - assertNull(user2); - userDao.delete(user); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testGetAll() throws Exception { - try { - assertTrue(userDao.getAll().size() > 0); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testUserWithAnnotatorSchema() throws Exception { - try { - User user = new User(); - UserAnnotationSchema uas = new UserAnnotationSchema(); - uas.setValidateMiriamTypes(true); - UserClassAnnotators ca = new UserClassAnnotators(); - ca.setClassName(Species.class); - ca.addAnnotator(String.class); - ca.addAnnotator(Integer.class); - uas.addClassAnnotator(ca); - uas.addClassAnnotator(new UserClassAnnotators(String.class, new ArrayList<String>())); - UserClassValidAnnotations cva = new UserClassValidAnnotations(); - cva.setClassName(Reaction.class); - cva.addValidMiriamType(MiriamType.HGNC); - cva.addValidMiriamType(MiriamType.HGNC_SYMBOL); - uas.addClassValidAnnotations(cva); - uas.addClassValidAnnotations(new UserClassValidAnnotations(String.class, new ArrayList<MiriamType>())); - uas.addClassValidAnnotations(new UserClassValidAnnotations(Integer.class, new ArrayList<MiriamType>())); - user.setAnnotationSchema(uas); - userDao.add(user); - userDao.evict(user); - User user2 = userDao.getById(user.getId()); - assertNotNull(user2); - UserAnnotationSchema uas2 = user2.getAnnotationSchema(); - assertNotNull(uas2); - assertEquals(2, uas2.getClassAnnotators().size()); - assertEquals(3, uas2.getClassValidAnnotators().size()); - assertEquals(Species.class.getCanonicalName(), uas.getClassAnnotators().get(0).getClassName()); - assertEquals(String.class.getCanonicalName(), uas.getClassAnnotators().get(0).getAnnotators().get(0)); - assertEquals(Integer.class.getCanonicalName(), uas.getClassAnnotators().get(0).getAnnotators().get(1)); - assertEquals(Reaction.class.getCanonicalName(), uas.getClassValidAnnotators().get(0).getClassName()); - assertEquals(MiriamType.HGNC, uas.getClassValidAnnotators().get(0).getValidMiriamTypes().get(0)); - assertEquals(MiriamType.HGNC_SYMBOL, uas.getClassValidAnnotators().get(0).getValidMiriamTypes().get(1)); - - userDao.delete(user2); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - -} +package lcsb.mapviewer.persist.dao.user; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.crypto.password.PasswordEncoder; + +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; +import lcsb.mapviewer.model.map.MiriamType; +import lcsb.mapviewer.model.map.reaction.Reaction; +import lcsb.mapviewer.model.user.User; +import lcsb.mapviewer.model.user.UserAnnotationSchema; +import lcsb.mapviewer.model.user.UserClassAnnotators; +import lcsb.mapviewer.model.user.UserClassValidAnnotations; +import lcsb.mapviewer.persist.PersistTestFunctions; + +public class UserDaoTest extends PersistTestFunctions { + + @Autowired + protected PasswordEncoder passwordEncoder; + + protected Logger logger = Logger.getLogger(UserDaoTest.class.getName()); + String testLogin = "test_login123"; + String testEmail = "a@a.pl"; + String testPasswd = "pwd"; + String testLogin2 = "test_login_tmp"; + String testName = "John"; + String testSurname = "Doe"; + + @Before + public void setUp() throws Exception { + Map<String, Object> params = new HashMap<String, Object>(); + params.put("login_param", testLogin); + params.put("login_param2", testLogin2); + dbUtils.executeSqlQuery("delete from user_table where login = :login_param or login = :login_param2", params); + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testAddUpdateDelete() { + try { + User user = userDao.getUserByLogin(testLogin); + assertNull(user); + + long counter = userDao.getCount(); + + user = new User(); + user.setLogin(testLogin); + userDao.add(user); + + long counter2 = userDao.getCount(); + assertEquals(counter + 1, counter2); + + user.setLogin(testLogin2); + userDao.update(user); + + User user2 = userDao.getUserByLogin(testLogin2); + assertNotNull(user2); + + userDao.delete(user); + + user2 = userDao.getUserByLogin(testLogin2); + assertNull(user2); + counter2 = userDao.getCount(); + assertEquals(counter, counter2); + + } catch (Exception e) { + e.printStackTrace(); + fail("Unexpected exception occured"); + } + } + + @Test + public void testAddDeleteAdd() { + try { + User user = userDao.getUserByLogin(testLogin); + assertNull(user); + + long counter = userDao.getCount(); + + user = new User(); + user.setLogin(testLogin); + userDao.add(user); + + long counter2 = userDao.getCount(); + assertEquals(counter + 1, counter2); + + userDao.delete(user); + + User user2 = userDao.getUserByLogin(testLogin); + assertNull(user2); + + user2 = new User(); + user2.setLogin(testLogin); + userDao.add(user2); + + assertNotNull(userDao.getUserByLogin(testLogin)); + + userDao.delete(user2); + + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testGetUserByLoginAndPassword() throws Exception { + try { + User user = new User(); + user.setCryptedPassword(passwordEncoder.encode(testPasswd)); + user.setLogin(testLogin); + userDao.add(user); + User user2 = userDao.getUserByLoginAndPassword(testLogin, testPasswd); + assertNotNull(user2); + assertEquals(user2.getId(), user.getId()); + assertEquals(user2.getLogin(), user.getLogin()); + assertEquals(user2.getCryptedPassword(), user.getCryptedPassword()); + userDao.delete(user); + // after we remove it we shouldn't be able to get it + User user3 = userDao.getUserByLoginAndPassword(testLogin, testPasswd); + assertNull(user3); + + // after we remove it we shouldn't be able to get the removed and modified + // object + User user4 = userDao.getUserByLoginAndPassword(user2.getLogin(), testPasswd); + assertNull(user4); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testGetUserByLoginAndEmptyPassword() throws Exception { + try { + User user = new User(); + user.setCryptedPassword(passwordEncoder.encode(testPasswd)); + user.setLogin(testLogin); + userDao.add(user); + User user2 = userDao.getUserByLoginAndPassword(testLogin, null); + assertNull(user2); + userDao.delete(user); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testGetUserByLogin() throws Exception { + try { + User user = new User(); + user.setCryptedPassword(passwordEncoder.encode(testPasswd)); + user.setLogin(testLogin); + userDao.add(user); + User user2 = userDao.getUserByLogin(testLogin); + assertNotNull(user2); + assertEquals(user2.getId(), user.getId()); + assertEquals(user2.getLogin(), user.getLogin()); + assertEquals(user2.getCryptedPassword(), user.getCryptedPassword()); + user2 = userDao.getUserByLogin(testLogin2); + assertNull(user2); + userDao.delete(user); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testGetUserByEmail() throws Exception { + try { + User user = new User(); + user.setCryptedPassword(passwordEncoder.encode(testPasswd)); + user.setLogin(testLogin); + user.setEmail(testEmail); + userDao.add(user); + User user2 = userDao.getUserByEmail(testEmail); + assertNotNull(user2); + assertEquals(user2.getId(), user.getId()); + assertEquals(user2.getLogin(), user.getLogin()); + assertEquals(user2.getCryptedPassword(), user.getCryptedPassword()); + user2 = userDao.getUserByEmail(testEmail + "sadas"); + assertNull(user2); + userDao.delete(user); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testGetUserByNameSurname() throws Exception { + try { + User user = new User(); + user.setCryptedPassword(passwordEncoder.encode(testPasswd)); + user.setLogin(testLogin); + user.setEmail(testEmail); + user.setName(testName); + user.setSurname(testSurname); + userDao.add(user); + User user2 = userDao.getUserByNameSurname(testName + " " + testSurname); + assertNotNull(user2); + user2 = userDao.getUserByNameSurname(testName + " " + testSurname); + assertNull(user2); + userDao.delete(user); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testGetAll() throws Exception { + try { + assertTrue(userDao.getAll().size() > 0); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testUserWithAnnotatorSchema() throws Exception { + try { + User user = new User(); + UserAnnotationSchema uas = new UserAnnotationSchema(); + uas.setValidateMiriamTypes(true); + UserClassAnnotators ca = new UserClassAnnotators(); + ca.setClassName(Species.class); + ca.addAnnotator(String.class); + ca.addAnnotator(Integer.class); + uas.addClassAnnotator(ca); + uas.addClassAnnotator(new UserClassAnnotators(String.class, new ArrayList<String>())); + UserClassValidAnnotations cva = new UserClassValidAnnotations(); + cva.setClassName(Reaction.class); + cva.addValidMiriamType(MiriamType.HGNC); + cva.addValidMiriamType(MiriamType.HGNC_SYMBOL); + uas.addClassValidAnnotations(cva); + uas.addClassValidAnnotations(new UserClassValidAnnotations(String.class, new ArrayList<MiriamType>())); + uas.addClassValidAnnotations(new UserClassValidAnnotations(Integer.class, new ArrayList<MiriamType>())); + user.setAnnotationSchema(uas); + userDao.add(user); + userDao.evict(user); + User user2 = userDao.getById(user.getId()); + assertNotNull(user2); + UserAnnotationSchema uas2 = user2.getAnnotationSchema(); + assertNotNull(uas2); + assertEquals(2, uas2.getClassAnnotators().size()); + assertEquals(3, uas2.getClassValidAnnotators().size()); + assertEquals(Species.class.getCanonicalName(), uas.getClassAnnotators().get(0).getClassName()); + assertEquals(String.class.getCanonicalName(), uas.getClassAnnotators().get(0).getAnnotators().get(0)); + assertEquals(Integer.class.getCanonicalName(), uas.getClassAnnotators().get(0).getAnnotators().get(1)); + assertEquals(Reaction.class.getCanonicalName(), uas.getClassValidAnnotators().get(0).getClassName()); + assertEquals(MiriamType.HGNC, uas.getClassValidAnnotators().get(0).getValidMiriamTypes().get(0)); + assertEquals(MiriamType.HGNC_SYMBOL, uas.getClassValidAnnotators().get(0).getValidMiriamTypes().get(1)); + + userDao.delete(user2); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + +} diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/DataFormatter.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/DataFormatter.java index b321d7e705a6837958209979574d2ab171192d36..e356ed007241fa5cf44c6b66bf9618bd900aebd5 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/DataFormatter.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/DataFormatter.java @@ -10,10 +10,10 @@ import org.springframework.beans.factory.annotation.Autowired; import lcsb.mapviewer.annotation.services.MiriamConnector; import lcsb.mapviewer.annotation.services.annotators.AnnotatorException; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; -import lcsb.mapviewer.model.map.species.ComplexSpecies; import lcsb.mapviewer.reactome.model.ReactomeCatalystActivity; import lcsb.mapviewer.reactome.model.ReactomeDatabaseObject; import lcsb.mapviewer.reactome.model.ReactomePhysicalEntity; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/ElementUtil.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/ElementUtil.java index cfb4df2a77dd10d152083502352402bd6b634eda..d6a7c2f07b309ba8b7f469302ed06882cf417e3f 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/ElementUtil.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/ElementUtil.java @@ -12,8 +12,8 @@ import lcsb.mapviewer.annotation.services.annotators.ChebiAnnotator; import lcsb.mapviewer.annotation.services.annotators.ChebiSearchException; import lcsb.mapviewer.annotation.services.annotators.HgncAnnotator; import lcsb.mapviewer.common.exception.InvalidStateException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; import lcsb.mapviewer.model.map.AnnotatedObject; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.Alias; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/ReactionComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/ReactionComparator.java index 0355531f6efef36caa3fbe18ef7fabb75a089077..f15afd32f9aaaec00f26b30bd5f53ce3a907629e 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/ReactionComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/ReactionComparator.java @@ -7,11 +7,11 @@ import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.PhenotypeAlias; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.ReactionNode; -import lcsb.mapviewer.model.map.species.Species; import lcsb.mapviewer.reactome.model.ReactomeCatalystActivity; import lcsb.mapviewer.reactome.model.ReactomeDatabaseObject; import lcsb.mapviewer.reactome.model.ReactomePhysicalEntity; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ComplexAndSimpleEntityComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ComplexAndSimpleEntityComparator.java index ed6766fed3eea33f774022f06170b5686a81a26c..30589675b71addb27847a19874a37cbe185bd535 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ComplexAndSimpleEntityComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ComplexAndSimpleEntityComparator.java @@ -3,11 +3,11 @@ package lcsb.mapviewer.reactome.utils.comparators; import java.util.HashSet; import java.util.Set; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.ComplexAlias; -import lcsb.mapviewer.model.map.species.ComplexSpecies; import lcsb.mapviewer.reactome.model.ReactomeReferenceEntity; import lcsb.mapviewer.reactome.model.ReactomeReferenceMolecule; import lcsb.mapviewer.reactome.model.ReactomeSimpleEntity; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/DegradedAndEntityWithAccessionedSequenceComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/DegradedAndEntityWithAccessionedSequenceComparator.java index 1b3710a69300d9273cdae7d2c63b53d708aa4d60..5562adf3994aa2c9fdaabfaf40a046d061de5158 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/DegradedAndEntityWithAccessionedSequenceComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/DegradedAndEntityWithAccessionedSequenceComparator.java @@ -1,7 +1,7 @@ package lcsb.mapviewer.reactome.utils.comparators; +import lcsb.mapviewer.converter.model.celldesigner.structure.Degraded; import lcsb.mapviewer.model.map.layout.alias.DegradedAlias; -import lcsb.mapviewer.model.map.species.Degraded; import lcsb.mapviewer.reactome.model.ReactomeEntityWithAccessionedSequence; /** diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/DrugAndCatalystComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/DrugAndCatalystComparator.java index de0b223f9b7465063bcd08253235cd052de65515..9aa4d9a61873905c4b52799ec892abe4d0fdf7b3 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/DrugAndCatalystComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/DrugAndCatalystComparator.java @@ -2,8 +2,8 @@ package lcsb.mapviewer.reactome.utils.comparators; import org.apache.log4j.Logger; +import lcsb.mapviewer.converter.model.celldesigner.structure.Drug; import lcsb.mapviewer.model.map.layout.alias.DrugAlias; -import lcsb.mapviewer.model.map.species.Drug; import lcsb.mapviewer.reactome.model.ReactomeCatalystActivity; /** diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/GeneAndDefinedSetComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/GeneAndDefinedSetComparator.java index c739522629dce0f6e5735239ea22b2caf7a82ab7..29897ec770fba84b410cf441c54109f5ae09dd04 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/GeneAndDefinedSetComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/GeneAndDefinedSetComparator.java @@ -2,8 +2,8 @@ package lcsb.mapviewer.reactome.utils.comparators; import org.apache.log4j.Logger; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; import lcsb.mapviewer.model.map.layout.alias.GeneAlias; -import lcsb.mapviewer.model.map.species.Gene; import lcsb.mapviewer.reactome.model.ReactomeDefinedSet; /** diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/GeneAndOtherEntityComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/GeneAndOtherEntityComparator.java index 4ece8e2ef098fe7ecac7b2f795a0b800128849be..394d3051efec887f13d7b653cd027b142aaae593 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/GeneAndOtherEntityComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/GeneAndOtherEntityComparator.java @@ -1,7 +1,7 @@ package lcsb.mapviewer.reactome.utils.comparators; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; import lcsb.mapviewer.model.map.layout.alias.GeneAlias; -import lcsb.mapviewer.model.map.species.Gene; import lcsb.mapviewer.reactome.model.ReactomeOtherEntity; import org.apache.log4j.Logger; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/IonAndCatalystComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/IonAndCatalystComparator.java index 2e578b812c8bbd11b252a70e25559f32927610b3..d13b28ace09debf4bd3c4361dbb51aed64bacb3b 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/IonAndCatalystComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/IonAndCatalystComparator.java @@ -1,8 +1,8 @@ package lcsb.mapviewer.reactome.utils.comparators; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Ion; import lcsb.mapviewer.model.map.layout.alias.IonAlias; -import lcsb.mapviewer.model.map.species.Ion; import lcsb.mapviewer.reactome.model.ReactomeCatalystActivity; import lcsb.mapviewer.reactome.model.ReactomeComplex; import lcsb.mapviewer.reactome.model.ReactomeDefinedSet; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/IonAndComplexComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/IonAndComplexComparator.java index b8271459f779fb630e50a94f1bb16a447b5c3939..773e5130f2dcfdcf059bcb47556889674452579a 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/IonAndComplexComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/IonAndComplexComparator.java @@ -4,9 +4,9 @@ import java.util.List; import lcsb.mapviewer.annotation.services.annotators.ChebiSearchException; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Ion; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.layout.alias.IonAlias; -import lcsb.mapviewer.model.map.species.Ion; import lcsb.mapviewer.reactome.model.ReactomeComplex; import lcsb.mapviewer.reactome.model.ReactomeDefinedSet; import lcsb.mapviewer.reactome.model.ReactomeEntityWithAccessionedSequence; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/IonAndDefinedSetComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/IonAndDefinedSetComparator.java index 0caa0ffe903d8e1ebe76368f7fb72e6c8d37422e..057f32b4e2ea7fba9e74a7401d5e59742d4d9ad0 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/IonAndDefinedSetComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/IonAndDefinedSetComparator.java @@ -1,8 +1,8 @@ package lcsb.mapviewer.reactome.utils.comparators; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Ion; import lcsb.mapviewer.model.map.layout.alias.IonAlias; -import lcsb.mapviewer.model.map.species.Ion; import lcsb.mapviewer.reactome.model.ReactomeComplex; import lcsb.mapviewer.reactome.model.ReactomeDefinedSet; import lcsb.mapviewer.reactome.model.ReactomeEntityWithAccessionedSequence; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/IonAndEntityWithAccessionedSequenceComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/IonAndEntityWithAccessionedSequenceComparator.java index 871429bf1d67f008362a2c0845ecce506d09945d..ccfdc73c017140e39297510fd40d1ec322ab06a8 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/IonAndEntityWithAccessionedSequenceComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/IonAndEntityWithAccessionedSequenceComparator.java @@ -1,7 +1,7 @@ package lcsb.mapviewer.reactome.utils.comparators; +import lcsb.mapviewer.converter.model.celldesigner.structure.Ion; import lcsb.mapviewer.model.map.layout.alias.IonAlias; -import lcsb.mapviewer.model.map.species.Ion; import lcsb.mapviewer.reactome.model.ReactomeEntityWithAccessionedSequence; /** diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/IonAndSimpleEntityComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/IonAndSimpleEntityComparator.java index 2bfcd947f68868dec83f3ec651ce53e26a877b8c..fc671bff37a5a60920eb0fa016115826e9b9a0b5 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/IonAndSimpleEntityComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/IonAndSimpleEntityComparator.java @@ -4,9 +4,9 @@ import java.util.List; import java.util.Set; import lcsb.mapviewer.annotation.services.annotators.ChebiSearchException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Ion; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.layout.alias.IonAlias; -import lcsb.mapviewer.model.map.species.Ion; import lcsb.mapviewer.reactome.model.ReactomeSimpleEntity; import lcsb.mapviewer.reactome.utils.ComparatorException; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MatchResult.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MatchResult.java index ffa4d378d1fa12fb2e4eaa360e81d841b703223f..730e0b08f4cb87691b9dccfb78bde2a13dcdd6b5 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MatchResult.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MatchResult.java @@ -5,9 +5,9 @@ import java.util.List; import org.apache.log4j.Logger; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.Species; import lcsb.mapviewer.reactome.model.ReactomeDatabaseObject; import lcsb.mapviewer.reactome.model.ReactomeReactionlikeEvent; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MoleculeAndCatalystComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MoleculeAndCatalystComparator.java index c01ede4f8e9c90fd4754c53da6590e7ebd973f9e..8f3a22a1aa481bd91ca171db8aedf125a9859b9b 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MoleculeAndCatalystComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MoleculeAndCatalystComparator.java @@ -1,8 +1,8 @@ package lcsb.mapviewer.reactome.utils.comparators; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; import lcsb.mapviewer.model.map.layout.alias.SimpleMoleculeAlias; -import lcsb.mapviewer.model.map.species.SimpleMolecule; import lcsb.mapviewer.reactome.model.ReactomeCatalystActivity; import lcsb.mapviewer.reactome.model.ReactomeComplex; import lcsb.mapviewer.reactome.model.ReactomeDefinedSet; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MoleculeAndComplexComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MoleculeAndComplexComparator.java index 20e34847176fe73c786bbe6f335381a176a0373d..0692c746cee58ce2f1d2350557aca1dc4392da17 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MoleculeAndComplexComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MoleculeAndComplexComparator.java @@ -2,9 +2,9 @@ package lcsb.mapviewer.reactome.utils.comparators; import lcsb.mapviewer.annotation.services.annotators.ChebiSearchException; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.layout.alias.SimpleMoleculeAlias; -import lcsb.mapviewer.model.map.species.SimpleMolecule; import lcsb.mapviewer.reactome.model.ReactomeComplex; import lcsb.mapviewer.reactome.model.ReactomeDefinedSet; import lcsb.mapviewer.reactome.model.ReactomeEntityWithAccessionedSequence; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MoleculeAndDefinedSetComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MoleculeAndDefinedSetComparator.java index e889654e1869aafdc02840fce762062fb6d89222..746163c93f50909546f257e393658bc3a9b99544 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MoleculeAndDefinedSetComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MoleculeAndDefinedSetComparator.java @@ -1,8 +1,8 @@ package lcsb.mapviewer.reactome.utils.comparators; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; import lcsb.mapviewer.model.map.layout.alias.SimpleMoleculeAlias; -import lcsb.mapviewer.model.map.species.SimpleMolecule; import lcsb.mapviewer.reactome.model.ReactomeComplex; import lcsb.mapviewer.reactome.model.ReactomeDefinedSet; import lcsb.mapviewer.reactome.model.ReactomeEntityWithAccessionedSequence; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MoleculeAndEntityWithAccessionedSequenceComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MoleculeAndEntityWithAccessionedSequenceComparator.java index 842e30f3905d21ae8f1d7f37f2df31212426ca46..bd267ad0dffc201cfbdf0a060abd5fd0c0465739 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MoleculeAndEntityWithAccessionedSequenceComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MoleculeAndEntityWithAccessionedSequenceComparator.java @@ -1,7 +1,7 @@ package lcsb.mapviewer.reactome.utils.comparators; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; import lcsb.mapviewer.model.map.layout.alias.SimpleMoleculeAlias; -import lcsb.mapviewer.model.map.species.SimpleMolecule; import lcsb.mapviewer.reactome.model.ReactomeEntityWithAccessionedSequence; /** diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MoleculeAndSimpleEntityComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MoleculeAndSimpleEntityComparator.java index 6621dca93a5b40e5c28f33483e44fe2c6dd8904b..65f000e50fb987d8101f0d28bbb0a548502978b7 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MoleculeAndSimpleEntityComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/MoleculeAndSimpleEntityComparator.java @@ -4,9 +4,9 @@ import java.util.List; import java.util.Set; import lcsb.mapviewer.annotation.services.annotators.ChebiSearchException; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.layout.alias.SimpleMoleculeAlias; -import lcsb.mapviewer.model.map.species.SimpleMolecule; import lcsb.mapviewer.reactome.model.ReactomeSimpleEntity; import lcsb.mapviewer.reactome.utils.ComparatorException; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/NodeComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/NodeComparator.java index 96ec98a48a2adaf5a658cd7854f4ec91805a742d..290fabe72aeef56e63a5b1b589501ec06ca93f9b 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/NodeComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/NodeComparator.java @@ -6,9 +6,9 @@ import java.util.Map; import org.apache.log4j.Logger; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; -import lcsb.mapviewer.model.map.species.Protein; import lcsb.mapviewer.persist.SpringApplicationContext; import lcsb.mapviewer.reactome.model.ReactomeDatabaseObject; import lcsb.mapviewer.reactome.utils.ComparatorException; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndCandidateSetComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndCandidateSetComparator.java index 33d87198fd8bc8de1bdacec0a75594ca14eb884e..0f5e16047ab5d908ea331f4985c1508d186220f9 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndCandidateSetComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndCandidateSetComparator.java @@ -4,8 +4,8 @@ import java.util.HashSet; import java.util.Set; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; -import lcsb.mapviewer.model.map.species.Protein; import lcsb.mapviewer.reactome.model.ReactomeCandidateSet; import lcsb.mapviewer.reactome.model.ReactomeComplex; import lcsb.mapviewer.reactome.model.ReactomeEntityWithAccessionedSequence; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndCatalystComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndCatalystComparator.java index a9485d3662cd30cc906e66d090aeb5ea51d963b0..87e47f4d2d17f03a4b20efa0c04022a711aab251 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndCatalystComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndCatalystComparator.java @@ -1,8 +1,8 @@ package lcsb.mapviewer.reactome.utils.comparators; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; -import lcsb.mapviewer.model.map.species.Protein; import lcsb.mapviewer.reactome.model.ReactomeCandidateSet; import lcsb.mapviewer.reactome.model.ReactomeCatalystActivity; import lcsb.mapviewer.reactome.model.ReactomeComplex; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndComplexComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndComplexComparator.java index 6c25ff64ccaced4b4e15b40cfdfe968b2d9a1ebc..13d5a90f6693ba2e8d85cdafe1f1750274b55381 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndComplexComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndComplexComparator.java @@ -5,10 +5,10 @@ import java.util.Set; import org.apache.log4j.Logger; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; -import lcsb.mapviewer.model.map.species.Protein; import lcsb.mapviewer.reactome.model.ReactomeComplex; import lcsb.mapviewer.reactome.utils.ComparatorException; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndDefinedSetComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndDefinedSetComparator.java index 574e97672c45844dafecfc6dd652b681b5be3b7f..36d9b30bfd67588d0ebb675e857b6e286056a6f6 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndDefinedSetComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndDefinedSetComparator.java @@ -1,8 +1,8 @@ package lcsb.mapviewer.reactome.utils.comparators; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; -import lcsb.mapviewer.model.map.species.Protein; import lcsb.mapviewer.reactome.model.ReactomeComplex; import lcsb.mapviewer.reactome.model.ReactomeDefinedSet; import lcsb.mapviewer.reactome.model.ReactomeEntityWithAccessionedSequence; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndEntityWithAccessionedSequenceComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndEntityWithAccessionedSequenceComparator.java index c2be3f4611a25f32d93c4bf86205ddb40da5d867..5ec9507444f3b7e7cc31d3883aba436f43346e4e 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndEntityWithAccessionedSequenceComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndEntityWithAccessionedSequenceComparator.java @@ -5,10 +5,10 @@ import java.util.Set; import org.apache.log4j.Logger; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; -import lcsb.mapviewer.model.map.species.Protein; import lcsb.mapviewer.reactome.model.ReactomeEntityWithAccessionedSequence; import lcsb.mapviewer.reactome.model.ReactomeReferenceEntity; import lcsb.mapviewer.reactome.model.ReactomeReferenceGeneProduct; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndGenomeEncodedEntity.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndGenomeEncodedEntity.java index d9c00667285151936ce260795bda5bcdd86feb13..0d8b91ae447f15675c9bd0307be3507c581b8332 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndGenomeEncodedEntity.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndGenomeEncodedEntity.java @@ -2,8 +2,8 @@ package lcsb.mapviewer.reactome.utils.comparators; import org.apache.log4j.Logger; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; -import lcsb.mapviewer.model.map.species.Protein; import lcsb.mapviewer.reactome.model.ReactomeGenomeEncodedEntity; /** diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndOtherEntityComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndOtherEntityComparator.java index 4682b93e6b4d0b4ecff22c91519613b0822341c6..e65d79b6fb2e00054210b78fa868735e4f83532c 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndOtherEntityComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndOtherEntityComparator.java @@ -2,8 +2,8 @@ package lcsb.mapviewer.reactome.utils.comparators; import org.apache.log4j.Logger; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; -import lcsb.mapviewer.model.map.species.Protein; import lcsb.mapviewer.reactome.model.ReactomeOtherEntity; /** diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndPolymerComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndPolymerComparator.java index f18d40805c5e1becb8331a218489414d3a266c59..9a3f909753dadc3a5b83e13bdb14c389fcf325bf 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndPolymerComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndPolymerComparator.java @@ -5,10 +5,10 @@ import java.util.List; import java.util.Set; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; -import lcsb.mapviewer.model.map.species.Protein; import lcsb.mapviewer.reactome.model.ReactomeComplex; import lcsb.mapviewer.reactome.model.ReactomeDefinedSet; import lcsb.mapviewer.reactome.model.ReactomeEntityWithAccessionedSequence; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndSimpleEntityComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndSimpleEntityComparator.java index 1c8c70d0e2c9525a4bd7efaadd3cef099038224e..997349c0ecd69713116e805318e53f85bf3f1537 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndSimpleEntityComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ProteinAndSimpleEntityComparator.java @@ -1,7 +1,7 @@ package lcsb.mapviewer.reactome.utils.comparators; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; -import lcsb.mapviewer.model.map.species.Protein; import lcsb.mapviewer.reactome.model.ReactomeSimpleEntity; /** diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/UnknownAndCatalystComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/UnknownAndCatalystComparator.java index 3170fe8459e51c52b811a7658f85dddc3844adb8..6a4d62232fa38b5eebde77824e0c5019cd336e95 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/UnknownAndCatalystComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/UnknownAndCatalystComparator.java @@ -1,8 +1,8 @@ package lcsb.mapviewer.reactome.utils.comparators; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Unknown; import lcsb.mapviewer.model.map.layout.alias.UnknownAlias; -import lcsb.mapviewer.model.map.species.Unknown; import lcsb.mapviewer.reactome.model.ReactomeCatalystActivity; import lcsb.mapviewer.reactome.model.ReactomeGenomeEncodedEntity; import lcsb.mapviewer.reactome.model.ReactomePhysicalEntity; diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/UnknownAndGenomeEncodedEntityComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/UnknownAndGenomeEncodedEntityComparator.java index efd684fa1172926bf59a4803550d24da7c7ef5de..5daaf4ad10b6f42ef5bf3fa5f2ed20a87d405a8d 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/UnknownAndGenomeEncodedEntityComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/UnknownAndGenomeEncodedEntityComparator.java @@ -1,7 +1,7 @@ package lcsb.mapviewer.reactome.utils.comparators; +import lcsb.mapviewer.converter.model.celldesigner.structure.Unknown; import lcsb.mapviewer.model.map.layout.alias.UnknownAlias; -import lcsb.mapviewer.model.map.species.Unknown; import lcsb.mapviewer.reactome.model.ReactomeGenomeEncodedEntity; /** diff --git a/service/src/main/java/lcsb/mapviewer/services/impl/DataMiningService.java b/service/src/main/java/lcsb/mapviewer/services/impl/DataMiningService.java index 6fdfc8fdaf6fdb29e1cd0aab8506f70dd2d260b2..7b10d88a223bb49a665d4c097c0ead46d10a7937 100644 --- a/service/src/main/java/lcsb/mapviewer/services/impl/DataMiningService.java +++ b/service/src/main/java/lcsb/mapviewer/services/impl/DataMiningService.java @@ -25,8 +25,8 @@ import lcsb.mapviewer.common.IProgressUpdater; import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.common.XmlParser; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; import lcsb.mapviewer.model.log.LogType; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.graph.DataMining; diff --git a/service/src/main/java/lcsb/mapviewer/services/impl/ExporterService.java b/service/src/main/java/lcsb/mapviewer/services/impl/ExporterService.java index f8fda6c140a81f89b22f40d4344e0ee29923b23d..33000680fed6484b594b3a50f7fe87bc7e19bfaa 100644 --- a/service/src/main/java/lcsb/mapviewer/services/impl/ExporterService.java +++ b/service/src/main/java/lcsb/mapviewer/services/impl/ExporterService.java @@ -17,10 +17,25 @@ import org.springframework.beans.factory.annotation.Autowired; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.converter.model.celldesigner.reaction.ReactionLineData; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRna; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRnaRegion; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Degraded; +import lcsb.mapviewer.converter.model.celldesigner.structure.Drug; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.Ion; +import lcsb.mapviewer.converter.model.celldesigner.structure.ModificationResidue; +import lcsb.mapviewer.converter.model.celldesigner.structure.Phenotype; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; +import lcsb.mapviewer.converter.model.celldesigner.structure.RnaRegion; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; +import lcsb.mapviewer.converter.model.celldesigner.structure.Unknown; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.ArtifitialCompartmentAlias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; @@ -32,21 +47,6 @@ import lcsb.mapviewer.model.map.reaction.Product; import lcsb.mapviewer.model.map.reaction.Reactant; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.ReactionNode; -import lcsb.mapviewer.model.map.species.AntisenseRna; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Degraded; -import lcsb.mapviewer.model.map.species.Drug; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.Ion; -import lcsb.mapviewer.model.map.species.Phenotype; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; -import lcsb.mapviewer.model.map.species.SimpleMolecule; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.model.map.species.Unknown; -import lcsb.mapviewer.model.map.species.fields.AntisenseRnaRegion; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; -import lcsb.mapviewer.model.map.species.fields.RnaRegion; import lcsb.mapviewer.services.interfaces.IExporterService; import lcsb.mapviewer.services.utils.data.ExportColumn; import lcsb.mapviewer.services.utils.data.ExportFileType; diff --git a/service/src/main/java/lcsb/mapviewer/services/impl/LayoutService.java b/service/src/main/java/lcsb/mapviewer/services/impl/LayoutService.java index 66297481ef5e17a1f55f132da7d3f7e0b6666622..97bc8dd86be0cebc31133b9970661c32e21e9cbc 100644 --- a/service/src/main/java/lcsb/mapviewer/services/impl/LayoutService.java +++ b/service/src/main/java/lcsb/mapviewer/services/impl/LayoutService.java @@ -1,976 +1,976 @@ -package lcsb.mapviewer.services.impl; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.mail.MessagingException; - -import org.apache.commons.io.IOUtils; -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; - -import lcsb.mapviewer.annotation.services.MiriamConnector; -import lcsb.mapviewer.commands.ColorModelCommand; -import lcsb.mapviewer.commands.CommandExecutionException; -import lcsb.mapviewer.commands.CopyCommand; -import lcsb.mapviewer.common.IProgressUpdater; -import lcsb.mapviewer.common.Pair; -import lcsb.mapviewer.common.TextFileUtils; -import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.common.exception.InvalidStateException; -import lcsb.mapviewer.converter.graphics.MapGenerator; -import lcsb.mapviewer.converter.graphics.MapGenerator.MapGeneratorParams; -import lcsb.mapviewer.model.Project; -import lcsb.mapviewer.model.cache.UploadedFileEntry; -import lcsb.mapviewer.model.log.LogType; -import lcsb.mapviewer.model.map.MiriamData; -import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.layout.ColorSchema; -import lcsb.mapviewer.model.map.layout.GeneVariation; -import lcsb.mapviewer.model.map.layout.GeneVariationColorSchema; -import lcsb.mapviewer.model.map.layout.GenericColorSchema; -import lcsb.mapviewer.model.map.layout.InvalidColorSchemaException; -import lcsb.mapviewer.model.map.layout.Layout; -import lcsb.mapviewer.model.map.layout.LayoutStatus; -import lcsb.mapviewer.model.map.layout.alias.Alias; -import lcsb.mapviewer.model.map.model.Model; -import lcsb.mapviewer.model.map.model.ModelSubmodelConnection; -import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.model.user.ObjectPrivilege; -import lcsb.mapviewer.model.user.PrivilegeType; -import lcsb.mapviewer.model.user.User; -import lcsb.mapviewer.persist.DbUtils; -import lcsb.mapviewer.persist.dao.map.LayoutDao; -import lcsb.mapviewer.services.interfaces.IConfigurationService; -import lcsb.mapviewer.services.interfaces.ILayoutService; -import lcsb.mapviewer.services.interfaces.ILogService; -import lcsb.mapviewer.services.interfaces.ILogService.LogParams; -import lcsb.mapviewer.services.interfaces.IUserService; -import lcsb.mapviewer.services.search.layout.FullLayoutAliasView; -import lcsb.mapviewer.services.search.layout.FullLayoutAliasViewFactory; -import lcsb.mapviewer.services.search.layout.LightLayoutAliasView; -import lcsb.mapviewer.services.search.layout.LightLayoutAliasViewFactory; -import lcsb.mapviewer.services.search.layout.LightLayoutReactionView; -import lcsb.mapviewer.services.search.layout.LightLayoutReactionViewFactory; -import lcsb.mapviewer.services.utils.ColorSchemaReader; -import lcsb.mapviewer.services.utils.EmailSender; -import lcsb.mapviewer.services.utils.data.ColorSchemaColumn; -import lcsb.mapviewer.services.view.LayoutView; -import lcsb.mapviewer.services.view.LayoutViewFactory; - -/** - * Implementation of the layout service. - * - * @author Piotr Gawron - * - */ -@Transactional(value = "txManager") -public class LayoutService implements ILayoutService { - - /** - * Default class logger. - */ - private Logger logger = Logger.getLogger(LayoutService.class); - - /** - * Layout data access object. - */ - @Autowired - private LayoutDao layoutDao; - - /** - * Factory object used for creation of {@link LayoutView} elements. - */ - @Autowired - private LayoutViewFactory layoutViewFactory; - - /** - * Service that manages and gives access to user information. - */ - @Autowired - private IUserService userService; - - /** - * Service used to access logs. - * - * @see ILogService - */ - @Autowired - private ILogService logService; - - /** - * Service that manages and gives access to configuration parameters. - */ - @Autowired - private IConfigurationService configurationService; - - /** - * Utils that help to manage the sessions in custom multithreaded - * implementation. - */ - @Autowired - private DbUtils dbUtils; - - @Override - public boolean userCanAddLayout(Model model, User user) { - // if we don't have privileges to view the object then we cannot add layouts - if (!userService.userHasPrivilege(user, PrivilegeType.VIEW_PROJECT, model.getProject())) { - return false; - } - long count = getAvailableCustomLayoutsNumber(user); - return count > 0; - } - - @Override - public long getAvailableCustomLayoutsNumber(User user) { - long level = userService.getUserPrivilegeLevel(user, PrivilegeType.CUSTOM_LAYOUTS); - long layouts = layoutDao.getCountByUser(user); - return level - layouts; - - } - - @Override - public boolean userCanRemoveLayout(LayoutView layout, User user) { - Layout originalLayout = layoutDao.getById(layout.getIdObject()); - User creator = originalLayout.getCreator(); - Project project = originalLayout.getModel().getProject(); - if (creator == null) { - return userService.userHasPrivilege(user, PrivilegeType.LAYOUT_MANAGEMENT, project); - } else { - return creator.getId().equals(user.getId()) || userService.userHasPrivilege(user, PrivilegeType.LAYOUT_MANAGEMENT, project); - } - } - - @Override - public List<LayoutView> getCustomLayouts(Model model, User user) { - List<LayoutView> result = new ArrayList<LayoutView>(); - if (model == null || user == null) { - return result; - } - List<Layout> layouts = layoutDao.getLayoutsByModel(model); - for (Layout layout : layouts) { - if (!layout.isPublicLayout() && layout.getCreator() != null) { - if (layout.getCreator().getLogin().equals(user.getLogin())) { - result.add(layoutViewFactory.create(layout)); - } else if (userService.userHasPrivilege(user, PrivilegeType.LAYOUT_VIEW, layout)) { - result.add(layoutViewFactory.create(layout)); - } - } - } - Collections.sort(result, LayoutView.ID_COMPARATOR); - return result; - } - - @Override - public List<LayoutView> getGeneralLayouts(Model model) { - List<LayoutView> result = new ArrayList<LayoutView>(); - if (model == null) { - return result; - } - List<Layout> layouts = layoutDao.getLayoutsByModel(model); - for (Layout layout : layouts) { - if (layout.isPublicLayout()) { - result.add(layoutViewFactory.create(layout)); - } - } - Collections.sort(result, LayoutView.ID_COMPARATOR); - return result; - } - - @Override - public void removeLayout(LayoutView layout, final String homeDir) throws IOException { - final String dir; - final Layout dbLayout = layoutDao.getById(layout.getIdObject()); - if (homeDir != null) { - if (dbLayout.getModel().getProject().getDirectory() != null) { - dir = homeDir + "/../map_images/" + dbLayout.getModel().getProject().getDirectory() + "/"; - } else { - dir = homeDir + "/../map_images/"; - } - } else { - dir = null; - } - - String projectId = dbLayout.getModel().getProject().getProjectId(); - String email = null; - User user = dbLayout.getCreator(); - if (user != null) { - email = user.getEmail(); - } - - dbLayout.getModel().removeLayout(dbLayout); - layoutDao.delete(dbLayout); - - LogParams params = new LogParams().object(dbLayout).type(LogType.LAYOUT_REMOVED); - logService.log(params); - - if (email != null) { - try { - sendSuccesfullRemoveEmail(projectId, layout.getName(), email); - } catch (MessagingException e) { - logger.error(e); - } - } - Thread computations = new Thread(new Runnable() { - @Override - public void run() { - MapGenerator generator = new MapGenerator(); - try { - generator.removeLayout(dbLayout, dir); - } catch (IOException e) { - logger.error(e); - } - - } - }); - computations.start(); - } - - @Override - public void updateLayout(LayoutView layout) { - Layout dbLayout = layoutDao.getById(layout.getIdObject()); - dbLayout.setTitle(layout.getName()); - dbLayout.setDescription(layout.getDescription()); - if (layout.getCreator().isEmpty()) { - dbLayout.setCreator(null); - dbLayout.setPublicLayout(true); - } else { - User user = userService.getUserByNameSurname(layout.getCreator()); - dbLayout.setCreator(user); - dbLayout.setPublicLayout(false); - } - - layoutDao.update(dbLayout); - } - - @Override - public void addViewPrivilegeToLayout(LayoutView layout, User user) { - ObjectPrivilege privilege = new ObjectPrivilege(); - privilege.setIdObject(layout.getIdObject()); - privilege.setLevel(1); - privilege.setType(PrivilegeType.LAYOUT_VIEW); - privilege.setUser(user); - userService.setUserPrivilege(user, privilege); - } - - @Override - public void dropViewPrivilegeFromLayout(LayoutView layout, User user) { - ObjectPrivilege privilege = new ObjectPrivilege(); - privilege.setIdObject(layout.getIdObject()); - privilege.setLevel(0); - privilege.setType(PrivilegeType.LAYOUT_VIEW); - privilege.setUser(user); - userService.setUserPrivilege(user, privilege); - } - - @Override - public LayoutView createLayoutWithImages(final CreateLayoutParams params) throws IOException, InvalidColorSchemaException, CommandExecutionException { - ColorSchemaReader reader = new ColorSchemaReader(); - final Collection<ColorSchema> schemas = reader - .readColorSchema(params.getColorInputStream(), TextFileUtils.getHeaderParametersFromFile(params.getColorInputStream())); - final Model colorModel = new CopyCommand(params.getModel()).execute(); - new ColorModelCommand(params.getModel(), schemas).execute(); - final EmailSender sender = new EmailSender(configurationService); - String[] tmp = params.getDirectory().split("[\\\\/]"); - String simpleDir = tmp[tmp.length - 1]; - - layoutDao.flush(); - - boolean customSession = false; - if (params.isAsync()) { - customSession = !dbUtils.isCustomSessionForCurrentThread(); - if (customSession) { - dbUtils.createSessionForCurrentThread(); - } - } - final Map<Model, Integer> layoutIdByModel = new HashMap<Model, Integer>(); - - Layout topLayout = new Layout(params.getName(), simpleDir, false); - if (params.getUser() == null) { - topLayout.setPublicLayout(true); - } else { - topLayout.setPublicLayout(false); - } - topLayout.setStatus(LayoutStatus.NA); - topLayout.setProgress(0.0); - UploadedFileEntry fileEntry = new UploadedFileEntry(); - fileEntry.setFileContent(IOUtils.toByteArray(params.getColorInputStream())); - fileEntry.setOriginalFileName(params.getLayoutFileName()); - topLayout.setInputData(fileEntry); - topLayout.setDescription(params.getDescription()); - params.getModel().addLayout(topLayout); - topLayout.setCreator(params.getUser()); - layoutDao.add(topLayout); - topLayout.setDirectory(simpleDir + topLayout.getId()); - - layoutDao.update(topLayout); - - layoutIdByModel.put(colorModel, topLayout.getId()); - - for (ModelSubmodelConnection connection : params.getModel().getSubmodelConnections()) { - Layout layout = new Layout(params.getName(), simpleDir, false); - layout.setStatus(LayoutStatus.NA); - layout.setProgress(0.0); - connection.getSubmodel().getModel().addLayout(layout); - layout.setCreator(params.getUser()); - layout.setPublicLayout(false); - topLayout.addLayout(layout); - layoutDao.add(layout); - layout.setDirectory(simpleDir + layout.getId()); - - layoutDao.update(layout); - - layoutIdByModel.put(colorModel.getSubmodelByConnectionName(connection.getName()), layout.getId()); - } - - if (params.isAsync()) { - if (customSession) { - dbUtils.closeSessionForCurrentThread(); - } else { - layoutDao.commit(); - } - } - final int layoutId = layoutIdByModel.get(colorModel); - - Thread computations = new Thread(new Runnable() { - @Override - public void run() { - if (params.isAsync()) { - // open transaction for this thread - dbUtils.createSessionForCurrentThread(); - } - - try { - MapGenerator generator = new MapGenerator(); - final int models = layoutIdByModel.entrySet().size(); - - int count = 0; - for (Model m : layoutIdByModel.keySet()) { - final int counted = count; - int id = layoutIdByModel.get(m); - MapGeneratorParams imgParams = generator.new MapGeneratorParams().model(m).directory(params.getDirectory() + id).updater(new IProgressUpdater() { - private int lastProgress = -1; - - @Override - public void setProgress(double progress) { - progress = progress / ((double) models) + ((double) counted * MAX_PROGRESS) / ((double) models); - if (((int) progress) != lastProgress) { - Layout layout = layoutDao.getById(layoutId); - lastProgress = (int) progress; - layout.setProgress(progress); - layout.setStatus(LayoutStatus.GENERATING); - layoutDao.update(layout); - if (params.isAsync()) { - layoutDao.commit(); - } - } - } - }); - generator.generateMapImages(imgParams); - count++; - } - Layout layout = layoutDao.getById(layoutId); - layout.setProgress(IProgressUpdater.MAX_PROGRESS); - layout.setStatus(LayoutStatus.OK); - layoutDao.update(layout); - if (params.isAsync()) { - layoutDao.commit(); - } - - try { - sendSuccessfullGenerationEmail(params, schemas); - } catch (MessagingException e) { - logger.error("Problem with sending email", e); - } - logService.log(new LogParams().object(layout).description("Created successfully.").type(LogType.LAYOUT_CREATED)); - } catch (Exception e) { - logger.error("Problem with creating layout", e); - - Layout layout = layoutDao.getById(layoutId); - layout.setProgress(IProgressUpdater.MAX_PROGRESS); - layout.setStatus(LayoutStatus.FAILURE); - layoutDao.update(layout); - - try { - sender.sendEmail( - "MapViewer status", "There was a problem with generating layout " + params.getName() + ". Contact administrator to solve this issue.", - params.getUser()); - } catch (MessagingException e1) { - logger.error("Problem with sending email", e1); - } - logService.log(new LogParams().object(layout).description("Problem during creation.").type(LogType.LAYOUT_CREATED)); - } - if (params.isAsync()) { - // close the transaction for this thread - dbUtils.closeSessionForCurrentThread(); - } - } - }); - - if (params.isAsync()) { - computations.start(); - } else { - computations.run(); - } - return layoutViewFactory.create(topLayout); - } - - @Override - public LayoutView createLayout(final CreateLayoutParams params) throws IOException, InvalidColorSchemaException { - ColorSchemaReader reader = new ColorSchemaReader(); - final Collection<ColorSchema> schemas = reader - .readColorSchema(params.getColorInputStream(), TextFileUtils.getHeaderParametersFromFile(params.getColorInputStream())); - - // check if we can color our model using this schema, - // if not then exception will be thrown and passed up - try { - new ColorModelCommand(params.getModel(), schemas).execute(); - } catch (CommandExecutionException e) { - throw new InvalidColorSchemaException(e); - } - - String[] tmp = params.getDirectory().split("[\\\\/]"); - String simpleDir = tmp[tmp.length - 1]; - - layoutDao.flush(); - - boolean customSession = false; - - if (params.isAsync()) { - customSession = !dbUtils.isCustomSessionForCurrentThread(); - if (customSession) { - dbUtils.createSessionForCurrentThread(); - } - } - - Layout topLayout = new Layout(params.getName(), simpleDir, false); - if (params.getUser() == null) { - topLayout.setPublicLayout(true); - } else { - topLayout.setPublicLayout(false); - } - topLayout.setStatus(LayoutStatus.OK); - topLayout.setProgress(0.0); - UploadedFileEntry fileEntry = new UploadedFileEntry(); - fileEntry.setFileContent(IOUtils.toByteArray(params.getColorInputStream())); - fileEntry.setOriginalFileName(params.getLayoutFileName()); - topLayout.setInputData(fileEntry); - topLayout.setDescription(params.getDescription()); - params.getModel().addLayout(topLayout); - topLayout.setCreator(params.getUser()); - layoutDao.add(topLayout); - topLayout.setDirectory(simpleDir + topLayout.getId()); - - layoutDao.update(topLayout); - - for (ModelSubmodelConnection connection : params.getModel().getSubmodelConnections()) { - Layout layout = new Layout(params.getName(), simpleDir, false); - layout.setStatus(LayoutStatus.OK); - layout.setProgress(0.0); - connection.getSubmodel().getModel().addLayout(layout); - layout.setCreator(params.getUser()); - layout.setPublicLayout(false); - topLayout.addLayout(layout); - layoutDao.add(layout); - layout.setDirectory(simpleDir + layout.getId()); - - layoutDao.update(layout); - } - - if (params.isAsync()) { - if (customSession) { - dbUtils.closeSessionForCurrentThread(); - } else { - layoutDao.commit(); - } - } - Thread computations = new Thread(new Runnable() { - @Override - public void run() { - if (params.isAsync()) { - // open transaction for this thread - dbUtils.createSessionForCurrentThread(); - } - - try { - sendSuccessfullGenerationEmail(params, schemas); - } catch (MessagingException e) { - logger.error("Problem with sending email", e); - } - - if (params.isAsync()) { - // close the transaction for this thread - dbUtils.closeSessionForCurrentThread(); - } - } - }); - - LogParams logParams = new LogParams().object(topLayout).description("Created successfully.").type(LogType.LAYOUT_CREATED); - logService.log(logParams); - - if (params.isAsync()) { - computations.start(); - } else { - computations.run(); - } - return layoutViewFactory.create(topLayout); - } - - /** - * @return the configurationService - * @see #configurationService - */ - public IConfigurationService getConfigurationService() { - return configurationService; - } - - /** - * @param configurationService - * the configurationService to set - * @see #configurationService - */ - public void setConfigurationService(IConfigurationService configurationService) { - this.configurationService = configurationService; - } - - /** - * @return the dbUtils - * @see #dbUtils - */ - public DbUtils getDbUtils() { - return dbUtils; - } - - /** - * @param dbUtils - * the dbUtils to set - * @see #dbUtils - */ - public void setDbUtils(DbUtils dbUtils) { - this.dbUtils = dbUtils; - } - - /** - * @return the userService - * @see #userService - */ - public IUserService getUserService() { - return userService; - } - - /** - * @param userService - * the userService to set - * @see #userService - */ - public void setUserService(IUserService userService) { - this.userService = userService; - } - - @Override - public LayoutView getLayoutByName(Model model, String name) { - if (model == null) { - return null; - } - Layout layout = layoutDao.getLayoutByName(model, name); - if (layout != null) { - return layoutViewFactory.create(layout); - } else { - return null; - } - } - - /** - * Sends notification email that layout was removed. - * - * @param projectId - * identifier of the project - * @param layoutName - * name of the layout - * @param email - * otification email - * @throws MessagingException - * thrown when there is a problem with sending email - */ - protected void sendSuccesfullRemoveEmail(String projectId, String layoutName, String email) throws MessagingException { - EmailSender emailSender = new EmailSender(configurationService); - StringBuilder content = new StringBuilder("Layout " + layoutName + " in map " + projectId + " was successfully removed.<br/>"); - emailSender.sendEmail("MapViewer notification", content.toString(), email); - } - - /** - * Sends notification email that layout was generated. - * - * @param params - * list of {@link CreateLayoutParams params} used for layout creation - * @param schemas - * set of schemas used in coloring - * @throws MessagingException - * thrown when there is a problem with sending email - */ - protected void sendSuccessfullGenerationEmail(final CreateLayoutParams params, final Collection<ColorSchema> schemas) throws MessagingException { - EmailSender emailSender = new EmailSender(configurationService); - StringBuilder content = new StringBuilder("Layout " + params.getName() + " generated successfully.\n"); - content.append("Result of coloring:<br/>"); - - String table = prepareTableResult(schemas, new ColorSchemaReader()); - content.append(table); - if (params.getUser() != null) { // send email to a user who owns the layout - emailSender.sendEmail("MapViewer notification", content.toString(), params.getUser()); - - // send email to the model owner - String email = params.getModel().getNotifyEmail(); - if (email != null && !email.equals(params.getUser().getEmail())) { - content = new StringBuilder(""); - String username = "UNKNOWN"; - if (params.getUser() != null) { - username = params.getUser().getLogin(); - } - content.append("User " + username + " created layout in " + params.getModel().getProject().getProjectId() + " map."); - - emailSender.sendEmail("MapViewer notification", content.toString(), email); - } - } else if (params.getModel().getNotifyEmail() != null) { - // if nobody owns the layout then send it to the model owner - emailSender.sendEmail("MapViewer notification", content.toString(), params.getModel().getNotifyEmail()); - } - } - - /** - * Prepares table with statistics about coloring. - * - * @param schemas - * schemas that were used for coloring - * @param scr - * interface that returns list of columns that should be printed - * @return table with statistics about coloring - */ - protected String prepareTableResult(Collection<ColorSchema> schemas, ColorSchemaReader scr) { - StringBuilder sb = new StringBuilder(""); - - Collection<ColorSchemaColumn> columns = scr.getSetColorSchemaColumns(schemas); - - for (ColorSchemaColumn column : ColorSchemaColumn.values()) { - if (columns.contains(column)) { - sb.append(column.getTitle() + "\t"); - } - } - sb.append("matches<br/>\n"); - - for (ColorSchema originalSchema : schemas) { - for (ColorSchema schema : splitColorSchema(originalSchema)) { - sb.append(prepareTableRow(columns, schema)); - } - } - - return sb.toString(); - } - - /** - * {@link ColorSchema} sometimes contains merged value from few rows. This - * method split single {@link ColorSchema} object to simple flat objects that - * can be serialiazed in a simple tab separated file. - * - * @param originalSchema - * original {@link ColorSchema} objcet that we want to spli into flat - * objects - * @return {@link List} of flat schema objects obtained from input - */ - private List<ColorSchema> splitColorSchema(ColorSchema originalSchema) { - List<ColorSchema> result = new ArrayList<>(); - if (originalSchema instanceof GenericColorSchema) { - result.add(originalSchema); - } else if (originalSchema instanceof GeneVariationColorSchema) { - for (GeneVariation gv : ((GeneVariationColorSchema) originalSchema).getGeneVariations()) { - GeneVariationColorSchema copy = (GeneVariationColorSchema) originalSchema.copy(); - copy.getGeneVariations().clear(); - copy.addGeneVariation(gv.copy()); - result.add(copy); - } - } else { - throw new InvalidArgumentException("Unknown class type: " + originalSchema.getClass()); - } - return result; - } - - /** - * Prepares tab separated {@link String} represenation of {@link ColorSchema}. - * - * @param columns - * columns that should be outputed in the result String - * @param schema - * input ColorSchema that is going to be transformed into String - * representation - * @return tab separated {@link String} represenation of {@link ColorSchema} - */ - protected String prepareTableRow(Collection<ColorSchemaColumn> columns, ColorSchema schema) { - StringBuilder sb = new StringBuilder(); - for (ColorSchemaColumn column : ColorSchemaColumn.values()) { - if (columns.contains(column)) { - if (schema instanceof GenericColorSchema) { - sb.append(prepareTableCellForGenericSchema((GenericColorSchema) schema, column)); - } else if (schema instanceof GeneVariationColorSchema) { - sb.append(prepareTableCellForGeneVariationSchema((GeneVariationColorSchema) schema, column)); - } else { - throw new InvalidArgumentException("Unknown schema type: " + schema.getClass()); - } - } - } - sb.append(schema.getMatches() + "<br/>\n"); - return sb.toString(); - } - - /** - * Returns String representing data of {@link GenericColorSchema} that should - * appear in a given {@link ColorSchemaColumn}. - * - * @param schema - * object for which data will be returned - * @param column - * column for which data should be returned - * @return {@link String} representing data of {@link GenericColorSchema} that - * should appear in a given {@link ColorSchemaColumn} - */ - protected String prepareTableCellForGenericSchema(GenericColorSchema schema, ColorSchemaColumn column) { - StringBuilder sb = new StringBuilder(); - if (column.equals(ColorSchemaColumn.COLOR)) { - if (schema.getColor() != null) { - sb.append("#" + Integer.toHexString(schema.getColor().getRGB()).substring(2).toUpperCase()); - } - sb.append("\t"); - } else if (column.equals(ColorSchemaColumn.NAME)) { - sb.append(schema.getName() + "\t"); - } else if (column.equals(ColorSchemaColumn.VALUE)) { - sb.append(schema.getValue() + "\t"); - } else if (column.equals(ColorSchemaColumn.COMPARTMENT)) { - for (String str : schema.getCompartments()) { - sb.append(str + ", "); - } - sb.append("\t"); - } else if (column.equals(ColorSchemaColumn.TYPE)) { - for (Class<? extends Species> str : schema.getTypes()) { - sb.append(str.getSimpleName() + ", "); - } - sb.append("\t"); - } else if (column.equals(ColorSchemaColumn.IDENTIFIER)) { - for (Pair<MiriamType, String> pair : schema.getIdentifierColumns()) { - if (pair.getRight() != null && !pair.getRight().trim().equals("")) { - sb.append(pair.getLeft().getCommonName() + ": " + pair.getRight() + ", "); - } - } - sb.append("\t"); - } else if (column.equals(ColorSchemaColumn.REACTION_IDENTIFIER)) { - sb.append(schema.getReactionIdentifier() + "\t"); - } else if (column.equals(ColorSchemaColumn.LINE_WIDTH)) { - sb.append(schema.getLineWidth() + "\t"); - } else if (column.equals(ColorSchemaColumn.REVERSE_REACTION)) { - sb.append(schema.getReverseReaction() + "\t"); - } else if (column.equals(ColorSchemaColumn.POSITION)) { - sb.append(schema.getReverseReaction() + "\t"); - } else if (column.equals(ColorSchemaColumn.DESCRIPTION)) { - sb.append(schema.getDescription() + "\t"); - } else { - throw new InvalidArgumentException("Unknown column type: " + column + " for schema type: " + schema.getClass()); - } - return sb.toString(); - } - - /** - * Returns String representing data of {@link GeneVariationColorSchema} that - * should appear in a given {@link ColorSchemaColumn}. - * - * @param schema - * object for which data will be returned - * @param column - * column for which data should be returned - * @return {@link String} representing data of - * {@link GeneVariationColorSchema} that should appear in a given - * {@link ColorSchemaColumn} - */ - protected String prepareTableCellForGeneVariationSchema(GeneVariationColorSchema schema, ColorSchemaColumn column) { - StringBuilder sb = new StringBuilder(); - if (column.equals(ColorSchemaColumn.COLOR)) { - if (schema.getColor() != null) { - sb.append("#" + Integer.toHexString(schema.getColor().getRGB()).substring(2).toUpperCase()); - } - sb.append("\t"); - } else if (column.equals(ColorSchemaColumn.NAME)) { - sb.append(schema.getName() + "\t"); - } else if (column.equals(ColorSchemaColumn.VALUE)) { - sb.append(schema.getValue() + "\t"); - } else if (column.equals(ColorSchemaColumn.COMPARTMENT)) { - for (String str : schema.getCompartments()) { - sb.append(str + ", "); - } - sb.append("\t"); - } else if (column.equals(ColorSchemaColumn.TYPE)) { - for (Class<? extends Species> str : schema.getTypes()) { - sb.append(str.getSimpleName() + ", "); - } - sb.append("\t"); - } else if (column.equals(ColorSchemaColumn.IDENTIFIER)) { - for (Pair<MiriamType, String> pair : schema.getIdentifierColumns()) { - if (pair.getRight() != null && !pair.getRight().trim().equals("")) { - sb.append(pair.getLeft().getCommonName() + ": " + pair.getRight() + ", "); - } - } - sb.append("\t"); - } else if (column.equals(ColorSchemaColumn.REACTION_IDENTIFIER)) { - sb.append(schema.getReactionIdentifier() + "\t"); - } else if (column.equals(ColorSchemaColumn.LINE_WIDTH)) { - sb.append(schema.getLineWidth() + "\t"); - } else if (column.equals(ColorSchemaColumn.REVERSE_REACTION)) { - sb.append(schema.getReverseReaction() + "\t"); - } else if (column.equals(ColorSchemaColumn.POSITION)) { - sb.append(schema.getGeneVariations().get(0).getPosition() + "\t"); - } else if (column.equals(ColorSchemaColumn.DESCRIPTION)) { - sb.append(schema.getDescription() + "\t"); - } else if (column.equals(ColorSchemaColumn.ORIGINAL_DNA)) { - sb.append(schema.getGeneVariations().get(0).getOriginalDna() + "\t"); - } else if (column.equals(ColorSchemaColumn.ALTERNATIVE_DNA)) { - sb.append(schema.getGeneVariations().get(0).getModifiedDna() + "\t"); - } else if (column.equals(ColorSchemaColumn.REFERENCE_GENOME_TYPE)) { - sb.append(schema.getGeneVariations().get(0).getReferenceGenomeType() + "\t"); - } else if (column.equals(ColorSchemaColumn.REFERENCE_GENOME_VERSION)) { - sb.append(schema.getGeneVariations().get(0).getReferenceGenomeVersion() + "\t"); - } else if (column.equals(ColorSchemaColumn.CONTIG)) { - sb.append(schema.getGeneVariations().get(0).getContig() + "\t"); - } else if (column.equals(ColorSchemaColumn.REFERENCES)) { - MiriamConnector mc = new MiriamConnector(); - for (MiriamData md : schema.getGeneVariations().get(0).getReferences()) { - sb.append(mc.miriamDataToUri(md) + "\t"); - } - } else { - throw new InvalidArgumentException("Unknown column type: " + column + " for schema type: " + schema.getClass()); - } - return sb.toString(); - } - - @Override - public byte[] getInputDataForLayout(LayoutView layoutView) { - return getInputDataForLayout(layoutView.getIdObject()); - } - - /** - * Returns byte array containing data from original input file that was used - * to generate the layout. - * - * @param layoutId - * identifier of layout for which we want to retrieve original file - * data - * @return original data file for given layout, if such file is not stored in - * database (compatibility reasons) then null is returned - */ - private byte[] getInputDataForLayout(int layoutId) { - Layout layout = layoutDao.getById(layoutId); - if (layout == null) { - return null; - } else { - if (layout.getInputData() != null) { - return layout.getInputData().getFileContent(); - } else { - return null; - } - } - } - - @Override - public List<LightLayoutAliasView> getAliasesForLayout(Model model, int layoutId) { - try { - ColorSchemaReader reader = new ColorSchemaReader(); - Collection<ColorSchema> schemas; - schemas = reader.readColorSchema(getInputDataForLayout(layoutId)); - ColorModelCommand command = new ColorModelCommand(model, schemas); - LightLayoutAliasViewFactory factory = new LightLayoutAliasViewFactory(); - List<LightLayoutAliasView> result = new ArrayList<>(); - for (Map.Entry<Object, ColorSchema> entry : command.getModifiedElements().entrySet()) { - if (entry.getKey() instanceof Alias) { - result.add(factory.create(new Pair<Alias, ColorSchema>((Alias) entry.getKey(), entry.getValue()))); - } - } - return result; - } catch (InvalidColorSchemaException e) { - throw new InvalidStateException(e); - } catch (IOException e) { - throw new InvalidStateException(e); - } - } - - @Override - public List<LightLayoutReactionView> getReactionsForLayout(Model model, int layoutId) { - try { - ColorSchemaReader reader = new ColorSchemaReader(); - Collection<ColorSchema> schemas; - schemas = reader.readColorSchema(getInputDataForLayout(layoutId)); - ColorModelCommand command = new ColorModelCommand(model, schemas); - LightLayoutReactionViewFactory factory = new LightLayoutReactionViewFactory(); - List<LightLayoutReactionView> result = new ArrayList<>(); - for (Map.Entry<Object, ColorSchema> entry : command.getModifiedElements().entrySet()) { - if (entry.getKey() instanceof Reaction) { - result.add(factory.create(new Pair<Reaction, ColorSchema>((Reaction) entry.getKey(), entry.getValue()))); - } - } - return result; - } catch (InvalidColorSchemaException e) { - throw new InvalidStateException(e); - } catch (IOException e) { - throw new InvalidStateException(e); - } - } - - @Override - public Map<Object, ColorSchema> getElementsForLayout(Model model, Integer layoutId) { - try { - ColorSchemaReader reader = new ColorSchemaReader(); - Collection<ColorSchema> schemas; - schemas = reader.readColorSchema(getInputDataForLayout(layoutId)); - ColorModelCommand command = new ColorModelCommand(model, schemas); - return command.getModifiedElements(); - } catch (InvalidColorSchemaException e) { - throw new InvalidStateException(e); - } catch (IOException e) { - throw new InvalidStateException(e); - } - } - - @Override - public List<FullLayoutAliasView> getFullAliasesForLayoutByIds(Model model, List<Pair<Integer, Integer>> identifiers, int layoutId) { - try { - Set<Integer> ids = new HashSet<>(); - for (Pair<Integer, Integer> pair : identifiers) { - ids.add(pair.getRight()); - } - - ColorSchemaReader reader = new ColorSchemaReader(); - Collection<ColorSchema> schemas; - schemas = reader.readColorSchema(getInputDataForLayout(layoutId)); - ColorModelCommand command = new ColorModelCommand(model, schemas); - FullLayoutAliasViewFactory factory = new FullLayoutAliasViewFactory(); - List<FullLayoutAliasView> result = new ArrayList<>(); - - // TODO poor performance, improve it - for (Map.Entry<Object, ColorSchema> entry : command.getModifiedElements().entrySet()) { - if (entry.getKey() instanceof Alias) { - Alias alias = (Alias) entry.getKey(); - if (ids.contains(alias.getId())) { - result.add(factory.create(new Pair<Alias, ColorSchema>(alias, entry.getValue()))); - } - } - } - return result; - } catch (InvalidColorSchemaException e) { - throw new InvalidStateException(e); - } catch (IOException e) { - throw new InvalidStateException(e); - } - } -} +package lcsb.mapviewer.services.impl; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.mail.MessagingException; + +import org.apache.commons.io.IOUtils; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +import lcsb.mapviewer.annotation.services.MiriamConnector; +import lcsb.mapviewer.commands.ColorModelCommand; +import lcsb.mapviewer.commands.CommandExecutionException; +import lcsb.mapviewer.commands.CopyCommand; +import lcsb.mapviewer.common.IProgressUpdater; +import lcsb.mapviewer.common.Pair; +import lcsb.mapviewer.common.TextFileUtils; +import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.common.exception.InvalidStateException; +import lcsb.mapviewer.converter.graphics.MapGenerator; +import lcsb.mapviewer.converter.graphics.MapGenerator.MapGeneratorParams; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; +import lcsb.mapviewer.model.Project; +import lcsb.mapviewer.model.cache.UploadedFileEntry; +import lcsb.mapviewer.model.log.LogType; +import lcsb.mapviewer.model.map.MiriamData; +import lcsb.mapviewer.model.map.MiriamType; +import lcsb.mapviewer.model.map.layout.ColorSchema; +import lcsb.mapviewer.model.map.layout.GeneVariation; +import lcsb.mapviewer.model.map.layout.GeneVariationColorSchema; +import lcsb.mapviewer.model.map.layout.GenericColorSchema; +import lcsb.mapviewer.model.map.layout.InvalidColorSchemaException; +import lcsb.mapviewer.model.map.layout.Layout; +import lcsb.mapviewer.model.map.layout.LayoutStatus; +import lcsb.mapviewer.model.map.layout.alias.Alias; +import lcsb.mapviewer.model.map.model.Model; +import lcsb.mapviewer.model.map.model.ModelSubmodelConnection; +import lcsb.mapviewer.model.map.reaction.Reaction; +import lcsb.mapviewer.model.user.ObjectPrivilege; +import lcsb.mapviewer.model.user.PrivilegeType; +import lcsb.mapviewer.model.user.User; +import lcsb.mapviewer.persist.DbUtils; +import lcsb.mapviewer.persist.dao.map.LayoutDao; +import lcsb.mapviewer.services.interfaces.IConfigurationService; +import lcsb.mapviewer.services.interfaces.ILayoutService; +import lcsb.mapviewer.services.interfaces.ILogService; +import lcsb.mapviewer.services.interfaces.ILogService.LogParams; +import lcsb.mapviewer.services.interfaces.IUserService; +import lcsb.mapviewer.services.search.layout.FullLayoutAliasView; +import lcsb.mapviewer.services.search.layout.FullLayoutAliasViewFactory; +import lcsb.mapviewer.services.search.layout.LightLayoutAliasView; +import lcsb.mapviewer.services.search.layout.LightLayoutAliasViewFactory; +import lcsb.mapviewer.services.search.layout.LightLayoutReactionView; +import lcsb.mapviewer.services.search.layout.LightLayoutReactionViewFactory; +import lcsb.mapviewer.services.utils.ColorSchemaReader; +import lcsb.mapviewer.services.utils.EmailSender; +import lcsb.mapviewer.services.utils.data.ColorSchemaColumn; +import lcsb.mapviewer.services.view.LayoutView; +import lcsb.mapviewer.services.view.LayoutViewFactory; + +/** + * Implementation of the layout service. + * + * @author Piotr Gawron + * + */ +@Transactional(value = "txManager") +public class LayoutService implements ILayoutService { + + /** + * Default class logger. + */ + private Logger logger = Logger.getLogger(LayoutService.class); + + /** + * Layout data access object. + */ + @Autowired + private LayoutDao layoutDao; + + /** + * Factory object used for creation of {@link LayoutView} elements. + */ + @Autowired + private LayoutViewFactory layoutViewFactory; + + /** + * Service that manages and gives access to user information. + */ + @Autowired + private IUserService userService; + + /** + * Service used to access logs. + * + * @see ILogService + */ + @Autowired + private ILogService logService; + + /** + * Service that manages and gives access to configuration parameters. + */ + @Autowired + private IConfigurationService configurationService; + + /** + * Utils that help to manage the sessions in custom multithreaded + * implementation. + */ + @Autowired + private DbUtils dbUtils; + + @Override + public boolean userCanAddLayout(Model model, User user) { + // if we don't have privileges to view the object then we cannot add layouts + if (!userService.userHasPrivilege(user, PrivilegeType.VIEW_PROJECT, model.getProject())) { + return false; + } + long count = getAvailableCustomLayoutsNumber(user); + return count > 0; + } + + @Override + public long getAvailableCustomLayoutsNumber(User user) { + long level = userService.getUserPrivilegeLevel(user, PrivilegeType.CUSTOM_LAYOUTS); + long layouts = layoutDao.getCountByUser(user); + return level - layouts; + + } + + @Override + public boolean userCanRemoveLayout(LayoutView layout, User user) { + Layout originalLayout = layoutDao.getById(layout.getIdObject()); + User creator = originalLayout.getCreator(); + Project project = originalLayout.getModel().getProject(); + if (creator == null) { + return userService.userHasPrivilege(user, PrivilegeType.LAYOUT_MANAGEMENT, project); + } else { + return creator.getId().equals(user.getId()) || userService.userHasPrivilege(user, PrivilegeType.LAYOUT_MANAGEMENT, project); + } + } + + @Override + public List<LayoutView> getCustomLayouts(Model model, User user) { + List<LayoutView> result = new ArrayList<LayoutView>(); + if (model == null || user == null) { + return result; + } + List<Layout> layouts = layoutDao.getLayoutsByModel(model); + for (Layout layout : layouts) { + if (!layout.isPublicLayout() && layout.getCreator() != null) { + if (layout.getCreator().getLogin().equals(user.getLogin())) { + result.add(layoutViewFactory.create(layout)); + } else if (userService.userHasPrivilege(user, PrivilegeType.LAYOUT_VIEW, layout)) { + result.add(layoutViewFactory.create(layout)); + } + } + } + Collections.sort(result, LayoutView.ID_COMPARATOR); + return result; + } + + @Override + public List<LayoutView> getGeneralLayouts(Model model) { + List<LayoutView> result = new ArrayList<LayoutView>(); + if (model == null) { + return result; + } + List<Layout> layouts = layoutDao.getLayoutsByModel(model); + for (Layout layout : layouts) { + if (layout.isPublicLayout()) { + result.add(layoutViewFactory.create(layout)); + } + } + Collections.sort(result, LayoutView.ID_COMPARATOR); + return result; + } + + @Override + public void removeLayout(LayoutView layout, final String homeDir) throws IOException { + final String dir; + final Layout dbLayout = layoutDao.getById(layout.getIdObject()); + if (homeDir != null) { + if (dbLayout.getModel().getProject().getDirectory() != null) { + dir = homeDir + "/../map_images/" + dbLayout.getModel().getProject().getDirectory() + "/"; + } else { + dir = homeDir + "/../map_images/"; + } + } else { + dir = null; + } + + String projectId = dbLayout.getModel().getProject().getProjectId(); + String email = null; + User user = dbLayout.getCreator(); + if (user != null) { + email = user.getEmail(); + } + + dbLayout.getModel().removeLayout(dbLayout); + layoutDao.delete(dbLayout); + + LogParams params = new LogParams().object(dbLayout).type(LogType.LAYOUT_REMOVED); + logService.log(params); + + if (email != null) { + try { + sendSuccesfullRemoveEmail(projectId, layout.getName(), email); + } catch (MessagingException e) { + logger.error(e); + } + } + Thread computations = new Thread(new Runnable() { + @Override + public void run() { + MapGenerator generator = new MapGenerator(); + try { + generator.removeLayout(dbLayout, dir); + } catch (IOException e) { + logger.error(e); + } + + } + }); + computations.start(); + } + + @Override + public void updateLayout(LayoutView layout) { + Layout dbLayout = layoutDao.getById(layout.getIdObject()); + dbLayout.setTitle(layout.getName()); + dbLayout.setDescription(layout.getDescription()); + if (layout.getCreator().isEmpty()) { + dbLayout.setCreator(null); + dbLayout.setPublicLayout(true); + } else { + User user = userService.getUserByNameSurname(layout.getCreator()); + dbLayout.setCreator(user); + dbLayout.setPublicLayout(false); + } + + layoutDao.update(dbLayout); + } + + @Override + public void addViewPrivilegeToLayout(LayoutView layout, User user) { + ObjectPrivilege privilege = new ObjectPrivilege(); + privilege.setIdObject(layout.getIdObject()); + privilege.setLevel(1); + privilege.setType(PrivilegeType.LAYOUT_VIEW); + privilege.setUser(user); + userService.setUserPrivilege(user, privilege); + } + + @Override + public void dropViewPrivilegeFromLayout(LayoutView layout, User user) { + ObjectPrivilege privilege = new ObjectPrivilege(); + privilege.setIdObject(layout.getIdObject()); + privilege.setLevel(0); + privilege.setType(PrivilegeType.LAYOUT_VIEW); + privilege.setUser(user); + userService.setUserPrivilege(user, privilege); + } + + @Override + public LayoutView createLayoutWithImages(final CreateLayoutParams params) throws IOException, InvalidColorSchemaException, CommandExecutionException { + ColorSchemaReader reader = new ColorSchemaReader(); + final Collection<ColorSchema> schemas = reader + .readColorSchema(params.getColorInputStream(), TextFileUtils.getHeaderParametersFromFile(params.getColorInputStream())); + final Model colorModel = new CopyCommand(params.getModel()).execute(); + new ColorModelCommand(params.getModel(), schemas).execute(); + final EmailSender sender = new EmailSender(configurationService); + String[] tmp = params.getDirectory().split("[\\\\/]"); + String simpleDir = tmp[tmp.length - 1]; + + layoutDao.flush(); + + boolean customSession = false; + if (params.isAsync()) { + customSession = !dbUtils.isCustomSessionForCurrentThread(); + if (customSession) { + dbUtils.createSessionForCurrentThread(); + } + } + final Map<Model, Integer> layoutIdByModel = new HashMap<Model, Integer>(); + + Layout topLayout = new Layout(params.getName(), simpleDir, false); + if (params.getUser() == null) { + topLayout.setPublicLayout(true); + } else { + topLayout.setPublicLayout(false); + } + topLayout.setStatus(LayoutStatus.NA); + topLayout.setProgress(0.0); + UploadedFileEntry fileEntry = new UploadedFileEntry(); + fileEntry.setFileContent(IOUtils.toByteArray(params.getColorInputStream())); + fileEntry.setOriginalFileName(params.getLayoutFileName()); + topLayout.setInputData(fileEntry); + topLayout.setDescription(params.getDescription()); + params.getModel().addLayout(topLayout); + topLayout.setCreator(params.getUser()); + layoutDao.add(topLayout); + topLayout.setDirectory(simpleDir + topLayout.getId()); + + layoutDao.update(topLayout); + + layoutIdByModel.put(colorModel, topLayout.getId()); + + for (ModelSubmodelConnection connection : params.getModel().getSubmodelConnections()) { + Layout layout = new Layout(params.getName(), simpleDir, false); + layout.setStatus(LayoutStatus.NA); + layout.setProgress(0.0); + connection.getSubmodel().getModel().addLayout(layout); + layout.setCreator(params.getUser()); + layout.setPublicLayout(false); + topLayout.addLayout(layout); + layoutDao.add(layout); + layout.setDirectory(simpleDir + layout.getId()); + + layoutDao.update(layout); + + layoutIdByModel.put(colorModel.getSubmodelByConnectionName(connection.getName()), layout.getId()); + } + + if (params.isAsync()) { + if (customSession) { + dbUtils.closeSessionForCurrentThread(); + } else { + layoutDao.commit(); + } + } + final int layoutId = layoutIdByModel.get(colorModel); + + Thread computations = new Thread(new Runnable() { + @Override + public void run() { + if (params.isAsync()) { + // open transaction for this thread + dbUtils.createSessionForCurrentThread(); + } + + try { + MapGenerator generator = new MapGenerator(); + final int models = layoutIdByModel.entrySet().size(); + + int count = 0; + for (Model m : layoutIdByModel.keySet()) { + final int counted = count; + int id = layoutIdByModel.get(m); + MapGeneratorParams imgParams = generator.new MapGeneratorParams().model(m).directory(params.getDirectory() + id).updater(new IProgressUpdater() { + private int lastProgress = -1; + + @Override + public void setProgress(double progress) { + progress = progress / ((double) models) + ((double) counted * MAX_PROGRESS) / ((double) models); + if (((int) progress) != lastProgress) { + Layout layout = layoutDao.getById(layoutId); + lastProgress = (int) progress; + layout.setProgress(progress); + layout.setStatus(LayoutStatus.GENERATING); + layoutDao.update(layout); + if (params.isAsync()) { + layoutDao.commit(); + } + } + } + }); + generator.generateMapImages(imgParams); + count++; + } + Layout layout = layoutDao.getById(layoutId); + layout.setProgress(IProgressUpdater.MAX_PROGRESS); + layout.setStatus(LayoutStatus.OK); + layoutDao.update(layout); + if (params.isAsync()) { + layoutDao.commit(); + } + + try { + sendSuccessfullGenerationEmail(params, schemas); + } catch (MessagingException e) { + logger.error("Problem with sending email", e); + } + logService.log(new LogParams().object(layout).description("Created successfully.").type(LogType.LAYOUT_CREATED)); + } catch (Exception e) { + logger.error("Problem with creating layout", e); + + Layout layout = layoutDao.getById(layoutId); + layout.setProgress(IProgressUpdater.MAX_PROGRESS); + layout.setStatus(LayoutStatus.FAILURE); + layoutDao.update(layout); + + try { + sender.sendEmail( + "MapViewer status", "There was a problem with generating layout " + params.getName() + ". Contact administrator to solve this issue.", + params.getUser()); + } catch (MessagingException e1) { + logger.error("Problem with sending email", e1); + } + logService.log(new LogParams().object(layout).description("Problem during creation.").type(LogType.LAYOUT_CREATED)); + } + if (params.isAsync()) { + // close the transaction for this thread + dbUtils.closeSessionForCurrentThread(); + } + } + }); + + if (params.isAsync()) { + computations.start(); + } else { + computations.run(); + } + return layoutViewFactory.create(topLayout); + } + + @Override + public LayoutView createLayout(final CreateLayoutParams params) throws IOException, InvalidColorSchemaException { + ColorSchemaReader reader = new ColorSchemaReader(); + final Collection<ColorSchema> schemas = reader + .readColorSchema(params.getColorInputStream(), TextFileUtils.getHeaderParametersFromFile(params.getColorInputStream())); + + // check if we can color our model using this schema, + // if not then exception will be thrown and passed up + try { + new ColorModelCommand(params.getModel(), schemas).execute(); + } catch (CommandExecutionException e) { + throw new InvalidColorSchemaException(e); + } + + String[] tmp = params.getDirectory().split("[\\\\/]"); + String simpleDir = tmp[tmp.length - 1]; + + layoutDao.flush(); + + boolean customSession = false; + + if (params.isAsync()) { + customSession = !dbUtils.isCustomSessionForCurrentThread(); + if (customSession) { + dbUtils.createSessionForCurrentThread(); + } + } + + Layout topLayout = new Layout(params.getName(), simpleDir, false); + if (params.getUser() == null) { + topLayout.setPublicLayout(true); + } else { + topLayout.setPublicLayout(false); + } + topLayout.setStatus(LayoutStatus.OK); + topLayout.setProgress(0.0); + UploadedFileEntry fileEntry = new UploadedFileEntry(); + fileEntry.setFileContent(IOUtils.toByteArray(params.getColorInputStream())); + fileEntry.setOriginalFileName(params.getLayoutFileName()); + topLayout.setInputData(fileEntry); + topLayout.setDescription(params.getDescription()); + params.getModel().addLayout(topLayout); + topLayout.setCreator(params.getUser()); + layoutDao.add(topLayout); + topLayout.setDirectory(simpleDir + topLayout.getId()); + + layoutDao.update(topLayout); + + for (ModelSubmodelConnection connection : params.getModel().getSubmodelConnections()) { + Layout layout = new Layout(params.getName(), simpleDir, false); + layout.setStatus(LayoutStatus.OK); + layout.setProgress(0.0); + connection.getSubmodel().getModel().addLayout(layout); + layout.setCreator(params.getUser()); + layout.setPublicLayout(false); + topLayout.addLayout(layout); + layoutDao.add(layout); + layout.setDirectory(simpleDir + layout.getId()); + + layoutDao.update(layout); + } + + if (params.isAsync()) { + if (customSession) { + dbUtils.closeSessionForCurrentThread(); + } else { + layoutDao.commit(); + } + } + Thread computations = new Thread(new Runnable() { + @Override + public void run() { + if (params.isAsync()) { + // open transaction for this thread + dbUtils.createSessionForCurrentThread(); + } + + try { + sendSuccessfullGenerationEmail(params, schemas); + } catch (MessagingException e) { + logger.error("Problem with sending email", e); + } + + if (params.isAsync()) { + // close the transaction for this thread + dbUtils.closeSessionForCurrentThread(); + } + } + }); + + LogParams logParams = new LogParams().object(topLayout).description("Created successfully.").type(LogType.LAYOUT_CREATED); + logService.log(logParams); + + if (params.isAsync()) { + computations.start(); + } else { + computations.run(); + } + return layoutViewFactory.create(topLayout); + } + + /** + * @return the configurationService + * @see #configurationService + */ + public IConfigurationService getConfigurationService() { + return configurationService; + } + + /** + * @param configurationService + * the configurationService to set + * @see #configurationService + */ + public void setConfigurationService(IConfigurationService configurationService) { + this.configurationService = configurationService; + } + + /** + * @return the dbUtils + * @see #dbUtils + */ + public DbUtils getDbUtils() { + return dbUtils; + } + + /** + * @param dbUtils + * the dbUtils to set + * @see #dbUtils + */ + public void setDbUtils(DbUtils dbUtils) { + this.dbUtils = dbUtils; + } + + /** + * @return the userService + * @see #userService + */ + public IUserService getUserService() { + return userService; + } + + /** + * @param userService + * the userService to set + * @see #userService + */ + public void setUserService(IUserService userService) { + this.userService = userService; + } + + @Override + public LayoutView getLayoutByName(Model model, String name) { + if (model == null) { + return null; + } + Layout layout = layoutDao.getLayoutByName(model, name); + if (layout != null) { + return layoutViewFactory.create(layout); + } else { + return null; + } + } + + /** + * Sends notification email that layout was removed. + * + * @param projectId + * identifier of the project + * @param layoutName + * name of the layout + * @param email + * otification email + * @throws MessagingException + * thrown when there is a problem with sending email + */ + protected void sendSuccesfullRemoveEmail(String projectId, String layoutName, String email) throws MessagingException { + EmailSender emailSender = new EmailSender(configurationService); + StringBuilder content = new StringBuilder("Layout " + layoutName + " in map " + projectId + " was successfully removed.<br/>"); + emailSender.sendEmail("MapViewer notification", content.toString(), email); + } + + /** + * Sends notification email that layout was generated. + * + * @param params + * list of {@link CreateLayoutParams params} used for layout creation + * @param schemas + * set of schemas used in coloring + * @throws MessagingException + * thrown when there is a problem with sending email + */ + protected void sendSuccessfullGenerationEmail(final CreateLayoutParams params, final Collection<ColorSchema> schemas) throws MessagingException { + EmailSender emailSender = new EmailSender(configurationService); + StringBuilder content = new StringBuilder("Layout " + params.getName() + " generated successfully.\n"); + content.append("Result of coloring:<br/>"); + + String table = prepareTableResult(schemas, new ColorSchemaReader()); + content.append(table); + if (params.getUser() != null) { // send email to a user who owns the layout + emailSender.sendEmail("MapViewer notification", content.toString(), params.getUser()); + + // send email to the model owner + String email = params.getModel().getNotifyEmail(); + if (email != null && !email.equals(params.getUser().getEmail())) { + content = new StringBuilder(""); + String username = "UNKNOWN"; + if (params.getUser() != null) { + username = params.getUser().getLogin(); + } + content.append("User " + username + " created layout in " + params.getModel().getProject().getProjectId() + " map."); + + emailSender.sendEmail("MapViewer notification", content.toString(), email); + } + } else if (params.getModel().getNotifyEmail() != null) { + // if nobody owns the layout then send it to the model owner + emailSender.sendEmail("MapViewer notification", content.toString(), params.getModel().getNotifyEmail()); + } + } + + /** + * Prepares table with statistics about coloring. + * + * @param schemas + * schemas that were used for coloring + * @param scr + * interface that returns list of columns that should be printed + * @return table with statistics about coloring + */ + protected String prepareTableResult(Collection<ColorSchema> schemas, ColorSchemaReader scr) { + StringBuilder sb = new StringBuilder(""); + + Collection<ColorSchemaColumn> columns = scr.getSetColorSchemaColumns(schemas); + + for (ColorSchemaColumn column : ColorSchemaColumn.values()) { + if (columns.contains(column)) { + sb.append(column.getTitle() + "\t"); + } + } + sb.append("matches<br/>\n"); + + for (ColorSchema originalSchema : schemas) { + for (ColorSchema schema : splitColorSchema(originalSchema)) { + sb.append(prepareTableRow(columns, schema)); + } + } + + return sb.toString(); + } + + /** + * {@link ColorSchema} sometimes contains merged value from few rows. This + * method split single {@link ColorSchema} object to simple flat objects that + * can be serialiazed in a simple tab separated file. + * + * @param originalSchema + * original {@link ColorSchema} objcet that we want to spli into flat + * objects + * @return {@link List} of flat schema objects obtained from input + */ + private List<ColorSchema> splitColorSchema(ColorSchema originalSchema) { + List<ColorSchema> result = new ArrayList<>(); + if (originalSchema instanceof GenericColorSchema) { + result.add(originalSchema); + } else if (originalSchema instanceof GeneVariationColorSchema) { + for (GeneVariation gv : ((GeneVariationColorSchema) originalSchema).getGeneVariations()) { + GeneVariationColorSchema copy = (GeneVariationColorSchema) originalSchema.copy(); + copy.getGeneVariations().clear(); + copy.addGeneVariation(gv.copy()); + result.add(copy); + } + } else { + throw new InvalidArgumentException("Unknown class type: " + originalSchema.getClass()); + } + return result; + } + + /** + * Prepares tab separated {@link String} represenation of {@link ColorSchema}. + * + * @param columns + * columns that should be outputed in the result String + * @param schema + * input ColorSchema that is going to be transformed into String + * representation + * @return tab separated {@link String} represenation of {@link ColorSchema} + */ + protected String prepareTableRow(Collection<ColorSchemaColumn> columns, ColorSchema schema) { + StringBuilder sb = new StringBuilder(); + for (ColorSchemaColumn column : ColorSchemaColumn.values()) { + if (columns.contains(column)) { + if (schema instanceof GenericColorSchema) { + sb.append(prepareTableCellForGenericSchema((GenericColorSchema) schema, column)); + } else if (schema instanceof GeneVariationColorSchema) { + sb.append(prepareTableCellForGeneVariationSchema((GeneVariationColorSchema) schema, column)); + } else { + throw new InvalidArgumentException("Unknown schema type: " + schema.getClass()); + } + } + } + sb.append(schema.getMatches() + "<br/>\n"); + return sb.toString(); + } + + /** + * Returns String representing data of {@link GenericColorSchema} that should + * appear in a given {@link ColorSchemaColumn}. + * + * @param schema + * object for which data will be returned + * @param column + * column for which data should be returned + * @return {@link String} representing data of {@link GenericColorSchema} that + * should appear in a given {@link ColorSchemaColumn} + */ + protected String prepareTableCellForGenericSchema(GenericColorSchema schema, ColorSchemaColumn column) { + StringBuilder sb = new StringBuilder(); + if (column.equals(ColorSchemaColumn.COLOR)) { + if (schema.getColor() != null) { + sb.append("#" + Integer.toHexString(schema.getColor().getRGB()).substring(2).toUpperCase()); + } + sb.append("\t"); + } else if (column.equals(ColorSchemaColumn.NAME)) { + sb.append(schema.getName() + "\t"); + } else if (column.equals(ColorSchemaColumn.VALUE)) { + sb.append(schema.getValue() + "\t"); + } else if (column.equals(ColorSchemaColumn.COMPARTMENT)) { + for (String str : schema.getCompartments()) { + sb.append(str + ", "); + } + sb.append("\t"); + } else if (column.equals(ColorSchemaColumn.TYPE)) { + for (Class<? extends Species> str : schema.getTypes()) { + sb.append(str.getSimpleName() + ", "); + } + sb.append("\t"); + } else if (column.equals(ColorSchemaColumn.IDENTIFIER)) { + for (Pair<MiriamType, String> pair : schema.getIdentifierColumns()) { + if (pair.getRight() != null && !pair.getRight().trim().equals("")) { + sb.append(pair.getLeft().getCommonName() + ": " + pair.getRight() + ", "); + } + } + sb.append("\t"); + } else if (column.equals(ColorSchemaColumn.REACTION_IDENTIFIER)) { + sb.append(schema.getReactionIdentifier() + "\t"); + } else if (column.equals(ColorSchemaColumn.LINE_WIDTH)) { + sb.append(schema.getLineWidth() + "\t"); + } else if (column.equals(ColorSchemaColumn.REVERSE_REACTION)) { + sb.append(schema.getReverseReaction() + "\t"); + } else if (column.equals(ColorSchemaColumn.POSITION)) { + sb.append(schema.getReverseReaction() + "\t"); + } else if (column.equals(ColorSchemaColumn.DESCRIPTION)) { + sb.append(schema.getDescription() + "\t"); + } else { + throw new InvalidArgumentException("Unknown column type: " + column + " for schema type: " + schema.getClass()); + } + return sb.toString(); + } + + /** + * Returns String representing data of {@link GeneVariationColorSchema} that + * should appear in a given {@link ColorSchemaColumn}. + * + * @param schema + * object for which data will be returned + * @param column + * column for which data should be returned + * @return {@link String} representing data of + * {@link GeneVariationColorSchema} that should appear in a given + * {@link ColorSchemaColumn} + */ + protected String prepareTableCellForGeneVariationSchema(GeneVariationColorSchema schema, ColorSchemaColumn column) { + StringBuilder sb = new StringBuilder(); + if (column.equals(ColorSchemaColumn.COLOR)) { + if (schema.getColor() != null) { + sb.append("#" + Integer.toHexString(schema.getColor().getRGB()).substring(2).toUpperCase()); + } + sb.append("\t"); + } else if (column.equals(ColorSchemaColumn.NAME)) { + sb.append(schema.getName() + "\t"); + } else if (column.equals(ColorSchemaColumn.VALUE)) { + sb.append(schema.getValue() + "\t"); + } else if (column.equals(ColorSchemaColumn.COMPARTMENT)) { + for (String str : schema.getCompartments()) { + sb.append(str + ", "); + } + sb.append("\t"); + } else if (column.equals(ColorSchemaColumn.TYPE)) { + for (Class<? extends Species> str : schema.getTypes()) { + sb.append(str.getSimpleName() + ", "); + } + sb.append("\t"); + } else if (column.equals(ColorSchemaColumn.IDENTIFIER)) { + for (Pair<MiriamType, String> pair : schema.getIdentifierColumns()) { + if (pair.getRight() != null && !pair.getRight().trim().equals("")) { + sb.append(pair.getLeft().getCommonName() + ": " + pair.getRight() + ", "); + } + } + sb.append("\t"); + } else if (column.equals(ColorSchemaColumn.REACTION_IDENTIFIER)) { + sb.append(schema.getReactionIdentifier() + "\t"); + } else if (column.equals(ColorSchemaColumn.LINE_WIDTH)) { + sb.append(schema.getLineWidth() + "\t"); + } else if (column.equals(ColorSchemaColumn.REVERSE_REACTION)) { + sb.append(schema.getReverseReaction() + "\t"); + } else if (column.equals(ColorSchemaColumn.POSITION)) { + sb.append(schema.getGeneVariations().get(0).getPosition() + "\t"); + } else if (column.equals(ColorSchemaColumn.DESCRIPTION)) { + sb.append(schema.getDescription() + "\t"); + } else if (column.equals(ColorSchemaColumn.ORIGINAL_DNA)) { + sb.append(schema.getGeneVariations().get(0).getOriginalDna() + "\t"); + } else if (column.equals(ColorSchemaColumn.ALTERNATIVE_DNA)) { + sb.append(schema.getGeneVariations().get(0).getModifiedDna() + "\t"); + } else if (column.equals(ColorSchemaColumn.REFERENCE_GENOME_TYPE)) { + sb.append(schema.getGeneVariations().get(0).getReferenceGenomeType() + "\t"); + } else if (column.equals(ColorSchemaColumn.REFERENCE_GENOME_VERSION)) { + sb.append(schema.getGeneVariations().get(0).getReferenceGenomeVersion() + "\t"); + } else if (column.equals(ColorSchemaColumn.CONTIG)) { + sb.append(schema.getGeneVariations().get(0).getContig() + "\t"); + } else if (column.equals(ColorSchemaColumn.REFERENCES)) { + MiriamConnector mc = new MiriamConnector(); + for (MiriamData md : schema.getGeneVariations().get(0).getReferences()) { + sb.append(mc.miriamDataToUri(md) + "\t"); + } + } else { + throw new InvalidArgumentException("Unknown column type: " + column + " for schema type: " + schema.getClass()); + } + return sb.toString(); + } + + @Override + public byte[] getInputDataForLayout(LayoutView layoutView) { + return getInputDataForLayout(layoutView.getIdObject()); + } + + /** + * Returns byte array containing data from original input file that was used + * to generate the layout. + * + * @param layoutId + * identifier of layout for which we want to retrieve original file + * data + * @return original data file for given layout, if such file is not stored in + * database (compatibility reasons) then null is returned + */ + private byte[] getInputDataForLayout(int layoutId) { + Layout layout = layoutDao.getById(layoutId); + if (layout == null) { + return null; + } else { + if (layout.getInputData() != null) { + return layout.getInputData().getFileContent(); + } else { + return null; + } + } + } + + @Override + public List<LightLayoutAliasView> getAliasesForLayout(Model model, int layoutId) { + try { + ColorSchemaReader reader = new ColorSchemaReader(); + Collection<ColorSchema> schemas; + schemas = reader.readColorSchema(getInputDataForLayout(layoutId)); + ColorModelCommand command = new ColorModelCommand(model, schemas); + LightLayoutAliasViewFactory factory = new LightLayoutAliasViewFactory(); + List<LightLayoutAliasView> result = new ArrayList<>(); + for (Map.Entry<Object, ColorSchema> entry : command.getModifiedElements().entrySet()) { + if (entry.getKey() instanceof Alias) { + result.add(factory.create(new Pair<Alias, ColorSchema>((Alias) entry.getKey(), entry.getValue()))); + } + } + return result; + } catch (InvalidColorSchemaException e) { + throw new InvalidStateException(e); + } catch (IOException e) { + throw new InvalidStateException(e); + } + } + + @Override + public List<LightLayoutReactionView> getReactionsForLayout(Model model, int layoutId) { + try { + ColorSchemaReader reader = new ColorSchemaReader(); + Collection<ColorSchema> schemas; + schemas = reader.readColorSchema(getInputDataForLayout(layoutId)); + ColorModelCommand command = new ColorModelCommand(model, schemas); + LightLayoutReactionViewFactory factory = new LightLayoutReactionViewFactory(); + List<LightLayoutReactionView> result = new ArrayList<>(); + for (Map.Entry<Object, ColorSchema> entry : command.getModifiedElements().entrySet()) { + if (entry.getKey() instanceof Reaction) { + result.add(factory.create(new Pair<Reaction, ColorSchema>((Reaction) entry.getKey(), entry.getValue()))); + } + } + return result; + } catch (InvalidColorSchemaException e) { + throw new InvalidStateException(e); + } catch (IOException e) { + throw new InvalidStateException(e); + } + } + + @Override + public Map<Object, ColorSchema> getElementsForLayout(Model model, Integer layoutId) { + try { + ColorSchemaReader reader = new ColorSchemaReader(); + Collection<ColorSchema> schemas; + schemas = reader.readColorSchema(getInputDataForLayout(layoutId)); + ColorModelCommand command = new ColorModelCommand(model, schemas); + return command.getModifiedElements(); + } catch (InvalidColorSchemaException e) { + throw new InvalidStateException(e); + } catch (IOException e) { + throw new InvalidStateException(e); + } + } + + @Override + public List<FullLayoutAliasView> getFullAliasesForLayoutByIds(Model model, List<Pair<Integer, Integer>> identifiers, int layoutId) { + try { + Set<Integer> ids = new HashSet<>(); + for (Pair<Integer, Integer> pair : identifiers) { + ids.add(pair.getRight()); + } + + ColorSchemaReader reader = new ColorSchemaReader(); + Collection<ColorSchema> schemas; + schemas = reader.readColorSchema(getInputDataForLayout(layoutId)); + ColorModelCommand command = new ColorModelCommand(model, schemas); + FullLayoutAliasViewFactory factory = new FullLayoutAliasViewFactory(); + List<FullLayoutAliasView> result = new ArrayList<>(); + + // TODO poor performance, improve it + for (Map.Entry<Object, ColorSchema> entry : command.getModifiedElements().entrySet()) { + if (entry.getKey() instanceof Alias) { + Alias alias = (Alias) entry.getKey(); + if (ids.contains(alias.getId())) { + result.add(factory.create(new Pair<Alias, ColorSchema>(alias, entry.getValue()))); + } + } + } + return result; + } catch (InvalidColorSchemaException e) { + throw new InvalidStateException(e); + } catch (IOException e) { + throw new InvalidStateException(e); + } + } +} diff --git a/service/src/main/java/lcsb/mapviewer/services/impl/ModelService.java b/service/src/main/java/lcsb/mapviewer/services/impl/ModelService.java index 28375a5c04c7d9b3de1188d10d197a16a1a2812e..6a1d8e58d520f335e5854141a2fdccbec5db80ed 100644 --- a/service/src/main/java/lcsb/mapviewer/services/impl/ModelService.java +++ b/service/src/main/java/lcsb/mapviewer/services/impl/ModelService.java @@ -23,7 +23,8 @@ import lcsb.mapviewer.commands.CopyCommand; import lcsb.mapviewer.common.IProgressUpdater; import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.Layout; @@ -32,7 +33,6 @@ import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelData; import lcsb.mapviewer.model.map.model.ModelFullIndexed; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.Species; import lcsb.mapviewer.model.user.User; import lcsb.mapviewer.persist.dao.map.ModelDao; import lcsb.mapviewer.services.interfaces.ILayoutService; diff --git a/service/src/main/java/lcsb/mapviewer/services/impl/ProjectService.java b/service/src/main/java/lcsb/mapviewer/services/impl/ProjectService.java index a6bfe23fb5972f26182f5c26986b29788e97f8ce..25cc9a4e3ff56f6d8f7a2f6b077d5de2be861a54 100644 --- a/service/src/main/java/lcsb/mapviewer/services/impl/ProjectService.java +++ b/service/src/main/java/lcsb/mapviewer/services/impl/ProjectService.java @@ -53,13 +53,13 @@ import lcsb.mapviewer.converter.graphics.DrawingException; import lcsb.mapviewer.converter.graphics.MapGenerator; import lcsb.mapviewer.converter.graphics.MapGenerator.MapGeneratorParams; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; import lcsb.mapviewer.converter.model.sbgnml.SbgnmlXmlConverter; import lcsb.mapviewer.converter.zip.ZipEntryFile; import lcsb.mapviewer.model.Project; import lcsb.mapviewer.model.ProjectStatus; import lcsb.mapviewer.model.log.LogType; import lcsb.mapviewer.model.map.AnnotatedObject; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.graph.DataMining; diff --git a/service/src/main/java/lcsb/mapviewer/services/impl/SearchService.java b/service/src/main/java/lcsb/mapviewer/services/impl/SearchService.java index 95083039b99b9ec4741f0d1ad13f32751be3c5c3..99869b8ae651215c65091a62473135a168284325 100644 --- a/service/src/main/java/lcsb/mapviewer/services/impl/SearchService.java +++ b/service/src/main/java/lcsb/mapviewer/services/impl/SearchService.java @@ -18,8 +18,18 @@ import lcsb.mapviewer.common.Configuration; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidClassException; import lcsb.mapviewer.common.exception.InvalidStateException; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Degraded; +import lcsb.mapviewer.converter.model.celldesigner.structure.Drug; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.Ion; +import lcsb.mapviewer.converter.model.celldesigner.structure.Phenotype; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; +import lcsb.mapviewer.converter.model.celldesigner.structure.Unknown; import lcsb.mapviewer.model.map.AnnotatedObject; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.Alias; @@ -30,16 +40,6 @@ import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelSubmodelConnection; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.ReactionNode; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Degraded; -import lcsb.mapviewer.model.map.species.Drug; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.Ion; -import lcsb.mapviewer.model.map.species.Phenotype; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; -import lcsb.mapviewer.model.map.species.SimpleMolecule; -import lcsb.mapviewer.model.map.species.Unknown; import lcsb.mapviewer.model.map.statistics.SearchType; import lcsb.mapviewer.persist.dao.map.ModelDao; import lcsb.mapviewer.services.interfaces.ISearchHistoryService; diff --git a/service/src/main/java/lcsb/mapviewer/services/interfaces/IDataMiningService.java b/service/src/main/java/lcsb/mapviewer/services/interfaces/IDataMiningService.java index ba81f380e588b98b0f94f7204d12da75eed97123..1c087cc40e0154ac049c525b809c7c973e03b154 100644 --- a/service/src/main/java/lcsb/mapviewer/services/interfaces/IDataMiningService.java +++ b/service/src/main/java/lcsb/mapviewer/services/interfaces/IDataMiningService.java @@ -5,7 +5,7 @@ import java.util.Collection; import java.util.Set; import lcsb.mapviewer.common.IProgressUpdater; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; import lcsb.mapviewer.model.map.graph.DataMining; import lcsb.mapviewer.model.map.graph.DataMiningSet; import lcsb.mapviewer.model.map.graph.DataMiningType; diff --git a/service/src/main/java/lcsb/mapviewer/services/search/SearchResultFactory.java b/service/src/main/java/lcsb/mapviewer/services/search/SearchResultFactory.java index 060d242ccb60ed9578d6b13316c1dbbadb6c0822..3f3d223863154253cf5ee24edc10c9ac7978e582 100644 --- a/service/src/main/java/lcsb/mapviewer/services/search/SearchResultFactory.java +++ b/service/src/main/java/lcsb/mapviewer/services/search/SearchResultFactory.java @@ -12,16 +12,16 @@ import org.springframework.transaction.annotation.Transactional; import lcsb.mapviewer.annotation.data.Article; import lcsb.mapviewer.annotation.data.TargetType; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.model.Model; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; -import lcsb.mapviewer.model.map.species.Species; import lcsb.mapviewer.services.search.data.ElementIdentifier; import lcsb.mapviewer.services.search.data.ElementIdentifier.ElementIdentifierType; import lcsb.mapviewer.services.search.db.GeneRow; diff --git a/service/src/main/java/lcsb/mapviewer/services/search/data/FullAliasView.java b/service/src/main/java/lcsb/mapviewer/services/search/data/FullAliasView.java index 8268fbbb960928c26d055ce52e52b45d5ef6d9f9..de97a53dfa0bf9c74aa25b7d9d05c974de0a9b8c 100644 --- a/service/src/main/java/lcsb/mapviewer/services/search/data/FullAliasView.java +++ b/service/src/main/java/lcsb/mapviewer/services/search/data/FullAliasView.java @@ -8,10 +8,10 @@ import java.util.Map; import org.apache.log4j.Logger; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; -import lcsb.mapviewer.model.map.species.Species; import lcsb.mapviewer.services.search.IHeavyView; import lcsb.mapviewer.services.view.AnnotationView; diff --git a/service/src/main/java/lcsb/mapviewer/services/search/data/FullAliasViewFactory.java b/service/src/main/java/lcsb/mapviewer/services/search/data/FullAliasViewFactory.java index 7fd70377fc97cfdb1f6f96a36858b360243017ad..9457e4eae7dca4f143885c21e40e9b016c1fbada 100644 --- a/service/src/main/java/lcsb/mapviewer/services/search/data/FullAliasViewFactory.java +++ b/service/src/main/java/lcsb/mapviewer/services/search/data/FullAliasViewFactory.java @@ -18,7 +18,10 @@ import lcsb.mapviewer.annotation.services.annotators.ChebiAnnotator; import lcsb.mapviewer.annotation.services.annotators.ChebiSearchException; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.ModificationResidue; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; @@ -26,9 +29,6 @@ import lcsb.mapviewer.model.map.graph.DataMining; import lcsb.mapviewer.model.map.graph.DataMiningSet; import lcsb.mapviewer.model.map.graph.DataMiningType; import lcsb.mapviewer.model.map.layout.alias.Alias; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.model.map.species.fields.ModificationResidue; import lcsb.mapviewer.services.interfaces.IDataMiningService; import lcsb.mapviewer.services.overlay.ChebiTreeRow; import lcsb.mapviewer.services.search.ElementViewFactory; diff --git a/service/src/main/java/lcsb/mapviewer/services/search/db/IDbSearchService.java b/service/src/main/java/lcsb/mapviewer/services/search/db/IDbSearchService.java index a74deb1eddf8389bdec20ed0348e20ed130b1380..75f84bb111a8996719ee941adabd487ce5b8b55c 100644 --- a/service/src/main/java/lcsb/mapviewer/services/search/db/IDbSearchService.java +++ b/service/src/main/java/lcsb/mapviewer/services/search/db/IDbSearchService.java @@ -4,7 +4,7 @@ import java.util.Collection; import java.util.List; import lcsb.mapviewer.common.IProgressUpdater; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.services.view.AbstractView; diff --git a/service/src/main/java/lcsb/mapviewer/services/search/db/chemical/ChemicalService.java b/service/src/main/java/lcsb/mapviewer/services/search/db/chemical/ChemicalService.java index e82b7af3ec28870ce38fac7b6d09a1605811e694..a2c1eaa67e4afb250a10e3dfe738d08ad866033d 100644 --- a/service/src/main/java/lcsb/mapviewer/services/search/db/chemical/ChemicalService.java +++ b/service/src/main/java/lcsb/mapviewer/services/search/db/chemical/ChemicalService.java @@ -23,8 +23,11 @@ import lcsb.mapviewer.annotation.services.annotators.AnnotatorException; import lcsb.mapviewer.annotation.services.annotators.HgncAnnotator; import lcsb.mapviewer.common.IProgressUpdater; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; import lcsb.mapviewer.model.map.AnnotatedObject; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.Alias; @@ -32,9 +35,6 @@ import lcsb.mapviewer.model.map.layout.alias.GeneAlias; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.layout.alias.RnaAlias; import lcsb.mapviewer.model.map.model.Model; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; import lcsb.mapviewer.model.map.statistics.SearchType; import lcsb.mapviewer.services.interfaces.ISearchHistoryService; import lcsb.mapviewer.services.search.db.DbSearchCriteria; diff --git a/service/src/main/java/lcsb/mapviewer/services/search/db/chemical/ChemicalViewFactory.java b/service/src/main/java/lcsb/mapviewer/services/search/db/chemical/ChemicalViewFactory.java index 69f2559cdddcfd0c94ee3758c656c1d0ba0c4ec7..402a083a15bdc104bf11d9e03af98486faf40ff3 100644 --- a/service/src/main/java/lcsb/mapviewer/services/search/db/chemical/ChemicalViewFactory.java +++ b/service/src/main/java/lcsb/mapviewer/services/search/db/chemical/ChemicalViewFactory.java @@ -18,7 +18,7 @@ import lcsb.mapviewer.annotation.services.MeSHParser; import lcsb.mapviewer.annotation.services.PubmedParser; import lcsb.mapviewer.annotation.services.PubmedSearchException; import lcsb.mapviewer.annotation.services.annotators.AnnotatorException; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.Alias; diff --git a/service/src/main/java/lcsb/mapviewer/services/search/db/drug/DrugViewFactory.java b/service/src/main/java/lcsb/mapviewer/services/search/db/drug/DrugViewFactory.java index a372abb9bc566a738eca5dc7ddc226762ba13983..5dabb9d7d2c0fc3673975f1f87ee6d8d83572ef4 100644 --- a/service/src/main/java/lcsb/mapviewer/services/search/db/drug/DrugViewFactory.java +++ b/service/src/main/java/lcsb/mapviewer/services/search/db/drug/DrugViewFactory.java @@ -16,11 +16,11 @@ import com.google.gson.Gson; import lcsb.mapviewer.annotation.data.Drug; import lcsb.mapviewer.annotation.data.Target; import lcsb.mapviewer.annotation.data.TargetType; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.model.Model; -import lcsb.mapviewer.model.map.species.Species; import lcsb.mapviewer.services.overlay.IconManager; import lcsb.mapviewer.services.overlay.IconType; import lcsb.mapviewer.services.search.SearchResultFactory; diff --git a/service/src/main/java/lcsb/mapviewer/services/search/db/mirna/MiRNAService.java b/service/src/main/java/lcsb/mapviewer/services/search/db/mirna/MiRNAService.java index 47810a2bf49b9b0763fc42afeb4e7f34d8355a86..98ba29b6fa88b7c4d8ede7f143e668d847cb1ad0 100644 --- a/service/src/main/java/lcsb/mapviewer/services/search/db/mirna/MiRNAService.java +++ b/service/src/main/java/lcsb/mapviewer/services/search/db/mirna/MiRNAService.java @@ -20,8 +20,11 @@ import lcsb.mapviewer.annotation.services.MiRNASearchException; import lcsb.mapviewer.annotation.services.annotators.AnnotatorException; import lcsb.mapviewer.annotation.services.annotators.HgncAnnotator; import lcsb.mapviewer.common.IProgressUpdater; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; import lcsb.mapviewer.model.map.AnnotatedObject; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.alias.Alias; @@ -29,9 +32,6 @@ import lcsb.mapviewer.model.map.layout.alias.GeneAlias; import lcsb.mapviewer.model.map.layout.alias.ProteinAlias; import lcsb.mapviewer.model.map.layout.alias.RnaAlias; import lcsb.mapviewer.model.map.model.Model; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; import lcsb.mapviewer.model.map.statistics.SearchType; import lcsb.mapviewer.services.interfaces.ISearchHistoryService; import lcsb.mapviewer.services.search.db.DbSearchCriteria; diff --git a/service/src/main/java/lcsb/mapviewer/services/search/db/mirna/MiRNAViewFactory.java b/service/src/main/java/lcsb/mapviewer/services/search/db/mirna/MiRNAViewFactory.java index ed03c735fed4adb33805e890151f7a847f68743e..ca77e51f1de4d4722a4b5532e0d50152ca05e43c 100644 --- a/service/src/main/java/lcsb/mapviewer/services/search/db/mirna/MiRNAViewFactory.java +++ b/service/src/main/java/lcsb/mapviewer/services/search/db/mirna/MiRNAViewFactory.java @@ -1,119 +1,119 @@ -package lcsb.mapviewer.services.search.db.mirna; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; - -import com.google.gson.Gson; - -import lcsb.mapviewer.annotation.data.MiRNA; -import lcsb.mapviewer.annotation.data.Target; -import lcsb.mapviewer.model.map.Element; -import lcsb.mapviewer.model.map.layout.alias.Alias; -import lcsb.mapviewer.model.map.model.Model; -import lcsb.mapviewer.services.overlay.IconManager; -import lcsb.mapviewer.services.overlay.IconType; -import lcsb.mapviewer.services.search.SearchResultFactory; -import lcsb.mapviewer.services.search.data.ElementIdentifier; -import lcsb.mapviewer.services.search.db.DrugTargetViewVisibilityComparator; -import lcsb.mapviewer.services.search.db.TargetView; -import lcsb.mapviewer.services.search.db.TargetViewFactory; - -/** - * Factory class for {@link MiRNAView} class. - * - * @author Ayan Rota - * - */ -public class MiRNAViewFactory extends SearchResultFactory<MiRNA, MiRNAView> { - - /** - * Default class logger. - */ - @SuppressWarnings("unused") - private static Logger logger = Logger.getLogger(MiRNAViewFactory.class); - - /** - * Factory object for {@link TargetView} elements. - */ - @Autowired - private TargetViewFactory drugTargetViewFactory; - - @Override - public MiRNAView create(MiRNA miRNA) { - return create(miRNA, null, 0); - } - - /** - * Creates {@link MiRNAView}. - * - * @param miRNA - * original MiRNA from which the data will be initialized - * @param model - * model where the view will be presented - * @param set - * which set of icons should be used - * - * @return {@link MiRNAView} object for given miRNA. links are placed - * according to model given in the parameter. - */ - public MiRNAView create(MiRNA miRNA, Model model, int set) { - MiRNAView miRNAView = new MiRNAView(miRNA); - if (miRNA == null) { - return miRNAView; - } - - miRNAView.setName(miRNA.getName()); - - List<TargetView> targetsRows = new ArrayList<>(); - int differentNames = 0; - for (Target geneEntry : miRNA.getTargets()) { - targetsRows.add(drugTargetViewFactory.create(geneEntry, model)); - } - - Collections.sort(targetsRows, new DrugTargetViewVisibilityComparator()); - - for (TargetView geneTargetView : targetsRows) { - if (geneTargetView.getSelectable()) { - String icon = IconManager.getInstance().getIconForIndex(differentNames++, IconType.MI_RNA, set); - geneTargetView.setIcon(icon); - geneTargetView.setSelected(true); - } - } - miRNAView.setTargetRows(targetsRows); - return miRNAView; - - } - - @Override - public String createGson(MiRNAView object) { - return new Gson().toJson(object); - } - - @Override - public List<ElementIdentifier> searchResultToElementIdentifier(MiRNAView searchResult, Model inputModel) { - List<ElementIdentifier> result = new ArrayList<>(); - - List<Model> models = new ArrayList<>(); - models.addAll(inputModel.getSubmodels()); - models.add(inputModel); - for (Model model : models) { - for (TargetView target : searchResult.getTargetRows()) { - if (target.getSelected() && target.getIcon() != null) { - for (Element element : model.getElements()) { - if (elementMatch(target, element)) { - for (Alias alias : model.getAliasesForElement(element)) { - result.add(new ElementIdentifier(alias, target.getIcon())); - } - } - } - } - } - } - return result; - } - -} +package lcsb.mapviewer.services.search.db.mirna; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; + +import com.google.gson.Gson; + +import lcsb.mapviewer.annotation.data.MiRNA; +import lcsb.mapviewer.annotation.data.Target; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.model.map.layout.alias.Alias; +import lcsb.mapviewer.model.map.model.Model; +import lcsb.mapviewer.services.overlay.IconManager; +import lcsb.mapviewer.services.overlay.IconType; +import lcsb.mapviewer.services.search.SearchResultFactory; +import lcsb.mapviewer.services.search.data.ElementIdentifier; +import lcsb.mapviewer.services.search.db.DrugTargetViewVisibilityComparator; +import lcsb.mapviewer.services.search.db.TargetView; +import lcsb.mapviewer.services.search.db.TargetViewFactory; + +/** + * Factory class for {@link MiRNAView} class. + * + * @author Ayan Rota + * + */ +public class MiRNAViewFactory extends SearchResultFactory<MiRNA, MiRNAView> { + + /** + * Default class logger. + */ + @SuppressWarnings("unused") + private static Logger logger = Logger.getLogger(MiRNAViewFactory.class); + + /** + * Factory object for {@link TargetView} elements. + */ + @Autowired + private TargetViewFactory drugTargetViewFactory; + + @Override + public MiRNAView create(MiRNA miRNA) { + return create(miRNA, null, 0); + } + + /** + * Creates {@link MiRNAView}. + * + * @param miRNA + * original MiRNA from which the data will be initialized + * @param model + * model where the view will be presented + * @param set + * which set of icons should be used + * + * @return {@link MiRNAView} object for given miRNA. links are placed + * according to model given in the parameter. + */ + public MiRNAView create(MiRNA miRNA, Model model, int set) { + MiRNAView miRNAView = new MiRNAView(miRNA); + if (miRNA == null) { + return miRNAView; + } + + miRNAView.setName(miRNA.getName()); + + List<TargetView> targetsRows = new ArrayList<>(); + int differentNames = 0; + for (Target geneEntry : miRNA.getTargets()) { + targetsRows.add(drugTargetViewFactory.create(geneEntry, model)); + } + + Collections.sort(targetsRows, new DrugTargetViewVisibilityComparator()); + + for (TargetView geneTargetView : targetsRows) { + if (geneTargetView.getSelectable()) { + String icon = IconManager.getInstance().getIconForIndex(differentNames++, IconType.MI_RNA, set); + geneTargetView.setIcon(icon); + geneTargetView.setSelected(true); + } + } + miRNAView.setTargetRows(targetsRows); + return miRNAView; + + } + + @Override + public String createGson(MiRNAView object) { + return new Gson().toJson(object); + } + + @Override + public List<ElementIdentifier> searchResultToElementIdentifier(MiRNAView searchResult, Model inputModel) { + List<ElementIdentifier> result = new ArrayList<>(); + + List<Model> models = new ArrayList<>(); + models.addAll(inputModel.getSubmodels()); + models.add(inputModel); + for (Model model : models) { + for (TargetView target : searchResult.getTargetRows()) { + if (target.getSelected() && target.getIcon() != null) { + for (Element element : model.getElements()) { + if (elementMatch(target, element)) { + for (Alias alias : model.getAliasesForElement(element)) { + result.add(new ElementIdentifier(alias, target.getIcon())); + } + } + } + } + } + } + return result; + } + +} diff --git a/service/src/main/java/lcsb/mapviewer/services/utils/SearchIndexer.java b/service/src/main/java/lcsb/mapviewer/services/utils/SearchIndexer.java index b7bc490f3dc0042e74ef8852fe496e304f278cd5..d9d2d8ba367c868bfdf00985bf1f2fd1f0668d11 100644 --- a/service/src/main/java/lcsb/mapviewer/services/utils/SearchIndexer.java +++ b/service/src/main/java/lcsb/mapviewer/services/utils/SearchIndexer.java @@ -8,7 +8,7 @@ import java.util.Map.Entry; import org.apache.log4j.Logger; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.SearchIndex; diff --git a/service/src/main/java/lcsb/mapviewer/services/utils/data/ExportColumn.java b/service/src/main/java/lcsb/mapviewer/services/utils/data/ExportColumn.java index e38aea2294b4bdfe1da68160cd157f8ea704127f..d95592e179591a2738c1aea11cca4209bb1aa8f6 100644 --- a/service/src/main/java/lcsb/mapviewer/services/utils/data/ExportColumn.java +++ b/service/src/main/java/lcsb/mapviewer/services/utils/data/ExportColumn.java @@ -1,7 +1,7 @@ package lcsb.mapviewer.services.utils.data; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.Species; /** * This enum defines which columns are available in export function. diff --git a/service/src/main/java/lcsb/mapviewer/services/view/PubmedAnnotatedElementsView.java b/service/src/main/java/lcsb/mapviewer/services/view/PubmedAnnotatedElementsView.java index 53198e9f7379b04ec71493d1ba01d3bbe773f556..4bde13627c927e3ecc3c4958b9c9cb550b64f342 100644 --- a/service/src/main/java/lcsb/mapviewer/services/view/PubmedAnnotatedElementsView.java +++ b/service/src/main/java/lcsb/mapviewer/services/view/PubmedAnnotatedElementsView.java @@ -6,8 +6,8 @@ import java.util.List; import lcsb.mapviewer.annotation.data.Article; import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.common.exception.InvalidStateException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; import lcsb.mapviewer.model.map.AnnotatedObject; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.reaction.Reaction; diff --git a/service/src/test/java/lcsb/mapviewer/services/impl/DataMiningServiceTest.java b/service/src/test/java/lcsb/mapviewer/services/impl/DataMiningServiceTest.java index a1b51aa31dd252218048bc6f1c541d74ef247669..a1a75c7e9b06c681ee46835cd39f7847e535e9ac 100644 --- a/service/src/test/java/lcsb/mapviewer/services/impl/DataMiningServiceTest.java +++ b/service/src/test/java/lcsb/mapviewer/services/impl/DataMiningServiceTest.java @@ -22,16 +22,16 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.annotation.Rollback; import lcsb.mapviewer.common.IProgressUpdater; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; import lcsb.mapviewer.model.Project; import lcsb.mapviewer.model.log.GenericLog; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.graph.DataMining; import lcsb.mapviewer.model.map.graph.DataMiningSet; import lcsb.mapviewer.model.map.model.Model; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Protein; import lcsb.mapviewer.services.ServiceTestFunctions; import lcsb.mapviewer.services.interfaces.IDataMiningService; diff --git a/service/src/test/java/lcsb/mapviewer/services/impl/DataMiningServiceTest2.java b/service/src/test/java/lcsb/mapviewer/services/impl/DataMiningServiceTest2.java index 6a0ec1ed15dc71ec5b0093239029648eba8dcd0c..3c3f6b35a1aab37888f0897578a8e23d192fcba8 100644 --- a/service/src/test/java/lcsb/mapviewer/services/impl/DataMiningServiceTest2.java +++ b/service/src/test/java/lcsb/mapviewer/services/impl/DataMiningServiceTest2.java @@ -11,7 +11,10 @@ import java.util.HashSet; import java.util.Set; import lcsb.mapviewer.common.IProgressUpdater; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.graph.DataMining; @@ -19,9 +22,6 @@ import lcsb.mapviewer.model.map.graph.DataMiningType; import lcsb.mapviewer.model.map.reaction.Product; import lcsb.mapviewer.model.map.reaction.Reactant; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.SimpleMolecule; import lcsb.mapviewer.services.ServiceTestFunctions; import org.apache.log4j.Logger; diff --git a/service/src/test/java/lcsb/mapviewer/services/impl/ExporterServiceTest.java b/service/src/test/java/lcsb/mapviewer/services/impl/ExporterServiceTest.java index 50700a9a30ee8c8bf0318e388d8f9215a2808bbd..688d103d325f1ef3a5c7493a3843d45bb054d6fd 100644 --- a/service/src/test/java/lcsb/mapviewer/services/impl/ExporterServiceTest.java +++ b/service/src/test/java/lcsb/mapviewer/services/impl/ExporterServiceTest.java @@ -1,529 +1,529 @@ -package lcsb.mapviewer.services.impl; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import lcsb.mapviewer.commands.CreateHierarchyCommand; -import lcsb.mapviewer.converter.model.celldesigner.reaction.ReactionLineData; -import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; -import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; -import lcsb.mapviewer.model.map.model.Model; -import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.reaction.ReactionNode; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.services.ServiceTestFunctions; -import lcsb.mapviewer.services.interfaces.IExporterService; -import lcsb.mapviewer.services.interfaces.IExporterService.ExporterParameters; -import lcsb.mapviewer.services.utils.data.ExportColumn; -import lcsb.mapviewer.services.utils.data.ExportFileType; -import lcsb.mapviewer.services.view.PubmedAnnotatedElementsView; - -import org.apache.log4j.Logger; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; - -public class ExporterServiceTest extends ServiceTestFunctions { - Logger logger = Logger.getLogger(ExporterServiceTest.class); - @Autowired - IExporterService exporter2; - - ExporterService exporter; - - @Before - public void setUp() throws Exception { - exporter = (ExporterService) exporter2; - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testGetExportSpeciesStringForTabSeparatedFile() throws Exception { - try { - Model model = getModelForFile("testFiles/export_with_artifitial_comp.xml", false); - ExportColumn columns[] = { ExportColumn.NAME, ExportColumn.ID, ExportColumn.COMPONENT_NAME, ExportColumn.COMPARTMENT_NAME, ExportColumn.TYPE }; - - ExporterParameters params = new IExporterService.ExporterParameters().model(model).column(columns).fileType(ExportFileType.TAB_SEPARATED); - - // full export (all elements) - String string = exporter.getExportSpeciesString(params); - String lines[] = string.split("\n"); - assertTrue("Not enough elements in the result file", lines.length > 1); - - String response = lines[0]; - String textColumns[] = response.split("\t"); - assertEquals(5, textColumns.length); - - // only proteins for self-made modules - new CreateHierarchyCommand(model, 8, 80).execute(); - string = exporter.getExportSpeciesString(params.type(GenericProtein.class)); - lines = string.split("\n"); - assertTrue(lines.length > 1); - - boolean differenceBetweenComponentCompartmnet = false; - int lineCount = 0; - for (String string2 : lines) { - if (lineCount == 0) { - textColumns = string2.split("\t"); - assertEquals(ExportColumn.TYPE.getTitle(), textColumns[4]); - } else { - textColumns = string2.split("\t"); - assertEquals(GenericProtein.class.getSimpleName(), textColumns[4]); - if (!textColumns[2].equalsIgnoreCase(textColumns[3])) { - differenceBetweenComponentCompartmnet = true; - } - } - lineCount++; - } - assertTrue(differenceBetweenComponentCompartmnet); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testDuplicatesInGetExportSpeciesString() throws Exception { - try { - Model model = getModelForFile("testFiles/export_duplicate_elements.xml", false); - ExportColumn columns[] = { ExportColumn.NAME, ExportColumn.COMPONENT_NAME, ExportColumn.TYPE }; - - ExporterParameters params = new IExporterService.ExporterParameters().model(model).column(columns).fileType(ExportFileType.TAB_SEPARATED); - - // full export (all elements) - String string = exporter.getExportSpeciesString(params); - - String lines[] = string.split("\n"); - Set<String> uniqueNames = new HashSet<String>(); - for (String string2 : lines) { - uniqueNames.add(string2); - } - assertEquals(uniqueNames.size(), lines.length); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testGetExportStringForOneSpecies_Complex() { - try { - Model model = getModelForFile("testFiles/export/hsp70.xml", true); - - SpeciesAlias alias = (SpeciesAlias) model.getAliasByAliasId("csa1"); - ExportColumn columns[] = { ExportColumn.NAME }; - - ExporterParameters params = new IExporterService.ExporterParameters().model(model).// - column(columns).// - complexElementsName(false).// - fileType(ExportFileType.TAB_SEPARATED); - - List<String> elements = exporter.getExportStringForOneSpecies(alias, params); - assertTrue(elements.contains("HSP70:chaperon")); - - // now the results are concatenated children - params.complexElementsName(true); - - elements = exporter.getExportStringForOneSpecies(alias, params); - assertTrue(elements.size() > 0); - String string = elements.get(0); - assertFalse(string.equals("HSP70:chaperon")); - assertTrue(string.contains("HSP70")); - assertTrue(string.contains("STUB1")); - assertTrue(string.contains("DNAJB2")); - assertTrue(string.contains("BAG1")); - - // and now check complexes with mix of proteins and molecules - alias = (SpeciesAlias) model.getAliasByAliasId("csa3"); - - elements = exporter.getExportStringForOneSpecies(alias, params); - assertTrue(elements.size() > 0); - string = elements.get(0); - assertTrue(string.contains("UBA1")); - assertTrue(string.contains("UBA6")); - assertTrue(string.contains("AMP")); - - elements = exporter.getExportStringForOneSpecies(alias, params.type(Protein.class)); - assertTrue(elements.size() > 0); - string = elements.get(0); - assertTrue(string.contains("UBA1")); - assertTrue(string.contains("UBA6")); - assertFalse(string.contains("AMP")); - - } catch (Exception e) { - e.printStackTrace(); - fail("Exception occured"); - } - } - - @Test - public void testGetExportStringForOneReaction() throws Exception { - try { - Model model = getModelForFile("testFiles/export/reaction.xml", false); - Set<CompartmentAlias> aliases = new HashSet<CompartmentAlias>(); - for (CompartmentAlias alias : model.getCompartmentsAliases()) { - if (alias.getTitle().equalsIgnoreCase("Dopamine loaded synaptic vesicle")) - aliases.add(alias); - } - - Reaction reaction = model.getReactionByReactionId("re2"); - - ExporterParameters params = new IExporterService.ExporterParameters().model(model).// - fileType(ExportFileType.SIF).// - type(Protein.class).// - type(ComplexSpecies.class).// - fileType(ExportFileType.SIF).// - complexElementsName(false).// - excluded(aliases); - - String string = exporter.getExportSingleInteractionString(reaction, params).get(0); - assertNotNull(string); - assertTrue(string.contains("Calcium channel:RIMBP:RIM:MUNC13:RAB")); - assertTrue(string.contains("CSP:Hsc70:SGT")); - assertTrue(string.contains("SNCA")); - assertTrue(string.contains("trans-SNARE complex")); - assertFalse(string.contains("VAMP2")); - - params = new IExporterService.ExporterParameters().model(model).fileType(ExportFileType.SIF).type(ComplexSpecies.class).type(Protein.class); - string = exporter.getExportSingleInteractionString(reaction, params).get(0); - assertTrue(string.contains("VAMP2")); - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - - } - - @Test - public void testGetExportStringForOneReactionInGeneral() { - try { - Model model = getModelForFile("testFiles/export/reaction.xml", true); - Reaction reaction = model.getReactionByReactionId("re2"); - ExporterParameters params = new IExporterService.ExporterParameters().model(model).// - fileType(ExportFileType.SIF).// - complexElementsName(false).// - type(ComplexSpecies.class).type(Protein.class); - String string = exporter.getExportSingleInteractionString(reaction, params).get(0); - assertNotNull(string); - assertTrue(string.contains("Calcium channel:RIMBP:RIM:MUNC13:RAB")); - assertTrue(string.contains("CSP:Hsc70:SGT")); - assertTrue(string.contains("SNCA")); - assertTrue(string.contains("trans-SNARE complex")); - assertTrue(string.contains("SNAP25")); - assertFalse(string.contains("RAB3A")); - - params.complexElementsName(true); - string = exporter.getExportSingleInteractionString(reaction, params).get(0); - assertFalse(string.contains("trans-SNARE complex")); - assertTrue(string.contains("RAB3A")); - - } catch (Exception e) { - e.printStackTrace(); - fail("Exception occured"); - } - - } - - @Test - public void testGetExportStringForOneReactionInGeneralWithOnlyOneElement() throws Exception { - try { - Model model = getModelForFile("testFiles/export/reaction.xml", false); - Reaction reaction = model.getReactionByReactionId("re11"); - model.getReactions().clear(); - model.addReaction(reaction); - Set<CompartmentAlias> aliases = new HashSet<CompartmentAlias>(); - aliases.add((CompartmentAlias) model.getAliasByAliasId("ca1")); - ExporterParameters params = new IExporterService.ExporterParameters() - .model(model).fileType(ExportFileType.SIF).included("dopamine loaded synaptic vesicle"); - assertEquals(0, exporter.getExportSingleInteractionString(reaction, params).size()); - - params = new IExporterService.ExporterParameters().model(model).fileType(ExportFileType.SIF); - assertEquals(1, exporter.getExportSingleInteractionString(reaction, params).size()); - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testGetExportSingleInteractionString_text() { - try { - Model model = getModelForFile("testFiles/export_with_artifitial_comp.xml", false); - for (Reaction reaction : model.getReactions()) { - String str = exporter.getExportSingleInteractionString( - reaction, new IExporterService.ExporterParameters().fileType(ExportFileType.TAB_SEPARATED).type(Species.class)).get(0); - - List<String> strings = new ArrayList<String>(); - strings.add(ReactionLineData.getByReactionType(reaction.getClass()).getCellDesignerString()); - strings.add(reaction.getIdReaction()); - for (ReactionNode node : reaction.getReactionNodes()) { - strings.add(((Species) node.getElement()).getName()); - - } - for (String string : strings) { - assertTrue("Description \"" + str + "\" doesn't contain " + string + ". reactionId=" + reaction.getIdReaction(), str.contains(string)); - } - } - - } catch (Exception e) { - e.printStackTrace(); - fail("Exception occured"); - } - } - - @Test - public void testGetExportComponentAndCompartments() throws Exception { - try { - Model model = getModelForFile("testFiles/export/export_model.xml", false); - new CreateHierarchyCommand(model, 7, 80).execute(); - ExporterParameters params = new IExporterService.ExporterParameters() - .model(model).fileType(ExportFileType.TAB_SEPARATED).column(ExportColumn.NAME).column(ExportColumn.COMPONENT_NAME) - .column(ExportColumn.COMPARTMENT_NAME); - - List<String> list = exporter.getExportStringForOneSpecies(model.getAliasesBySpeciesId("s1").get(0), params); - String desc = list.get(0); - String compartment = desc.split("\t")[2]; - assertEquals("c1", compartment); - String component = desc.split("\t")[1]; - assertEquals("Test3", component); - - list = exporter.getExportStringForOneSpecies(model.getAliasesBySpeciesId("s2").get(0), params); - desc = null; - for (String string : list) { - if (string.contains("Test 1")) { - desc = string; - } - } - compartment = desc.split("\t")[2]; - assertEquals("c2", compartment); - component = desc.split("\t")[1]; - assertEquals("Test 1", component); - - for (String string : list) { - if (string.contains("Test2")) { - desc = string; - } - } - compartment = desc.split("\t")[2]; - assertEquals("c2", compartment); - component = desc.split("\t")[1]; - assertEquals("Test2", component); - - for (String string : list) { - if (string.contains("Test3")) { - desc = string; - } - } - compartment = desc.split("\t")[2]; - assertEquals("c2", compartment); - component = desc.split("\t")[1]; - assertEquals("Test3", component); - - list = exporter.getExportStringForOneSpecies(model.getAliasesBySpeciesId("s3").get(0), params); - boolean ok = false; - for (String string : list) { - if (string.split("\t")[2].equals("null") && string.split("\t")[1].equals("Test2")) { - ok = true; - } - } - assertTrue(ok); - - list = exporter.getExportStringForOneSpecies(model.getAliasesBySpeciesId("s4").get(0), params); - desc = list.get(0); - compartment = desc.split("\t")[2]; - assertEquals("null", compartment); - component = desc.split("\t")[1]; - assertEquals("Test3", component); - - list = exporter.getExportStringForOneSpecies(model.getAliasesBySpeciesId("s5").get(0), params); - desc = list.get(0); - compartment = desc.split("\t")[2]; - assertEquals("c3", compartment); - component = desc.split("\t")[1]; - assertEquals("null", component); - - list = exporter.getExportStringForOneSpecies(model.getAliasesBySpeciesId("s6").get(0), params); - desc = list.get(0); - compartment = desc.split("\t")[2]; - assertEquals("null", compartment); - component = desc.split("\t")[1]; - assertEquals("null", component); - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testGetExportSpeciesStringForTabSeparatedFile2() throws Exception { - try { - Model model = getModelForFile("testFiles/export_with_artifitial_comp.xml", false); - ExportColumn columns[] = { ExportColumn.NAME, ExportColumn.ID, ExportColumn.COMPONENT_NAME, ExportColumn.COMPARTMENT_NAME, ExportColumn.TYPE }; - - ExporterParameters params = new IExporterService.ExporterParameters() - .model(model).column(columns).fileType(ExportFileType.TAB_SEPARATED).type(Object.class); - - // full export (all elements) - String string = exporter.getExportSpeciesString(params); - String lines[] = string.split("\n"); - assertTrue("Not enough elements in the result file", lines.length > 1); - - String response = lines[0]; - String textColumns[] = response.split("\t"); - assertEquals(columns.length, textColumns.length); - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testGetExportCompartmentsString() throws Exception { - try { - Model model = getModelForFile("testFiles/export/export_compartments.xml", false); - - ExporterParameters params = new IExporterService.ExporterParameters().model(model).fileType(ExportFileType.TAB_SEPARATED).type(Object.class); - - // full export (all compartments) - String string = exporter.getExportCompartmentsString(params); - String lines[] = string.split("\n"); - assertTrue("Not enough elements in the result file", lines.length >= 2); - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testAllExportColumnsSpecies() throws Exception { - try { - Model model = getModelForFile("testFiles/export_with_artifitial_comp.xml", false); - List<ExportColumn> columns = new ArrayList<ExportColumn>(); - for (ExportColumn column : ExportColumn.values()) { - if (column.getClazz().isAssignableFrom(Species.class)) { - columns.add(column); - } - } - - ExporterParameters params = new IExporterService.ExporterParameters().model(model).column(columns).fileType(ExportFileType.TAB_SEPARATED); - - // full export (all elements) - String string = exporter.getExportSpeciesString(params); - assertNotNull(string); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testAllExportColumnsReaction() throws Exception { - try { - Model model = getModelForFile("testFiles/export_with_artifitial_comp.xml", false); - List<ExportColumn> columns = new ArrayList<ExportColumn>(); - for (ExportColumn column : ExportColumn.values()) { - if (column.getClazz().isAssignableFrom(Reaction.class)) { - columns.add(column); - } - } - - ExporterParameters params = new IExporterService.ExporterParameters().model(model).column(columns).fileType(ExportFileType.TAB_SEPARATED); - - // full export (all elements) - String string = exporter.getExportInteractionString(params); - assertNotNull(string); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testGetTabSeparatedReaction() throws Exception { - try { - Model model = getModelForFile("testFiles/export/reaction.xml", false); - Set<CompartmentAlias> aliases = new HashSet<CompartmentAlias>(); - for (CompartmentAlias alias : model.getCompartmentsAliases()) { - if (alias.getTitle().equalsIgnoreCase("Dopamine loaded synaptic vesicle")) - aliases.add(alias); - } - - ExporterParameters params = new IExporterService.ExporterParameters().model(model).// - fileType(ExportFileType.TAB_SEPARATED).// - column(ExportColumn.REACTION_ID).// - column(ExportColumn.REACTION_TYPE).// - type(Species.class); - - String string = exporter.getExportInteractionString(params); - assertTrue(string.indexOf("STATE_TRANSITION REACTANT") >= 0); - assertTrue(string.indexOf("s2240") >= 0); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - - } - - @Test - public void test() throws Exception { - try { - Model model = getModelForFile("testFiles/export/new_line_file.xml", false); - List<ExportColumn> columns = new ArrayList<ExportColumn>(); - for (ExportColumn column : ExportColumn.values()) { - if (column.getClazz().isAssignableFrom(Species.class)) { - columns.add(column); - } - } - - ExporterParameters params = new IExporterService.ExporterParameters().model(model).column(columns).fileType(ExportFileType.TAB_SEPARATED); - - // full export (all elements) - String string = exporter.getExportSpeciesString(params); - String tmp[] = string.split("\n"); - for (String string2 : tmp) { - assertTrue(string2,columns.size()<=string2.split("\t",-1).length); - } - assertNotNull(string); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testPubmedSummary() throws Exception { - try { - Model model = getModelForFile("testFiles/export/reaction.xml", false); - List<PubmedAnnotatedElementsView> result = exporter.getPublicationModelSummary(model); - assertNotNull(result); - for (PubmedAnnotatedElementsView pubmedAnnotatedElementsView : result) { - assertNotNull(pubmedAnnotatedElementsView.getArticle()); - assertNotNull(pubmedAnnotatedElementsView.getArticle().getTitle()); - assertTrue(pubmedAnnotatedElementsView.getElements().size()>0); - } - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - -} +package lcsb.mapviewer.services.impl; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import lcsb.mapviewer.commands.CreateHierarchyCommand; +import lcsb.mapviewer.converter.model.celldesigner.reaction.ReactionLineData; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; +import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; +import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; +import lcsb.mapviewer.model.map.model.Model; +import lcsb.mapviewer.model.map.reaction.Reaction; +import lcsb.mapviewer.model.map.reaction.ReactionNode; +import lcsb.mapviewer.services.ServiceTestFunctions; +import lcsb.mapviewer.services.interfaces.IExporterService; +import lcsb.mapviewer.services.interfaces.IExporterService.ExporterParameters; +import lcsb.mapviewer.services.utils.data.ExportColumn; +import lcsb.mapviewer.services.utils.data.ExportFileType; +import lcsb.mapviewer.services.view.PubmedAnnotatedElementsView; + +import org.apache.log4j.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +public class ExporterServiceTest extends ServiceTestFunctions { + Logger logger = Logger.getLogger(ExporterServiceTest.class); + @Autowired + IExporterService exporter2; + + ExporterService exporter; + + @Before + public void setUp() throws Exception { + exporter = (ExporterService) exporter2; + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testGetExportSpeciesStringForTabSeparatedFile() throws Exception { + try { + Model model = getModelForFile("testFiles/export_with_artifitial_comp.xml", false); + ExportColumn columns[] = { ExportColumn.NAME, ExportColumn.ID, ExportColumn.COMPONENT_NAME, ExportColumn.COMPARTMENT_NAME, ExportColumn.TYPE }; + + ExporterParameters params = new IExporterService.ExporterParameters().model(model).column(columns).fileType(ExportFileType.TAB_SEPARATED); + + // full export (all elements) + String string = exporter.getExportSpeciesString(params); + String lines[] = string.split("\n"); + assertTrue("Not enough elements in the result file", lines.length > 1); + + String response = lines[0]; + String textColumns[] = response.split("\t"); + assertEquals(5, textColumns.length); + + // only proteins for self-made modules + new CreateHierarchyCommand(model, 8, 80).execute(); + string = exporter.getExportSpeciesString(params.type(GenericProtein.class)); + lines = string.split("\n"); + assertTrue(lines.length > 1); + + boolean differenceBetweenComponentCompartmnet = false; + int lineCount = 0; + for (String string2 : lines) { + if (lineCount == 0) { + textColumns = string2.split("\t"); + assertEquals(ExportColumn.TYPE.getTitle(), textColumns[4]); + } else { + textColumns = string2.split("\t"); + assertEquals(GenericProtein.class.getSimpleName(), textColumns[4]); + if (!textColumns[2].equalsIgnoreCase(textColumns[3])) { + differenceBetweenComponentCompartmnet = true; + } + } + lineCount++; + } + assertTrue(differenceBetweenComponentCompartmnet); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testDuplicatesInGetExportSpeciesString() throws Exception { + try { + Model model = getModelForFile("testFiles/export_duplicate_elements.xml", false); + ExportColumn columns[] = { ExportColumn.NAME, ExportColumn.COMPONENT_NAME, ExportColumn.TYPE }; + + ExporterParameters params = new IExporterService.ExporterParameters().model(model).column(columns).fileType(ExportFileType.TAB_SEPARATED); + + // full export (all elements) + String string = exporter.getExportSpeciesString(params); + + String lines[] = string.split("\n"); + Set<String> uniqueNames = new HashSet<String>(); + for (String string2 : lines) { + uniqueNames.add(string2); + } + assertEquals(uniqueNames.size(), lines.length); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testGetExportStringForOneSpecies_Complex() { + try { + Model model = getModelForFile("testFiles/export/hsp70.xml", true); + + SpeciesAlias alias = (SpeciesAlias) model.getAliasByAliasId("csa1"); + ExportColumn columns[] = { ExportColumn.NAME }; + + ExporterParameters params = new IExporterService.ExporterParameters().model(model).// + column(columns).// + complexElementsName(false).// + fileType(ExportFileType.TAB_SEPARATED); + + List<String> elements = exporter.getExportStringForOneSpecies(alias, params); + assertTrue(elements.contains("HSP70:chaperon")); + + // now the results are concatenated children + params.complexElementsName(true); + + elements = exporter.getExportStringForOneSpecies(alias, params); + assertTrue(elements.size() > 0); + String string = elements.get(0); + assertFalse(string.equals("HSP70:chaperon")); + assertTrue(string.contains("HSP70")); + assertTrue(string.contains("STUB1")); + assertTrue(string.contains("DNAJB2")); + assertTrue(string.contains("BAG1")); + + // and now check complexes with mix of proteins and molecules + alias = (SpeciesAlias) model.getAliasByAliasId("csa3"); + + elements = exporter.getExportStringForOneSpecies(alias, params); + assertTrue(elements.size() > 0); + string = elements.get(0); + assertTrue(string.contains("UBA1")); + assertTrue(string.contains("UBA6")); + assertTrue(string.contains("AMP")); + + elements = exporter.getExportStringForOneSpecies(alias, params.type(Protein.class)); + assertTrue(elements.size() > 0); + string = elements.get(0); + assertTrue(string.contains("UBA1")); + assertTrue(string.contains("UBA6")); + assertFalse(string.contains("AMP")); + + } catch (Exception e) { + e.printStackTrace(); + fail("Exception occured"); + } + } + + @Test + public void testGetExportStringForOneReaction() throws Exception { + try { + Model model = getModelForFile("testFiles/export/reaction.xml", false); + Set<CompartmentAlias> aliases = new HashSet<CompartmentAlias>(); + for (CompartmentAlias alias : model.getCompartmentsAliases()) { + if (alias.getTitle().equalsIgnoreCase("Dopamine loaded synaptic vesicle")) + aliases.add(alias); + } + + Reaction reaction = model.getReactionByReactionId("re2"); + + ExporterParameters params = new IExporterService.ExporterParameters().model(model).// + fileType(ExportFileType.SIF).// + type(Protein.class).// + type(ComplexSpecies.class).// + fileType(ExportFileType.SIF).// + complexElementsName(false).// + excluded(aliases); + + String string = exporter.getExportSingleInteractionString(reaction, params).get(0); + assertNotNull(string); + assertTrue(string.contains("Calcium channel:RIMBP:RIM:MUNC13:RAB")); + assertTrue(string.contains("CSP:Hsc70:SGT")); + assertTrue(string.contains("SNCA")); + assertTrue(string.contains("trans-SNARE complex")); + assertFalse(string.contains("VAMP2")); + + params = new IExporterService.ExporterParameters().model(model).fileType(ExportFileType.SIF).type(ComplexSpecies.class).type(Protein.class); + string = exporter.getExportSingleInteractionString(reaction, params).get(0); + assertTrue(string.contains("VAMP2")); + + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + + } + + @Test + public void testGetExportStringForOneReactionInGeneral() { + try { + Model model = getModelForFile("testFiles/export/reaction.xml", true); + Reaction reaction = model.getReactionByReactionId("re2"); + ExporterParameters params = new IExporterService.ExporterParameters().model(model).// + fileType(ExportFileType.SIF).// + complexElementsName(false).// + type(ComplexSpecies.class).type(Protein.class); + String string = exporter.getExportSingleInteractionString(reaction, params).get(0); + assertNotNull(string); + assertTrue(string.contains("Calcium channel:RIMBP:RIM:MUNC13:RAB")); + assertTrue(string.contains("CSP:Hsc70:SGT")); + assertTrue(string.contains("SNCA")); + assertTrue(string.contains("trans-SNARE complex")); + assertTrue(string.contains("SNAP25")); + assertFalse(string.contains("RAB3A")); + + params.complexElementsName(true); + string = exporter.getExportSingleInteractionString(reaction, params).get(0); + assertFalse(string.contains("trans-SNARE complex")); + assertTrue(string.contains("RAB3A")); + + } catch (Exception e) { + e.printStackTrace(); + fail("Exception occured"); + } + + } + + @Test + public void testGetExportStringForOneReactionInGeneralWithOnlyOneElement() throws Exception { + try { + Model model = getModelForFile("testFiles/export/reaction.xml", false); + Reaction reaction = model.getReactionByReactionId("re11"); + model.getReactions().clear(); + model.addReaction(reaction); + Set<CompartmentAlias> aliases = new HashSet<CompartmentAlias>(); + aliases.add((CompartmentAlias) model.getAliasByAliasId("ca1")); + ExporterParameters params = new IExporterService.ExporterParameters() + .model(model).fileType(ExportFileType.SIF).included("dopamine loaded synaptic vesicle"); + assertEquals(0, exporter.getExportSingleInteractionString(reaction, params).size()); + + params = new IExporterService.ExporterParameters().model(model).fileType(ExportFileType.SIF); + assertEquals(1, exporter.getExportSingleInteractionString(reaction, params).size()); + + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testGetExportSingleInteractionString_text() { + try { + Model model = getModelForFile("testFiles/export_with_artifitial_comp.xml", false); + for (Reaction reaction : model.getReactions()) { + String str = exporter.getExportSingleInteractionString( + reaction, new IExporterService.ExporterParameters().fileType(ExportFileType.TAB_SEPARATED).type(Species.class)).get(0); + + List<String> strings = new ArrayList<String>(); + strings.add(ReactionLineData.getByReactionType(reaction.getClass()).getCellDesignerString()); + strings.add(reaction.getIdReaction()); + for (ReactionNode node : reaction.getReactionNodes()) { + strings.add(((Species) node.getElement()).getName()); + + } + for (String string : strings) { + assertTrue("Description \"" + str + "\" doesn't contain " + string + ". reactionId=" + reaction.getIdReaction(), str.contains(string)); + } + } + + } catch (Exception e) { + e.printStackTrace(); + fail("Exception occured"); + } + } + + @Test + public void testGetExportComponentAndCompartments() throws Exception { + try { + Model model = getModelForFile("testFiles/export/export_model.xml", false); + new CreateHierarchyCommand(model, 7, 80).execute(); + ExporterParameters params = new IExporterService.ExporterParameters() + .model(model).fileType(ExportFileType.TAB_SEPARATED).column(ExportColumn.NAME).column(ExportColumn.COMPONENT_NAME) + .column(ExportColumn.COMPARTMENT_NAME); + + List<String> list = exporter.getExportStringForOneSpecies(model.getAliasesBySpeciesId("s1").get(0), params); + String desc = list.get(0); + String compartment = desc.split("\t")[2]; + assertEquals("c1", compartment); + String component = desc.split("\t")[1]; + assertEquals("Test3", component); + + list = exporter.getExportStringForOneSpecies(model.getAliasesBySpeciesId("s2").get(0), params); + desc = null; + for (String string : list) { + if (string.contains("Test 1")) { + desc = string; + } + } + compartment = desc.split("\t")[2]; + assertEquals("c2", compartment); + component = desc.split("\t")[1]; + assertEquals("Test 1", component); + + for (String string : list) { + if (string.contains("Test2")) { + desc = string; + } + } + compartment = desc.split("\t")[2]; + assertEquals("c2", compartment); + component = desc.split("\t")[1]; + assertEquals("Test2", component); + + for (String string : list) { + if (string.contains("Test3")) { + desc = string; + } + } + compartment = desc.split("\t")[2]; + assertEquals("c2", compartment); + component = desc.split("\t")[1]; + assertEquals("Test3", component); + + list = exporter.getExportStringForOneSpecies(model.getAliasesBySpeciesId("s3").get(0), params); + boolean ok = false; + for (String string : list) { + if (string.split("\t")[2].equals("null") && string.split("\t")[1].equals("Test2")) { + ok = true; + } + } + assertTrue(ok); + + list = exporter.getExportStringForOneSpecies(model.getAliasesBySpeciesId("s4").get(0), params); + desc = list.get(0); + compartment = desc.split("\t")[2]; + assertEquals("null", compartment); + component = desc.split("\t")[1]; + assertEquals("Test3", component); + + list = exporter.getExportStringForOneSpecies(model.getAliasesBySpeciesId("s5").get(0), params); + desc = list.get(0); + compartment = desc.split("\t")[2]; + assertEquals("c3", compartment); + component = desc.split("\t")[1]; + assertEquals("null", component); + + list = exporter.getExportStringForOneSpecies(model.getAliasesBySpeciesId("s6").get(0), params); + desc = list.get(0); + compartment = desc.split("\t")[2]; + assertEquals("null", compartment); + component = desc.split("\t")[1]; + assertEquals("null", component); + + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testGetExportSpeciesStringForTabSeparatedFile2() throws Exception { + try { + Model model = getModelForFile("testFiles/export_with_artifitial_comp.xml", false); + ExportColumn columns[] = { ExportColumn.NAME, ExportColumn.ID, ExportColumn.COMPONENT_NAME, ExportColumn.COMPARTMENT_NAME, ExportColumn.TYPE }; + + ExporterParameters params = new IExporterService.ExporterParameters() + .model(model).column(columns).fileType(ExportFileType.TAB_SEPARATED).type(Object.class); + + // full export (all elements) + String string = exporter.getExportSpeciesString(params); + String lines[] = string.split("\n"); + assertTrue("Not enough elements in the result file", lines.length > 1); + + String response = lines[0]; + String textColumns[] = response.split("\t"); + assertEquals(columns.length, textColumns.length); + + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testGetExportCompartmentsString() throws Exception { + try { + Model model = getModelForFile("testFiles/export/export_compartments.xml", false); + + ExporterParameters params = new IExporterService.ExporterParameters().model(model).fileType(ExportFileType.TAB_SEPARATED).type(Object.class); + + // full export (all compartments) + String string = exporter.getExportCompartmentsString(params); + String lines[] = string.split("\n"); + assertTrue("Not enough elements in the result file", lines.length >= 2); + + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testAllExportColumnsSpecies() throws Exception { + try { + Model model = getModelForFile("testFiles/export_with_artifitial_comp.xml", false); + List<ExportColumn> columns = new ArrayList<ExportColumn>(); + for (ExportColumn column : ExportColumn.values()) { + if (column.getClazz().isAssignableFrom(Species.class)) { + columns.add(column); + } + } + + ExporterParameters params = new IExporterService.ExporterParameters().model(model).column(columns).fileType(ExportFileType.TAB_SEPARATED); + + // full export (all elements) + String string = exporter.getExportSpeciesString(params); + assertNotNull(string); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testAllExportColumnsReaction() throws Exception { + try { + Model model = getModelForFile("testFiles/export_with_artifitial_comp.xml", false); + List<ExportColumn> columns = new ArrayList<ExportColumn>(); + for (ExportColumn column : ExportColumn.values()) { + if (column.getClazz().isAssignableFrom(Reaction.class)) { + columns.add(column); + } + } + + ExporterParameters params = new IExporterService.ExporterParameters().model(model).column(columns).fileType(ExportFileType.TAB_SEPARATED); + + // full export (all elements) + String string = exporter.getExportInteractionString(params); + assertNotNull(string); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testGetTabSeparatedReaction() throws Exception { + try { + Model model = getModelForFile("testFiles/export/reaction.xml", false); + Set<CompartmentAlias> aliases = new HashSet<CompartmentAlias>(); + for (CompartmentAlias alias : model.getCompartmentsAliases()) { + if (alias.getTitle().equalsIgnoreCase("Dopamine loaded synaptic vesicle")) + aliases.add(alias); + } + + ExporterParameters params = new IExporterService.ExporterParameters().model(model).// + fileType(ExportFileType.TAB_SEPARATED).// + column(ExportColumn.REACTION_ID).// + column(ExportColumn.REACTION_TYPE).// + type(Species.class); + + String string = exporter.getExportInteractionString(params); + assertTrue(string.indexOf("STATE_TRANSITION REACTANT") >= 0); + assertTrue(string.indexOf("s2240") >= 0); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + + } + + @Test + public void test() throws Exception { + try { + Model model = getModelForFile("testFiles/export/new_line_file.xml", false); + List<ExportColumn> columns = new ArrayList<ExportColumn>(); + for (ExportColumn column : ExportColumn.values()) { + if (column.getClazz().isAssignableFrom(Species.class)) { + columns.add(column); + } + } + + ExporterParameters params = new IExporterService.ExporterParameters().model(model).column(columns).fileType(ExportFileType.TAB_SEPARATED); + + // full export (all elements) + String string = exporter.getExportSpeciesString(params); + String tmp[] = string.split("\n"); + for (String string2 : tmp) { + assertTrue(string2,columns.size()<=string2.split("\t",-1).length); + } + assertNotNull(string); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testPubmedSummary() throws Exception { + try { + Model model = getModelForFile("testFiles/export/reaction.xml", false); + List<PubmedAnnotatedElementsView> result = exporter.getPublicationModelSummary(model); + assertNotNull(result); + for (PubmedAnnotatedElementsView pubmedAnnotatedElementsView : result) { + assertNotNull(pubmedAnnotatedElementsView.getArticle()); + assertNotNull(pubmedAnnotatedElementsView.getArticle().getTitle()); + assertTrue(pubmedAnnotatedElementsView.getElements().size()>0); + } + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + +} diff --git a/service/src/test/java/lcsb/mapviewer/services/impl/LayoutServiceTest2.java b/service/src/test/java/lcsb/mapviewer/services/impl/LayoutServiceTest2.java index 278902204729c5da28b751565054a3e609177343..8f0dacdddf7c48e8ed09c96a5600fa171765bb39 100644 --- a/service/src/test/java/lcsb/mapviewer/services/impl/LayoutServiceTest2.java +++ b/service/src/test/java/lcsb/mapviewer/services/impl/LayoutServiceTest2.java @@ -1,247 +1,247 @@ -package lcsb.mapviewer.services.impl; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; - -import java.awt.Color; -import java.io.FileInputStream; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; - -import org.apache.log4j.Logger; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import lcsb.mapviewer.commands.ColorModelCommand; -import lcsb.mapviewer.common.Pair; -import lcsb.mapviewer.common.TextFileUtils; -import lcsb.mapviewer.converter.ConverterParams; -import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser; -import lcsb.mapviewer.model.map.MiriamData; -import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.layout.ColorSchema; -import lcsb.mapviewer.model.map.layout.GeneVariation; -import lcsb.mapviewer.model.map.layout.GeneVariationColorSchema; -import lcsb.mapviewer.model.map.layout.GenericColorSchema; -import lcsb.mapviewer.model.map.layout.ReferenceGenomeType; -import lcsb.mapviewer.model.map.model.Model; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.services.interfaces.ILayoutService.CreateLayoutParams; -import lcsb.mapviewer.services.utils.ColorSchemaReader; -import lcsb.mapviewer.services.utils.data.ColorSchemaColumn; -import lcsb.mapviewer.services.utils.data.ColorSchemaType; - -public class LayoutServiceTest2 { - Logger logger = Logger.getLogger(LayoutServiceTest2.class); - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testValidPreprareTableResultForGeneric() throws Exception { - try { - class CSR extends ColorSchemaReader { - public Collection<ColorSchemaColumn> getSetColorSchemaColumns(Collection<ColorSchema> schemas) { - List<ColorSchemaColumn> result = new ArrayList<ColorSchemaColumn>(); - for (ColorSchemaColumn csc : ColorSchemaColumn.values()) { - if (csc.getTypes().contains(ColorSchemaType.GENERIC)) { - result.add(csc); - } - } - return result; - } - } - ; - List<ColorSchema> schemas = new ArrayList<ColorSchema>(); - ColorSchema cs = new GenericColorSchema(); - cs.setColor(Color.CYAN); - cs.addCompartment("BLA"); - cs.addIdentifierColumn(new Pair<MiriamType, String>(MiriamType.CAS, "CAS_ID")); - cs.setLineWidth(3.3); - cs.setMatches(2); - cs.setName("UUU"); - cs.setReactionIdentifier("RE ID"); - cs.setReverseReaction(true); - cs.addType(GenericProtein.class); - cs.setValue(1111.1111); - schemas.add(cs); - - LayoutService ls = new LayoutService(); - String result = ls.prepareTableResult(schemas, new CSR()); - assertNotNull(result); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - - } - - @Test - public void testValidPreprareTableResultForGeneVariation() throws Exception { - try { - class CSR extends ColorSchemaReader { - public Collection<ColorSchemaColumn> getSetColorSchemaColumns(Collection<ColorSchema> schemas) { - List<ColorSchemaColumn> result = new ArrayList<ColorSchemaColumn>(); - for (ColorSchemaColumn csc : ColorSchemaColumn.values()) { - if (csc.getTypes().contains(ColorSchemaType.GENETIC_VARIANT)) { - result.add(csc); - } - } - return result; - } - } - ; - List<ColorSchema> schemas = new ArrayList<ColorSchema>(); - GeneVariationColorSchema cs = new GeneVariationColorSchema(); - cs.setColor(Color.CYAN); - cs.addCompartment("BLA"); - cs.addIdentifierColumn(new Pair<MiriamType, String>(MiriamType.CAS, "CAS_ID")); - cs.setLineWidth(3.3); - cs.setMatches(2); - cs.setName("UUU"); - cs.setReactionIdentifier("RE ID"); - cs.setReverseReaction(true); - cs.addType(GenericProtein.class); - cs.setValue(1111.1111); - GeneVariation gv = new GeneVariation(); - gv.setModifiedDna("C"); - gv.setContig("chr1"); - gv.setOriginalDna("T"); - gv.setPosition(12); - gv.setReferenceGenomeType(ReferenceGenomeType.UCSC); - gv.setReferenceGenomeVersion("hg19"); - cs.addGeneVariation(gv); - GeneVariation gv2 = new GeneVariation(); - gv2.setModifiedDna("CC"); - gv2.setContig("chr2"); - gv2.setOriginalDna("TT"); - gv2.setPosition(124); - gv2.setReferenceGenomeType(ReferenceGenomeType.UCSC); - gv2.setReferenceGenomeVersion("hg18"); - gv2.addReference(new MiriamData(MiriamType.CHEBI, "XXX")); - cs.addGeneVariation(gv2); - schemas.add(cs); - - LayoutService ls = new LayoutService(); - String result = ls.prepareTableResult(schemas, new CSR()); - assertNotNull(result); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - - } - - @Test - public void testEmptyPreprareTableResultForGeneric() throws Exception { - try { - class CSR extends ColorSchemaReader { - public Collection<ColorSchemaColumn> getSetColorSchemaColumns(Collection<ColorSchema> schemas) { - List<ColorSchemaColumn> result = new ArrayList<ColorSchemaColumn>(); - for (ColorSchemaColumn csc : ColorSchemaColumn.values()) { - if (csc.getTypes().contains(ColorSchemaType.GENERIC)) { - result.add(csc); - } - } - return result; - } - } - ; - List<ColorSchema> schemas = new ArrayList<ColorSchema>(); - ColorSchema cs = new GenericColorSchema(); - schemas.add(cs); - - LayoutService ls = new LayoutService(); - String result = ls.prepareTableResult(schemas, new CSR()); - assertNotNull(result); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - - } - - @Test - public void testEmptyPreprareTableResultForGeneVariant() throws Exception { - try { - class CSR extends ColorSchemaReader { - public Collection<ColorSchemaColumn> getSetColorSchemaColumns(Collection<ColorSchema> schemas) { - List<ColorSchemaColumn> result = new ArrayList<ColorSchemaColumn>(); - for (ColorSchemaColumn csc : ColorSchemaColumn.values()) { - if (csc.getTypes().contains(ColorSchemaType.GENETIC_VARIANT)) { - result.add(csc); - } - } - return result; - } - } - ; - List<ColorSchema> schemas = new ArrayList<ColorSchema>(); - ColorSchema cs = new GeneVariationColorSchema(); - schemas.add(cs); - - LayoutService ls = new LayoutService(); - String result = ls.prepareTableResult(schemas, new CSR()); - assertNotNull(result); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - - } - - @Test - public void testGetLayoutAliasesForInvalidAlias() throws Exception { - try { - - Model model = new CellDesignerXmlParser().createModel(new ConverterParams().filename("testFiles/coloring/problematicModel2.xml")); - - FileInputStream fis = new FileInputStream("testFiles/coloring/problematicSchema2.txt"); - CreateLayoutParams params = new CreateLayoutParams().name("Test").// - directory("testDir").// - model(model).// - colorInputStream(fis).// - async(false); - ColorSchemaReader reader = new ColorSchemaReader(); - final Collection<ColorSchema> schemas = reader - .readColorSchema(params.getColorInputStream(), TextFileUtils.getHeaderParametersFromFile(params.getColorInputStream())); - - ColorModelCommand command = new ColorModelCommand(model, schemas); - command.execute(); - - command.getModifiedElements(); - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testSchemaWithCompartments() throws Exception { - try { - FileInputStream fis = new FileInputStream("testFiles/coloring/schemaWithCompartment.txt"); - ColorSchemaReader reader = new ColorSchemaReader(); - final Collection<ColorSchema> schemas = reader.readColorSchema(fis, new HashMap<>()); - for (ColorSchema colorSchema : schemas) { - for (String string : colorSchema.getCompartments()) { - assertNotNull(string); - assertFalse(string.isEmpty()); - } - } - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - -} +package lcsb.mapviewer.services.impl; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; + +import java.awt.Color; +import java.io.FileInputStream; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; + +import org.apache.log4j.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import lcsb.mapviewer.commands.ColorModelCommand; +import lcsb.mapviewer.common.Pair; +import lcsb.mapviewer.common.TextFileUtils; +import lcsb.mapviewer.converter.ConverterParams; +import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.model.map.MiriamData; +import lcsb.mapviewer.model.map.MiriamType; +import lcsb.mapviewer.model.map.layout.ColorSchema; +import lcsb.mapviewer.model.map.layout.GeneVariation; +import lcsb.mapviewer.model.map.layout.GeneVariationColorSchema; +import lcsb.mapviewer.model.map.layout.GenericColorSchema; +import lcsb.mapviewer.model.map.layout.ReferenceGenomeType; +import lcsb.mapviewer.model.map.model.Model; +import lcsb.mapviewer.services.interfaces.ILayoutService.CreateLayoutParams; +import lcsb.mapviewer.services.utils.ColorSchemaReader; +import lcsb.mapviewer.services.utils.data.ColorSchemaColumn; +import lcsb.mapviewer.services.utils.data.ColorSchemaType; + +public class LayoutServiceTest2 { + Logger logger = Logger.getLogger(LayoutServiceTest2.class); + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testValidPreprareTableResultForGeneric() throws Exception { + try { + class CSR extends ColorSchemaReader { + public Collection<ColorSchemaColumn> getSetColorSchemaColumns(Collection<ColorSchema> schemas) { + List<ColorSchemaColumn> result = new ArrayList<ColorSchemaColumn>(); + for (ColorSchemaColumn csc : ColorSchemaColumn.values()) { + if (csc.getTypes().contains(ColorSchemaType.GENERIC)) { + result.add(csc); + } + } + return result; + } + } + ; + List<ColorSchema> schemas = new ArrayList<ColorSchema>(); + ColorSchema cs = new GenericColorSchema(); + cs.setColor(Color.CYAN); + cs.addCompartment("BLA"); + cs.addIdentifierColumn(new Pair<MiriamType, String>(MiriamType.CAS, "CAS_ID")); + cs.setLineWidth(3.3); + cs.setMatches(2); + cs.setName("UUU"); + cs.setReactionIdentifier("RE ID"); + cs.setReverseReaction(true); + cs.addType(GenericProtein.class); + cs.setValue(1111.1111); + schemas.add(cs); + + LayoutService ls = new LayoutService(); + String result = ls.prepareTableResult(schemas, new CSR()); + assertNotNull(result); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + + } + + @Test + public void testValidPreprareTableResultForGeneVariation() throws Exception { + try { + class CSR extends ColorSchemaReader { + public Collection<ColorSchemaColumn> getSetColorSchemaColumns(Collection<ColorSchema> schemas) { + List<ColorSchemaColumn> result = new ArrayList<ColorSchemaColumn>(); + for (ColorSchemaColumn csc : ColorSchemaColumn.values()) { + if (csc.getTypes().contains(ColorSchemaType.GENETIC_VARIANT)) { + result.add(csc); + } + } + return result; + } + } + ; + List<ColorSchema> schemas = new ArrayList<ColorSchema>(); + GeneVariationColorSchema cs = new GeneVariationColorSchema(); + cs.setColor(Color.CYAN); + cs.addCompartment("BLA"); + cs.addIdentifierColumn(new Pair<MiriamType, String>(MiriamType.CAS, "CAS_ID")); + cs.setLineWidth(3.3); + cs.setMatches(2); + cs.setName("UUU"); + cs.setReactionIdentifier("RE ID"); + cs.setReverseReaction(true); + cs.addType(GenericProtein.class); + cs.setValue(1111.1111); + GeneVariation gv = new GeneVariation(); + gv.setModifiedDna("C"); + gv.setContig("chr1"); + gv.setOriginalDna("T"); + gv.setPosition(12); + gv.setReferenceGenomeType(ReferenceGenomeType.UCSC); + gv.setReferenceGenomeVersion("hg19"); + cs.addGeneVariation(gv); + GeneVariation gv2 = new GeneVariation(); + gv2.setModifiedDna("CC"); + gv2.setContig("chr2"); + gv2.setOriginalDna("TT"); + gv2.setPosition(124); + gv2.setReferenceGenomeType(ReferenceGenomeType.UCSC); + gv2.setReferenceGenomeVersion("hg18"); + gv2.addReference(new MiriamData(MiriamType.CHEBI, "XXX")); + cs.addGeneVariation(gv2); + schemas.add(cs); + + LayoutService ls = new LayoutService(); + String result = ls.prepareTableResult(schemas, new CSR()); + assertNotNull(result); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + + } + + @Test + public void testEmptyPreprareTableResultForGeneric() throws Exception { + try { + class CSR extends ColorSchemaReader { + public Collection<ColorSchemaColumn> getSetColorSchemaColumns(Collection<ColorSchema> schemas) { + List<ColorSchemaColumn> result = new ArrayList<ColorSchemaColumn>(); + for (ColorSchemaColumn csc : ColorSchemaColumn.values()) { + if (csc.getTypes().contains(ColorSchemaType.GENERIC)) { + result.add(csc); + } + } + return result; + } + } + ; + List<ColorSchema> schemas = new ArrayList<ColorSchema>(); + ColorSchema cs = new GenericColorSchema(); + schemas.add(cs); + + LayoutService ls = new LayoutService(); + String result = ls.prepareTableResult(schemas, new CSR()); + assertNotNull(result); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + + } + + @Test + public void testEmptyPreprareTableResultForGeneVariant() throws Exception { + try { + class CSR extends ColorSchemaReader { + public Collection<ColorSchemaColumn> getSetColorSchemaColumns(Collection<ColorSchema> schemas) { + List<ColorSchemaColumn> result = new ArrayList<ColorSchemaColumn>(); + for (ColorSchemaColumn csc : ColorSchemaColumn.values()) { + if (csc.getTypes().contains(ColorSchemaType.GENETIC_VARIANT)) { + result.add(csc); + } + } + return result; + } + } + ; + List<ColorSchema> schemas = new ArrayList<ColorSchema>(); + ColorSchema cs = new GeneVariationColorSchema(); + schemas.add(cs); + + LayoutService ls = new LayoutService(); + String result = ls.prepareTableResult(schemas, new CSR()); + assertNotNull(result); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + + } + + @Test + public void testGetLayoutAliasesForInvalidAlias() throws Exception { + try { + + Model model = new CellDesignerXmlParser().createModel(new ConverterParams().filename("testFiles/coloring/problematicModel2.xml")); + + FileInputStream fis = new FileInputStream("testFiles/coloring/problematicSchema2.txt"); + CreateLayoutParams params = new CreateLayoutParams().name("Test").// + directory("testDir").// + model(model).// + colorInputStream(fis).// + async(false); + ColorSchemaReader reader = new ColorSchemaReader(); + final Collection<ColorSchema> schemas = reader + .readColorSchema(params.getColorInputStream(), TextFileUtils.getHeaderParametersFromFile(params.getColorInputStream())); + + ColorModelCommand command = new ColorModelCommand(model, schemas); + command.execute(); + + command.getModifiedElements(); + + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testSchemaWithCompartments() throws Exception { + try { + FileInputStream fis = new FileInputStream("testFiles/coloring/schemaWithCompartment.txt"); + ColorSchemaReader reader = new ColorSchemaReader(); + final Collection<ColorSchema> schemas = reader.readColorSchema(fis, new HashMap<>()); + for (ColorSchema colorSchema : schemas) { + for (String string : colorSchema.getCompartments()) { + assertNotNull(string); + assertFalse(string.isEmpty()); + } + } + + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + +} diff --git a/service/src/test/java/lcsb/mapviewer/services/impl/LogServiceTest.java b/service/src/test/java/lcsb/mapviewer/services/impl/LogServiceTest.java index 5a6d651f390774f4726c5d741bb99a44c683c84a..f372dffd72e7d4978c75c137ca19a6ab6ac7e20f 100644 --- a/service/src/test/java/lcsb/mapviewer/services/impl/LogServiceTest.java +++ b/service/src/test/java/lcsb/mapviewer/services/impl/LogServiceTest.java @@ -1,134 +1,134 @@ -package lcsb.mapviewer.services.impl; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -import java.util.Set; - -import lcsb.mapviewer.common.Configuration; -import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.Project; -import lcsb.mapviewer.model.log.GenericLog; -import lcsb.mapviewer.model.log.LogType; -import lcsb.mapviewer.model.map.Element; -import lcsb.mapviewer.model.map.graph.DataMining; -import lcsb.mapviewer.model.map.model.Model; -import lcsb.mapviewer.services.ServiceTestFunctions; -import lcsb.mapviewer.services.interfaces.ILogService.LogParams; - -import org.apache.log4j.Logger; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.springframework.test.annotation.Rollback; - -@Rollback(true) -public class LogServiceTest extends ServiceTestFunctions { - - static Logger logger = Logger.getLogger(LogServiceTest.class); - - private Model model; - private Project project; - private Set<Element> nodes; - private Element node; - private DataMining mc; - - @Before - public void setUp() throws Exception { - try { - model = getModelForFile("testFiles/graph_path_example3.xml", false); - project = new Project(); - project.addModel(model); - projectDao.add(project); - modelDao.add(model); - nodes = model.getElements(); - node = nodes.iterator().next(); - - mc = new DataMining(); - mc.setElement(node); - missingConnectionDao.add(mc); - - createUser(); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @After - public void tearDown() throws Exception { - try { - missingConnectionDao.delete(mc); - modelDao.delete(model); - projectDao.delete(project); - userDao.delete(user); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testLog1() throws Exception { - try { - logService.setLoggedUser(null); - LogParams params = new LogParams().type(LogType.ADD_MISSING_CONNECTION).description("bla").object(mc); - GenericLog log = logService.log(params); - assertEquals(userService.getUserByLogin(Configuration.ANONYMOUS_LOGIN), log.getUser()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testLog2() throws Exception { - try { - LogParams params = new LogParams().type(LogType.ADD_MISSING_CONNECTION).description("bla").user(user); - GenericLog log = logService.log(params); - logDao.delete(log); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testLog3() { - try { - LogParams params = new LogParams().type(LogType.ADD_MISSING_CONNECTION).description("bla").user(user).object(new DataMining()); - logService.log(params); - fail("Exception expected"); - } catch (InvalidArgumentException e) { - - } - } - - @Test - public void testLog4() { - try { - LogParams params = new LogParams().description("bla").user(user).object(mc); - logService.log(params); - fail("Exception expected"); - } catch (InvalidArgumentException e) { - - } - } - - @Test - public void testLog5() throws Exception { - try { - LogParams params = new LogParams().type(LogType.ADD_MISSING_CONNECTION).description("bla").user(user).object(mc).object(mc); - GenericLog log = logService.log(params); - assertNotNull(log); - assertNotNull(log.getId()); - assertNotNull(logDao.getById(log.getId())); - logDao.delete(log); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - -} +package lcsb.mapviewer.services.impl; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + +import java.util.Set; + +import lcsb.mapviewer.common.Configuration; +import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.model.Project; +import lcsb.mapviewer.model.log.GenericLog; +import lcsb.mapviewer.model.log.LogType; +import lcsb.mapviewer.model.map.graph.DataMining; +import lcsb.mapviewer.model.map.model.Model; +import lcsb.mapviewer.services.ServiceTestFunctions; +import lcsb.mapviewer.services.interfaces.ILogService.LogParams; + +import org.apache.log4j.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.springframework.test.annotation.Rollback; + +@Rollback(true) +public class LogServiceTest extends ServiceTestFunctions { + + static Logger logger = Logger.getLogger(LogServiceTest.class); + + private Model model; + private Project project; + private Set<Element> nodes; + private Element node; + private DataMining mc; + + @Before + public void setUp() throws Exception { + try { + model = getModelForFile("testFiles/graph_path_example3.xml", false); + project = new Project(); + project.addModel(model); + projectDao.add(project); + modelDao.add(model); + nodes = model.getElements(); + node = nodes.iterator().next(); + + mc = new DataMining(); + mc.setElement(node); + missingConnectionDao.add(mc); + + createUser(); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @After + public void tearDown() throws Exception { + try { + missingConnectionDao.delete(mc); + modelDao.delete(model); + projectDao.delete(project); + userDao.delete(user); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testLog1() throws Exception { + try { + logService.setLoggedUser(null); + LogParams params = new LogParams().type(LogType.ADD_MISSING_CONNECTION).description("bla").object(mc); + GenericLog log = logService.log(params); + assertEquals(userService.getUserByLogin(Configuration.ANONYMOUS_LOGIN), log.getUser()); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testLog2() throws Exception { + try { + LogParams params = new LogParams().type(LogType.ADD_MISSING_CONNECTION).description("bla").user(user); + GenericLog log = logService.log(params); + logDao.delete(log); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testLog3() { + try { + LogParams params = new LogParams().type(LogType.ADD_MISSING_CONNECTION).description("bla").user(user).object(new DataMining()); + logService.log(params); + fail("Exception expected"); + } catch (InvalidArgumentException e) { + + } + } + + @Test + public void testLog4() { + try { + LogParams params = new LogParams().description("bla").user(user).object(mc); + logService.log(params); + fail("Exception expected"); + } catch (InvalidArgumentException e) { + + } + } + + @Test + public void testLog5() throws Exception { + try { + LogParams params = new LogParams().type(LogType.ADD_MISSING_CONNECTION).description("bla").user(user).object(mc).object(mc); + GenericLog log = logService.log(params); + assertNotNull(log); + assertNotNull(log.getId()); + assertNotNull(logDao.getById(log.getId())); + logDao.delete(log); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + +} diff --git a/service/src/test/java/lcsb/mapviewer/services/impl/ProjectServiceTest.java b/service/src/test/java/lcsb/mapviewer/services/impl/ProjectServiceTest.java index f48ace29ad4616fd67cdb19c10e0ec5c9942ebd6..bf372378552391f023855dabf5305d63e0180b6c 100644 --- a/service/src/test/java/lcsb/mapviewer/services/impl/ProjectServiceTest.java +++ b/service/src/test/java/lcsb/mapviewer/services/impl/ProjectServiceTest.java @@ -29,20 +29,20 @@ import lcsb.mapviewer.commands.CopyCommand; import lcsb.mapviewer.converter.ComplexZipConverter; import lcsb.mapviewer.converter.ComplexZipConverterParams; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; import lcsb.mapviewer.converter.zip.ModelZipEntryFile; import lcsb.mapviewer.converter.zip.ZipEntryFile; import lcsb.mapviewer.converter.zip.ZipEntryFileFactory; import lcsb.mapviewer.model.Project; import lcsb.mapviewer.model.ProjectStatus; import lcsb.mapviewer.model.map.AnnotatedObject; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.Layout; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelSubmodelConnection; import lcsb.mapviewer.model.map.model.SubmodelType; -import lcsb.mapviewer.model.map.species.Protein; import lcsb.mapviewer.model.user.ObjectPrivilege; import lcsb.mapviewer.model.user.PrivilegeType; import lcsb.mapviewer.model.user.User; diff --git a/service/src/test/java/lcsb/mapviewer/services/impl/SearchServiceTest.java b/service/src/test/java/lcsb/mapviewer/services/impl/SearchServiceTest.java index a677f5a753372c065b9f90189e908c6141f6d3cc..4f1bb907935cb869e22c575d6aabac72cb35e26a 100644 --- a/service/src/test/java/lcsb/mapviewer/services/impl/SearchServiceTest.java +++ b/service/src/test/java/lcsb/mapviewer/services/impl/SearchServiceTest.java @@ -18,6 +18,16 @@ import org.junit.Test; import lcsb.mapviewer.annotation.data.Drug; import lcsb.mapviewer.common.Configuration; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Degraded; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Ion; +import lcsb.mapviewer.converter.model.celldesigner.structure.Phenotype; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; +import lcsb.mapviewer.converter.model.celldesigner.structure.Unknown; import lcsb.mapviewer.model.Project; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; @@ -29,16 +39,6 @@ import lcsb.mapviewer.model.map.layout.alias.SpeciesAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelFullIndexed; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Degraded; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Ion; -import lcsb.mapviewer.model.map.species.Phenotype; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; -import lcsb.mapviewer.model.map.species.SimpleMolecule; -import lcsb.mapviewer.model.map.species.Unknown; import lcsb.mapviewer.services.ServiceTestFunctions; import lcsb.mapviewer.services.interfaces.ISearchService.CoordinatesSearchParams; import lcsb.mapviewer.services.search.data.FullAliasView; diff --git a/service/src/test/java/lcsb/mapviewer/services/search/SearchResultFactoryTest.java b/service/src/test/java/lcsb/mapviewer/services/search/SearchResultFactoryTest.java index 930de2e9869d0f81993e74ae816261a2c79a7993..e144cedee6cc7d176d234645212d31d2520c3b4c 100644 --- a/service/src/test/java/lcsb/mapviewer/services/search/SearchResultFactoryTest.java +++ b/service/src/test/java/lcsb/mapviewer/services/search/SearchResultFactoryTest.java @@ -8,10 +8,10 @@ import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.species.Rna; import lcsb.mapviewer.services.ServiceTestFunctions; import lcsb.mapviewer.services.search.db.DbSearchCriteria; import lcsb.mapviewer.services.search.db.GeneRow; diff --git a/service/src/test/java/lcsb/mapviewer/services/search/data/FullAliasViewFactoryTest.java b/service/src/test/java/lcsb/mapviewer/services/search/data/FullAliasViewFactoryTest.java index cea3dbadde8aeb7200281188e1a25ae11cf73388..efe150fa185e21156c5f3e2c69d2c8237ee2305f 100644 --- a/service/src/test/java/lcsb/mapviewer/services/search/data/FullAliasViewFactoryTest.java +++ b/service/src/test/java/lcsb/mapviewer/services/search/data/FullAliasViewFactoryTest.java @@ -21,11 +21,14 @@ import org.springframework.beans.factory.annotation.Autowired; import lcsb.mapviewer.annotation.data.Chebi; import lcsb.mapviewer.annotation.services.annotators.ChebiAnnotator; +import lcsb.mapviewer.converter.model.celldesigner.structure.Compartment; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; import lcsb.mapviewer.model.graphics.PolylineData; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.agregator.Compartment; import lcsb.mapviewer.model.map.layout.Layout; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; @@ -37,9 +40,6 @@ import lcsb.mapviewer.model.map.reaction.Product; import lcsb.mapviewer.model.map.reaction.Reactant; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.type.NegativeInfluenceReaction; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Species; import lcsb.mapviewer.services.ServiceTestFunctions; import lcsb.mapviewer.services.overlay.ChebiTreeRow; diff --git a/service/src/test/java/lcsb/mapviewer/services/search/db/chemical/ChemicalServiceTest.java b/service/src/test/java/lcsb/mapviewer/services/search/db/chemical/ChemicalServiceTest.java index be4ba23f734bb2cd4571fb46d5f3ac7711f73ef1..5806f92d3e9e3849f682ff30d2e55e16b4d8ccf3 100644 --- a/service/src/test/java/lcsb/mapviewer/services/search/db/chemical/ChemicalServiceTest.java +++ b/service/src/test/java/lcsb/mapviewer/services/search/db/chemical/ChemicalServiceTest.java @@ -1,101 +1,101 @@ -package lcsb.mapviewer.services.search.db.chemical; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.log4j.Logger; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import lcsb.mapviewer.model.map.Element; -import lcsb.mapviewer.model.map.MiriamData; -import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.species.Rna; -import lcsb.mapviewer.services.ServiceTestFunctions; -import lcsb.mapviewer.services.search.db.DbSearchCriteria; - -public class ChemicalServiceTest extends ServiceTestFunctions { - Logger logger = Logger.getLogger(ChemicalServiceTest.class); - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - /** - * @throws Exception - */ - @Test - public void testgetPDChemicalByName() throws Exception { - try { - List<ChemicalView> result = null; - MiriamData pdDiseaseID = new MiriamData(MiriamType.MESH_2012, "D010300"); - - List<String> names = new ArrayList<String>(); - names.add("Dopamine"); - names.add("2-(2-furanyl)-7-(2-(4-(4-(2-methoxyethoxy)phenyl)-1-piperazinyl)ethyl)-7H-pyrazolo(4,3-e)(1,2,4)triazolo(1,5-c)pyrimidine-5-amine"); - names.add("Anti-Inflammatory Agents, Non-Steroidal"); - names.add("2-furanyl"); - names.add(null); - result = chemicalService.getByNames(names, new DbSearchCriteria().disease(pdDiseaseID)); - assertNotNull(result); - assertTrue(!result.isEmpty()); - assertTrue(result.size() == 3); - names.clear(); - names.add("2-furanyl"); - result = chemicalService.getByNames(names, new DbSearchCriteria().disease(pdDiseaseID)); - assertNotNull(result); - assertTrue(result.isEmpty()); - - assertEquals("No warnings expected.", 0, getWarnings().size()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testgetPDChemicalByName2() throws Exception { - try { - MiriamData pdDiseaseID = new MiriamData(MiriamType.MESH_2012, "D010300"); - String name = "Amphetamine"; - ChemicalView result = chemicalService.getByName(name, new DbSearchCriteria().disease(pdDiseaseID)); - assertNotNull(result); - assertEquals("D000661", result.getSourceLink().getName()); - - assertEquals("No warnings expected.", 0, getWarnings().size()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testSearchByElements4() throws Exception { - try { - List<Element> elements = new ArrayList<Element>(); - Rna protein = new Rna(); - protein.setName("GDNF"); - elements.add(protein); - - List<ChemicalView> chemicals = chemicalService.getForTargets(elements, new DbSearchCriteria().disease(new MiriamData(MiriamType.MESH_2012, "D010300"))); - assertNotNull(chemicals); - assertTrue(chemicals.size() > 0); - - assertEquals("No warnings expected.", 0, getWarnings().size()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - - } - -} +package lcsb.mapviewer.services.search.db.chemical; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; +import lcsb.mapviewer.model.map.MiriamData; +import lcsb.mapviewer.model.map.MiriamType; +import lcsb.mapviewer.services.ServiceTestFunctions; +import lcsb.mapviewer.services.search.db.DbSearchCriteria; + +public class ChemicalServiceTest extends ServiceTestFunctions { + Logger logger = Logger.getLogger(ChemicalServiceTest.class); + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + /** + * @throws Exception + */ + @Test + public void testgetPDChemicalByName() throws Exception { + try { + List<ChemicalView> result = null; + MiriamData pdDiseaseID = new MiriamData(MiriamType.MESH_2012, "D010300"); + + List<String> names = new ArrayList<String>(); + names.add("Dopamine"); + names.add("2-(2-furanyl)-7-(2-(4-(4-(2-methoxyethoxy)phenyl)-1-piperazinyl)ethyl)-7H-pyrazolo(4,3-e)(1,2,4)triazolo(1,5-c)pyrimidine-5-amine"); + names.add("Anti-Inflammatory Agents, Non-Steroidal"); + names.add("2-furanyl"); + names.add(null); + result = chemicalService.getByNames(names, new DbSearchCriteria().disease(pdDiseaseID)); + assertNotNull(result); + assertTrue(!result.isEmpty()); + assertTrue(result.size() == 3); + names.clear(); + names.add("2-furanyl"); + result = chemicalService.getByNames(names, new DbSearchCriteria().disease(pdDiseaseID)); + assertNotNull(result); + assertTrue(result.isEmpty()); + + assertEquals("No warnings expected.", 0, getWarnings().size()); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testgetPDChemicalByName2() throws Exception { + try { + MiriamData pdDiseaseID = new MiriamData(MiriamType.MESH_2012, "D010300"); + String name = "Amphetamine"; + ChemicalView result = chemicalService.getByName(name, new DbSearchCriteria().disease(pdDiseaseID)); + assertNotNull(result); + assertEquals("D000661", result.getSourceLink().getName()); + + assertEquals("No warnings expected.", 0, getWarnings().size()); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testSearchByElements4() throws Exception { + try { + List<Element> elements = new ArrayList<Element>(); + Rna protein = new Rna(); + protein.setName("GDNF"); + elements.add(protein); + + List<ChemicalView> chemicals = chemicalService.getForTargets(elements, new DbSearchCriteria().disease(new MiriamData(MiriamType.MESH_2012, "D010300"))); + assertNotNull(chemicals); + assertTrue(chemicals.size() > 0); + + assertEquals("No warnings expected.", 0, getWarnings().size()); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + + } + +} diff --git a/service/src/test/java/lcsb/mapviewer/services/search/db/drug/DrugServiceTest.java b/service/src/test/java/lcsb/mapviewer/services/search/db/drug/DrugServiceTest.java index 6c1aecbfa2192233ab7e45bbe4b99ce64554249f..355a1dd62e176aa0b93396036e13e726c4715ccb 100644 --- a/service/src/test/java/lcsb/mapviewer/services/search/db/drug/DrugServiceTest.java +++ b/service/src/test/java/lcsb/mapviewer/services/search/db/drug/DrugServiceTest.java @@ -16,17 +16,17 @@ import lcsb.mapviewer.annotation.services.TaxonomyBackend; import lcsb.mapviewer.converter.ComplexZipConverter; import lcsb.mapviewer.converter.ComplexZipConverterParams; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.GenericProtein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; import lcsb.mapviewer.converter.zip.ModelZipEntryFile; import lcsb.mapviewer.converter.zip.ZipEntryFile; import lcsb.mapviewer.model.Project; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelFullIndexed; import lcsb.mapviewer.model.map.model.SubmodelType; -import lcsb.mapviewer.model.map.species.GenericProtein; -import lcsb.mapviewer.model.map.species.Protein; import lcsb.mapviewer.services.ServiceTestFunctions; import lcsb.mapviewer.services.search.db.TargetView; import lcsb.mapviewer.services.search.db.DbSearchCriteria; diff --git a/service/src/test/java/lcsb/mapviewer/services/search/db/drug/DrugViewFactoryTest.java b/service/src/test/java/lcsb/mapviewer/services/search/db/drug/DrugViewFactoryTest.java index d82ef8d9b6724351fef18231cc096351090ff8f0..d6b93643f664ffd20ed4878c3f71c25d47e75cac 100644 --- a/service/src/test/java/lcsb/mapviewer/services/search/db/drug/DrugViewFactoryTest.java +++ b/service/src/test/java/lcsb/mapviewer/services/search/db/drug/DrugViewFactoryTest.java @@ -1,155 +1,155 @@ -package lcsb.mapviewer.services.search.db.drug; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.log4j.Logger; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; - -import lcsb.mapviewer.annotation.data.Drug; -import lcsb.mapviewer.annotation.data.Target; -import lcsb.mapviewer.annotation.data.TargetType; -import lcsb.mapviewer.model.map.MiriamData; -import lcsb.mapviewer.model.map.layout.alias.Alias; -import lcsb.mapviewer.model.map.model.Model; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.services.ServiceTestFunctions; -import lcsb.mapviewer.services.overlay.IconManager; -import lcsb.mapviewer.services.search.data.ElementIdentifier; -import lcsb.mapviewer.services.search.db.TargetDetails; -import lcsb.mapviewer.services.search.db.TargetView; -import lcsb.mapviewer.services.search.db.TargetViewFactory; -import lcsb.mapviewer.services.view.AnnotationView; -import lcsb.mapviewer.services.view.AnnotationViewFactory; - -public class DrugViewFactoryTest extends ServiceTestFunctions { - - @Autowired - TargetViewFactory targetViewFactory; - - Logger logger = Logger.getLogger(DrugViewFactoryTest.class); - - @Autowired - AnnotationViewFactory avFactory; - - @Autowired - DrugViewFactory dvf; - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testGeneToOverlayList() throws Exception { - try { - Model model = getModelForFile("testFiles/drug_target.xml", true); - model.setTileSize(256); - List<Model> models = new ArrayList<>(); - models.add(model); - - AnnotationView annotation = avFactory.create(new MiriamData()); - annotation.setName("M"); - - List<ElementIdentifier> overlays = dvf.geneToOverlayList(annotation, IconManager.getInstance().getEmpyIcon(), models); - assertEquals(1, overlays.size()); - - annotation.setName("GRIN2B"); - overlays = dvf.geneToOverlayList(annotation, IconManager.getInstance().getEmpyIcon(), models); - assertEquals(3, overlays.size()); - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testComplexToOverlayList() throws Exception { - try { - Drug drug = chemblParser.findDrug("AMANTADINE"); - Target exampleTarget = null; - assertTrue(drug.getTargets().size() > 0); - for (Target target : drug.getTargets()) { - if (target.getName().equals("Glutamate [NMDA] receptor")) { - target.setType(TargetType.COMPLEX_PROTEIN); - exampleTarget = target; - } - logger.debug(target); - } - assertNotNull(exampleTarget); - Model model = getModelForFile("testFiles/drug_target.xml", true); - model.setTileSize(256); - List<Model> models = new ArrayList<>(); - models.add(model); - TargetView view = targetViewFactory.create(exampleTarget); - view.setIcon(IconManager.getInstance().getEmpyIcon()); - - List<ElementIdentifier> overlays = dvf.complexToOverlayList(view, models); - assertEquals(2, overlays.size()); - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testgetElementInformationForResult() throws Exception { - try { - Drug drug = chemblParser.findDrug("AMANTADINE"); - Model model = getModelForFile("testFiles/drug_target.xml", false); - Species species = model.getSpeciesBySpeciesId("s9"); - species.setName("M"); - Alias alias = model.getAliasesBySpeciesId(species.getElementId()).get(0); - alias.setId(12); - model.removeAlias(alias); - model.addAlias(alias); - ElementIdentifier ei = new ElementIdentifier(alias, null); - model.setTileSize(256); - List<Model> models = new ArrayList<>(); - models.add(model); - DrugView view = dvf.create(drug); - TargetDetails result = dvf.getElementInformationForResult(view.getTargetRows(), ei, model); - assertNotNull(result); - assertFalse(result.getDatabaseSource().equals(result.getReferences().get(0))); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testCreateEmpty() throws Exception { - try { - Object object = dvf.create(null); - assertNotNull(object); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testCreateGson() throws Exception { - try { - DrugView object = dvf.create(null); - assertNotNull(dvf.createGson(object)); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - -} +package lcsb.mapviewer.services.search.db.drug; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import lcsb.mapviewer.annotation.data.Drug; +import lcsb.mapviewer.annotation.data.Target; +import lcsb.mapviewer.annotation.data.TargetType; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; +import lcsb.mapviewer.model.map.MiriamData; +import lcsb.mapviewer.model.map.layout.alias.Alias; +import lcsb.mapviewer.model.map.model.Model; +import lcsb.mapviewer.services.ServiceTestFunctions; +import lcsb.mapviewer.services.overlay.IconManager; +import lcsb.mapviewer.services.search.data.ElementIdentifier; +import lcsb.mapviewer.services.search.db.TargetDetails; +import lcsb.mapviewer.services.search.db.TargetView; +import lcsb.mapviewer.services.search.db.TargetViewFactory; +import lcsb.mapviewer.services.view.AnnotationView; +import lcsb.mapviewer.services.view.AnnotationViewFactory; + +public class DrugViewFactoryTest extends ServiceTestFunctions { + + @Autowired + TargetViewFactory targetViewFactory; + + Logger logger = Logger.getLogger(DrugViewFactoryTest.class); + + @Autowired + AnnotationViewFactory avFactory; + + @Autowired + DrugViewFactory dvf; + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testGeneToOverlayList() throws Exception { + try { + Model model = getModelForFile("testFiles/drug_target.xml", true); + model.setTileSize(256); + List<Model> models = new ArrayList<>(); + models.add(model); + + AnnotationView annotation = avFactory.create(new MiriamData()); + annotation.setName("M"); + + List<ElementIdentifier> overlays = dvf.geneToOverlayList(annotation, IconManager.getInstance().getEmpyIcon(), models); + assertEquals(1, overlays.size()); + + annotation.setName("GRIN2B"); + overlays = dvf.geneToOverlayList(annotation, IconManager.getInstance().getEmpyIcon(), models); + assertEquals(3, overlays.size()); + + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testComplexToOverlayList() throws Exception { + try { + Drug drug = chemblParser.findDrug("AMANTADINE"); + Target exampleTarget = null; + assertTrue(drug.getTargets().size() > 0); + for (Target target : drug.getTargets()) { + if (target.getName().equals("Glutamate [NMDA] receptor")) { + target.setType(TargetType.COMPLEX_PROTEIN); + exampleTarget = target; + } + logger.debug(target); + } + assertNotNull(exampleTarget); + Model model = getModelForFile("testFiles/drug_target.xml", true); + model.setTileSize(256); + List<Model> models = new ArrayList<>(); + models.add(model); + TargetView view = targetViewFactory.create(exampleTarget); + view.setIcon(IconManager.getInstance().getEmpyIcon()); + + List<ElementIdentifier> overlays = dvf.complexToOverlayList(view, models); + assertEquals(2, overlays.size()); + + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testgetElementInformationForResult() throws Exception { + try { + Drug drug = chemblParser.findDrug("AMANTADINE"); + Model model = getModelForFile("testFiles/drug_target.xml", false); + Species species = model.getSpeciesBySpeciesId("s9"); + species.setName("M"); + Alias alias = model.getAliasesBySpeciesId(species.getElementId()).get(0); + alias.setId(12); + model.removeAlias(alias); + model.addAlias(alias); + ElementIdentifier ei = new ElementIdentifier(alias, null); + model.setTileSize(256); + List<Model> models = new ArrayList<>(); + models.add(model); + DrugView view = dvf.create(drug); + TargetDetails result = dvf.getElementInformationForResult(view.getTargetRows(), ei, model); + assertNotNull(result); + assertFalse(result.getDatabaseSource().equals(result.getReferences().get(0))); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testCreateEmpty() throws Exception { + try { + Object object = dvf.create(null); + assertNotNull(object); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testCreateGson() throws Exception { + try { + DrugView object = dvf.create(null); + assertNotNull(dvf.createGson(object)); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + +} diff --git a/service/src/test/java/lcsb/mapviewer/services/utils/graph/MissingConnectionDaoTest.java b/service/src/test/java/lcsb/mapviewer/services/utils/graph/MissingConnectionDaoTest.java index 6c51589a57bca8da24b046fdc52f00fea1cc07d9..fd9fef970feff95fd3fce94a7f9718b9e601f7ba 100644 --- a/service/src/test/java/lcsb/mapviewer/services/utils/graph/MissingConnectionDaoTest.java +++ b/service/src/test/java/lcsb/mapviewer/services/utils/graph/MissingConnectionDaoTest.java @@ -1,103 +1,103 @@ -package lcsb.mapviewer.services.utils.graph; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.util.Collection; - -import lcsb.mapviewer.model.Project; -import lcsb.mapviewer.model.map.Element; -import lcsb.mapviewer.model.map.MiriamData; -import lcsb.mapviewer.model.map.MiriamType; -import lcsb.mapviewer.model.map.graph.DataMining; -import lcsb.mapviewer.model.map.model.Model; -import lcsb.mapviewer.services.ServiceTestFunctions; - -import org.apache.log4j.Logger; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class MissingConnectionDaoTest extends ServiceTestFunctions { - static Logger logger = Logger.getLogger(MissingConnectionDaoTest.class); - - private Model model; - private Collection<Element> nodes; - - private Project project; - - @Before - public void setUp() throws Exception { - project = new Project(); - projectDao.add(project); - dbUtils.setAutoFlush(false); - model =getModelForFile("testFiles/graph_path_example.xml",false); - project.addModel(model); - modelDao.add((Model) model); - - nodes = model.getElements(); - } - - @After - public void tearDown() throws Exception { - modelDao.delete((Model) model); - dbUtils.setAutoFlush(true); - projectDao.delete(project); - } - - @Test - public void testGetMissingConnections() { - try { - Element node = nodes.iterator().next(); - - DataMining mc = new DataMining(); - mc.setDescription("desc a"); - mc.setElement(node); - mc.addReference(new MiriamData(MiriamType.PUBMED, "12345")); - mc.addReference(new MiriamData(MiriamType.PUBMED, "123456")); - - missingConnectionDao.add(mc); - - DataMining mc2 = new DataMining(); - mc2.setDescription("desc ab"); - mc2.setElement(node); - mc2.addReference(new MiriamData(MiriamType.PUBMED, "323456")); - - missingConnectionDao.add(mc2); - missingConnectionDao.flush(); - missingConnectionDao.evict(mc); - missingConnectionDao.evict(mc2); - - Collection<DataMining> collection = missingConnectionDao.getMissingConnectionForElement(node); - - assertNotNull(collection); - - DataMining mc3 = null; - DataMining mc4 = null; - - assertEquals(2,collection.size()); - - for (DataMining missingConnection : collection) { - if (mc3 == null) - mc3 = missingConnection; - else if (mc4 == null) - mc4 = missingConnection; - else - fail("Incorrect number of elemenets in collection"); - } - - assertTrue("invalid number of references: "+mc3.getReferences().size(),mc3.getReferences().size() == 2 || mc3.getReferences().size() == 1); - assertTrue("invalid number of references: "+mc4.getReferences().size(),mc4.getReferences().size() == 2 || mc4.getReferences().size() == 1); - - missingConnectionDao.delete(mc3); - missingConnectionDao.delete(mc4); - - } catch (Exception e) { - e.printStackTrace(); - fail("Unknown exception occured"); - } - } - -} +package lcsb.mapviewer.services.utils.graph; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.Collection; + +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.model.Project; +import lcsb.mapviewer.model.map.MiriamData; +import lcsb.mapviewer.model.map.MiriamType; +import lcsb.mapviewer.model.map.graph.DataMining; +import lcsb.mapviewer.model.map.model.Model; +import lcsb.mapviewer.services.ServiceTestFunctions; + +import org.apache.log4j.Logger; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class MissingConnectionDaoTest extends ServiceTestFunctions { + static Logger logger = Logger.getLogger(MissingConnectionDaoTest.class); + + private Model model; + private Collection<Element> nodes; + + private Project project; + + @Before + public void setUp() throws Exception { + project = new Project(); + projectDao.add(project); + dbUtils.setAutoFlush(false); + model =getModelForFile("testFiles/graph_path_example.xml",false); + project.addModel(model); + modelDao.add((Model) model); + + nodes = model.getElements(); + } + + @After + public void tearDown() throws Exception { + modelDao.delete((Model) model); + dbUtils.setAutoFlush(true); + projectDao.delete(project); + } + + @Test + public void testGetMissingConnections() { + try { + Element node = nodes.iterator().next(); + + DataMining mc = new DataMining(); + mc.setDescription("desc a"); + mc.setElement(node); + mc.addReference(new MiriamData(MiriamType.PUBMED, "12345")); + mc.addReference(new MiriamData(MiriamType.PUBMED, "123456")); + + missingConnectionDao.add(mc); + + DataMining mc2 = new DataMining(); + mc2.setDescription("desc ab"); + mc2.setElement(node); + mc2.addReference(new MiriamData(MiriamType.PUBMED, "323456")); + + missingConnectionDao.add(mc2); + missingConnectionDao.flush(); + missingConnectionDao.evict(mc); + missingConnectionDao.evict(mc2); + + Collection<DataMining> collection = missingConnectionDao.getMissingConnectionForElement(node); + + assertNotNull(collection); + + DataMining mc3 = null; + DataMining mc4 = null; + + assertEquals(2,collection.size()); + + for (DataMining missingConnection : collection) { + if (mc3 == null) + mc3 = missingConnection; + else if (mc4 == null) + mc4 = missingConnection; + else + fail("Incorrect number of elemenets in collection"); + } + + assertTrue("invalid number of references: "+mc3.getReferences().size(),mc3.getReferences().size() == 2 || mc3.getReferences().size() == 1); + assertTrue("invalid number of references: "+mc4.getReferences().size(),mc4.getReferences().size() == 2 || mc4.getReferences().size() == 1); + + missingConnectionDao.delete(mc3); + missingConnectionDao.delete(mc4); + + } catch (Exception e) { + e.printStackTrace(); + fail("Unknown exception occured"); + } + } + +} diff --git a/web/src/main/java/lcsb/mapviewer/bean/ChemicalBean.java b/web/src/main/java/lcsb/mapviewer/bean/ChemicalBean.java index 68671a2166a2797cca3e4d8f63aba6378db3dde3..4e59b89d1f45dae6619a072b42446de1f6e0c8fb 100644 --- a/web/src/main/java/lcsb/mapviewer/bean/ChemicalBean.java +++ b/web/src/main/java/lcsb/mapviewer/bean/ChemicalBean.java @@ -13,8 +13,8 @@ import org.apache.log4j.Logger; import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; import lcsb.mapviewer.model.Project; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.services.interfaces.IUserService; diff --git a/web/src/main/java/lcsb/mapviewer/bean/DrugBean.java b/web/src/main/java/lcsb/mapviewer/bean/DrugBean.java index aedad5dce41ebde28381a03977571fc66174d965..fc34f958f4fd160a68ecac36da85e486abab2fc0 100644 --- a/web/src/main/java/lcsb/mapviewer/bean/DrugBean.java +++ b/web/src/main/java/lcsb/mapviewer/bean/DrugBean.java @@ -1,421 +1,421 @@ -package lcsb.mapviewer.bean; - -import java.awt.geom.Path2D; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.ManagedProperty; -import javax.faces.bean.ViewScoped; -import javax.faces.event.ActionEvent; - -import org.apache.log4j.Logger; - -import lcsb.mapviewer.commands.SubModelCommand; -import lcsb.mapviewer.common.Pair; -import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.Project; -import lcsb.mapviewer.model.map.Element; -import lcsb.mapviewer.model.map.layout.alias.Alias; -import lcsb.mapviewer.model.map.model.Model; -import lcsb.mapviewer.model.user.PrivilegeType; -import lcsb.mapviewer.model.user.User; -import lcsb.mapviewer.services.interfaces.IUserService; -import lcsb.mapviewer.services.search.ElementIdentifierDetails; -import lcsb.mapviewer.services.search.data.ElementIdentifier; -import lcsb.mapviewer.services.search.data.ElementIdentifier.ElementIdentifierType; -import lcsb.mapviewer.services.search.db.DbSearchCriteria; -import lcsb.mapviewer.services.search.db.TargetDetails; -import lcsb.mapviewer.services.search.db.drug.DrugView; -import lcsb.mapviewer.services.search.db.drug.DrugViewFactory; -import lcsb.mapviewer.services.search.db.drug.IDrugService; -import lcsb.mapviewer.services.utils.gmap.CoordinationConverter; - -/** - * Bean used for drug interface. It allows to look for the drugs that targets - * some proteins or to find all possible information about a drug entered by - * user. - * - * @author Piotr Gawron - * - */ -@ManagedBean(name = "drugMB") -@ViewScoped -public class DrugBean extends AbstractMarkerManagerBean<DrugView> implements Serializable { - - /** - * Name of the param passed in the request that contains name of drug to - * search. - */ - private static final String DRUG_NAME_PARAM = "tabView:drugForm:searchDrug"; - - /** - * Name of the session field that store last query. - */ - private static final String DRUG_LAST_SEARCH_SESSION_PARAM = "DRUG_SEARCH_PARAM"; - - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * Default class logger. - */ - private static Logger logger = Logger.getLogger(DrugBean.class); - - /** - * List of drugs suggested for vizualization (we cannot vizualize all of them, - * because it's too much data). - */ - private List<DrugView> suggestedDrugs = new ArrayList<DrugView>(); - - /** - * Polygon selected on the map. It is used to find targets for drugs. This - * polygon is in serialized javascript format. - */ - private String polygon = ""; - - /** - * Service used to query about drugs. - * - * @see IDrugService - */ - @ManagedProperty(value = "#{DrugService}") - private transient IDrugService drugService; - - /** - * Factory for drug elements. - * - */ - @ManagedProperty(value = "#{DrugViewFactory}") - private transient DrugViewFactory drugViewFactory; - - /** - * Service used to access information about users. - * - * @see IUserService - */ - @ManagedProperty(value = "#{UserService}") - private transient IUserService userService; - - /** - * Bean used for communication with the client side about the data related to - * users (including information about currently logged user). - * - * @see UserBean - */ - @ManagedProperty(value = "#{userMB}") - private transient UserBean userBean; - - /** - * Bean used for communication with the client side about the map currently - * visualized. - * - * @see MapBean - */ - @ManagedProperty(value = "#{mapMB}") - private transient MapBean mapBean; - - /** - * This method populates list of suggested drugs. As the input we take a - * polygon (which should contains some proteins to target) - * - * @param actionEvent - * event from thefrom the client - */ - public void findDrugsForMapFragment(final ActionEvent actionEvent) { - Model model = getCurrentTopModel(); - if (model == null) { - logger.warn("Unknown model. Skipping..."); - return; - } - // transform serialized polygon into set of points - CoordinationConverter cc = new CoordinationConverter(model); - Path2D awtPolygon = cc.latLngToPolygon(polygon); - - // create a part of the model that contains only the elements from the - // polygon - SubModelCommand subModelCommand = new SubModelCommand(model, awtPolygon); - Model partModel = subModelCommand.execute(); - suggestedDrugs.addAll(drugService.getForTargets(partModel.getElements(), new DbSearchCriteria().organisms(mapBean.getOrganism()))); - } - - /** - * Empty list of suggested drugs. - * - * @param actionEvent - * event from thefrom the client - */ - public void clearDrugsForMapFragment(final ActionEvent actionEvent) { - suggestedDrugs = new ArrayList<DrugView>(); - } - - /** - * This method look for the drugs. - * - * @param actionEvent - * event from thefrom the client - */ - public void search(final ActionEvent actionEvent) { - - String searchText = getRequestParameter(DRUG_NAME_PARAM); - - findDrug(searchText); - } - - /** - * Look for a drug using query given in the parameter. - * - * @param query - * search query - */ - protected void findDrug(String query) { - if (getCurrentTopModel() == null) { - logger.warn("Unknown model. Skipping..."); - return; - } - - // gather information for search engine - String ipAddress = getClientIpAddress(); - Model model = getCurrentTopModel(); - - clearResults(); - - // drugs are comma separated - List<String> names = splitQuery(query, true); - int set = 0; - for (String string : names) { - DrugView drug = drugService.getByName(string, new DbSearchCriteria().ipAddress(ipAddress).model(model).organisms(mapBean.getOrganism()).colorSet(set++)); - if (drug != null) { - addResult(drug); - } - } - - // format results - if (getResults().size() == 0) { // if there are no results, add empty drug - logger.debug("No results found"); - DrugView drug = drugService.createEmptyView(); - drug.setName("Not found"); - addResult(drug); - } - - // send it to the client - refreshDataInJavascript(); - - addSessionParam(DRUG_LAST_SEARCH_SESSION_PARAM + getCurrentMapId(), query); - } - - /** - * Check privileges for advanced drug targeting view. - * - * @return true if user has advanced privilege view for drugs - */ - public boolean getUserHasAdvancedView() { - Project project = getCurrentProject(); - User user = userBean.getLoggedUser(); - boolean result = userService.userHasPrivilege(user, PrivilegeType.DRUG_TARGETING_ADVANCED_VIEW_PROJECT, project); - return result; - } - - @Override - public void clear() { - addSessionParam(DRUG_LAST_SEARCH_SESSION_PARAM + getCurrentMapId(), null); - setSuggestedDrugs(new ArrayList<DrugView>()); - setPolygon(""); - clearResults(); - refreshDataInJavascript(); - } - - /** - * @return the suggestedDrugs - * @see #suggestedDrugs - */ - public List<DrugView> getSuggestedDrugs() { - return suggestedDrugs; - } - - /** - * @param suggestedDrugs - * the suggestedDrugs to set - * @see #suggestedDrugs - */ - public void setSuggestedDrugs(List<DrugView> suggestedDrugs) { - this.suggestedDrugs = suggestedDrugs; - } - - /** - * @return the polygon - * @see #polygon - */ - public String getPolygon() { - return polygon; - } - - /** - * @param polygon - * the polygon to set - * @see #polygon - */ - public void setPolygon(String polygon) { - this.polygon = polygon; - } - - /** - * @return the drugService - * @see #drugService - */ - public IDrugService getDrugService() { - return drugService; - } - - /** - * @param drugService - * the drugService to set - * @see #drugService - */ - public void setDrugService(IDrugService drugService) { - this.drugService = drugService; - } - - /** - * @return the userService - * @see #userService - */ - public IUserService getUserService() { - return userService; - } - - /** - * @param userService - * the userService to set - * @see #userService - */ - public void setUserService(IUserService userService) { - this.userService = userService; - } - - /** - * @return the userBean - * @see #userBean - */ - public UserBean getUserBean() { - return userBean; - } - - /** - * @param userBean - * the userBean to set - * @see #userBean - */ - public void setUserBean(UserBean userBean) { - this.userBean = userBean; - } - - @Override - public void init() { - String searchVal = (String) getSessionParam(DRUG_LAST_SEARCH_SESSION_PARAM + getCurrentMapId()); - if (searchVal != null && !searchVal.isEmpty()) { - findDrug(searchVal); - } - - } - - @Override - protected List<ElementIdentifier> getLightElementsForSearchResult(DrugView result) { - return drugViewFactory.searchResultToElementIdentifier(result, getCurrentTopModel()); - } - - @Override - protected ElementIdentifierDetails getElementInformationForResult(ElementIdentifier element, DrugView result) { - return drugViewFactory.getElementInformationForResult(result.getTargetRows(), element, getCurrentTopModel()); - } - - @Override - protected List<Pair<String, ElementIdentifierDetails>> getElementInformationForResult(ElementIdentifier element) { - if (element.getType().equals(ElementIdentifierType.ALIAS.getJsName())) { - List<Pair<String, ElementIdentifierDetails>> result = new ArrayList<>(); - - Model model = getCurrentTopModel().getSubmodelById(element.getModelId()); - - Alias alias = model.getAliasByDbId(Integer.valueOf(element.getObjectId())); - Element e = alias.getElement(); - List<Element> list = new ArrayList<>(); - list.add(e); - List<DrugView> drugs = drugService.getForTargets(list, new DbSearchCriteria().model(getCurrentTopModel()).organisms(mapBean.getOrganism())); - for (DrugView drugView : drugs) { - TargetDetails td = drugViewFactory.getElementInformationForResult(drugView.getTargetRows(), element, getCurrentTopModel()); - if (td != null) { - result.add(new Pair<String, ElementIdentifierDetails>(drugView.getName(), td)); - } - } - return result; - } else { - throw new InvalidArgumentException("Drugs are not supported for element: " + element.getType()); - } - } - - /** - * @return the drugViewFactory - * @see #drugViewFactory - */ - public DrugViewFactory getDrugViewFactory() { - return drugViewFactory; - } - - /** - * @param drugViewFactory - * the drugViewFactory to set - * @see #drugViewFactory - */ - public void setDrugViewFactory(DrugViewFactory drugViewFactory) { - this.drugViewFactory = drugViewFactory; - } - - /** - * Returns currently browsed map. - * - * @return currently browsed map - */ - private Model getCurrentTopModel() { - return mapBean.getCurrentTopModel(); - } - - /** - * Returns identifier of browsed map (if such map wasn't setup it will be - * default identifier). - * - * @return identifier of browsed map - */ - private String getCurrentMapId() { - return mapBean.getCurrentMapId(); - } - - /** - * Returns curently browsed project. - * - * @return curently browsed project - */ - private Project getCurrentProject() { - return getCurrentTopModel().getProject(); - } - - /** - * @return the mapBean - * @see #mapBean - */ - public MapBean getMapBean() { - return mapBean; - } - - /** - * @param mapBean - * the mapBean to set - * @see #mapBean - */ - public void setMapBean(MapBean mapBean) { - this.mapBean = mapBean; - } - -} +package lcsb.mapviewer.bean; + +import java.awt.geom.Path2D; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.event.ActionEvent; + +import org.apache.log4j.Logger; + +import lcsb.mapviewer.commands.SubModelCommand; +import lcsb.mapviewer.common.Pair; +import lcsb.mapviewer.common.exception.InvalidArgumentException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.model.Project; +import lcsb.mapviewer.model.map.layout.alias.Alias; +import lcsb.mapviewer.model.map.model.Model; +import lcsb.mapviewer.model.user.PrivilegeType; +import lcsb.mapviewer.model.user.User; +import lcsb.mapviewer.services.interfaces.IUserService; +import lcsb.mapviewer.services.search.ElementIdentifierDetails; +import lcsb.mapviewer.services.search.data.ElementIdentifier; +import lcsb.mapviewer.services.search.data.ElementIdentifier.ElementIdentifierType; +import lcsb.mapviewer.services.search.db.DbSearchCriteria; +import lcsb.mapviewer.services.search.db.TargetDetails; +import lcsb.mapviewer.services.search.db.drug.DrugView; +import lcsb.mapviewer.services.search.db.drug.DrugViewFactory; +import lcsb.mapviewer.services.search.db.drug.IDrugService; +import lcsb.mapviewer.services.utils.gmap.CoordinationConverter; + +/** + * Bean used for drug interface. It allows to look for the drugs that targets + * some proteins or to find all possible information about a drug entered by + * user. + * + * @author Piotr Gawron + * + */ +@ManagedBean(name = "drugMB") +@ViewScoped +public class DrugBean extends AbstractMarkerManagerBean<DrugView> implements Serializable { + + /** + * Name of the param passed in the request that contains name of drug to + * search. + */ + private static final String DRUG_NAME_PARAM = "tabView:drugForm:searchDrug"; + + /** + * Name of the session field that store last query. + */ + private static final String DRUG_LAST_SEARCH_SESSION_PARAM = "DRUG_SEARCH_PARAM"; + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Default class logger. + */ + private static Logger logger = Logger.getLogger(DrugBean.class); + + /** + * List of drugs suggested for vizualization (we cannot vizualize all of them, + * because it's too much data). + */ + private List<DrugView> suggestedDrugs = new ArrayList<DrugView>(); + + /** + * Polygon selected on the map. It is used to find targets for drugs. This + * polygon is in serialized javascript format. + */ + private String polygon = ""; + + /** + * Service used to query about drugs. + * + * @see IDrugService + */ + @ManagedProperty(value = "#{DrugService}") + private transient IDrugService drugService; + + /** + * Factory for drug elements. + * + */ + @ManagedProperty(value = "#{DrugViewFactory}") + private transient DrugViewFactory drugViewFactory; + + /** + * Service used to access information about users. + * + * @see IUserService + */ + @ManagedProperty(value = "#{UserService}") + private transient IUserService userService; + + /** + * Bean used for communication with the client side about the data related to + * users (including information about currently logged user). + * + * @see UserBean + */ + @ManagedProperty(value = "#{userMB}") + private transient UserBean userBean; + + /** + * Bean used for communication with the client side about the map currently + * visualized. + * + * @see MapBean + */ + @ManagedProperty(value = "#{mapMB}") + private transient MapBean mapBean; + + /** + * This method populates list of suggested drugs. As the input we take a + * polygon (which should contains some proteins to target) + * + * @param actionEvent + * event from thefrom the client + */ + public void findDrugsForMapFragment(final ActionEvent actionEvent) { + Model model = getCurrentTopModel(); + if (model == null) { + logger.warn("Unknown model. Skipping..."); + return; + } + // transform serialized polygon into set of points + CoordinationConverter cc = new CoordinationConverter(model); + Path2D awtPolygon = cc.latLngToPolygon(polygon); + + // create a part of the model that contains only the elements from the + // polygon + SubModelCommand subModelCommand = new SubModelCommand(model, awtPolygon); + Model partModel = subModelCommand.execute(); + suggestedDrugs.addAll(drugService.getForTargets(partModel.getElements(), new DbSearchCriteria().organisms(mapBean.getOrganism()))); + } + + /** + * Empty list of suggested drugs. + * + * @param actionEvent + * event from thefrom the client + */ + public void clearDrugsForMapFragment(final ActionEvent actionEvent) { + suggestedDrugs = new ArrayList<DrugView>(); + } + + /** + * This method look for the drugs. + * + * @param actionEvent + * event from thefrom the client + */ + public void search(final ActionEvent actionEvent) { + + String searchText = getRequestParameter(DRUG_NAME_PARAM); + + findDrug(searchText); + } + + /** + * Look for a drug using query given in the parameter. + * + * @param query + * search query + */ + protected void findDrug(String query) { + if (getCurrentTopModel() == null) { + logger.warn("Unknown model. Skipping..."); + return; + } + + // gather information for search engine + String ipAddress = getClientIpAddress(); + Model model = getCurrentTopModel(); + + clearResults(); + + // drugs are comma separated + List<String> names = splitQuery(query, true); + int set = 0; + for (String string : names) { + DrugView drug = drugService.getByName(string, new DbSearchCriteria().ipAddress(ipAddress).model(model).organisms(mapBean.getOrganism()).colorSet(set++)); + if (drug != null) { + addResult(drug); + } + } + + // format results + if (getResults().size() == 0) { // if there are no results, add empty drug + logger.debug("No results found"); + DrugView drug = drugService.createEmptyView(); + drug.setName("Not found"); + addResult(drug); + } + + // send it to the client + refreshDataInJavascript(); + + addSessionParam(DRUG_LAST_SEARCH_SESSION_PARAM + getCurrentMapId(), query); + } + + /** + * Check privileges for advanced drug targeting view. + * + * @return true if user has advanced privilege view for drugs + */ + public boolean getUserHasAdvancedView() { + Project project = getCurrentProject(); + User user = userBean.getLoggedUser(); + boolean result = userService.userHasPrivilege(user, PrivilegeType.DRUG_TARGETING_ADVANCED_VIEW_PROJECT, project); + return result; + } + + @Override + public void clear() { + addSessionParam(DRUG_LAST_SEARCH_SESSION_PARAM + getCurrentMapId(), null); + setSuggestedDrugs(new ArrayList<DrugView>()); + setPolygon(""); + clearResults(); + refreshDataInJavascript(); + } + + /** + * @return the suggestedDrugs + * @see #suggestedDrugs + */ + public List<DrugView> getSuggestedDrugs() { + return suggestedDrugs; + } + + /** + * @param suggestedDrugs + * the suggestedDrugs to set + * @see #suggestedDrugs + */ + public void setSuggestedDrugs(List<DrugView> suggestedDrugs) { + this.suggestedDrugs = suggestedDrugs; + } + + /** + * @return the polygon + * @see #polygon + */ + public String getPolygon() { + return polygon; + } + + /** + * @param polygon + * the polygon to set + * @see #polygon + */ + public void setPolygon(String polygon) { + this.polygon = polygon; + } + + /** + * @return the drugService + * @see #drugService + */ + public IDrugService getDrugService() { + return drugService; + } + + /** + * @param drugService + * the drugService to set + * @see #drugService + */ + public void setDrugService(IDrugService drugService) { + this.drugService = drugService; + } + + /** + * @return the userService + * @see #userService + */ + public IUserService getUserService() { + return userService; + } + + /** + * @param userService + * the userService to set + * @see #userService + */ + public void setUserService(IUserService userService) { + this.userService = userService; + } + + /** + * @return the userBean + * @see #userBean + */ + public UserBean getUserBean() { + return userBean; + } + + /** + * @param userBean + * the userBean to set + * @see #userBean + */ + public void setUserBean(UserBean userBean) { + this.userBean = userBean; + } + + @Override + public void init() { + String searchVal = (String) getSessionParam(DRUG_LAST_SEARCH_SESSION_PARAM + getCurrentMapId()); + if (searchVal != null && !searchVal.isEmpty()) { + findDrug(searchVal); + } + + } + + @Override + protected List<ElementIdentifier> getLightElementsForSearchResult(DrugView result) { + return drugViewFactory.searchResultToElementIdentifier(result, getCurrentTopModel()); + } + + @Override + protected ElementIdentifierDetails getElementInformationForResult(ElementIdentifier element, DrugView result) { + return drugViewFactory.getElementInformationForResult(result.getTargetRows(), element, getCurrentTopModel()); + } + + @Override + protected List<Pair<String, ElementIdentifierDetails>> getElementInformationForResult(ElementIdentifier element) { + if (element.getType().equals(ElementIdentifierType.ALIAS.getJsName())) { + List<Pair<String, ElementIdentifierDetails>> result = new ArrayList<>(); + + Model model = getCurrentTopModel().getSubmodelById(element.getModelId()); + + Alias alias = model.getAliasByDbId(Integer.valueOf(element.getObjectId())); + Element e = alias.getElement(); + List<Element> list = new ArrayList<>(); + list.add(e); + List<DrugView> drugs = drugService.getForTargets(list, new DbSearchCriteria().model(getCurrentTopModel()).organisms(mapBean.getOrganism())); + for (DrugView drugView : drugs) { + TargetDetails td = drugViewFactory.getElementInformationForResult(drugView.getTargetRows(), element, getCurrentTopModel()); + if (td != null) { + result.add(new Pair<String, ElementIdentifierDetails>(drugView.getName(), td)); + } + } + return result; + } else { + throw new InvalidArgumentException("Drugs are not supported for element: " + element.getType()); + } + } + + /** + * @return the drugViewFactory + * @see #drugViewFactory + */ + public DrugViewFactory getDrugViewFactory() { + return drugViewFactory; + } + + /** + * @param drugViewFactory + * the drugViewFactory to set + * @see #drugViewFactory + */ + public void setDrugViewFactory(DrugViewFactory drugViewFactory) { + this.drugViewFactory = drugViewFactory; + } + + /** + * Returns currently browsed map. + * + * @return currently browsed map + */ + private Model getCurrentTopModel() { + return mapBean.getCurrentTopModel(); + } + + /** + * Returns identifier of browsed map (if such map wasn't setup it will be + * default identifier). + * + * @return identifier of browsed map + */ + private String getCurrentMapId() { + return mapBean.getCurrentMapId(); + } + + /** + * Returns curently browsed project. + * + * @return curently browsed project + */ + private Project getCurrentProject() { + return getCurrentTopModel().getProject(); + } + + /** + * @return the mapBean + * @see #mapBean + */ + public MapBean getMapBean() { + return mapBean; + } + + /** + * @param mapBean + * the mapBean to set + * @see #mapBean + */ + public void setMapBean(MapBean mapBean) { + this.mapBean = mapBean; + } + +} diff --git a/web/src/main/java/lcsb/mapviewer/bean/ExportBean.java b/web/src/main/java/lcsb/mapviewer/bean/ExportBean.java index 9b185b6feed561dcea7201b51ba557dcbad3c939..66c334eaedcfab83de1e727069e7a6bd70a9cd19 100644 --- a/web/src/main/java/lcsb/mapviewer/bean/ExportBean.java +++ b/web/src/main/java/lcsb/mapviewer/bean/ExportBean.java @@ -49,8 +49,19 @@ import lcsb.mapviewer.converter.graphics.AbstractImageGenerator.Params; import lcsb.mapviewer.converter.graphics.ImageGenerators; import lcsb.mapviewer.converter.graphics.SvgImageGenerator; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser; +import lcsb.mapviewer.converter.model.celldesigner.structure.AntisenseRna; +import lcsb.mapviewer.converter.model.celldesigner.structure.ComplexSpecies; +import lcsb.mapviewer.converter.model.celldesigner.structure.Degraded; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Gene; +import lcsb.mapviewer.converter.model.celldesigner.structure.Ion; +import lcsb.mapviewer.converter.model.celldesigner.structure.Phenotype; +import lcsb.mapviewer.converter.model.celldesigner.structure.Protein; +import lcsb.mapviewer.converter.model.celldesigner.structure.Rna; +import lcsb.mapviewer.converter.model.celldesigner.structure.SimpleMolecule; +import lcsb.mapviewer.converter.model.celldesigner.structure.Species; +import lcsb.mapviewer.converter.model.celldesigner.structure.Unknown; import lcsb.mapviewer.converter.model.sbgnml.SbgnmlXmlConverter; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.InconsistentModelException; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; @@ -61,17 +72,6 @@ import lcsb.mapviewer.model.map.layout.alias.CompartmentAlias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelSubmodelConnection; import lcsb.mapviewer.model.map.reaction.Reaction; -import lcsb.mapviewer.model.map.species.AntisenseRna; -import lcsb.mapviewer.model.map.species.ComplexSpecies; -import lcsb.mapviewer.model.map.species.Degraded; -import lcsb.mapviewer.model.map.species.Gene; -import lcsb.mapviewer.model.map.species.Ion; -import lcsb.mapviewer.model.map.species.Phenotype; -import lcsb.mapviewer.model.map.species.Protein; -import lcsb.mapviewer.model.map.species.Rna; -import lcsb.mapviewer.model.map.species.SimpleMolecule; -import lcsb.mapviewer.model.map.species.Species; -import lcsb.mapviewer.model.map.species.Unknown; import lcsb.mapviewer.services.interfaces.IExporterService; import lcsb.mapviewer.services.interfaces.IExporterService.ExporterParameters; import lcsb.mapviewer.services.interfaces.ILayoutService; diff --git a/web/src/main/java/lcsb/mapviewer/bean/FeedbackBean.java b/web/src/main/java/lcsb/mapviewer/bean/FeedbackBean.java index 7b940625200240a80f5f114e66076aeff081f0b5..83277c00b0a21182ac6c3ba8937a030ea8cebd7a 100644 --- a/web/src/main/java/lcsb/mapviewer/bean/FeedbackBean.java +++ b/web/src/main/java/lcsb/mapviewer/bean/FeedbackBean.java @@ -19,8 +19,8 @@ import lcsb.mapviewer.common.Configuration; import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.NotImplementedException; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; import lcsb.mapviewer.model.Project; -import lcsb.mapviewer.model.map.Element; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.reaction.Modifier; diff --git a/web/src/main/java/lcsb/mapviewer/bean/MiRNABean.java b/web/src/main/java/lcsb/mapviewer/bean/MiRNABean.java index e3e693baad2a05293969fca66b92586de928a54d..1691d560f8a8fb9740052928aa9b2bc9e66c350d 100644 --- a/web/src/main/java/lcsb/mapviewer/bean/MiRNABean.java +++ b/web/src/main/java/lcsb/mapviewer/bean/MiRNABean.java @@ -13,7 +13,7 @@ import org.apache.log4j.Logger; import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.Element; +import lcsb.mapviewer.converter.model.celldesigner.structure.Element; import lcsb.mapviewer.model.map.layout.alias.Alias; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.services.search.ElementIdentifierDetails;