Commit 0ea35cb7 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

export to CellDesigner properly handles new line characters

parent 8fd36e0a
...@@ -5,6 +5,8 @@ minerva (15.0.0~alpha.1) stable; urgency=medium ...@@ -5,6 +5,8 @@ minerva (15.0.0~alpha.1) stable; urgency=medium
(#995) (#995)
* Bug fix: clear button icon, refresh comments button and show overview * Bug fix: clear button icon, refresh comments button and show overview
button icons were missing (regression 15.0.0~alpha.0) button icons were missing (regression 15.0.0~alpha.0)
* Bug fix: export to CellDesigner names with new line is properly handled
(#930)
minerva (15.0.0~alpha.0) stable; urgency=medium minerva (15.0.0~alpha.0) stable; urgency=medium
* Improvement: logs provided for validation data model are structurized (#325) * Improvement: logs provided for validation data model are structurized (#325)
......
...@@ -33,13 +33,13 @@ public abstract class AbstractElementXmlParser<T extends CellDesignerElement<?>, ...@@ -33,13 +33,13 @@ public abstract class AbstractElementXmlParser<T extends CellDesignerElement<?>,
* Default class logger. * Default class logger.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
private Logger logger = LogManager.getLogger(AbstractElementXmlParser.class.getName()); private Logger logger = LogManager.getLogger();
/** /**
* List of special strings in CellDesigner that should be translated into some * List of special strings in CellDesigner that should be translated into some
* UTF characters. * UTF characters.
*/ */
private List<Pair<String, String>> encodedStrings = new ArrayList<Pair<String, String>>(); private List<Pair<String, String>> encodedStrings = new ArrayList<>();
/** /**
* Parser of the notes that allows to extract additional structured data for the * Parser of the notes that allows to extract additional structured data for the
...@@ -51,61 +51,61 @@ public abstract class AbstractElementXmlParser<T extends CellDesignerElement<?>, ...@@ -51,61 +51,61 @@ public abstract class AbstractElementXmlParser<T extends CellDesignerElement<?>,
* Default constructor. * Default constructor.
*/ */
protected AbstractElementXmlParser() { protected AbstractElementXmlParser() {
encodedStrings.add(new Pair<String, String>("_underscore_", "_")); encodedStrings.add(new Pair<>("_underscore_", "_"));
encodedStrings.add(new Pair<String, String>("_BR_", "\n")); encodedStrings.add(new Pair<>("_br_", "\n"));
encodedStrings.add(new Pair<String, String>("_br_", "\n")); encodedStrings.add(new Pair<>("_BR_", "\n"));
encodedStrings.add(new Pair<String, String>("_plus_", "+")); encodedStrings.add(new Pair<>("_plus_", "+"));
encodedStrings.add(new Pair<String, String>("_minus_", "-")); encodedStrings.add(new Pair<>("_minus_", "-"));
encodedStrings.add(new Pair<String, String>("_slash_", "/")); encodedStrings.add(new Pair<>("_slash_", "/"));
encodedStrings.add(new Pair<String, String>("_space_", " ")); encodedStrings.add(new Pair<>("_space_", " "));
encodedStrings.add(new Pair<String, String>("_Alpha_", "Α")); encodedStrings.add(new Pair<>("_Alpha_", "Α"));
encodedStrings.add(new Pair<String, String>("_alpha_", "α")); encodedStrings.add(new Pair<>("_alpha_", "α"));
encodedStrings.add(new Pair<String, String>("_Beta_", "Β")); encodedStrings.add(new Pair<>("_Beta_", "Β"));
encodedStrings.add(new Pair<String, String>("_beta_", "β")); encodedStrings.add(new Pair<>("_beta_", "β"));
encodedStrings.add(new Pair<String, String>("_Gamma_", "Γ")); encodedStrings.add(new Pair<>("_Gamma_", "Γ"));
encodedStrings.add(new Pair<String, String>("_gamma_", "γ")); encodedStrings.add(new Pair<>("_gamma_", "γ"));
encodedStrings.add(new Pair<String, String>("_Delta_", "Δ")); encodedStrings.add(new Pair<>("_Delta_", "Δ"));
encodedStrings.add(new Pair<String, String>("_delta_", "δ")); encodedStrings.add(new Pair<>("_delta_", "δ"));
encodedStrings.add(new Pair<String, String>("_Epsilon_", "Ε")); encodedStrings.add(new Pair<>("_Epsilon_", "Ε"));
encodedStrings.add(new Pair<String, String>("_epsilon_", "ε")); encodedStrings.add(new Pair<>("_epsilon_", "ε"));
encodedStrings.add(new Pair<String, String>("_Zeta_", "Ζ")); encodedStrings.add(new Pair<>("_Zeta_", "Ζ"));
encodedStrings.add(new Pair<String, String>("_zeta_", "ζ")); encodedStrings.add(new Pair<>("_zeta_", "ζ"));
encodedStrings.add(new Pair<String, String>("_Eta_", "Η")); encodedStrings.add(new Pair<>("_Eta_", "Η"));
encodedStrings.add(new Pair<String, String>("_eta_", "η")); encodedStrings.add(new Pair<>("_eta_", "η"));
encodedStrings.add(new Pair<String, String>("_Theta_", "Θ")); encodedStrings.add(new Pair<>("_Theta_", "Θ"));
encodedStrings.add(new Pair<String, String>("_theta_", "θ")); encodedStrings.add(new Pair<>("_theta_", "θ"));
encodedStrings.add(new Pair<String, String>("_Iota_", "Ι")); encodedStrings.add(new Pair<>("_Iota_", "Ι"));
encodedStrings.add(new Pair<String, String>("_iota_", "ι")); encodedStrings.add(new Pair<>("_iota_", "ι"));
encodedStrings.add(new Pair<String, String>("_Kappa_", "Κ")); encodedStrings.add(new Pair<>("_Kappa_", "Κ"));
encodedStrings.add(new Pair<String, String>("_kappa_", "κ")); encodedStrings.add(new Pair<>("_kappa_", "κ"));
encodedStrings.add(new Pair<String, String>("_Lambda_", "Λ")); encodedStrings.add(new Pair<>("_Lambda_", "Λ"));
encodedStrings.add(new Pair<String, String>("_lambda_", "λ")); encodedStrings.add(new Pair<>("_lambda_", "λ"));
encodedStrings.add(new Pair<String, String>("_Mu_", "Μ")); encodedStrings.add(new Pair<>("_Mu_", "Μ"));
encodedStrings.add(new Pair<String, String>("_mu_", "μ")); encodedStrings.add(new Pair<>("_mu_", "μ"));
encodedStrings.add(new Pair<String, String>("_Nu_", "Ν")); encodedStrings.add(new Pair<>("_Nu_", "Ν"));
encodedStrings.add(new Pair<String, String>("_nu_", "ν")); encodedStrings.add(new Pair<>("_nu_", "ν"));
encodedStrings.add(new Pair<String, String>("_Xi_", "Ξ")); encodedStrings.add(new Pair<>("_Xi_", "Ξ"));
encodedStrings.add(new Pair<String, String>("_xi_", "ξ")); encodedStrings.add(new Pair<>("_xi_", "ξ"));
encodedStrings.add(new Pair<String, String>("_Omicron_", "Ο")); encodedStrings.add(new Pair<>("_Omicron_", "Ο"));
encodedStrings.add(new Pair<String, String>("_omicron_", "ο")); encodedStrings.add(new Pair<>("_omicron_", "ο"));
encodedStrings.add(new Pair<String, String>("_Pi_", "Π")); encodedStrings.add(new Pair<>("_Pi_", "Π"));
encodedStrings.add(new Pair<String, String>("_pi_", "π")); encodedStrings.add(new Pair<>("_pi_", "π"));
encodedStrings.add(new Pair<String, String>("_Rho_", "Ρ")); encodedStrings.add(new Pair<>("_Rho_", "Ρ"));
encodedStrings.add(new Pair<String, String>("_rho_", "ρ")); encodedStrings.add(new Pair<>("_rho_", "ρ"));
encodedStrings.add(new Pair<String, String>("_Sigma_", "Σ")); encodedStrings.add(new Pair<>("_Sigma_", "Σ"));
encodedStrings.add(new Pair<String, String>("_sigma_", "σ")); encodedStrings.add(new Pair<>("_sigma_", "σ"));
encodedStrings.add(new Pair<String, String>("_Tau_", "Τ")); encodedStrings.add(new Pair<>("_Tau_", "Τ"));
encodedStrings.add(new Pair<String, String>("_tau_", "τ")); encodedStrings.add(new Pair<>("_tau_", "τ"));
encodedStrings.add(new Pair<String, String>("_Upsilon_", "Υ")); encodedStrings.add(new Pair<>("_Upsilon_", "Υ"));
encodedStrings.add(new Pair<String, String>("_upsilon_", "υ")); encodedStrings.add(new Pair<>("_upsilon_", "υ"));
encodedStrings.add(new Pair<String, String>("_Phi_", "Φ")); encodedStrings.add(new Pair<>("_Phi_", "Φ"));
encodedStrings.add(new Pair<String, String>("_phi_", "φ")); encodedStrings.add(new Pair<>("_phi_", "φ"));
encodedStrings.add(new Pair<String, String>("_Chi_", "Χ")); encodedStrings.add(new Pair<>("_Chi_", "Χ"));
encodedStrings.add(new Pair<String, String>("_chi_", "χ")); encodedStrings.add(new Pair<>("_chi_", "χ"));
encodedStrings.add(new Pair<String, String>("_Psi_", "Ψ")); encodedStrings.add(new Pair<>("_Psi_", "Ψ"));
encodedStrings.add(new Pair<String, String>("_psi_", "ψ")); encodedStrings.add(new Pair<>("_psi_", "ψ"));
encodedStrings.add(new Pair<String, String>("_Omega_", "Ω")); encodedStrings.add(new Pair<>("_Omega_", "Ω"));
encodedStrings.add(new Pair<String, String>("_omega_", "ω")); encodedStrings.add(new Pair<>("_omega_", "ω"));
} }
/** /**
......
package lcsb.mapviewer.converter.model.celldesigner.species;
import static org.junit.Assert.assertTrue;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.Test;
import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions;
public class AbstractElementXmlParserTest extends CellDesignerTestFunctions {
Logger logger = LogManager.getLogger();
AbstractElementXmlParser<?, ?> parser = new ProteinXmlParser(null);
@Test
public void testEncode() {
String encoded = parser.encodeName("\n");
assertTrue(encoded.contains("_br_"));
}
}
...@@ -4,7 +4,9 @@ import org.junit.runner.RunWith; ...@@ -4,7 +4,9 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite; import org.junit.runners.Suite;
@RunWith(Suite.class) @RunWith(Suite.class)
@Suite.SuiteClasses({ AntisenseRnaXmlParserTest.class, @Suite.SuiteClasses({
AbstractElementXmlParserTest.class,
AntisenseRnaXmlParserTest.class,
ComplexParserTest.class, ComplexParserTest.class,
GeneXmlParserTest.class, GeneXmlParserTest.class,
InternalModelSpeciesDataTest.class, InternalModelSpeciesDataTest.class,
...@@ -17,6 +19,7 @@ import org.junit.runners.Suite; ...@@ -17,6 +19,7 @@ import org.junit.runners.Suite;
SpeciesMappingTest.class, SpeciesMappingTest.class,
SpeciesSbmlParserTest.class, SpeciesSbmlParserTest.class,
}) })
public class AllSpeciesTests { public class AllSpeciesTests {
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment