From befea788d8ee8f726b006f696e3394597adf4307 Mon Sep 17 00:00:00 2001 From: "cmzmasek@gmail.com" Date: Fri, 27 Sep 2013 22:35:17 +0000 Subject: [PATCH] initial commit --- forester_applications/.classpath | 7 + forester_applications/.project | 18 ++ .../.settings/org.eclipse.jdt.core.prefs | 290 ++++++++++++++++++++ .../.settings/org.eclipse.jdt.ui.prefs | 61 ++++ .../applications/appearance_vs_count.class | Bin 0 -> 4535 bytes .../src/org/forester/applications/core_chars.class | Bin 0 -> 3242 bytes .../src/org/forester/applications/core_chars.java | 92 +++++++ .../applications/domainloss_replacement.class | Bin 0 -> 2703 bytes .../applications/domainloss_replacement.java | 59 ++++ .../genome_counts_for_once_appearing_dcs.class | Bin 0 -> 4854 bytes .../genome_counts_for_once_appearing_dcs.java | 147 ++++++++++ .../org/forester/applications/get_distances.java | 92 +++++++ .../applications/get_genome_counts_per_char.class | Bin 0 -> 4496 bytes .../applications/get_genome_counts_per_char.java | 149 ++++++++++ .../org/forester/applications/get_loss_nodes.class | Bin 0 -> 3085 bytes .../org/forester/applications/get_loss_nodes.java | 93 +++++++ .../forester/applications/get_shared_chars.class | Bin 0 -> 4547 bytes .../forester/applications/get_shared_chars.java | 126 +++++++++ .../applications/get_subtree_specific_chars.class | Bin 0 -> 4899 bytes .../applications/get_subtree_specific_chars.java | 162 +++++++++++ .../org/forester/applications/inverted_dcs.class | Bin 0 -> 3182 bytes .../org/forester/applications/inverted_dcs.java | 86 ++++++ .../src/org/forester/applications/map_lengths.java | 88 ++++++ .../applications/phylo2coloredgraphics.java | 72 +++++ .../org/forester/applications/phylo2graphics.java | 43 +++ .../org/forester/applications/reinv_count.class | Bin 0 -> 3553 bytes .../src/org/forester/applications/reinv_count.java | 106 +++++++ .../org/forester/applications/set_comparator.class | Bin 0 -> 1826 bytes .../org/forester/applications/set_comparator.java | 76 +++++ .../applications/shared_chars_in_ext_nodes.class | Bin 0 -> 3302 bytes .../applications/shared_chars_in_ext_nodes.java | 85 ++++++ .../applications/simple_node_processor.class | Bin 0 -> 2670 bytes .../applications/simple_node_processor.java | 121 ++++++++ .../org/forester/applications/wiki_examples.java | 50 ++++ 34 files changed, 2023 insertions(+) create mode 100644 forester_applications/.classpath create mode 100644 forester_applications/.project create mode 100644 forester_applications/.settings/org.eclipse.jdt.core.prefs create mode 100644 forester_applications/.settings/org.eclipse.jdt.ui.prefs create mode 100644 forester_applications/src/org/forester/applications/appearance_vs_count.class create mode 100644 forester_applications/src/org/forester/applications/core_chars.class create mode 100644 forester_applications/src/org/forester/applications/core_chars.java create mode 100644 forester_applications/src/org/forester/applications/domainloss_replacement.class create mode 100644 forester_applications/src/org/forester/applications/domainloss_replacement.java create mode 100644 forester_applications/src/org/forester/applications/genome_counts_for_once_appearing_dcs.class create mode 100644 forester_applications/src/org/forester/applications/genome_counts_for_once_appearing_dcs.java create mode 100644 forester_applications/src/org/forester/applications/get_distances.java create mode 100644 forester_applications/src/org/forester/applications/get_genome_counts_per_char.class create mode 100644 forester_applications/src/org/forester/applications/get_genome_counts_per_char.java create mode 100644 forester_applications/src/org/forester/applications/get_loss_nodes.class create mode 100644 forester_applications/src/org/forester/applications/get_loss_nodes.java create mode 100644 forester_applications/src/org/forester/applications/get_shared_chars.class create mode 100644 forester_applications/src/org/forester/applications/get_shared_chars.java create mode 100644 forester_applications/src/org/forester/applications/get_subtree_specific_chars.class create mode 100644 forester_applications/src/org/forester/applications/get_subtree_specific_chars.java create mode 100644 forester_applications/src/org/forester/applications/inverted_dcs.class create mode 100644 forester_applications/src/org/forester/applications/inverted_dcs.java create mode 100644 forester_applications/src/org/forester/applications/map_lengths.java create mode 100644 forester_applications/src/org/forester/applications/phylo2coloredgraphics.java create mode 100644 forester_applications/src/org/forester/applications/phylo2graphics.java create mode 100644 forester_applications/src/org/forester/applications/reinv_count.class create mode 100644 forester_applications/src/org/forester/applications/reinv_count.java create mode 100644 forester_applications/src/org/forester/applications/set_comparator.class create mode 100644 forester_applications/src/org/forester/applications/set_comparator.java create mode 100644 forester_applications/src/org/forester/applications/shared_chars_in_ext_nodes.class create mode 100644 forester_applications/src/org/forester/applications/shared_chars_in_ext_nodes.java create mode 100644 forester_applications/src/org/forester/applications/simple_node_processor.class create mode 100644 forester_applications/src/org/forester/applications/simple_node_processor.java create mode 100644 forester_applications/src/org/forester/applications/wiki_examples.java diff --git a/forester_applications/.classpath b/forester_applications/.classpath new file mode 100644 index 0000000..69d0b06 --- /dev/null +++ b/forester_applications/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/forester_applications/.project b/forester_applications/.project new file mode 100644 index 0000000..1a9303e --- /dev/null +++ b/forester_applications/.project @@ -0,0 +1,18 @@ + + + forester_applications + + + forester + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/forester_applications/.settings/org.eclipse.jdt.core.prefs b/forester_applications/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..7e8284b --- /dev/null +++ b/forester_applications/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,290 @@ +#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 diff --git a/forester_applications/.settings/org.eclipse.jdt.ui.prefs b/forester_applications/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000..d4e2b16 --- /dev/null +++ b/forester_applications/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,61 @@ +#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 diff --git a/forester_applications/src/org/forester/applications/appearance_vs_count.class b/forester_applications/src/org/forester/applications/appearance_vs_count.class new file mode 100644 index 0000000000000000000000000000000000000000..812a0adcbc14fef0fabbc672855431d8bba8e255 GIT binary patch literal 4535 zcmbtYeRLGn75}~6C9^v_fW)l0h_a}~O$da5AZ!o}S>{Ic6+%DzskdHfqxJ$tYR5W0{f)A=_lqk02 zLsH?xVcd;-ZT=dT6|r{7JZxEl+mr8rf%0Ut)3RCIJVo>Q(HUrtS7HvfMHhfkQdd56?}oQQ1C?s zk0^MQKoopQAl_rRt(nZyKG$$8J+s0wa)#x$TIq|qmyvGUtUG#&?{Wec#yf1Mr)iT- z8Ll*CH}_}k9>eNyT2Y#H5qV2}0bSlTGfmyL;~MF1!);OUWr0w)*<tR#}s@;!&k9P zVCD$&iP(0>wt8Zgmxq|WDW*F;`Cf)7C$%0IICphU?=cdwvq#X5F|n>=7>hIv;-G-$ zrOmXPBtVJcaRrAo4B-g{hc$c+UsrHM!#D7xz^UaFFYQYiS=Y3g`-$b%LgJU?%}m;G zG<*}^5;#R|v-6pB%(C5>W9aFaT>rL!P&Ir9-z6C|J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?c6%Bra%|jvz1S)S zkP$<$#PhJli?~+21V_AvoOlzicnjOazp!2W8-3y(^!tL?;TwnRd{eR0*NE$VD>$yf zF5gwy?MveZ-%YsDcPIAv?#9hT3Sy5;J5F!?3OW>YDugT)Ea%!{D8p+CR+Ro$g1(%k z;4+GJHy>p|{}&TD9K!+ys}!tOu(B-hHs&Z;a};M#V#0r*y@N&tmy4rlejBGz@+e~b z?B}-?(;*wp-5keoTv;sMj)p-j>TDdsVu3DJs+Z%roOmg|C=r+*WnU>);1F6_V-+h) z3M&K0pPs&-Mhh9A#9RZn@}DWUkp=q@=RXz_xE;%Jrx%e4(w92V-L)RV1lD=VSCKqd Id$Vi)2NBi<@&Et; literal 0 HcmV?d00001 diff --git a/forester_applications/src/org/forester/applications/core_chars.class b/forester_applications/src/org/forester/applications/core_chars.class new file mode 100644 index 0000000000000000000000000000000000000000..4dba303bca1ab5db2487f8a1d27e1785af39b887 GIT binary patch literal 3242 zcmbtXS#um$75=Vfq;9p^c088t$RuRq#AdW*yx;^R$B8!EL!^z$B)0vMQ0ihNsAshA%|KJgwo20-3T5 zM;vEjDU`lzIWxWtq#KU7rDOCgOJfU`Zx#7lAnKWGf5Hj#rlMa(1RJ z<%x5+H^x#8Z6{ms{7{w(G91?Mj6i3>F1uD(^@;t&|KslP?eQKN7BC84)i27UwjyUs zkx0)M8A0%XV#mZGJgDJICccbkH9TkHc|0hvr(rgfe$w~ca@vhJPJ8od%P&_KNl2iK zUl8a&8CYdGl-^C+&Ii@G(3kRjP?1G@-Y&*xrI|aWK4Ri4cu~NNGGlvLg-T&~LBm%~ zd<`#Y__~R2;F}s=Ht{WdTVPuwixW#lSqW{A>D}4T#+D=LOCccC33fy6gc~z&B zcD*p|ORJPt`d3(8hKcXtRU(+K*g?49UG&`0V){*dA3rcLiZNE&?D2`&$48i&kws6= zd6zv)VDpGi+GNGCg3vB0#n^)HEn3bc={Z(NZgs*VrOMsYCVq(5O#BGXn)oq(qL_No z#82@v7MO{j<8>2P@C)KxABMozNEKDeEGc81nD`}r71hf9|4Xr%_%(i`;kPD!hu>>> z!^BlwGw}xn=#RK2(CWpiR2;i#DO!VUBkwKPrspomV#r*)OHT=;-wRbeiLK=?kZOdQ zWA|90=abila*`=(!BJRdmo0JxNS~J5VHZh%)Cy#2t=o@Azb*@Ou^V#H6f3ee4rO{b z8Wc_b>La7(grQ_wKrp0AbY_r^sEh%eA% zao758`0P4NP43s?iQN&&{uU&SIkz!33M}k>pPVe8gs11dxP4hgE{jzplmIg z=xX4Y@ny)Hg;$P1Pc5h@zhj=`uesP=jW&FU z&yGmhk4}6TL$Rs&Hh*xUcZa}*U{Y+otz;$#^ zim4kg@`L^T$s6ceg_%I&z|Fyp1#r^<~09RE50EwVmsUo7lrl?Vapf!3U-WR*@0Nlc0!~Llh!f zdWVwzJuC" ); + 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 a = getAllExternalPresentAndGainedCharacters( phy.getNode( "Opisthokonta" ) ); + final SortedSet b = getAllExternalPresentAndGainedCharacters( phy.getNode( "THETRA" ) ); + final SortedSet c = getAllExternalPresentAndGainedCharacters( phy.getNode( "Amoebozoa" ) ); + final SortedSet d = getAllExternalPresentAndGainedCharacters( phy.getNode( "Archaeplastida" ) ); + final SortedSet e = getAllExternalPresentAndGainedCharacters( phy.getNode( "Chromalveolate" ) ); + final SortedSet 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 getAllExternalPresentAndGainedCharacters( final PhylogenyNode node ) { + final SortedSet chars = new TreeSet(); + final List 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_applications/src/org/forester/applications/domainloss_replacement.class b/forester_applications/src/org/forester/applications/domainloss_replacement.class new file mode 100644 index 0000000000000000000000000000000000000000..7b631ba8ef46ae8d56498063859bf00227576065 GIT binary patch literal 2703 zcmai0TYD2l7=9;BGRbzK&;unDOTZ#&DFh;NNNa%}kZLG}6tJM+Hrb|Il5E`F&;}Je z0Uq&uC>~Hzd*cm0kD-<4;Rnc-f52a&;5XZ(A&|gc%ziWT9p8Ds+5PLzpSJ*n@T-J& zba~N@r#(u3A`ZIUKG+vF`RPm8Kq3<;dn_xtFUQ>;=!1B$Artc zkW?{@b0j1@fe8+cW0Jw$t)(@qhoL6Wew4x4r^i)>x`>umhq9?L)fiF6lCoj#ysY<-T?97&E8N18+D$Z)(&p&6v8o;70X zK211niR;2`Qa8<0hMGw#F*T*8t<55Wj1Fw%Fl3mp7!DmVm4q7hSGMqXXC`tK9=zbE;B5* z{bnsK85}WGHL6-NJ{9_(;d72JWPFLQ2qzg|V@AdmT#)e%zLoJEW*D09$GkVICF3fA z^F6LIFs~4Pkntma64EspKZ}?RC9{F)n3}OPowEG}8yU9fMj|+_8>&fQ1eHuCsl^nr zZw4zv%&@HF?cms?8lzM3mw8z{gWz!SG>90bx~XP{?Nv-P%0sbq!z>vO5f=vw%M5K* z3>RYw^|CA%=vjophCZqrmKwJcX{f;Da`PNvlcLVhvy^w!0`G|!!$f+Ee5*>TtLVIZ znSp17Qj$8RDNwm#oa(ejZk>Ta(LRB);>cS@F-&4<(9U|;o*W_WnADpTI9@DTQ)y*K zr4T0~WiBh64JF@Nrenw2SKx$*#^4cc6f(uZtuI6=v_@C^LS44eBCO=IxpNo+HwkLt=K8qOT1Tn}%Z9=t#*soX$ zAzs}uP71-ICK*;^UYQ;-T{HJ9=7=(_r}b2BAzo?rsCY%qN5w1Z(Tzg&L}MCVnA*4& z8&Xol{zj^*)TV{|nZVP`fmFt#q$<*p;N$`v+l5;*59>PN+(1jcT3Ru3eT%myT^x_V z?S2cYr?ZS@B_`VV-LJn;S420hd!sfN>w180ZY3Vyn)LvR=9Nq z`Ul(lg?j(P)IFA7ytwM@Tg3jdj?iaI#aaaDZ$mr|F!6z;v6E(x(VNlR)o}ytItf$+ zjc$9f5ngOYkYrM2x8Xu9z3V$}xvrw_cR1>6@^Cul$hamn2X{>ZJI|d!wmi=L8exAvarkN%wtI&OJ~ql5bN?-HizX`&~VQ}*fk4D%d8~BcnAq}#owIlU@ww-*iar_K=kA(|oIoJ1Sa*nlkUoTFp8 zNCz`RXkR1TeXI|`JOR$qIN0>A~n%??5XyMq(5#o6A iKkVk%#_^QId*y|;az0rK=^-3YwA}3 literal 0 HcmV?d00001 diff --git a/forester_applications/src/org/forester/applications/domainloss_replacement.java b/forester_applications/src/org/forester/applications/domainloss_replacement.java new file mode 100644 index 0000000..15dce45 --- /dev/null +++ b/forester_applications/src/org/forester/applications/domainloss_replacement.java @@ -0,0 +1,59 @@ + +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 " ); + System.exit( -1 ); + } + final Phylogeny p = ParserUtils.readPhylogenies( args[ 0 ] )[ 0 ]; + final Set 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 lost_chars = new TreeSet(); + 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 ); + } + } +} diff --git a/forester_applications/src/org/forester/applications/genome_counts_for_once_appearing_dcs.class b/forester_applications/src/org/forester/applications/genome_counts_for_once_appearing_dcs.class new file mode 100644 index 0000000000000000000000000000000000000000..aea8dfb78c1ffd6ef2a095a6f7ee83cf71514687 GIT binary patch literal 4854 zcmbtY3wRXO75?w+CbK&`yaE9iU+bf|0YVH&&<&!H5DA8W21JN$7~2W<`F;Jqd~@&I zJ?GqW{_~%6@8s#jkL?FAAOF>`0`VXcFg0|eCx9(-v;w$TSLr^CJP=CdZEkaJ!0+X{be9 z#m6<&Ntbru4ykx&2%o@R@^QC(+@s>&5E`WJeNyI=A>5A#Bm&#z>{FFzn>&dLAgz5m zfCmE@4B#`;(q}{X9CoSryxj946<<*CMS;r2mThI02>7Bk7YO*9oP;Sbsm-#@_P*ZD zrn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TX_9E@Le=A&F-GFQNtgtkWx5srSn7EB^8%OYd1)eu0Jf z5=-$ltj3!-UkI!f6R=K9#(FUo7m6@8hy~av7U3dsCO?nPL6=yGO~Qg9Tx=FQ5Er|U z5D&l<529OS(IcL~7V!)$@d_>x2aptpV2fcmN(EBN1YD|2L0XxKjB+xzD)X>SsYk!E z2m{J8Y*$ubhti45lx|$ET+i_qT%p{KoytA9Qh6L#DNkXS@(iw4-oQ0J4cF0Y;BL&E zHB2OYD%PktPsRBVDmrEzMuUpA-ru^zI8Ma{Tweb+YE@jwRs8@a9)xnz0ZigBOu&L8 z1`2u`RBX%{0E#9KVF67X#L?87QuP+}w=q{mr#OiELzu2&-9bbSVWKyg&;OC|yOL>? zZSgja6&%mY7hD_bxoOqhA+UM3v%z@0TF8k-yv(4`S D2=!tx literal 0 HcmV?d00001 diff --git a/forester_applications/src/org/forester/applications/genome_counts_for_once_appearing_dcs.java b/forester_applications/src/org/forester/applications/genome_counts_for_once_appearing_dcs.java new file mode 100644 index 0000000..d7ed36a --- /dev/null +++ b/forester_applications/src/org/forester/applications/genome_counts_for_once_appearing_dcs.java @@ -0,0 +1,147 @@ + +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 " ); + 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 all_dcs = getAllExternalPresentAndGainedCharacters( phy.getRoot() ); + final SortedSet appearing_once_dcs = new TreeSet(); + 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 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> node_to_chars = new HashMap>(); + final SortedSet appearing_in_all_dcs = new TreeSet(); + 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 getAllExternalPresentAndGainedCharacters( final PhylogenyNode node ) { + final SortedSet chars = new TreeSet(); + final List 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_applications/src/org/forester/applications/get_distances.java b/forester_applications/src/org/forester/applications/get_distances.java new file mode 100644 index 0000000..624493f --- /dev/null +++ b/forester_applications/src/org/forester/applications/get_distances.java @@ -0,0 +1,92 @@ +// $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 \"\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" ); + } +} diff --git a/forester_applications/src/org/forester/applications/get_genome_counts_per_char.class b/forester_applications/src/org/forester/applications/get_genome_counts_per_char.class new file mode 100644 index 0000000000000000000000000000000000000000..7880dfd141f4559b29bc3160456319f2b397d068 GIT binary patch literal 4496 zcmbtYi+2=P8UNkgO=hy0@Yq5imCEuELIPdhZ8tm`LITlj2yCDwAaSxgNd`7E+u2zl z*xJ_82WqLc^+B~(u^L-zTTnv+79aIdTi=g9e4ti6p5q_j@$~e7zdO5|>;@t|$3vL; z_PgKv{=Vq~cB$cS*N* ztN3sw?!i&1cW)5&xKG9Xm3RP0CHq(rDA~sp9G7Ab1@Un_9Kubdvw-LlsA{sUjH_GjEXDRg^+n>YV_JO;Qn4!T>WKp}J?+UW7-FFneATP#Qwp9| z@HOVkRB5W$w2}gQYcIFdW;=b6UfVG;uHi(|{evmH&#(p~9R;dk$yG(#nL&dqf2rDXI(QDiQA5AB;$rlR~2!y z&(htj!#Zv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K94?V#=QG7k zrlmWB#n+4FlW&fvKT(7JmQI59E6V5mUVg2aRZ_I#3yYetd6=0ND_=5<3XQ-*&R{C} zJ5zBkW!@AMSUgF9V`$?!+HWW6Aeb?9C(*yzEBV&qp2_#X)tj!1lVW@_=h5M3fHM3N z%#H1Ixt>fCYyvfTj~=j^>{N;e36GwJC0&@u>wBZT1!Fcgp^5L!{NzJ30;GA1;&UrG z*YPd*E~`5OamrI@<+I#lE=2|2i}&S3{jXAW8f~QO&Ig{rg46H~!_Q|ZFpM(!F3-Km z^^HI|2X%Lyf8`lew29aVg6+%d>jNXG9EIkGe`Rb4b?wwThbgWe${J?0Sm1={l2onW z1#L-G^RKOv3U!p2QZpqdfsK;#B z6PC+Mm)A~MR!Wy|n6RvtF5fs|xuSIWrqX4G$lVyac=8nSw~CN$MHK-o(Rl$k@VSC0 zT?vhAGq4(Sum=7f_D_%sm zcm=w64L#yb7~)^(6aPlPPvC&B0t3F8uzX?M=Bq`Ni0&_Ukg(8hQQwqNOQhk`h85%UyuQY-#8HY(Wp z7JU4h9#yKx{{4qP7X;-OgWf_acP*_$$Euh~Su)oeJ?bA_{iUJHNwFLk^=y`Ib7{&tW}> z!iF|FSs+7T8@03FWSe0PiF^+Q>T5WA@=Y{~jXvB`#95x>3|)GuD5z@*8sI?&b)0Z| n2(|oOB8rDu-ABB@ro(p;GrXG0BEH4NE-Lu2hZWlEQSbjRo%!CJ literal 0 HcmV?d00001 diff --git a/forester_applications/src/org/forester/applications/get_genome_counts_per_char.java b/forester_applications/src/org/forester/applications/get_genome_counts_per_char.java new file mode 100644 index 0000000..dd0b094 --- /dev/null +++ b/forester_applications/src/org/forester/applications/get_genome_counts_per_char.java @@ -0,0 +1,149 @@ + +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 " ); + 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 all_chars = getAllExternalPresentAndGainedCharacters( phy.getRoot() ); + final SortedSet human = getAllExternalPresentAndGainedCharacters( phy.getNode( "HUMAN" ) ); + final SortedSet primates = getAllExternalPresentAndGainedCharacters( find( "Primates", phy ) ); + final SortedSet mammalia = getAllExternalPresentAndGainedCharacters( find( "Mammalia", phy ) ); + final SortedSet metazoa = getAllExternalPresentAndGainedCharacters( find( "Metazoa", phy ) ); + final SortedSet fungi = getAllExternalPresentAndGainedCharacters( find( "Fungi", phy ) ); + final SortedSet plants = getAllExternalPresentAndGainedCharacters( find( "Viridiplantae", phy ) ); + System.out.println( "Sum of all external characters:\t" + all_chars.size() ); + System.out.println(); + final List 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 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 getAllExternalPresentAndGainedCharacters( final PhylogenyNode node ) { + final SortedSet chars = new TreeSet(); + final List 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_applications/src/org/forester/applications/get_loss_nodes.class b/forester_applications/src/org/forester/applications/get_loss_nodes.class new file mode 100644 index 0000000000000000000000000000000000000000..7b6991dd846901c393fe015d93eed5082d5967bd GIT binary patch literal 3085 zcmai0S#uOs6#i~9$(?i>kRV`CVF-&!Fbs=CO=2Q}M1qqcIzbGm*i1T;#+mN1yMu}Q zzVAD@uW@t=J#MpvLt9iGvy>hBOT0HVua`(u~8nT_T}D$Eb!Rj!2AYScTDM+<`lr zk;1qdj!N96;TZ02#)Ohg;JAhpxJSdixKG1L+}{iXr_?g7hDi-3rj)^q#I%MO`qW@W zaauheP|DdTauT+LBhc7q*_PigP~YBhmq6rzGieH}N?5j;oXMRs-EreomXb)$uxx>K z?I#kajWb3(YuK51%6Bb0)2kF$q-_8rq^Ul|76zjypuLJ_jW4#Iy%rPaYn~Om=)*bEVh>sVbSyn>xJKGHU9Z1Q z$D?>mKo7#ToVapUx%G&|<2s(elM+wqcpA@0Jgeh5JkLm~sTrD0n|a@IY#lGCNM6+O z5?(GtXl~?41;PyJcm=OAM><}^>pI@Rn*vu z^;n|uARlAF;wV$&32aJpXWuN!4w`w>o@9d_u~qGk&*d3IPif0iLH8c-NQ8o~F<*(k zXpZspg`icYrr0x%Yne=N;LV`nnUfXu;o$9@Kr>5Z#P)o{PScZp?TfZv(q6d+N=E3! z?#nx|NQtLhF)somwHYs#Wp51!B}vDLa8jzCRf3`;s{$T_b8nod21D8yaxI`|xYR3( zAb}=z)a=OyB^+DCL`Tt&KuZ-lcZilNR~@{y@5`l2jGQ*Sq&drS;R$}6MPmnxE6e!c zpf1HFu)1t8#y#eL4LBohirl&B>Ih zI4yo7!eTO=c5I(tSoUz}P$(B9iCtlNhYWArn00I?SL&wf>VJ3$+%6+8m(DV-7*;B6 z@uO-@S?Q#aV}XaOs`UA14O-q%F7MN+kn`p10iAE;r-Fx(Kv!)8mH{;#SQM4MM|3vo zJ4F$9QT0PNuo>6!rlo#$;N1Y79CvVaEuVtVhR*X4KXF1TIW`8uE;OMFJ2@w`ZWIx& zA(EZHHGGEkKclXtzJQ2&Ht<=ufW}`TCpzo*oJTYvMt4LO(3D(&))Q%s?C83H=6clc z8J&lo>?&Y|!i!{}5m6coSecy1N(C<93iXyMtJ!K4TtJJ!S^TADYXpABl|2ph-Hq25 zu(n6G$_rShUcaek>!}fKjTUfK0j&jWXl=NFtLymIDG9GRi-FSg+5$E%VADD5WDvh1 zHgO)CTNz7R%N7nbAg&77${^>lZ8_++3MkUuIDaX-w(%U=mIAkIuOR0yZU2dcT!((_ z=cP7*yi?uIbR_U4Msc2(-aj#hi%5wWj*2ZfCbr{lu>%w0 zFiwb3+=Dp1xC1LTT*7wLOYD-^ExECf*c-is7DOsCi5rx7pY|`LME6B(l(> \"" ); + 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 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 diff --git a/forester_applications/src/org/forester/applications/get_shared_chars.class b/forester_applications/src/org/forester/applications/get_shared_chars.class new file mode 100644 index 0000000000000000000000000000000000000000..8d995a2eb5f5107c4dbfdf988e7d0e79c798a995 GIT binary patch literal 4547 zcmb_gd2kz78UH<7(#rDYa^j>4302cJ_>2;#NvY(x#CDRp*v{c3B~D3LOKW8lc~_NI ziJby%N;rDZQYeLTH4Oz*&L)6kH;|M9D_C3kK03dHx2}GQ10&uLJN^Nq#zMO5Xlg942O`y zp;{O?tl)@(bO`e?D3_5SOu1V@WaNHF2wCJph{2XiUg|#@#Iah8VoWj|S8!(tD=-+u zd!@biNrCsv*LTU~Zn>NY;+`NrAde?&@j-k@E+1C#kq{bjuN1gXD!)I72ZH#hf(Iq% zLm{lk$7=B~PAd4geE5W9e?*=>8N#FZR0yBOV{-Y7g3l`WoPfW3OXr?#0%A~LUYBL& zY|XUyYU#XQO&(#?)uL(5OhpImtYN0&QgGgYttF21X&HxK!RP5+1z&KS`8eS!I7KB1D>Ek0(%|aI z+eSJ%U}bGRIiTC|#)?#dngJtaYIZ(L7`rQqwqK5^qq4e+oC1-QZf{Pfw~X3)*3{D7 zdM=@xNxCZ6Pk;0za{`+hdaZ0KI&5Y29J!*ILt|+xrJG~X9fgzRt!y@~;0b|U|BH%J z88EeOm1Vq^kml|EvqF6m{-{O|FZAJU78OKSov&1-)hJt zsVA0$Ia<_{2NT?KYhj!fgJz)$R30Eu@ zIhM7|RK#>LFk%fyv}`Ir!h7YU@VG$Fo}8A_W06&}Ek>BnQe#J?J?H9lUr%#ex+oMWx1n8cKdT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$k~SzqPs9H;LLQsMV-$ z>l;T?Kc&uN{=Rcq&^m#Ib&DoY*DMcWw>XVvUCQv_#rTy-{Eap3lt30u~Fge4% zDJ&P9Z{Fg{oW}~PTp9EGHU{bgO&3n%KvANpKF~&)y0;cgT;1Z5A~B^t;5&uIVSiYe z#Ih+|Q-#~cv2f;j6`xz>yQNdOmgkcJF+TkSRXcu|fpi@;w^l|JDB`HQULyCG^HFRy z+lmrartmg_$FN$S8U&t2V=NdBw1k5bXqrHC5#RL7VgDprq)a&A;wmvhx7JA&rS6#l zT(^b}mT#raU^wX6TrN+J&1kHK%;6fcjZgpe4D(<;wxS2~m`E~9PNRYAT4u{SsQfLw z1UK*}=|-%=jaZGFNR3ls6Q6FTTsI{*<5s3!n$j6kMsW*Hka7yWcnW< zp8f>`_y;G{*Rf9o(I@8PcCiEpL>q=g90@Uqq!@)R9>O8c6q*5(XS<-+$0@ z30n*22up$ECLJNGD8=2!J?f=iZQ)R9(V?g3*=O;YjSHaSrgF@jJQuNpGJqK7n=8beljwtvQJl;lV+$ zKIUric>{dXJT<-zeLqPm7 z;Q@NY1GMu>fHuqqv~dDAPT=is**Oqh%1vG&PQOrsayfGjxR)sJBg*@U@&TfJkO6tP RGSZlb^fo5(yBsI(`!8 ... " ); + 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 outside_external_ids = getAllExternalDescendantsNodeIds( phy.getRoot() ); + final SortedSet all_chars = getAllExternalPresentAndGainedCharacters( phy.getRoot() ); + System.out.println( "Sum of all external characters:\t" + all_chars.size() ); + final SortedSet all_shared_chars = new TreeSet(); + 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 outside_chars = new TreeSet(); + 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 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 copy( final SortedSet set ) { + final SortedSet copy = new TreeSet(); + for( final String s : set ) { + copy.add( s ); + } + return copy; + } + + private static SortedSet getAllExternalDescendantsNodeIds( final PhylogenyNode node ) { + final SortedSet ids = new TreeSet(); + final List descs = node.getAllExternalDescendants(); + for( final PhylogenyNode desc : descs ) { + ids.add( desc.getId() ); + } + return ids; + } + + private static SortedSet getAllExternalPresentAndGainedCharacters( final PhylogenyNode node ) { + final SortedSet chars = new TreeSet(); + final List 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_applications/src/org/forester/applications/get_subtree_specific_chars.class b/forester_applications/src/org/forester/applications/get_subtree_specific_chars.class new file mode 100644 index 0000000000000000000000000000000000000000..f885d069dd607691e4d896814428b8e79e36d8d2 GIT binary patch literal 4899 zcmb_g33L6)f%x~FZrH|;q+htopuAB}9uShVM~=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Ep9>RR;9=rIGv|1ffvsTKbinOBnG}lT%t{f{1LKVI;U&Rm> z7U2*oeC2Z8=-7F&c#%e+*+>y@m5zg*|f~QTNB4F zzQFek^sx&^PLLuC$fs6RkYkcSCsEIFK8dsd8Wv&_8ZixvFbmgW4z9;Mg!pDLpO#Rs znVL6Z6?qyXPZQ+lE;4j4-yEg2$4SC8C7wY$Z``YS!CixYV4a|sLd7OA0h>iNwuqV7 zDr#}7XvJ+}8@fdl+e8AocmO@(Fe2g!42Y+&Tb#ol@ha{tD#qTTGTc>EiF=Bw_|ttA z5${9goQp(Rtl$;}Z3>SR3OeRo0Dm~HcK$m5iB$^Ls24F8<-=mbZ}}>_ruH6pc&pvvC^oMoX#IeRzKd{Xc%|+*RWcc=a@6nTKVt5qfBVpY`yG$RNjQ}bJOY}I^^V2{9=;Kq+{5>9F5&*- z;ltBdB#*vUpo6D5)bVrSAh<5%sq?WZTtA3V7Rk#wNTxWp9wd^7$d~;H@INjgJnW#E zfT9bSV=Foh8}Qdp-x{733~h gQ(hb<%14Ou2vI&t{v90~X~;!-D~sVaCx~zOH`DKIegFUf literal 0 HcmV?d00001 diff --git a/forester_applications/src/org/forester/applications/get_subtree_specific_chars.java b/forester_applications/src/org/forester/applications/get_subtree_specific_chars.java new file mode 100644 index 0000000..2163927 --- /dev/null +++ b/forester_applications/src/org/forester/applications/get_subtree_specific_chars.java @@ -0,0 +1,162 @@ + +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 " ); + 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 all_external_ids = getAllExternalDescendantsNodeIds( phy.getRoot() ); + final SortedSet 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 external_ids = getAllExternalDescendantsNodeIds( node ); + final SortedSet not_external_ids = copy( all_external_ids ); + not_external_ids.removeAll( external_ids ); + final SortedSet not_node_chars = new TreeSet(); + for( final Integer id : not_external_ids ) { + not_node_chars.addAll( getAllExternalPresentAndGainedCharacters( phy.getNode( id ) ) ); + } + final SortedSet node_chars = getAllExternalPresentAndGainedCharacters( node ); + final SortedSet unique_chars = new TreeSet(); + 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 copy( final SortedSet set ) { + final SortedSet copy = new TreeSet(); + for( final Integer i : set ) { + copy.add( i ); + } + return copy; + } + + private static SortedSet getAllExternalDescendantsNodeIds( final PhylogenyNode node ) { + final SortedSet ids = new TreeSet(); + final List descs = node.getAllExternalDescendants(); + for( final PhylogenyNode desc : descs ) { + ids.add( desc.getId() ); + } + return ids; + } + + private static SortedSet getAllExternalPresentAndGainedCharacters( final PhylogenyNode node ) { + final SortedSet chars = new TreeSet(); + final List 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_applications/src/org/forester/applications/inverted_dcs.class b/forester_applications/src/org/forester/applications/inverted_dcs.class new file mode 100644 index 0000000000000000000000000000000000000000..57dc26c43d712cf197b9175a6cf3c4ba47ed1a85 GIT binary patch literal 3182 zcmbtXS#uQE75=Vfq#jxgHnLd8!FY^qF_MsnC1e?aVy(7pNeCn$Ky0Nob2T)yx+mQ| zSaL!Z@B5N?-`5a33*e*%DO6m3bon>rJ&&nM-f$W6-JTg~MoTJHdFgxm^ttDL=R3>2 z{ngdKehy$a{;Z<|18Z;>?$$Agdt$g(jYBaE>lBV?IG`hjQ5^?yNXHn)8*vy%G#u6N zLmlfdpdQC!IIhMMG5ko4_vyGF6FPR_$I7%B!(<~e$f|Er&88ZW!%6k9G@Odzw2rN? z)t6}vj*e~0ZVTK-5ZF{HYL$%({cnhCQl5V zGS8SP+jMfNvB0yOT&G&Nb}TS6r-#jasITFtq)5ZhLPpMN__;tbCxdR=?w<*y=a}}W zCw=Jz-A?u{T9(<~lcr~8_{|sCpB!?%Tx!at4kfAl$ywXYNoO`STA7UyXJ=~(OChlA z)R^l9GCL-NP7S{hSTknj95X0*#D4JqF}H8Izg?XI`j}hrGIGFD{*q&&!N8Wo0HZWXw-6eoEYB;4wTdV1&`J+>}D5P&}&P2?I~!DGg5> zcm~gEc+SA{ctPNX#YpzgWMn?DT!whlqO=s>o`Pj(rDxzp{9538z1J<+*@WW;2~V2Y zgp&V;8KxU}2`@9|242Cd27Z7$4ZMbjm}7w(nD%}RXAQiLH`IbR4ZMZ7nHL7$!Mg_D z!}~P7bZ1)KZ{P!bXy7A!OrAr9Fx=zxnZY*jTbv66e%t?&F$R8zPc(dL;P?20hCdqk z6V4mBfQtq`!+C+08Y^Z#Z(A8t@#3edLsx_Kz~m{J2}tJ(r6G{0vA9AeSK?5c#R5%> z&JMB&%)s>o)-4K$ET5ZJb2iIjnPw$RkD41wdCN=~WswF9r8K9RxTT=iiUqX1QnDHT z4awyRA9e;gV{yM|a!|ePTg9s>maywt(oc;tIi=TQ`ZBvvv;*PSS%F3-^kCSGGAy6H z$=22Cy~wu%GWPCPH z5b3ht<w)*7Vxq7I=^-EW9za6XO{)+mgeV3p3 zn`$UnJj+!^XS2LEkil{|!r=D0w#}x?#@wj_+DvE47m7u1a0_o*9qO8c&A0<8jyw5Q zhh2zp&I6jyZ&Pv;N5Qea?GnVraKTzmdW(bTRcH*iu!Gwmr$JBrvahmF+URMu|VOofhl#084Dv82h@Z?Tm{%)$AsLFR(RTAFpq^xrju%p==@E5Zz51O4t-{h^RTuq_vK?Hji8CxV(|u#p?;- z+_m!;Nx>cr@EW|994dnD$0j~^lBiu!SB++V-$F*W@oNhy+lB8@lIE$AgB^_;# zGkn{NNEXpLkG47-t&+5tB" ); + 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 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 getAllExternalPresentAndGainedCharacters( final PhylogenyNode node ) { + final SortedSet chars = new TreeSet(); + final List 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_applications/src/org/forester/applications/map_lengths.java b/forester_applications/src/org/forester/applications/map_lengths.java new file mode 100644 index 0000000..b4475df --- /dev/null +++ b/forester_applications/src/org/forester/applications/map_lengths.java @@ -0,0 +1,88 @@ +// $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 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_applications/src/org/forester/applications/phylo2coloredgraphics.java b/forester_applications/src/org/forester/applications/phylo2coloredgraphics.java new file mode 100644 index 0000000..8a7aeb5 --- /dev/null +++ b/forester_applications/src/org/forester/applications/phylo2coloredgraphics.java @@ -0,0 +1,72 @@ + +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 colors = new HashMap(); + 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(); + } + } +} diff --git a/forester_applications/src/org/forester/applications/phylo2graphics.java b/forester_applications/src/org/forester/applications/phylo2graphics.java new file mode 100644 index 0000000..7fd2f61 --- /dev/null +++ b/forester_applications/src/org/forester/applications/phylo2graphics.java @@ -0,0 +1,43 @@ + +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(); + } + } +} diff --git a/forester_applications/src/org/forester/applications/reinv_count.class b/forester_applications/src/org/forester/applications/reinv_count.class new file mode 100644 index 0000000000000000000000000000000000000000..e09e7b5708f0be4318eba3a17daba03b5f199e39 GIT binary patch literal 3553 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PD9BR_7=GZlIDonS)R{ztsA%v)?ony$!W_cCxw&+tC)=sJA*G?4zY~tgumyb;#0HK}>9C!2U zKF)%3bJsP9D_rnm;Mn35dl1H6e2{ChHa&|V){?>Ky3u?YTdtz1hycg7U=ht~ZYj;A zHZ4J3N9cH0p!XWWV_m`C!(x01S~3_7c6SGt5Lt#EK%jSg5k1Ku4_`;?@oQKcrL1*r z>x*dXR*Sp1D59NmmBj5ubSMeSxLfdX@fWq)!1`>CHZS3xWJ_QVl}0J%-ef4+vW)j} zFB}aoW20g}qgM9`yo>vjT3}Cv(jG|aQN1j!TdkC|HPJOi#ERHd#O7pcv^AqDU}ZjTyh=`U&XeHL(N6JpI)@ZIdsS( zI@`LqD)XvOwQ*0l2s*4BU0m68g#q7-F&x1fH2HA6ime1CL0EP|Cz9>NawAdPOdPk7 zV;A{%6R5pNq91)cJIK=mn8ZGKcog&4kLUS5dIiIH9V2|L9OO&rG5ijr_&pBc&wSYb zm8bs3zmC6S9RI`wZemgd@wngyoaWLppD}S?WvauXzG2( zc&My>jdL^S$uiz!jA_r|o@Hzo7~ft7d^Z<9-aC@PZk1SNP?wP)W;K+ZCCcK;AG+VB y&{D|nWw60tq7YJqAx$Su26viao$*~?kEWYw_nkOEKi=c!h=2GX(R<8ajs6>>Qrz|c literal 0 HcmV?d00001 diff --git a/forester_applications/src/org/forester/applications/reinv_count.java b/forester_applications/src/org/forester/applications/reinv_count.java new file mode 100644 index 0000000..97760e1 --- /dev/null +++ b/forester_applications/src/org/forester/applications/reinv_count.java @@ -0,0 +1,106 @@ + +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 " ); + 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 target_dcs = getAllExternalPresentAndGainedCharacters( target_node ); + //System.out.println( "Target DCs:" + target_dcs.size() ); + int counter = 0; + final SortedSet reinv = new TreeSet(); + 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 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 getAllExternalPresentAndGainedCharacters( final PhylogenyNode node ) { + final SortedSet chars = new TreeSet(); + final List 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_applications/src/org/forester/applications/set_comparator.class b/forester_applications/src/org/forester/applications/set_comparator.class new file mode 100644 index 0000000000000000000000000000000000000000..58da7dc77b1f50803e435c081e8565a9c54d68d5 GIT binary patch literal 1826 zcmb_d!E+N;9R6Oq&2G|#VoHlus9P(NG-(5+A|#=ZgcJg4f+Q`rsCApZhAo?HX0u@` zcV^_^L1#R8^2k*@q+n+luX^$5Kj0tXFb?{An*@@=I3CPocHi&4-}}Dr_rCY`{rdc; zrvTRT=U~7ax#`=e@32)_> zMnT4P;$rX@t)^Y(i-tfMX>ez~Y*p*Jtvi-IE1*1$1U5q!P{p;07Uf9^?WrsX+ft!wDMvI){z{@yGc*2psdBrb?rb=7GYEt%S+jv^! z>*Tsa-gCVgCr`U_d%79qx=1o<%ZvtJzhfl6V-Tzq%!>Up(N~$Paj{e9G6`l-w#eE! zs*<)y2eIRKJk%y=7iQTG-=y+LnU@xb*J!P0UMJxdRh@l76Qzc6k9I2^i7dlW68JB< ziet5p0mI?otBHi>v$;cuCuvd@;~gcg*0g1sWDMCC53Ny!#tRe1x=3zb*Bru#!Z*`T2fxSgkMINrT97=CF}Mfs>h!?eF675h za&9Dbq9w}PgKu>g{=iTRYWN8bFtl*6g<+cAGkSROvo?w*WJB(9fjNxY-i3yHziMSsA{YSr08ff87K{DP?^49-O5+Qy2NZ#(Px2F=4 z^B*dC2sIaO;h0$dN5U<3pM6Q+dXMX$O)VfyK1OhmZkYh0Wco?W;uLap8ExY_T1{)5jj@t3%nUN-*3L`p_TA<5G;!GrKWzxS_( literal 0 HcmV?d00001 diff --git a/forester_applications/src/org/forester/applications/set_comparator.java b/forester_applications/src/org/forester/applications/set_comparator.java new file mode 100644 index 0000000..3178a66 --- /dev/null +++ b/forester_applications/src/org/forester/applications/set_comparator.java @@ -0,0 +1,76 @@ +// $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 " ); + System.exit( -1 ); + } + Set set_a = ForesterUtil.file2set( new File( args[ 0 ] ) ); + final Set 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 diff --git a/forester_applications/src/org/forester/applications/shared_chars_in_ext_nodes.class b/forester_applications/src/org/forester/applications/shared_chars_in_ext_nodes.class new file mode 100644 index 0000000000000000000000000000000000000000..9830e0f8be96031181d78fb8509cbeb8c0b05988 GIT binary patch literal 3302 zcma)9Yj+#f72VgCeWmdv0TU+?4Im7-@+(S00*&k%@GCLMk5o<|Nn3X!T`Lph88I3W zo6-V(gwhsT-h@6VEi`=sNsAIUYtgQL?8p9x{t4EiVc(GyOU4Q;uXP_s=bXFGzUQ2| z{?Gsa@ezQ%xNKk-4n;792Ms)gR2b8Go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sOhs^HB0j`EH%)b;yX?-6K<9_&jmn>t9kFs$-Y$otFCh;B);zJz5Klvj6FCG+~ zct~{7>HtsaL0ivN#1WE6N(@O1OMDeVVkG_vx+LzCxc_6Eg`wX&#HX)5$2r6~aRoi( z{>!PpRm26R2UgLm`P{)ppTNJ+Khr~umf+B_kC|cPfyD#~nhaJ4KLyZVqlN$g literal 0 HcmV?d00001 diff --git a/forester_applications/src/org/forester/applications/shared_chars_in_ext_nodes.java b/forester_applications/src/org/forester/applications/shared_chars_in_ext_nodes.java new file mode 100644 index 0000000..b86d6cc --- /dev/null +++ b/forester_applications/src/org/forester/applications/shared_chars_in_ext_nodes.java @@ -0,0 +1,85 @@ + +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 " ); + 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 a = phy.getNode( node_name ).getNodeData().getBinaryCharacters().getGainedCharacters(); + for( final PhylogenyNodeIterator it = phy.iteratorExternalForward(); it.hasNext(); ) { + final PhylogenyNode n = it.next(); + final SortedSet b = n.getNodeData().getBinaryCharacters().getGainedCharacters(); + final SortedSet 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 copy( final SortedSet set ) { + final SortedSet copy = new TreeSet(); + for( final String i : set ) { + copy.add( i ); + } + return copy; + } +} diff --git a/forester_applications/src/org/forester/applications/simple_node_processor.class b/forester_applications/src/org/forester/applications/simple_node_processor.class new file mode 100644 index 0000000000000000000000000000000000000000..9f0fe1a3a165e777e8a6a14074fe267f0eeae55d GIT binary patch literal 2670 zcma)8TUQfT6#fng92kajQMA!|w;B*kMYL^#R7B8d5@|t2ZA%Yf2!nHpGZO)A)mD3N z?Zw{ksc$~phlq8p{(%0C{*10wyUz>>K~3#iStsYR&))m{&c4i_|NQ<3fF9gcupJ4G zJ_R*6B!_+lZ{RS;fPy+C8gT@J3XWo^5yLnphvN#iA<1zkILVP}KpGhZEjXoM z1aHdOTMF%sDj36QIh;{&7UOa_r{Fv;D0mz1D0mkW^7K796ZM#si!8?!hsF>-GB7&C z(3YANmqpAFRxUQ`Il7fgFfuF9bKeJ%iIn7##jg)3mFp-p2lu^6jWVK;ky0pR7&Ag#a zSadwGtkZV(O57@TBg(LAmF9w{8?iy#G=()K@eMe+f~i@aE2XSkMRk|rz$>^RzJrV z9AB#VN-n;}ZH{kLd@JvKr{a6u;rKztkN8Q&&$yxD7u;chibdRf61&Lf4LvKQbvO1* z${AW#Ts<{8t7Scgn#l=*@Qi3-PmSrX6L|xX=ghvXJ(Tb!E9w_njPRIY^w6(;{i0u+T zQ<}pNukK(;x(bivC7%&)Mw_RQp%QeSDvjkYqSbYl`SJ?`RRz!Xx5m>{U3!hP8NvSIBt*oAB zuO#_AdnGyIs6v0xy*966#V`BA%kAYf^#CHC_%QPxIrmKBDF`dW!S9}wO@?OWycs`C zlR^Gxgh}kSXqO7YaFaQUj0{pj)1gZo(;>C}ZS=JOP`APk?4Xnum@d%D9a#>MmoFAQY_6fk5F@tE`>7Pp(4Vm?l6t% zCDg{lk5G5+0eHMN65bQ3eTe!H;&qX_P*0pkco7Zp`q06KNc}@7jOub zumts11H1S5uSaMiB`?U`t_UX+&G)b_^BY>bi)bri4gIaHSwj1L@-B=y>Rc@ZPx?NM z2#tGb6{C}Vgrx_~*pGJfVk2J1R>TQ<0te7X<01NL>co2g+KoC9ugjl2z!zQN8S)-9r+{?-@q;v#y3StQ+6#D*noyo>E}R>Vv7zhXTd zZVHy07tzq!wxx)z@(}|fHiOe#r*RgoxJa}ZM2ktVErRI!0BXVhrUfHjp|MJ literal 0 HcmV?d00001 diff --git a/forester_applications/src/org/forester/applications/simple_node_processor.java b/forester_applications/src/org/forester/applications/simple_node_processor.java new file mode 100644 index 0000000..6f27819 --- /dev/null +++ b/forester_applications/src/org/forester/applications/simple_node_processor.java @@ -0,0 +1,121 @@ +// $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( "" ); + } + } + } + } + } +} diff --git a/forester_applications/src/org/forester/applications/wiki_examples.java b/forester_applications/src/org/forester/applications/wiki_examples.java new file mode 100644 index 0000000..4f4b502 --- /dev/null +++ b/forester_applications/src/org/forester/applications/wiki_examples.java @@ -0,0 +1,50 @@ + +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 colors = new HashMap(); + // 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 -- 1.7.10.2