+ }
+ }
+ else if ( taxonomy_extraction == TAXONOMY_EXTRACTION.YES ) {
+ final Matcher m1 = TAXOMONY_CODE_PATTERN_1.matcher( name );
+ if ( m1.matches() ) {
+ return name;
+ }
+ }
+ return null;
+ }
+
+ public final static String extractScientificNameFromNodeName( final String name ) {
+ final Matcher m1 = TAXOMONY_SN_PATTERN.matcher( name );
+ if ( m1.matches() ) {
+ return m1.group( 1 ).replace( '_', ' ' );
+ }
+ return null;
+ }
+
+ public final static String extractTaxonomyDataFromNodeName( final PhylogenyNode node,
+ final NHXParser.TAXONOMY_EXTRACTION taxonomy_extraction )
+ throws PhyloXmlDataFormatException {
+ final String id = extractUniprotTaxonomyIdFromNodeName( node.getName(), taxonomy_extraction );
+ if ( !ForesterUtil.isEmpty( id ) ) {
+ if ( !node.getNodeData().isHasTaxonomy() ) {
+ node.getNodeData().setTaxonomy( new Taxonomy() );
+ }
+ if ( ( node.getNodeData().getTaxonomy().getIdentifier() == null )
+ || ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getIdentifier().getValue() ) ) {
+ node.getNodeData().getTaxonomy().setIdentifier( new Identifier( id, "uniprot" ) );
+ return id;
+ }
+ }
+ else {
+ final String code = extractTaxonomyCodeFromNodeName( node.getName(), taxonomy_extraction );
+ if ( !ForesterUtil.isEmpty( code ) ) {
+ if ( !node.getNodeData().isHasTaxonomy() ) {
+ node.getNodeData().setTaxonomy( new Taxonomy() );
+ }
+ if ( ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getTaxonomyCode() ) ) {
+ node.getNodeData().getTaxonomy().setTaxonomyCode( code );
+ return code;