--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="lib" path="/forester/java/forester.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>forester_applications</name>
+ <comment></comment>
+ <projects>
+ <project>forester</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+#Thu Nov 03 10:01:31 PDT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=true
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=82
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=82
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=82
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=82
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=82
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=50
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=82
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=82
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=48
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=1
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=0
+org.eclipse.jdt.core.formatter.blank_lines_before_package=1
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=true
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=120
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=0
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
--- /dev/null
+#Thu Nov 03 10:01:31 PDT 2011
+cleanup.add_default_serial_version_id=false
+cleanup.add_generated_serial_version_id=true
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=true
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=true
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_to_enhanced_for_loop=true
+cleanup.correct_indentation=true
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=true
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=true
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=false
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=true
+cleanup.use_this_for_non_static_field_access=true
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=true
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup_profile=_forester_java_profile
+cleanup_settings_version=2
+eclipse.preferences.version=1
+formatter_profile=_forester
+formatter_settings_version=11
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.overrideannotation=true
--- /dev/null
+
+package org.forester.applications;
+
+// $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
+// javac -cp ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/org/forester/applications/core_chars.java
+// java -Xmx2048m -cp
+// /home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/:/home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// org.forester.applications.core_chars
+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;
+
+public class core_chars {
+
+ final static boolean SIMPLE = true;
+
+ public static void main( final String args[] ) {
+ if ( args.length != 1 ) {
+ System.err.println();
+ System.err.println( "core_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, org.forester.io.parsers.util.ParserUtils
+ .createParserDependingOnFileType( infile, true ) )[ 0 ];
+ }
+ catch ( final Exception e ) {
+ System.err.println( e + "\nCould not read " + infile + "\n" );
+ System.exit( -1 );
+ }
+ final SortedSet<String> a = getAllExternalPresentAndGainedCharacters( phy.getNode( "Opisthokonta" ) );
+ final SortedSet<String> b = getAllExternalPresentAndGainedCharacters( phy.getNode( "THETRA" ) );
+ final SortedSet<String> c = getAllExternalPresentAndGainedCharacters( phy.getNode( "Amoebozoa" ) );
+ final SortedSet<String> d = getAllExternalPresentAndGainedCharacters( phy.getNode( "Archaeplastida" ) );
+ final SortedSet<String> e = getAllExternalPresentAndGainedCharacters( phy.getNode( "Chromalveolate" ) );
+ final SortedSet<String> f = getAllExternalPresentAndGainedCharacters( phy.getNode( "Excavata" ) );
+ a.retainAll( b );
+ a.retainAll( c );
+ a.retainAll( d );
+ a.retainAll( e );
+ a.retainAll( f );
+ System.out.println( a.size() );
+ for( final String s : a ) {
+ System.out.println( s );
+ }
+ }
+
+ 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;
+ }
+}
--- /dev/null
+
+package org.forester.applications;
+
+import java.io.File;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.forester.io.parsers.util.ParserUtils;
+import org.forester.phylogeny.Phylogeny;
+import org.forester.phylogeny.PhylogenyNode;
+import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
+import org.forester.util.ForesterUtil;
+
+// javac -cp ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/org/forester/applications/domainloss_replacement.java
+// java -Xmx2048m -cp
+// /home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/:/home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// org.forester.applications.domainloss_replacement
+public class domainloss_replacement {
+
+ public static void main( final String args[] ) {
+ try {
+ if ( args.length != 2 ) {
+ System.out
+ .println( "Usage: domainloss_replacement <phylogeny file> <file with replacement characters>" );
+ System.exit( -1 );
+ }
+ final Phylogeny p = ParserUtils.readPhylogenies( args[ 0 ] )[ 0 ];
+ final Set<String> replacement_domains = ForesterUtil.file2set( new File( args[ 1 ] ) );
+ for( final PhylogenyNodeIterator it = p.iteratorExternalForward(); it.hasNext(); ) {
+ PhylogenyNode n = it.next();
+ String name = null;
+ if ( n.getNodeData().isHasTaxonomy()
+ && !ForesterUtil.isEmpty( n.getNodeData().getTaxonomy().getScientificName() ) ) {
+ name = n.getNodeData().getTaxonomy().getScientificName();
+ }
+ else {
+ name = n.getName();
+ }
+ final SortedSet<String> lost_chars = new TreeSet<String>();
+ while ( !n.isRoot() ) {
+ lost_chars.addAll( n.getNodeData().getBinaryCharacters().getLostCharacters() );
+ n = n.getParent();
+ }
+ final int losses = lost_chars.size();
+ lost_chars.retainAll( replacement_domains );
+ final int intersection = lost_chars.size();
+ final double percentage = 100.0 * intersection / losses;
+ System.out.println( name + "\t" + intersection + "\t" + losses + "\t"
+ + ForesterUtil.round( percentage, 3 ) );
+ }
+ }
+ catch ( final Exception e ) {
+ e.printStackTrace();
+ System.exit( -1 );
+ }
+ }
+}
--- /dev/null
+
+package org.forester.applications;
+
+// $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
+// javac -cp ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/org/forester/applications/genome_counts_for_once_appearing_dcs.java
+// java -Xmx2048m -cp
+// /home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/:/home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// org.forester.applications.genome_counts_for_once_appearing_dcs
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+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.BasicDescriptiveStatistics;
+import org.forester.util.DescriptiveStatistics;
+
+public class genome_counts_for_once_appearing_dcs {
+
+ public static void main( final String args[] ) {
+ if ( args.length != 1 ) {
+ System.err.println();
+ System.err.println( "genome_counts_for_once_appearing_dcs: wrong number of arguments" );
+ System.err.println( "Usage: \"genome_counts_for_once_appearing_dcs <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, org.forester.io.parsers.util.ParserUtils
+ .createParserDependingOnFileType( infile, true ) )[ 0 ];
+ }
+ catch ( final Exception e ) {
+ System.err.println( e + "\nCould not read " + infile + "\n" );
+ System.exit( -1 );
+ }
+ final SortedSet<String> all_dcs = getAllExternalPresentAndGainedCharacters( phy.getRoot() );
+ final SortedSet<String> appearing_once_dcs = new TreeSet<String>();
+ System.out.println( "All DCs: " + all_dcs.size() );
+ for( final String dc : all_dcs ) {
+ int reappearing_count = 0;
+ for( final PhylogenyNodeIterator it = phy.iteratorPreorder(); it.hasNext(); ) {
+ final PhylogenyNode n = it.next();
+ SortedSet<String> n_gained_dcs = null;
+ if ( n.isRoot() ) {
+ n_gained_dcs = n.getNodeData().getBinaryCharacters().getPresentCharacters();
+ }
+ else {
+ n_gained_dcs = n.getNodeData().getBinaryCharacters().getGainedCharacters();
+ }
+ if ( n_gained_dcs.contains( dc ) ) {
+ reappearing_count++;
+ }
+ }
+ if ( reappearing_count < 1 ) {
+ System.out.println( "error: " + dc );
+ System.exit( -1 );
+ }
+ if ( reappearing_count == 1 ) {
+ appearing_once_dcs.add( dc );
+ }
+ }
+ System.out.println( "Appearing once DCs: " + appearing_once_dcs.size() );
+ final DescriptiveStatistics stats = new BasicDescriptiveStatistics();
+ final Map<String, Set<String>> node_to_chars = new HashMap<String, Set<String>>();
+ final SortedSet<String> appearing_in_all_dcs = new TreeSet<String>();
+ for( final String appearing_once_dc : appearing_once_dcs ) {
+ int count = 0;
+ for( final PhylogenyNodeIterator ite = phy.iteratorExternalForward(); ite.hasNext(); ) {
+ final PhylogenyNode ext_node = ite.next();
+ if ( !node_to_chars.containsKey( ext_node.getName() ) ) {
+ node_to_chars.put( ext_node.getName(), getAllExternalPresentAndGainedCharacters( ext_node ) );
+ }
+ if ( node_to_chars.get( ext_node.getName() ).contains( appearing_once_dc ) ) {
+ count++;
+ }
+ }
+ if ( count < 1 ) {
+ System.out.println( "error, count is <1" );
+ System.exit( -1 );
+ }
+ if ( count == phy.getNumberOfExternalNodes() ) {
+ appearing_in_all_dcs.add( appearing_once_dc );
+ }
+ stats.addValue( count );
+ }
+ System.out.println();
+ System.out.println( stats.toString() );
+ System.out.println();
+ final int[] bins = BasicDescriptiveStatistics.performBinning( stats.getDataAsDoubleArray(), 1, 172, 172 );
+ for( int i = 0; i < bins.length; i++ ) {
+ System.out.println( ( i + 1 ) + "\t" + bins[ i ] );
+ }
+ System.out.println();
+ System.out.println( "appearing in all:" );
+ for( final String i : appearing_in_all_dcs ) {
+ System.out.println( i );
+ }
+ System.out.println();
+ for( String dc : appearing_once_dcs ) {
+ System.out.println( "1\t" + dc );
+ }
+ }
+
+ 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;
+ }
+}
--- /dev/null
+// $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/forester
+
+package org.forester.applications;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.StringTokenizer;
+
+import org.forester.io.parsers.PhylogenyParser;
+import org.forester.phylogeny.Phylogeny;
+import org.forester.phylogeny.PhylogenyMethods;
+import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
+import org.forester.phylogeny.factories.PhylogenyFactory;
+
+public class get_distances {
+
+ public static void main( final String args[] ) {
+ if ( args.length != 3 ) {
+ System.out.println( "\nget_distances: Wrong number of arguments.\n" );
+ System.out.println( "Usage: \"get_distances <phylogeny file> <file with node names> <outfile>\"\n" );
+ System.exit( -1 );
+ }
+ final File phylogeny_infile = new File( args[ 0 ] );
+ final File names_infile = new File( args[ 1 ] );
+ final File outfile = new File( args[ 2 ] );
+ Phylogeny p = null;
+ try {
+ final PhylogenyParser pp = org.forester.io.parsers.util.ParserUtils
+ .createParserDependingOnFileType( phylogeny_infile, true );
+ final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
+ p = factory.create( phylogeny_infile, pp )[ 0 ];
+ }
+ catch ( final Exception e ) {
+ System.out.println( "\nCould not read \"" + phylogeny_infile + "\" [" + e.getMessage() + "]\n" );
+ System.exit( -1 );
+ }
+ String line = "";
+ try {
+ final BufferedReader in = new BufferedReader( new FileReader( names_infile ) );
+ final BufferedWriter out = new BufferedWriter( new FileWriter( outfile ) );
+ while ( ( line = in.readLine() ) != null ) {
+ if ( line.length() < 3 ) {
+ continue;
+ }
+ final StringTokenizer st = new StringTokenizer( line );
+ if ( st.countTokens() < 2 ) {
+ continue;
+ }
+ final double d = PhylogenyMethods.getInstance().calculateDistance( p.getNode( st.nextToken() ),
+ p.getNode( st.nextToken() ) );
+ out.write( line + " " + d );
+ out.newLine();
+ }
+ out.flush();
+ out.close();
+ in.close();
+ }
+ catch ( final IOException e ) {
+ System.out.println( "\nError during processing of \"" + names_infile + "\" [" + e.getMessage()
+ + "] at line \"" + line + "\"\n" );
+ System.exit( -1 );
+ }
+ System.out.println( "\nDone.\n" );
+ }
+}
--- /dev/null
+
+package org.forester.applications;
+
+// $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
+// javac -cp ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/org/forester/applications/get_genome_counts_per_char.java
+// java -Xmx2048m -cp
+// /home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/:/home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// org.forester.applications.get_genome_counts_per_char
+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.PhylogenyMethods;
+import org.forester.phylogeny.PhylogenyNode;
+import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
+import org.forester.phylogeny.factories.PhylogenyFactory;
+
+public class get_genome_counts_per_char {
+
+ final static boolean SIMPLE = true;
+
+ public static void main( final String args[] ) {
+ if ( args.length != 1 ) {
+ System.err.println();
+ System.err.println( "get_genome_counts_per_char: 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, org.forester.io.parsers.util.ParserUtils
+ .createParserDependingOnFileType( infile, true ) )[ 0 ];
+ }
+ catch ( final Exception e ) {
+ System.err.println( e + "\nCould not read " + infile + "\n" );
+ System.exit( -1 );
+ }
+ final SortedSet<String> all_chars = getAllExternalPresentAndGainedCharacters( phy.getRoot() );
+ final SortedSet<String> human = getAllExternalPresentAndGainedCharacters( phy.getNode( "HUMAN" ) );
+ final SortedSet<String> primates = getAllExternalPresentAndGainedCharacters( find( "Primates", phy ) );
+ final SortedSet<String> mammalia = getAllExternalPresentAndGainedCharacters( find( "Mammalia", phy ) );
+ final SortedSet<String> metazoa = getAllExternalPresentAndGainedCharacters( find( "Metazoa", phy ) );
+ final SortedSet<String> fungi = getAllExternalPresentAndGainedCharacters( find( "Fungi", phy ) );
+ final SortedSet<String> plants = getAllExternalPresentAndGainedCharacters( find( "Viridiplantae", phy ) );
+ System.out.println( "Sum of all external characters:\t" + all_chars.size() );
+ System.out.println();
+ final List<PhylogenyNode> ext = phy.getRoot().getAllExternalDescendants();
+ System.out.println( "genomes" + "\t" + ext.size() );
+ for( final String c : all_chars ) {
+ int count = 0;
+ for( final PhylogenyNode e : ext ) {
+ if ( e.getNodeData().getBinaryCharacters().getGainedCharacters().contains( c )
+ || e.getNodeData().getBinaryCharacters().getPresentCharacters().contains( c ) ) {
+ count++;
+ }
+ }
+ if ( count < 1 ) {
+ System.err.println( "error" );
+ System.exit( -1 );
+ }
+ System.out.print( c + "\t" + count + "\t" );
+ if ( human.contains( c ) ) {
+ System.out.print( "HUMAN" + "\t" );
+ }
+ else {
+ System.out.print( "" + "\t" );
+ }
+ if ( primates.contains( c ) ) {
+ System.out.print( "PRIMATES" + "\t" );
+ }
+ else {
+ System.out.print( "" + "\t" );
+ }
+ if ( mammalia.contains( c ) ) {
+ System.out.print( "MAMMALS" + "\t" );
+ }
+ else {
+ System.out.print( "" + "\t" );
+ }
+ if ( metazoa.contains( c ) ) {
+ System.out.print( "METAZOA" + "\t" );
+ }
+ else {
+ System.out.print( "" + "\t" );
+ }
+ if ( fungi.contains( c ) ) {
+ System.out.print( "FUNGI" + "\t" );
+ }
+ else {
+ System.out.print( "" + "\t" );
+ }
+ if ( plants.contains( c ) ) {
+ System.out.print( "PLANTS" + "\t" );
+ }
+ else {
+ System.out.print( "" + "\t" );
+ }
+ System.out.println();
+ }
+ }
+
+ private static PhylogenyNode find( final String s, final Phylogeny phy ) {
+ final List<PhylogenyNode> l = PhylogenyMethods.searchData( s, phy, true, false, false );
+ if ( l.size() != 1 ) {
+ System.err.println( "error: " + s );
+ System.exit( -1 );
+ }
+ return l.get( 0 );
+ }
+
+ 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;
+ }
+}
--- /dev/null
+// $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/forester
+// javac -cp ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/org/forester/applications/get_loss_nodes.java
+// java -Xmx2048m -cp
+// /home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/:/home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// org.forester.applications.get_loss_nodes
+
+package org.forester.applications;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.forester.io.parsers.PhylogenyParser;
+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_loss_nodes {
+
+ public static void main( final String args[] ) {
+ if ( args.length != 2 ) {
+ System.out.println( "get_loss_nodes: Wrong number of arguments" );
+ System.out.println( "Usage: \"get_loss_nodes <phylogeny file> <file with characters>\"" );
+ System.exit( -1 );
+ }
+ final File phylogeny_infile = new File( args[ 0 ] );
+ Phylogeny p = null;
+ try {
+ final PhylogenyParser pp = org.forester.io.parsers.util.ParserUtils
+ .createParserDependingOnFileType( phylogeny_infile, true );
+ final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
+ p = factory.create( phylogeny_infile, pp )[ 0 ];
+ }
+ catch ( final Exception e ) {
+ e.printStackTrace();
+ System.exit( -1 );
+ }
+ List<String> chars = null;
+ try {
+ chars = ForesterUtil.file2list( new File( args[ 1 ] ) );
+ }
+ catch ( final IOException e ) {
+ e.printStackTrace();
+ System.exit( -1 );
+ }
+ for( final String c : chars ) {
+ boolean found = false;
+ for( final PhylogenyNodeIterator it = p.iteratorPostorder(); it.hasNext(); ) {
+ final PhylogenyNode n = it.next();
+ if ( n.getNodeData().getBinaryCharacters().getLostCharacters().contains( c ) ) {
+ if ( n.getNodeData().isHasTaxonomy()
+ && !ForesterUtil.isEmpty( n.getNodeData().getTaxonomy().getScientificName() ) ) {
+ System.out.println( c + "\t" + n.getNodeData().getTaxonomy().getScientificName() );
+ }
+ else {
+ System.out.println( c + "\t" + n.getName() );
+ }
+ found = true;
+ }
+ }
+ if ( !found ) {
+ System.out.println( c + "\t" + "never lost" );
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+
+package org.forester.applications;
+
+// $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
+// javac -cp ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/org/forester/applications/get_shared_chars.java
+// java -Xmx2048m -cp
+// /home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/:/home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// org.forester.applications.get_shared_chars
+import java.io.File;
+import java.util.List;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.forester.io.parsers.util.ParserUtils;
+import org.forester.phylogeny.Phylogeny;
+import org.forester.phylogeny.PhylogenyNode;
+import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
+import org.forester.phylogeny.factories.PhylogenyFactory;
+
+public class get_shared_chars {
+
+ public final static boolean DEBUG = true;
+
+ public static void main( final String args[] ) {
+ if ( args.length < 2 ) {
+ System.err.println();
+ System.err.println( "get_subtree_specific_chars: wrong number of arguments" );
+ System.err.println( "Usage: \"get_shared_chars <intree> <subtree 1> <subtree 2> ... <subtree n>" );
+ 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, ParserUtils.createParserDependingOnFileType( infile, true ) )[ 0 ];
+ }
+ catch ( final Exception e ) {
+ System.err.println( e + "\nCould not read " + infile + "\n" );
+ System.exit( -1 );
+ }
+ final SortedSet<Integer> outside_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() );
+ final SortedSet<String> all_shared_chars = new TreeSet<String>();
+ for( int i = 1; i < args.length; ++i ) {
+ System.out.print( args[ i ] + "\t" );
+ final PhylogenyNode current_node = phy.getNode( args[ i ] );
+ if ( i == 1 ) {
+ all_shared_chars.addAll( getAllExternalPresentAndGainedCharacters( current_node ) );
+ }
+ else {
+ all_shared_chars.retainAll( getAllExternalPresentAndGainedCharacters( current_node ) );
+ }
+ outside_external_ids.removeAll( getAllExternalDescendantsNodeIds( current_node ) );
+ }
+ System.out.println();
+ if ( DEBUG ) {
+ System.out.println( "Number of outside nodes: " + outside_external_ids.size() );
+ }
+ final SortedSet<String> outside_chars = new TreeSet<String>();
+ System.out.println( "All shared characters\t" + all_shared_chars.size() );
+ for( final Integer id : outside_external_ids ) {
+ outside_chars.addAll( getAllExternalPresentAndGainedCharacters( phy.getNode( id ) ) );
+ }
+ final SortedSet<String> unique_shared_chars = copy( all_shared_chars );
+ unique_shared_chars.removeAll( outside_chars );
+ System.out.println( "Unique shared characters\t" + unique_shared_chars.size() );
+ System.out.println();
+ System.out.println( "Unique shared characters:" );
+ for( final String unique_shared_char : unique_shared_chars ) {
+ System.out.println( unique_shared_char );
+ }
+ }
+
+ private static SortedSet<String> copy( final SortedSet<String> set ) {
+ final SortedSet<String> copy = new TreeSet<String>();
+ for( final String s : set ) {
+ copy.add( s );
+ }
+ 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;
+ }
+}
--- /dev/null
+
+package org.forester.applications;
+
+// $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
+// javac -cp ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/org/forester/applications/get_subtree_specific_chars.java
+// java -Xmx2048m -cp
+// /home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/:/home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// org.forester.applications.get_subtree_specific_chars
+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 = true;
+
+ 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, org.forester.io.parsers.util.ParserUtils
+ .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.getNodeData().getTaxonomy().getScientificName() );
+ }
+ else {
+ System.out.print( node.getName() );
+ }
+ // System.out.println( ":" );
+ System.out.print( "\t" );
+ 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() );
+ // System.out.println( unique_chars.size() );
+ int counter = 0;
+ System.out.print( "\t" + unique_chars.size() );
+ for( final String unique_char : unique_chars ) {
+ // System.out.println( "\t" + counter + ":\t" + unique_char
+ // );
+ // System.out.println( "\t" + counter + ":\t" + unique_char
+ // );
+ System.out.print( "\t" + unique_char );
+ ++counter;
+ }
+ System.out.println();
+ }
+ }
+ }
+
+ 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;
+ }
+}
--- /dev/null
+
+package org.forester.applications;
+
+// $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
+// javac -cp ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/org/forester/applications/inverted_dcs.java
+// java -Xmx2048m -cp
+// /home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/:/home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// org.forester.applications.inverted_dcs
+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;
+
+public class inverted_dcs {
+
+ final static boolean SIMPLE = true;
+
+ public static void main( final String args[] ) {
+ if ( args.length != 1 ) {
+ System.err.println();
+ System.err.println( "inverted_dcs: 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, org.forester.io.parsers.util.ParserUtils
+ .createParserDependingOnFileType( infile, true ) )[ 0 ];
+ }
+ catch ( final Exception e ) {
+ System.err.println( e + "\nCould not read " + infile + "\n" );
+ System.exit( -1 );
+ }
+ final SortedSet<String> orig = getAllExternalPresentAndGainedCharacters( phy.getRoot() );
+ System.out.println( "total=" + orig.size() );
+ for( final String dc : orig ) {
+ final String split[] = dc.split( "=" );
+ final String inv = split[ 1 ] + "=" + split[ 0 ];
+ if ( orig.contains( inv ) ) {
+ System.out.println( dc );
+ }
+ }
+ }
+
+ 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;
+ }
+}
--- /dev/null
+// $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.applications;
+
+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();
+ }
+ }
+}
--- /dev/null
+
+package org.forester.applications;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.forester.archaeopteryx.AptxUtil;
+import org.forester.archaeopteryx.AptxUtil.GraphicsExportType;
+import org.forester.archaeopteryx.Configuration;
+import org.forester.archaeopteryx.Options;
+import org.forester.archaeopteryx.TreeColorSet;
+import org.forester.io.parsers.PhylogenyParser;
+import org.forester.io.parsers.util.ParserUtils;
+import org.forester.phylogeny.Phylogeny;
+import org.forester.phylogeny.PhylogenyMethods;
+import org.forester.phylogeny.PhylogenyNode;
+import org.forester.phylogeny.data.BranchColor;
+import org.forester.phylogeny.data.BranchWidth;
+import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
+
+public class phylo2coloredgraphics {
+
+ public static void main( final String[] args ) {
+ try {
+ // Reading-in of a tree from a file.
+ final File treefile = new File( "/home/czmasek/tol_117_TEST.xml" );
+ final PhylogenyParser parser = ParserUtils.createParserDependingOnFileType( treefile, true );
+ final Phylogeny phy = PhylogenyMethods.readPhylogenies( parser, treefile )[ 0 ];
+ // Creating a node name -> color map.
+ final Map<String, Color> colors = new HashMap<String, Color>();
+ colors.put( "Primates", new Color( 255, 255, 0 ) );
+ colors.put( "PANTR", new Color( 255, 0, 255 ) );
+ colors.put( "HUMAN", new Color( 255, 0, 0 ) );
+ colors.put( "RAT", new Color( 155, 0, 0 ) );
+ colors.put( "MOUSE", new Color( 55, 155, 0 ) );
+ colors.put( "CAVPO", new Color( 155, 155, 0 ) );
+ colors.put( "LOTGI", new Color( 155, 155, 255 ) );
+ // Setting colors.
+ for( final PhylogenyNodeIterator it = phy.iteratorPostorder(); it.hasNext(); ) {
+ final PhylogenyNode n = it.next();
+ if ( colors.containsKey( n.getName() ) ) {
+ n.getBranchData().setBranchColor( new BranchColor( colors.get( n.getName() ) ) );
+ // To make colored subtrees thicker:
+ n.getBranchData().setBranchWidth( new BranchWidth( 4 ) );
+ }
+ }
+ // Setting up a configuration object.
+ final Configuration config = new Configuration();
+ config.putDisplayColors( TreeColorSet.BACKGROUND, new Color( 255, 255, 255 ) );
+ config.putDisplayColors( TreeColorSet.BRANCH, new Color( 0, 0, 0 ) );
+ config.putDisplayColors( TreeColorSet.TAXONOMY, new Color( 0, 0, 0 ) );
+ config.setPhylogenyGraphicsType( Options.PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
+ config.setTaxonomyColorize( false );
+ config.setColorizeBranches( true );
+ config.setUseBranchesWidths( true );
+ config.setDisplayTaxonomyCode( false );
+ // Writing to a graphics file.
+ AptxUtil.writePhylogenyToGraphicsFile( phy,
+ new File( "/home/czmasek/000.png" ),
+ 1300,
+ 1300,
+ GraphicsExportType.PNG,
+ config );
+ }
+ catch ( final IOException e ) {
+ e.printStackTrace();
+ }
+ }
+}
--- /dev/null
+
+package org.forester.applications;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.IOException;
+
+import org.forester.archaeopteryx.AptxUtil;
+import org.forester.archaeopteryx.AptxUtil.GraphicsExportType;
+import org.forester.archaeopteryx.Configuration;
+import org.forester.archaeopteryx.Options;
+import org.forester.archaeopteryx.TreeColorSet;
+
+public class phylo2graphics {
+
+ public static void main( final String[] args ) {
+ try {
+ final Configuration config = new Configuration();
+ // Could also read a configuration file with:
+ // Configuration config = new Configuration("my_configuration_file.txt", false, false, false);
+ config.putDisplayColors( TreeColorSet.BACKGROUND, new Color( 255, 255, 255 ) );
+ config.putDisplayColors( TreeColorSet.BRANCH, new Color( 0, 0, 0 ) );
+ config.putDisplayColors( TreeColorSet.TAXONOMY, new Color( 0, 0, 0 ) );
+ config.setPhylogenyGraphicsType( Options.PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
+ AptxUtil.writePhylogenyToGraphicsFile( new File( "/home/czmasek/tol_117_TEST.xml" ),
+ new File( "/home/czmasek/tol_117_TEST_.png" ),
+ 1000,
+ 1000,
+ GraphicsExportType.PNG,
+ config );
+ // If the tree 'phy' already exists, can also use this:
+ //AptxUtil.writePhylogenyToGraphicsFile( phy,
+ // new File( "/home/czmasek/tol_117_TEST_.png" ),
+ // 1000,
+ // 1000,
+ // GraphicsExportType.PNG,
+ // config );
+ }
+ catch ( final IOException e ) {
+ e.printStackTrace();
+ }
+ }
+}
--- /dev/null
+
+package org.forester.applications;
+
+// $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
+// javac -cp ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/org/forester/applications/reinv_count.java
+// java -Xmx2048m -cp
+// /home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/:/home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// org.forester.applications.reinv_count
+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;
+
+public class reinv_count {
+
+ public static void main( final String args[] ) {
+ if ( args.length != 2 ) {
+ System.err.println();
+ System.err.println( "reinv_count: wrong number of arguments" );
+ System.err.println( "Usage: \"reinv_count <intree> <name>" );
+ System.err.println();
+ System.exit( -1 );
+ }
+ final File infile = new File( args[ 0 ] );
+ final String node_name = args[ 1 ];
+ Phylogeny phy = null;
+ try {
+ final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
+ phy = factory.create( infile, org.forester.io.parsers.util.ParserUtils
+ .createParserDependingOnFileType( infile, true ) )[ 0 ];
+ }
+ catch ( final Exception e ) {
+ System.err.println( e + "\nCould not read " + infile + "\n" );
+ System.exit( -1 );
+ }
+ for( final PhylogenyNodeIterator ite = phy.iteratorExternalForward(); ite.hasNext(); ) {
+ final PhylogenyNode target_node = ite.next();
+ final SortedSet<String> target_dcs = getAllExternalPresentAndGainedCharacters( target_node );
+ //System.out.println( "Target DCs:" + target_dcs.size() );
+ int counter = 0;
+ final SortedSet<String> reinv = new TreeSet<String>();
+ for( final String target_dc : target_dcs ) {
+ int c = 0;
+ for( final PhylogenyNodeIterator it = phy.iteratorPreorder(); it.hasNext(); ) {
+ final PhylogenyNode n = it.next();
+ final SortedSet<String> n_gained_dcs = n.getNodeData().getBinaryCharacters().getGainedCharacters();
+ if ( n_gained_dcs.contains( target_dc ) ) {
+ c++;
+ }
+ }
+ if ( c > 1 ) {
+ counter++;
+ reinv.add( target_dc );
+ }
+ }
+ // System.out.println();
+ //System.out.println( "reinv:" + reinv );
+ //System.out.println();
+ // System.out.println( "Target DCs:" + target_dcs.size() );
+ // System.out.println( "reinv size:" + reinv.size() );
+ // System.out.println( ">1:" + counter );
+ final double ratio = ( double ) counter / target_dcs.size();
+ System.out.println( target_node.getName() + "\t" + counter + "/" + target_dcs.size() + "\t" + ratio );
+ }
+ }
+
+ 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;
+ }
+}
--- /dev/null
+// $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/forester
+// javac -cp ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/org/forester/applications/set_comparator.java
+// java -Xmx2048m -cp
+// /home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/:/home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// org.forester.applications.set_comparator
+
+package org.forester.applications;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Set;
+
+import org.forester.util.ForesterUtil;
+
+public class set_comparator {
+
+ public static void main( final String args[] ) {
+ try {
+ if ( args.length != 2 ) {
+ System.out.println( "Usage: set_comparator <set A> <set B>" );
+ System.exit( -1 );
+ }
+ Set<String> set_a = ForesterUtil.file2set( new File( args[ 0 ] ) );
+ final Set<String> set_b = ForesterUtil.file2set( new File( args[ 1 ] ) );
+ System.out.println( "# A SIZE: " + set_a.size() );
+ System.out.println( "# B SIZE: " + set_b.size() );
+ set_a.retainAll( set_b );
+ System.out.println( "# INTERSECTION (" + set_a.size() + "):" );
+ for( final String s : set_a ) {
+ System.out.println( s );
+ }
+ set_a = ForesterUtil.file2set( new File( args[ 0 ] ) );
+ System.out.println();
+ set_a.removeAll( set_b );
+ System.out.println( "# A ONLY (" + set_a.size() + "):" );
+ for( final String s : set_a ) {
+ System.out.println( s );
+ }
+ set_a = ForesterUtil.file2set( new File( args[ 0 ] ) );
+ System.out.println();
+ set_b.removeAll( set_a );
+ System.out.println( "# B ONLY (" + set_b.size() + "):" );
+ for( final String s : set_b ) {
+ System.out.println( s );
+ }
+ }
+ catch ( final IOException e ) {
+ e.printStackTrace();
+ System.exit( -1 );
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+
+package org.forester.applications;
+
+// $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
+// javac -cp ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/org/forester/applications/shared_chars_in_ext_nodes.java
+// java -Xmx2048m -cp
+// /home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/:/home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// org.forester.applications.shared_chars_in_ext_nodes
+import java.io.File;
+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;
+
+public class shared_chars_in_ext_nodes {
+
+ final static boolean SIMPLE = true;
+
+ public static void main( final String args[] ) {
+ if ( args.length != 2 ) {
+ System.err.println();
+ System.err.println( "shared_chars_in_ext_nodes: wrong number of arguments" );
+ System.err.println( "Usage: \"shared_chars_in_ext_nodes <intree> <node name>" );
+ System.err.println();
+ System.exit( -1 );
+ }
+ final File infile = new File( args[ 0 ] );
+ final String node_name = args[ 1 ];
+ Phylogeny phy = null;
+ try {
+ final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
+ phy = factory.create( infile, org.forester.io.parsers.util.ParserUtils
+ .createParserDependingOnFileType( infile, true ) )[ 0 ];
+ }
+ catch ( final Exception e ) {
+ System.err.println( e + "\nCould not read " + infile + "\n" );
+ System.exit( -1 );
+ }
+ final SortedSet<String> a = phy.getNode( node_name ).getNodeData().getBinaryCharacters().getGainedCharacters();
+ for( final PhylogenyNodeIterator it = phy.iteratorExternalForward(); it.hasNext(); ) {
+ final PhylogenyNode n = it.next();
+ final SortedSet<String> b = n.getNodeData().getBinaryCharacters().getGainedCharacters();
+ final SortedSet<String> a_copy = copy( a );
+ a_copy.retainAll( b );
+ final double ratio = ( double ) a_copy.size() / b.size();
+ System.out.println( n.getName() + "\t\"" + a_copy.size() + "/" + b.size() + "\"\t" + ratio );
+ }
+ }
+
+ private static SortedSet<String> copy( final SortedSet<String> set ) {
+ final SortedSet<String> copy = new TreeSet<String>();
+ for( final String i : set ) {
+ copy.add( i );
+ }
+ return copy;
+ }
+}
--- /dev/null
+// $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
+// javac -cp ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/org/forester/applications/simple_node_processor.java
+// java -Xmx2048m -cp
+// /home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/:/home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar
+// org.forester.applications.simple_node_processor
+
+package org.forester.applications;
+
+import java.io.File;
+
+import org.forester.io.parsers.phyloxml.PhyloXmlParser;
+import org.forester.io.writers.PhylogenyWriter;
+import org.forester.phylogeny.Phylogeny;
+import org.forester.phylogeny.PhylogenyNode;
+import org.forester.phylogeny.data.Taxonomy;
+import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
+import org.forester.phylogeny.factories.PhylogenyFactory;
+import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
+import org.forester.util.CommandLineArguments;
+import org.forester.util.ForesterUtil;
+
+public class simple_node_processor {
+
+ private final static String BASE = "b_";
+
+ public static void main( final String args[] ) {
+ File in = null;
+ 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 );
+ //}
+ // if ( !node.isExternal() ) {
+ // if ( !node.getNodeData().isHasTaxonomy() ) {
+ // if ( !ForesterUtil.isEmpty( node.getName() ) ) {
+ // if ( ( node.getName().indexOf( "_" ) < 0 ) && ( node.getName().indexOf( "&" ) < 0 )
+ // && ( node.getName().indexOf( " " ) < 0 ) ) {
+ // Taxonomy t = new Taxonomy();
+ // t.setScientificName( node.getName() );
+ // node.getNodeData().addTaxonomy( t );
+ // node.setName( "" );
+ // }
+ // }
+ // }
+ // }
+ if ( node.isExternal() ) {
+ if ( node.getNodeData().isHasTaxonomy() ) {
+ Taxonomy t = node.getNodeData().getTaxonomy();
+ if ( !ForesterUtil.isEmpty( t.getTaxonomyCode() ) && t.getTaxonomyCode().length() == 5 ) {
+ if ( node.getName().equalsIgnoreCase( t.getTaxonomyCode() ) ) {
+ node.setName( "" );
+ }
+ }
+ }
+ }
+ }
+}
--- /dev/null
+
+package org.forester.applications;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.forester.archaeopteryx.Archaeopteryx;
+import org.forester.io.parsers.PhylogenyParser;
+import org.forester.io.parsers.util.ParserUtils;
+import org.forester.phylogeny.Phylogeny;
+import org.forester.phylogeny.PhylogenyMethods;
+import org.forester.phylogeny.data.BranchColor;
+import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
+
+public class wiki_examples {
+
+ public static void main( final String[] args ) {
+ // Reading-in of (a) tree(s) from a file.
+ final File treefile = new File( args[ 0 ] );
+ PhylogenyParser parser = null;
+ try {
+ parser = ParserUtils.createParserDependingOnFileType( treefile, true );
+ }
+ catch ( final IOException e ) {
+ e.printStackTrace();
+ }
+ Phylogeny[] phys = null;
+ try {
+ phys = PhylogenyMethods.readPhylogenies( parser, treefile );
+ }
+ catch ( final IOException e ) {
+ e.printStackTrace();
+ }
+ final Phylogeny phy = phys[ 0 ];
+ // Read node->color map into a map
+ final Map<String, Color> colors = new HashMap<String, Color>();
+ // read it in from file...
+ // Iterate over nodes and set colors from 'colors' map
+ for( final PhylogenyNodeIterator it = phy.iteratorPostorder(); it.hasNext(); ) {
+ // if node-name (?) in 'colors' map
+ it.next().getBranchData().setBranchColor( new BranchColor( colors.get( "xx" ) ) );
+ }
+ // For testing, use Aptx...
+ Archaeopteryx.createApplication( phy );
+ // Finally, create
+ }
+}
\ No newline at end of file