moved to: https://sites.google.com/site/cmzmasek/home/software/forester
[jalview.git] / forester / java / src / org / forester / go / etc / MetaOntologizer.java
index 970f939..11afb54 100644 (file)
@@ -5,7 +5,7 @@
 // Copyright (C) 2008-2009 Christian M. Zmasek
 // Copyright (C) 2008-2009 Burnham Institute for Medical Research
 // All rights reserved
-// 
+//
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 // Lesser General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 //
 // Contact: phylosoft @ gmail . com
-// WWW: www.phylosoft.org
+// WWW: https://sites.google.com/site/cmzmasek/home/software/forester
 
 package org.forester.go.etc;
 
@@ -51,9 +51,9 @@ import org.forester.go.GoTerm;
 import org.forester.go.GoUtils;
 import org.forester.go.OBOparser;
 import org.forester.go.PfamToGoMapping;
-import org.forester.surfacing.BasicSpecies;
-import org.forester.surfacing.DomainId;
-import org.forester.surfacing.Species;
+import org.forester.protein.DomainId;
+import org.forester.species.BasicSpecies;
+import org.forester.species.Species;
 import org.forester.surfacing.SurfacingConstants;
 import org.forester.surfacing.SurfacingUtil;
 import org.forester.util.ForesterUtil;
@@ -66,7 +66,10 @@ public class MetaOntologizer {
     final static private String       PRG_NAME                         = "meta_ontologizer";
     private static final boolean      VERBOSE                          = true;
     //table-a_41_dollo_all_gains_d-Topology-Elim-Bonferroni.txt:
-    private final static Pattern      PATTERN_ONTOLOGIZER_TABLE_OUTPUT = Pattern.compile( ".*table-(.+)_dollo_.*",
+    //TODO change back
+    // private final static Pattern      PATTERN_ONTOLOGIZER_TABLE_OUTPUT = Pattern.compile( ".*table-(.+)_dollo_.*",
+    //                                                                                      Pattern.CASE_INSENSITIVE ); //TODO this might need some work...
+    private final static Pattern      PATTERN_ONTOLOGIZER_TABLE_OUTPUT = Pattern.compile( ".*table-(.+)\\.txt",
                                                                                           Pattern.CASE_INSENSITIVE ); //TODO this might need some work...
 
     private static boolean hasResultsForSpecies( final Map<GoId, GoTerm> go_id_to_terms,
@@ -146,6 +149,9 @@ public class MetaOntologizer {
                 else if ( line.startsWith( "#" ) ) {
                     current_species = new BasicSpecies( line.substring( 1 ) );
                     speciesto_to_domain_id.put( current_species, new TreeSet<DomainId>() );
+                    if ( VERBOSE ) {
+                        ForesterUtil.programMessage( PRG_NAME, "saw " + current_species );
+                    }
                 }
                 else {
                     if ( current_species == null ) {
@@ -438,22 +444,18 @@ public class MetaOntologizer {
         w.write( ForesterUtil.LINE_SEPARATOR );
         w.write( "a.new_type:link { font-size: 7pt; color : #505050; text-decoration : none; }" );
         w.write( ForesterUtil.LINE_SEPARATOR );
-        w
-                .write( "a.new_type:hover { font-size: 7pt; color : #000000; background-color : #FFFF00; text-decoration : none; }" );
+        w.write( "a.new_type:hover { font-size: 7pt; color : #000000; background-color : #FFFF00; text-decoration : none; }" );
         w.write( ForesterUtil.LINE_SEPARATOR );
-        w
-                .write( "a.new_type:hover { font-size: 7pt; color : #000000; background-color : #FFFF00; text-decoration : none; }" );
+        w.write( "a.new_type:hover { font-size: 7pt; color : #000000; background-color : #FFFF00; text-decoration : none; }" );
         w.write( ForesterUtil.LINE_SEPARATOR );
         w.write( "td { text-align: left; vertical-align: top; font-family: Verdana, Arial, Helvetica; font-size: 8pt}" );
         w.write( ForesterUtil.LINE_SEPARATOR );
-        w
-                .write( "th { text-align: left; vertical-align: top; font-family: Verdana, Arial, Helvetica; font-size: 10pt; font-weight: bold }" );
+        w.write( "th { text-align: left; vertical-align: top; font-family: Verdana, Arial, Helvetica; font-size: 10pt; font-weight: bold }" );
         w.write( ForesterUtil.LINE_SEPARATOR );
         w.write( "h1 { color : #000000; font-family: Verdana, Arial, Helvetica; font-size: 18pt; font-weight: bold }" );
         w.write( ForesterUtil.LINE_SEPARATOR );
         w.write( "h2 { color : #000000; font-family: Verdana, Arial, Helvetica; font-size: 16pt; font-weight: bold }" );
-        w
-                .write( "h3 { margin-top: 12px;  margin-bottom: 0px; color : #000000; font-family: Verdana, Arial, Helvetica; font-size: 12pt; font-weight: bold }" );
+        w.write( "h3 { margin-top: 12px;  margin-bottom: 0px; color : #000000; font-family: Verdana, Arial, Helvetica; font-size: 12pt; font-weight: bold }" );
         w.write( ForesterUtil.LINE_SEPARATOR );
         w.write( "</style>" );
         w.write( ForesterUtil.LINE_SEPARATOR );
@@ -592,8 +594,11 @@ public class MetaOntologizer {
         writer.write( String.valueOf( ontologizer_result.getStudyTerm() ) );
         writer.write( "</td><td>" );
         if ( domains_per_species != null ) {
-            final StringBuilder sb = obtainDomainsForGoId( pfam_to_go, domains_per_species, go_id_to_terms, go_term
-                    .getGoId(), domain_ids_with_go_annot );
+            final StringBuilder sb = obtainDomainsForGoId( pfam_to_go,
+                                                           domains_per_species,
+                                                           go_id_to_terms,
+                                                           go_term.getGoId(),
+                                                           domain_ids_with_go_annot );
             writer.write( sb.toString() );
         }
         else {