moved classes into different project
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Wed, 12 Oct 2011 19:57:29 +0000 (19:57 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Wed, 12 Oct 2011 19:57:29 +0000 (19:57 +0000)
forester/java/src/org/forester/application/get_subtree_specific_chars.java [deleted file]
forester/java/src/org/forester/application/map_lengths.java [deleted file]
forester/java/src/org/forester/application/simple_node_processor.java [deleted file]

diff --git a/forester/java/src/org/forester/application/get_subtree_specific_chars.java b/forester/java/src/org/forester/application/get_subtree_specific_chars.java
deleted file mode 100644 (file)
index e0d754f..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-// $Id:
-// FORESTER -- software libraries and applications
-// for evolutionary biology research and applications.
-//
-// Copyright (C) 2008-2011 Christian M. Zmasek
-// Copyright (C) 2008-2011 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
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// 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/forester
-
-package org.forester.application;
-
-import java.io.File;
-import java.util.List;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.forester.phylogeny.Phylogeny;
-import org.forester.phylogeny.PhylogenyNode;
-import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
-import org.forester.phylogeny.factories.PhylogenyFactory;
-import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
-import org.forester.util.ForesterUtil;
-
-public class get_subtree_specific_chars {
-
-    final static boolean SIMPLE = false;
-
-    public static void main( final String args[] ) {
-        if ( args.length != 1 ) {
-            System.err.println();
-            System.err.println( "get_subtree_specific_chars: wrong number of arguments" );
-            System.err.println( "Usage: \"get_subtree_specific_chars <intree>" );
-            System.err.println();
-            System.exit( -1 );
-        }
-        final File infile = new File( args[ 0 ] );
-        Phylogeny phy = null;
-        try {
-            final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
-            phy = factory.create( infile, ForesterUtil.createParserDependingOnFileType( infile, true ) )[ 0 ];
-        }
-        catch ( final Exception e ) {
-            System.err.println( e + "\nCould not read " + infile + "\n" );
-            System.exit( -1 );
-        }
-        final SortedSet<Integer> all_external_ids = getAllExternalDescendantsNodeIds( phy.getRoot() );
-        final SortedSet<String> all_chars = getAllExternalPresentAndGainedCharacters( phy.getRoot() );
-        System.out.println( "Sum of all external characters:\t" + all_chars.size() );
-        System.out.println();
-        for( final PhylogenyNodeIterator iter = phy.iteratorPostorder(); iter.hasNext(); ) {
-            final PhylogenyNode node = iter.next();
-            if ( !SIMPLE && node.isExternal() ) {
-                continue;
-            }
-            if ( !node.isRoot() ) {
-                System.out.println();
-                if ( node.getNodeData().isHasTaxonomy()
-                        && !ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getScientificName() ) ) {
-                    System.out.print( node.getName() + " " + node.getNodeData().getTaxonomy().getScientificName() );
-                }
-                else {
-                    System.out.print( node.getName() );
-                }
-                System.out.println( ":" );
-                final SortedSet<Integer> external_ids = getAllExternalDescendantsNodeIds( node );
-                final SortedSet<Integer> not_external_ids = copy( all_external_ids );
-                not_external_ids.removeAll( external_ids );
-                final SortedSet<String> not_node_chars = new TreeSet<String>();
-                for( final Integer id : not_external_ids ) {
-                    not_node_chars.addAll( getAllExternalPresentAndGainedCharacters( phy.getNode( id ) ) );
-                }
-                final SortedSet<String> node_chars = getAllExternalPresentAndGainedCharacters( node );
-                final SortedSet<String> unique_chars = new TreeSet<String>();
-                for( final String node_char : node_chars ) {
-                    if ( !not_node_chars.contains( node_char ) ) {
-                        if ( SIMPLE ) {
-                            unique_chars.add( node_char );
-                        }
-                        else {
-                            boolean found = true;
-                            for( final int external_id : external_ids ) {
-                                if ( !phy.getNode( external_id ).getNodeData().getBinaryCharacters()
-                                        .getGainedCharacters().contains( node_char )
-                                        && !phy.getNode( external_id ).getNodeData().getBinaryCharacters()
-                                                .getPresentCharacters().contains( node_char ) ) {
-                                    found = false;
-                                    break;
-                                }
-                            }
-                            if ( found ) {
-                                unique_chars.add( node_char );
-                            }
-                        }
-                    }
-                }
-                System.out.println( "\tSUM:\t" + unique_chars.size() );
-                int counter = 1;
-                for( final String unique_char : unique_chars ) {
-                    System.out.println( "\t" + counter + ":\t" + unique_char );
-                    ++counter;
-                }
-            }
-        }
-    }
-
-    private static SortedSet<Integer> copy( final SortedSet<Integer> set ) {
-        final SortedSet<Integer> copy = new TreeSet<Integer>();
-        for( final Integer i : set ) {
-            copy.add( i );
-        }
-        return copy;
-    }
-
-    private static SortedSet<Integer> getAllExternalDescendantsNodeIds( final PhylogenyNode node ) {
-        final SortedSet<Integer> ids = new TreeSet<Integer>();
-        final List<PhylogenyNode> descs = node.getAllExternalDescendants();
-        for( final PhylogenyNode desc : descs ) {
-            ids.add( desc.getId() );
-        }
-        return ids;
-    }
-
-    private static SortedSet<String> getAllExternalPresentAndGainedCharacters( final PhylogenyNode node ) {
-        final SortedSet<String> chars = new TreeSet<String>();
-        final List<PhylogenyNode> descs = node.getAllExternalDescendants();
-        for( final PhylogenyNode desc : descs ) {
-            chars.addAll( desc.getNodeData().getBinaryCharacters().getGainedCharacters() );
-            chars.addAll( desc.getNodeData().getBinaryCharacters().getPresentCharacters() );
-        }
-        return chars;
-    }
-}
diff --git a/forester/java/src/org/forester/application/map_lengths.java b/forester/java/src/org/forester/application/map_lengths.java
deleted file mode 100644 (file)
index 70bde38..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-// $Id:
-//
-// forester -- software libraries and applications
-// for genomics and evolutionary biology research.
-//
-// Copyright (C) 2011 Christian M Zmasek
-// Copyright (C) 2011 Sanford-Burnham Medical Research Institute
-// 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
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// 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/forester
-
-package org.forester.application;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
-import org.forester.archaeopteryx.Archaeopteryx;
-import org.forester.io.parsers.FastaParser;
-import org.forester.io.parsers.phyloxml.PhyloXmlParser;
-import org.forester.phylogeny.Phylogeny;
-import org.forester.phylogeny.PhylogenyNode;
-import org.forester.phylogeny.data.PropertiesMap;
-import org.forester.phylogeny.data.Property;
-import org.forester.phylogeny.data.Property.AppliesTo;
-import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
-import org.forester.phylogeny.factories.PhylogenyFactory;
-import org.forester.sequence.Sequence;
-import org.forester.util.CommandLineArguments;
-import org.forester.util.ForesterUtil;
-
-public class map_lengths {
-
-    final static private String PRG_NAME = "map_lengths";
-
-    public static void main( final String[] args ) {
-        CommandLineArguments cla = null;
-        try {
-            cla = new CommandLineArguments( args );
-        }
-        catch ( final Exception e ) {
-            ForesterUtil.fatalError( PRG_NAME, e.getMessage() );
-        }
-        try {
-            final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
-            final PhyloXmlParser xml_parser = new PhyloXmlParser();
-            final Phylogeny[] phylogenies_0 = factory.create( cla.getFile( 0 ), xml_parser );
-            final Phylogeny phy = phylogenies_0[ 0 ];
-            for( int i = 1; i < cla.getNumberOfNames(); i++ ) {
-                final String fasta_name = cla.getName( i );
-                final List<Sequence> seqs = FastaParser.parse( new File( fasta_name ) );
-                for( int s = 0; s < seqs.size(); s++ ) {
-                    final Sequence seq = seqs.get( s );
-                    final int actual_length = seq.getLength() - seq.getNumberOfGapResidues();
-                    String node_name = "" + seq.getIdentifier();
-                    node_name = node_name.substring( 0, node_name.indexOf( "/" ) );
-                    final PhylogenyNode n = phy.getNode( node_name );
-                    if ( n.getNodeData().getProperties() == null ) {
-                        n.getNodeData().setProperties( new PropertiesMap() );
-                    }
-                    final PropertiesMap properties = n.getNodeData().getProperties();
-                    final Property p = new Property( "r:" + i, "" + actual_length, "", "xsd:integer", AppliesTo.NODE );
-                    properties.addProperty( p );
-                }
-            }
-            Archaeopteryx.createApplication( phy );
-        }
-        catch ( final IOException e ) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-    }
-}
diff --git a/forester/java/src/org/forester/application/simple_node_processor.java b/forester/java/src/org/forester/application/simple_node_processor.java
deleted file mode 100644 (file)
index a190edf..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-// $Id:
-// FORESTER -- software libraries and applications
-// for evolutionary biology research and applications.
-//
-// 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
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// 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
-
-package org.forester.application;
-
-import java.io.File;
-
-import org.forester.io.parsers.phyloxml.PhyloXmlParser;
-import org.forester.phylogeny.Phylogeny;
-import org.forester.phylogeny.PhylogenyNode;
-import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
-import org.forester.phylogeny.factories.PhylogenyFactory;
-import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
-import org.forester.util.CommandLineArguments;
-
-public class simple_node_processor {
-
-    private final static String BASE = "b_";
-
-    public static void main( final String args[] ) {
-        File in = null;
-        final File out = null;
-        try {
-            CommandLineArguments cla = null;
-            cla = new CommandLineArguments( args );
-            in = cla.getFile( 0 );
-            // out = cla.getFile( 1 );
-            // if ( out.exists() ) {
-            //      System.out.println( out + " already exists" );
-            //      System.exit( -1 );
-            //  }
-            final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
-            final PhyloXmlParser xml_parser = new PhyloXmlParser();
-            final Phylogeny[] phylogenies_0 = factory.create( in, xml_parser );
-            final Phylogeny phylogeny_0 = phylogenies_0[ 0 ];
-            final PhylogenyNodeIterator it = phylogeny_0.iteratorPostorder();
-            int i = 0;
-            while ( it.hasNext() ) {
-                final PhylogenyNode node = it.next();
-                processNode( node, i );
-                i++;
-            }
-            //  final PhylogenyWriter writer = new PhylogenyWriter();
-            //  writer.toPhyloXML( out, phylogeny_0, 0 );
-        }
-        catch ( final Exception e ) {
-            System.out.println( e.getLocalizedMessage() );
-            e.printStackTrace();
-            System.exit( -1 );
-        }
-    }
-
-    //    private static void processNode( final PhylogenyNode node, final int i ) {
-    //        node.setDistanceToParent( PhylogenyNode.DISTANCE_DEFAULT );
-    //        if ( !node.isExternal() ) {
-    //            if ( ( node.getName() == null ) || node.getName().isEmpty() ) {
-    //                node.setName( BASE + i );
-    //            }
-    //        }
-    //    }
-    private static void processNode( final PhylogenyNode node, final int i ) {
-        if ( node.isExternal() ) {
-            final String c = "" + node.getNodeData().getBinaryCharacters().getPresentCount();
-            final String s = node.getNodeData().getTaxonomy().getScientificName();
-            System.out.println( s + "\t" + c );
-        }
-    }
-}