From 56c3dc52b7a220e18ce6d4b9327c18a0682930e9 Mon Sep 17 00:00:00 2001 From: "cmzmasek@gmail.com" Date: Wed, 16 Apr 2014 01:27:35 +0000 Subject: [PATCH] cleanup --- .../src/org/forester/archaeopteryx/Constants.java | 2 +- .../src/org/forester/io/parsers/util/ParserUtils.java | 16 ++++++++++++++-- forester/java/src/org/forester/test/Test.java | 17 ++++++++++++++++- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/forester/java/src/org/forester/archaeopteryx/Constants.java b/forester/java/src/org/forester/archaeopteryx/Constants.java index be02fd7..0ad0eb9 100644 --- a/forester/java/src/org/forester/archaeopteryx/Constants.java +++ b/forester/java/src/org/forester/archaeopteryx/Constants.java @@ -43,7 +43,7 @@ public final class Constants { public final static boolean ALLOW_DDBJ_BLAST = false; public final static String PRG_NAME = "Archaeopteryx"; final static String VERSION = "0.988 SR"; - final static String PRG_DATE = "140418"; + final static String PRG_DATE = "140415"; final static String DEFAULT_CONFIGURATION_FILE_NAME = "_aptx_configuration_file"; final static String[] DEFAULT_FONT_CHOICES = { "Arial", "Helvetica", "Verdana", "Tahoma", "Dialog", "Lucida Sans", "SansSerif", "Sans-serif", "Sans" }; diff --git a/forester/java/src/org/forester/io/parsers/util/ParserUtils.java b/forester/java/src/org/forester/io/parsers/util/ParserUtils.java index 4c650a1..d056ba3 100644 --- a/forester/java/src/org/forester/io/parsers/util/ParserUtils.java +++ b/forester/java/src/org/forester/io/parsers/util/ParserUtils.java @@ -72,11 +72,11 @@ public final class ParserUtils { final public static Pattern TAXOMONY_SN_PATTERN_STRAIN_1 = Pattern .compile( "(?:\\b|_)(" + SN_BN - + "[_ ](?:str|subsp|var)[a-z]{0,5}\\.?[_ ]\\S{1,60})(?:\\b|_)" ); + + "[_ ](?:str|subsp|ssp|var)[a-z]{0,5}\\.?[_ ]\\S{1,60})(?:\\b|_)" ); final public static Pattern TAXOMONY_SN_PATTERN_STRAIN_2 = Pattern .compile( "(?:\\b|_)(" + SN_BN - + "[_ ]\\((?:str|subsp|var)[a-z]{0,5}\\.?[_ ]\\S{1,60}\\))" ); + + "[_ ]\\((?:str|subsp|ssp|var)[a-z]{0,5}\\.?[_ ]\\S{1,60}\\))" ); final public static Pattern TAXOMONY_SN_PATTERN_STRAIN_SUBSTRAIN = Pattern .compile( "(?:\\b|_)(" + SN_BN @@ -236,6 +236,12 @@ public final class ParserUtils { else if ( s.indexOf( " subsp " ) > 4 ) { s = s.replaceFirst( " subsp ", " subsp. " ); } + else if ( s.indexOf( " ssp " ) > 4 ) { + s = s.replaceFirst( " ssp ", " subsp. " ); + } + else if ( s.indexOf( " ssp. " ) > 4 ) { + s = s.replaceFirst( " ssp. ", " subsp. " ); + } else if ( s.indexOf( " var " ) > 4 ) { s = s.replaceFirst( " var ", " var. " ); } @@ -250,6 +256,12 @@ public final class ParserUtils { else if ( s.indexOf( " (subsp " ) > 4 ) { s = s.replaceFirst( " \\(subsp ", " (subsp. " ); } + else if ( s.indexOf( " (ssp " ) > 4 ) { + s = s.replaceFirst( " \\(ssp ", " (subsp. " ); + } + else if ( s.indexOf( " (ssp. " ) > 4 ) { + s = s.replaceFirst( " \\(ssp. ", " (subsp. " ); + } else if ( s.indexOf( " (var " ) > 4 ) { s = s.replaceFirst( " \\(var ", " (var. " ); } diff --git a/forester/java/src/org/forester/test/Test.java b/forester/java/src/org/forester/test/Test.java index 8a937e9..f57b0be 100644 --- a/forester/java/src/org/forester/test/Test.java +++ b/forester/java/src/org/forester/test/Test.java @@ -4373,7 +4373,6 @@ public final class Test { .equals( "Escherichia coli str. K-12 substr. MG1655star" ) ) { return false; } - // if ( !ParserUtils.extractScientificNameFromNodeName( "Macrocera sp." ).equals( "Macrocera sp." ) ) { return false; } @@ -4390,6 +4389,22 @@ public final class Test { if ( !ParserUtils.extractScientificNameFromNodeName( "Macrocera sp" ).equals( "Macrocera sp." ) ) { return false; } + if ( !ParserUtils.extractScientificNameFromNodeName( "Sesamum rigidum ssp merenskyanum 07 48" ) + .equals( "Sesamum rigidum subsp. merenskyanum" ) ) { + return false; + } + if ( !ParserUtils.extractScientificNameFromNodeName( "Sesamum rigidum ssp. merenskyanum" ) + .equals( "Sesamum rigidum subsp. merenskyanum" ) ) { + return false; + } + if ( !ParserUtils.extractScientificNameFromNodeName( "Sesamum rigidum (ssp. merenskyanum)" ) + .equals( "Sesamum rigidum (subsp. merenskyanum)" ) ) { + return false; + } + if ( !ParserUtils.extractScientificNameFromNodeName( "Sesamum rigidum (ssp merenskyanum)" ) + .equals( "Sesamum rigidum (subsp. merenskyanum)" ) ) { + return false; + } } catch ( final Exception e ) { e.printStackTrace( System.out ); -- 1.7.10.2