f9bcd1f68897917be3525fd408324aaa3f90b5d8
[jalview.git] / forester / java / src / org / forester / tools / PhylogenyDecorator.java
1 // $Id:
2 // FORESTER -- software libraries and applications
3 // for evolutionary biology research and applications.
4 //
5 // Copyright (C) 2008-2009 Christian M. Zmasek
6 // Copyright (C) 2008-2009 Burnham Institute for Medical Research
7 // All rights reserved
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License as published by the Free Software Foundation; either
12 // version 2.1 of the License, or (at your option) any later version.
13 //
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Lesser General Public License for more details.
18 //
19 // You should have received a copy of the GNU Lesser General Public
20 // License along with this library; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 //
23 // Contact: phylosoft @ gmail . com
24 // WWW: www.phylosoft.org/forester
25
26 package org.forester.tools;
27
28 import java.io.File;
29 import java.io.IOException;
30 import java.util.HashMap;
31 import java.util.Map;
32
33 import org.forester.io.parsers.nhx.NHXFormatException;
34 import org.forester.io.parsers.phyloxml.PhyloXmlDataFormatException;
35 import org.forester.phylogeny.Phylogeny;
36 import org.forester.phylogeny.PhylogenyNode;
37 import org.forester.phylogeny.data.Accession;
38 import org.forester.phylogeny.data.Annotation;
39 import org.forester.phylogeny.data.DomainArchitecture;
40 import org.forester.phylogeny.data.Identifier;
41 import org.forester.phylogeny.data.Sequence;
42 import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
43 import org.forester.util.BasicTable;
44 import org.forester.util.BasicTableParser;
45 import org.forester.util.ForesterUtil;
46
47 public final class PhylogenyDecorator {
48
49     // From evoruby/lib/evo/apps/tseq_taxonomy_processor.rb:
50     final private static String TP_TAXONOMY_CODE        = "TAXONOMY_CODE";
51     final private static String TP_TAXONOMY_ID          = "TAXONOMY_ID";
52     final private static String TP_TAXONOMY_ID_PROVIDER = "TAXONOMY_ID_PROVIDER";
53     final private static String TP_TAXONOMY_SN          = "TAXONOMY_SN";
54     final private static String TP_TAXONOMY_CN          = "TAXONOMY_CN";
55     final private static String TP_TAXONOMY_SYN         = "TAXONOMY_SYN";
56     final private static String TP_SEQ_SYMBOL           = "SEQ_SYMBOL";
57     final private static String TP_SEQ_ACCESSION        = "SEQ_ACCESSION";
58     final private static String TP_SEQ_ACCESSION_SOURCE = "SEQ_ACCESSION_SOURCE";
59     final private static String TP_SEQ_ANNOTATION_DESC  = "SEQ_ANNOTATION_DESC";
60     final private static String TP_SEQ_ANNOTATION_REF   = "SEQ_ANNOTATION_REF";
61     final private static String TP_SEQ_MOL_SEQ          = "SEQ_MOL_SEQ";
62     final private static String TP_SEQ_NAME             = "SEQ_NAME";
63     final private static String TP_NODE_NAME            = "NODE_NAME";
64     public final static boolean SANITIZE                = false;
65     public final static boolean VERBOSE                 = true;
66
67     private PhylogenyDecorator() {
68         // Not needed.
69     }
70
71     public static void decorate( final Phylogeny phylogeny,
72                                  final Map<String, Map<String, String>> map,
73                                  final boolean picky,
74                                  final int numbers_of_chars_allowed_to_remove_if_not_found_in_map )
75             throws IllegalArgumentException, PhyloXmlDataFormatException {
76         for( final PhylogenyNodeIterator iter = phylogeny.iteratorPostorder(); iter.hasNext(); ) {
77             final PhylogenyNode node = iter.next();
78             final String name = node.getName();
79             if ( !ForesterUtil.isEmpty( name ) ) {
80                 if ( map.containsKey( name ) || ( numbers_of_chars_allowed_to_remove_if_not_found_in_map > 0 ) ) {
81                     Map<String, String> new_values = map.get( name );
82                     int x = 0;
83                     while ( ( new_values == null ) && ( numbers_of_chars_allowed_to_remove_if_not_found_in_map > 0 )
84                             && ( x <= numbers_of_chars_allowed_to_remove_if_not_found_in_map ) ) {
85                         new_values = map.get( name.substring( 0, name.length() - x ) );
86                         ++x;
87                     }
88                     if ( new_values != null ) {
89                         if ( new_values.containsKey( TP_TAXONOMY_CODE ) ) {
90                             ForesterUtil.ensurePresenceOfTaxonomy( node );
91                             node.getNodeData().getTaxonomy().setTaxonomyCode( new_values.get( TP_TAXONOMY_CODE ) );
92                         }
93                         if ( new_values.containsKey( TP_TAXONOMY_ID )
94                                 && new_values.containsKey( TP_TAXONOMY_ID_PROVIDER ) ) {
95                             ForesterUtil.ensurePresenceOfTaxonomy( node );
96                             node.getNodeData()
97                                     .getTaxonomy()
98                                     .setIdentifier( new Identifier( new_values.get( TP_TAXONOMY_ID ),
99                                                                     new_values.get( TP_TAXONOMY_ID_PROVIDER ) ) );
100                         }
101                         else if ( new_values.containsKey( TP_TAXONOMY_ID ) ) {
102                             ForesterUtil.ensurePresenceOfTaxonomy( node );
103                             node.getNodeData().getTaxonomy()
104                                     .setIdentifier( new Identifier( new_values.get( TP_TAXONOMY_ID ) ) );
105                         }
106                         if ( new_values.containsKey( TP_TAXONOMY_SN ) ) {
107                             ForesterUtil.ensurePresenceOfTaxonomy( node );
108                             node.getNodeData().getTaxonomy().setScientificName( new_values.get( TP_TAXONOMY_SN ) );
109                         }
110                         if ( new_values.containsKey( TP_TAXONOMY_CN ) ) {
111                             ForesterUtil.ensurePresenceOfTaxonomy( node );
112                             node.getNodeData().getTaxonomy().setCommonName( new_values.get( TP_TAXONOMY_CN ) );
113                         }
114                         if ( new_values.containsKey( TP_TAXONOMY_SYN ) ) {
115                             ForesterUtil.ensurePresenceOfTaxonomy( node );
116                             node.getNodeData().getTaxonomy().getSynonyms().add( new_values.get( TP_TAXONOMY_SYN ) );
117                         }
118                         if ( new_values.containsKey( TP_SEQ_ACCESSION )
119                                 && new_values.containsKey( TP_SEQ_ACCESSION_SOURCE ) ) {
120                             ForesterUtil.ensurePresenceOfSequence( node );
121                             node.getNodeData()
122                                     .getSequence()
123                                     .setAccession( new Accession( new_values.get( TP_SEQ_ACCESSION ),
124                                                                   new_values.get( TP_SEQ_ACCESSION_SOURCE ) ) );
125                         }
126                         if ( new_values.containsKey( TP_SEQ_ANNOTATION_DESC ) ) {
127                             ForesterUtil.ensurePresenceOfSequence( node );
128                             final Annotation ann = new Annotation();
129                             ann.setDesc( new_values.get( TP_SEQ_ANNOTATION_DESC ) );
130                             node.getNodeData().getSequence().addAnnotation( ann );
131                         }
132                         if ( new_values.containsKey( TP_SEQ_ANNOTATION_REF ) ) {
133                             ForesterUtil.ensurePresenceOfSequence( node );
134                             final Annotation ann = new Annotation( new_values.get( TP_SEQ_ANNOTATION_REF ) );
135                             node.getNodeData().getSequence().addAnnotation( ann );
136                         }
137                         if ( new_values.containsKey( TP_SEQ_SYMBOL ) ) {
138                             ForesterUtil.ensurePresenceOfSequence( node );
139                             node.getNodeData().getSequence().setSymbol( new_values.get( TP_SEQ_SYMBOL ) );
140                         }
141                         if ( new_values.containsKey( TP_SEQ_NAME ) ) {
142                             ForesterUtil.ensurePresenceOfSequence( node );
143                             node.getNodeData().getSequence().setName( new_values.get( TP_SEQ_NAME ) );
144                         }
145                         if ( new_values.containsKey( TP_SEQ_MOL_SEQ ) ) {
146                             ForesterUtil.ensurePresenceOfSequence( node );
147                             node.getNodeData().getSequence().setMolecularSequence( new_values.get( TP_SEQ_MOL_SEQ ) );
148                         }
149                         if ( new_values.containsKey( TP_NODE_NAME ) ) {
150                             node.setName( new_values.get( TP_NODE_NAME ) );
151                         }
152                     } // if ( new_values != null ) 
153                 } // if ( map.containsKey( name ) || ( numbers_of_chars_allowed_to_remove_if_not_found_in_map > 0 ) )
154                 else if ( picky ) {
155                     throw new IllegalArgumentException( "\"" + name + "\" not found in name map" );
156                 }
157             }
158         }
159     }
160
161     public static void decorate( final Phylogeny phylogeny,
162                                  final Map<String, String> map,
163                                  final FIELD field,
164                                  final boolean extract_bracketed_scientific_name,
165                                  final boolean extract_bracketed_tax_code,
166                                  final boolean picky,
167                                  final boolean cut_name_after_space,
168                                  final boolean process_name_intelligently,
169                                  final boolean process_similar_to,
170                                  final int numbers_of_chars_allowed_to_remove_if_not_found_in_map,
171                                  final boolean trim_after_tilde ) throws IllegalArgumentException, NHXFormatException,
172             PhyloXmlDataFormatException {
173         PhylogenyDecorator.decorate( phylogeny,
174                                      map,
175                                      field,
176                                      extract_bracketed_scientific_name,
177                                      extract_bracketed_tax_code,
178                                      picky,
179                                      null,
180                                      cut_name_after_space,
181                                      process_name_intelligently,
182                                      process_similar_to,
183                                      numbers_of_chars_allowed_to_remove_if_not_found_in_map,
184                                      trim_after_tilde );
185     }
186
187     /**
188      * 
189      * 
190      * 
191      * @param phylogeny
192      * @param map
193      *            maps names (in phylogeny) to new values if intermediate_map is
194      *            null otherwise maps intermediate value to new value
195      * @param field
196      * @param picky
197      * @param intermediate_map
198      *            maps name (in phylogeny) to a intermediate value
199      * @throws IllegalArgumentException
200      * @throws PhyloXmlDataFormatException 
201      */
202     public static void decorate( final Phylogeny phylogeny,
203                                  final Map<String, String> map,
204                                  final FIELD field,
205                                  final boolean extract_bracketed_scientific_name,
206                                  final boolean extract_bracketed_tax_code,
207                                  final boolean picky,
208                                  final Map<String, String> intermediate_map,
209                                  final boolean cut_name_after_space,
210                                  final boolean process_name_intelligently,
211                                  final boolean process_similar_to,
212                                  final int numbers_of_chars_allowed_to_remove_if_not_found_in_map,
213                                  final boolean trim_after_tilde ) throws IllegalArgumentException,
214             PhyloXmlDataFormatException {
215         if ( extract_bracketed_scientific_name && ( field == FIELD.TAXONOMY_SCIENTIFIC_NAME ) ) {
216             throw new IllegalArgumentException( "attempt to extract bracketed scientific name together with data field pointing to scientific name" );
217         }
218         for( final PhylogenyNodeIterator iter = phylogeny.iteratorPostorder(); iter.hasNext(); ) {
219             final PhylogenyNode node = iter.next();
220             String name = node.getName();
221             if ( trim_after_tilde && ( name.indexOf( '~' ) > 0 ) ) {
222                 name = name.substring( 0, name.indexOf( '~' ) );
223             }
224             if ( !ForesterUtil.isEmpty( name ) ) {
225                 if ( intermediate_map != null ) {
226                     name = PhylogenyDecorator.extractIntermediate( intermediate_map, name );
227                 }
228                 if ( map.containsKey( name ) || ( numbers_of_chars_allowed_to_remove_if_not_found_in_map > 0 ) ) {
229                     String new_value = map.get( name );
230                     int x = 0;
231                     while ( ( new_value == null ) && ( numbers_of_chars_allowed_to_remove_if_not_found_in_map > 0 )
232                             && ( x <= numbers_of_chars_allowed_to_remove_if_not_found_in_map ) ) {
233                         new_value = map.get( name.substring( 0, name.length() - x ) );
234                         ++x;
235                     }
236                     if ( new_value != null ) {
237                         new_value = new_value.trim();
238                         new_value.replaceAll( "/\\s+/", " " );
239                         if ( extract_bracketed_scientific_name && new_value.endsWith( "]" ) ) {
240                             new_value = extractBracketedScientificNames( node, new_value );
241                         }
242                         else if ( extract_bracketed_tax_code && new_value.endsWith( "]" ) ) {
243                             new_value = extractBracketedTaxCodes( node, new_value );
244                         }
245                         switch ( field ) {
246                             case SEQUENCE_ANNOTATION_DESC:
247                                 if ( PhylogenyDecorator.VERBOSE ) {
248                                     System.out.println( name + ": " + new_value );
249                                 }
250                                 if ( !node.getNodeData().isHasSequence() ) {
251                                     node.getNodeData().setSequence( new Sequence() );
252                                 }
253                                 final Annotation annotation = new Annotation( "?" );
254                                 annotation.setDesc( new_value );
255                                 node.getNodeData().getSequence().addAnnotation( annotation );
256                                 break;
257                             case DOMAIN_STRUCTURE:
258                                 if ( PhylogenyDecorator.VERBOSE ) {
259                                     System.out.println( name + ": " + new_value );
260                                 }
261                                 if ( !node.getNodeData().isHasSequence() ) {
262                                     node.getNodeData().setSequence( new Sequence() );
263                                 }
264                                 node.getNodeData().getSequence()
265                                         .setDomainArchitecture( new DomainArchitecture( new_value ) );
266                                 break;
267                             case TAXONOMY_CODE:
268                                 if ( PhylogenyDecorator.VERBOSE ) {
269                                     System.out.println( name + ": " + new_value );
270                                 }
271                                 ForesterUtil.ensurePresenceOfTaxonomy( node );
272                                 node.getNodeData().getTaxonomy().setTaxonomyCode( new_value );
273                                 break;
274                             case TAXONOMY_SCIENTIFIC_NAME:
275                                 if ( PhylogenyDecorator.VERBOSE ) {
276                                     System.out.println( name + ": " + new_value );
277                                 }
278                                 ForesterUtil.ensurePresenceOfTaxonomy( node );
279                                 node.getNodeData().getTaxonomy().setScientificName( new_value );
280                                 break;
281                             case SEQUENCE_NAME:
282                                 if ( PhylogenyDecorator.VERBOSE ) {
283                                     System.out.println( name + ": " + new_value );
284                                 }
285                                 if ( !node.getNodeData().isHasSequence() ) {
286                                     node.getNodeData().setSequence( new Sequence() );
287                                 }
288                                 node.getNodeData().getSequence().setName( new_value );
289                                 break;
290                             case NODE_NAME:
291                                 if ( PhylogenyDecorator.VERBOSE ) {
292                                     System.out.print( name + " -> " );
293                                 }
294                                 if ( cut_name_after_space ) {
295                                     if ( PhylogenyDecorator.VERBOSE ) {
296                                         System.out.print( new_value + " -> " );
297                                     }
298                                     new_value = PhylogenyDecorator.deleteAtFirstSpace( new_value );
299                                 }
300                                 else if ( process_name_intelligently ) {
301                                     if ( PhylogenyDecorator.VERBOSE ) {
302                                         System.out.print( new_value + " -> " );
303                                     }
304                                     new_value = PhylogenyDecorator.processNameIntelligently( new_value );
305                                 }
306                                 else if ( process_similar_to ) {
307                                     if ( PhylogenyDecorator.VERBOSE ) {
308                                         System.out.print( new_value + " -> " );
309                                     }
310                                     new_value = PhylogenyDecorator.processSimilarTo( new_value );
311                                 }
312                                 if ( PhylogenyDecorator.SANITIZE ) {
313                                     new_value = PhylogenyDecorator.sanitize( new_value );
314                                 }
315                                 if ( PhylogenyDecorator.VERBOSE ) {
316                                     System.out.println( new_value );
317                                 }
318                                 node.setName( new_value );
319                                 break;
320                             default:
321                                 throw new RuntimeException( "unknown field \"" + field + "\"" );
322                         }
323                     }
324                 }
325                 else if ( picky ) {
326                     throw new IllegalArgumentException( "\"" + name + "\" not found in name map" );
327                 }
328             }
329         }
330     }
331
332     public static void decorate( final Phylogeny[] phylogenies,
333                                  final Map<String, Map<String, String>> map,
334                                  final boolean picky,
335                                  final int numbers_of_chars_allowed_to_remove_if_not_found_in_map )
336             throws IllegalArgumentException, NHXFormatException, PhyloXmlDataFormatException {
337         for( final Phylogeny phylogenie : phylogenies ) {
338             PhylogenyDecorator
339                     .decorate( phylogenie, map, picky, numbers_of_chars_allowed_to_remove_if_not_found_in_map );
340         }
341     }
342
343     public static void decorate( final Phylogeny[] phylogenies,
344                                  final Map<String, String> map,
345                                  final FIELD field,
346                                  final boolean extract_bracketed_scientific_name,
347                                  final boolean extract_bracketed_tax_code,
348                                  final boolean picky,
349                                  final boolean cut_name_after_space,
350                                  final boolean process_name_intelligently,
351                                  final boolean process_similar_to,
352                                  final int numbers_of_chars_allowed_to_remove_if_not_found_in_map,
353                                  final boolean trim_after_tilde ) throws IllegalArgumentException, NHXFormatException,
354             PhyloXmlDataFormatException {
355         for( final Phylogeny phylogenie : phylogenies ) {
356             PhylogenyDecorator.decorate( phylogenie,
357                                          map,
358                                          field,
359                                          extract_bracketed_scientific_name,
360                                          extract_bracketed_tax_code,
361                                          picky,
362                                          cut_name_after_space,
363                                          process_name_intelligently,
364                                          process_similar_to,
365                                          numbers_of_chars_allowed_to_remove_if_not_found_in_map,
366                                          trim_after_tilde );
367         }
368     }
369
370     public static void decorate( final Phylogeny[] phylogenies,
371                                  final Map<String, String> map,
372                                  final FIELD field,
373                                  final boolean extract_bracketed_scientific_name,
374                                  final boolean extract_bracketed_tax_code,
375                                  final boolean picky,
376                                  final Map<String, String> intermediate_map,
377                                  final boolean cut_name_after_space,
378                                  final boolean process_name_intelligently,
379                                  final boolean process_similar_to,
380                                  final int numbers_of_chars_allowed_to_remove_if_not_found_in_map,
381                                  final boolean trim_after_tilde ) throws IllegalArgumentException, NHXFormatException,
382             PhyloXmlDataFormatException {
383         for( final Phylogeny phylogenie : phylogenies ) {
384             PhylogenyDecorator.decorate( phylogenie,
385                                          map,
386                                          field,
387                                          extract_bracketed_scientific_name,
388                                          extract_bracketed_tax_code,
389                                          picky,
390                                          intermediate_map,
391                                          cut_name_after_space,
392                                          process_name_intelligently,
393                                          process_similar_to,
394                                          numbers_of_chars_allowed_to_remove_if_not_found_in_map,
395                                          trim_after_tilde );
396         }
397     }
398
399     public static Map<String, Map<String, String>> parseMappingTable( final File mapping_table_file )
400             throws IOException {
401         final Map<String, Map<String, String>> map = new HashMap<String, Map<String, String>>();
402         BasicTable<String> mapping_table = null;
403         mapping_table = BasicTableParser.parse( mapping_table_file, "\t", false, false );
404         for( int row = 0; row < mapping_table.getNumberOfRows(); ++row ) {
405             final Map<String, String> row_map = new HashMap<String, String>();
406             String name = null;
407             for( int col = 0; col < mapping_table.getNumberOfColumns(); ++col ) {
408                 final String table_cell = mapping_table.getValue( col, row );
409                 if ( col == 0 ) {
410                     name = table_cell;
411                 }
412                 else if ( table_cell != null ) {
413                     final String key = table_cell.substring( 0, table_cell.indexOf( ':' ) );
414                     final String val = table_cell.substring( table_cell.indexOf( ':' ) + 1, table_cell.length() );
415                     row_map.put( key, val );
416                 }
417             }
418             map.put( name, row_map );
419         }
420         return map;
421     }
422
423     private static String deleteAtFirstSpace( final String name ) {
424         final int first_space = name.indexOf( " " );
425         if ( first_space > 1 ) {
426             return name.substring( 0, first_space ).trim();
427         }
428         return name;
429     }
430
431     private static String extractBracketedScientificNames( final PhylogenyNode node, final String new_value ) {
432         final int i = new_value.lastIndexOf( "[" );
433         final String scientific_name = new_value.substring( i + 1, new_value.length() - 1 );
434         ForesterUtil.ensurePresenceOfTaxonomy( node );
435         node.getNodeData().getTaxonomy().setScientificName( scientific_name );
436         return new_value.substring( 0, i - 1 ).trim();
437     }
438
439     private static String extractBracketedTaxCodes( final PhylogenyNode node, final String new_value ) {
440         final int i = new_value.lastIndexOf( "[" );
441         final String tc = new_value.substring( i + 1, new_value.length() - 1 );
442         ForesterUtil.ensurePresenceOfTaxonomy( node );
443         try {
444             node.getNodeData().getTaxonomy().setTaxonomyCode( tc );
445         }
446         catch ( final PhyloXmlDataFormatException e ) {
447             throw new IllegalArgumentException( "illegal format for taxonomy code: " + tc );
448         }
449         return new_value.substring( 0, i - 1 ).trim();
450     }
451
452     private static String extractIntermediate( final Map<String, String> intermediate_map, final String name ) {
453         String new_name = null;
454         if ( PhylogenyDecorator.VERBOSE ) {
455             System.out.print( name + " => " );
456         }
457         if ( intermediate_map.containsKey( name ) ) {
458             new_name = intermediate_map.get( name );
459             if ( ForesterUtil.isEmpty( new_name ) ) {
460                 throw new IllegalArgumentException( "\"" + name + "\" maps to null or empty string in secondary map" );
461             }
462         }
463         else {
464             throw new IllegalArgumentException( "\"" + name + "\" not found in name secondary map" );
465         }
466         if ( PhylogenyDecorator.VERBOSE ) {
467             System.out.println( new_name + "  " );
468         }
469         return new_name;
470     }
471
472     private static String processNameIntelligently( final String name ) {
473         final String[] s = name.split( " " );
474         if ( s.length < 2 ) {
475             return name;
476         }
477         else if ( ( s[ 0 ].indexOf( "_" ) > 0 ) && ( s[ 0 ].indexOf( "|" ) > 0 ) ) {
478             return s[ 0 ];
479         }
480         else if ( ( s[ 1 ].indexOf( "_" ) > 0 ) && ( s[ 1 ].indexOf( "|" ) > 0 ) ) {
481             return s[ 1 ];
482         }
483         else if ( ( s[ 0 ].indexOf( "_" ) > 0 ) && ( s[ 0 ].indexOf( "." ) > 0 ) ) {
484             return s[ 0 ];
485         }
486         else if ( ( s[ 1 ].indexOf( "_" ) > 0 ) && ( s[ 1 ].indexOf( "." ) > 0 ) ) {
487             return s[ 1 ];
488         }
489         else if ( s[ 0 ].indexOf( "_" ) > 0 ) {
490             return s[ 0 ];
491         }
492         else if ( s[ 1 ].indexOf( "_" ) > 0 ) {
493             return s[ 1 ];
494         }
495         else {
496             return s[ 0 ];
497         }
498     }
499
500     private static String processSimilarTo( final String name ) {
501         final int i = name.toLowerCase().indexOf( "similar to" );
502         String similar_to = "";
503         if ( i >= 0 ) {
504             similar_to = " similarity=" + name.substring( i + 10 ).trim();
505         }
506         final String pi = processNameIntelligently( name );
507         return pi + similar_to;
508     }
509
510     private static String sanitize( String s ) {
511         s = s.replace( ' ', '_' );
512         s = s.replace( '(', '{' );
513         s = s.replace( ')', '}' );
514         s = s.replace( '[', '{' );
515         s = s.replace( ']', '}' );
516         s = s.replace( ',', '_' );
517         return s;
518     }
519
520     public static enum FIELD {
521         NODE_NAME, SEQUENCE_ANNOTATION_DESC, DOMAIN_STRUCTURE, TAXONOMY_CODE, TAXONOMY_SCIENTIFIC_NAME, SEQUENCE_NAME;
522     }
523 }