From: cmzmasek@gmail.com Date: Fri, 27 Sep 2013 22:35:17 +0000 (+0000) Subject: initial commit X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=befea788d8ee8f726b006f696e3394597adf4307;p=jalview.git initial commit --- 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 0000000..812a0ad Binary files /dev/null and b/forester_applications/src/org/forester/applications/appearance_vs_count.class differ 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 0000000..4dba303 Binary files /dev/null and b/forester_applications/src/org/forester/applications/core_chars.class differ diff --git a/forester_applications/src/org/forester/applications/core_chars.java b/forester_applications/src/org/forester/applications/core_chars.java new file mode 100644 index 0000000..bcb3241 --- /dev/null +++ b/forester_applications/src/org/forester/applications/core_chars.java @@ -0,0 +1,92 @@ + +package org.forester.applications; + +// $Id: +// FORESTER -- software libraries and applications +// for evolutionary biology research and applications. +// +// Copyright (C) 2008-2011 Christian M. Zmasek +// Copyright (C) 2008-2011 Burnham Institute for Medical Research +// All rights reserved +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +// +// Contact: phylosoft @ gmail . com +// WWW: www.phylosoft.org/forester +// javac -cp ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar +// ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/org/forester/applications/core_chars.java +// java -Xmx2048m -cp +// /home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/:/home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar +// org.forester.applications.core_chars +import java.io.File; +import java.util.List; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.forester.phylogeny.Phylogeny; +import org.forester.phylogeny.PhylogenyNode; +import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory; +import org.forester.phylogeny.factories.PhylogenyFactory; + +public class core_chars { + + final static boolean SIMPLE = true; + + public static void main( final String args[] ) { + if ( args.length != 1 ) { + System.err.println(); + System.err.println( "core_chars: wrong number of arguments" ); + System.err.println( "Usage: \"get_subtree_specific_chars " ); + 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 0000000..7b631ba Binary files /dev/null and b/forester_applications/src/org/forester/applications/domainloss_replacement.class differ 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 0000000..aea8dfb Binary files /dev/null and b/forester_applications/src/org/forester/applications/genome_counts_for_once_appearing_dcs.class differ 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 0000000..7880dfd Binary files /dev/null and b/forester_applications/src/org/forester/applications/get_genome_counts_per_char.class differ 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 0000000..7b6991d Binary files /dev/null and b/forester_applications/src/org/forester/applications/get_loss_nodes.class differ diff --git a/forester_applications/src/org/forester/applications/get_loss_nodes.java b/forester_applications/src/org/forester/applications/get_loss_nodes.java new file mode 100644 index 0000000..6b0bb82 --- /dev/null +++ b/forester_applications/src/org/forester/applications/get_loss_nodes.java @@ -0,0 +1,93 @@ +// $Id: +// FORESTER -- software libraries and applications +// for evolutionary biology research and applications. +// +// Copyright (C) 2008-2009 Christian M. Zmasek +// Copyright (C) 2008-2009 Burnham Institute for Medical Research +// All rights reserved +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +// +// Contact: phylosoft @ gmail . com +// WWW: www.phylosoft.org/forester +// javac -cp ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar +// ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/org/forester/applications/get_loss_nodes.java +// java -Xmx2048m -cp +// /home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/:/home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar +// org.forester.applications.get_loss_nodes + +package org.forester.applications; + +import java.io.File; +import java.io.IOException; +import java.util.List; + +import org.forester.io.parsers.PhylogenyParser; +import org.forester.phylogeny.Phylogeny; +import org.forester.phylogeny.PhylogenyNode; +import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory; +import org.forester.phylogeny.factories.PhylogenyFactory; +import org.forester.phylogeny.iterators.PhylogenyNodeIterator; +import org.forester.util.ForesterUtil; + +public class get_loss_nodes { + + public static void main( final String args[] ) { + if ( args.length != 2 ) { + System.out.println( "get_loss_nodes: Wrong number of arguments" ); + System.out.println( "Usage: \"get_loss_nodes \"" ); + 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 0000000..8d995a2 Binary files /dev/null and b/forester_applications/src/org/forester/applications/get_shared_chars.class differ diff --git a/forester_applications/src/org/forester/applications/get_shared_chars.java b/forester_applications/src/org/forester/applications/get_shared_chars.java new file mode 100644 index 0000000..8496451 --- /dev/null +++ b/forester_applications/src/org/forester/applications/get_shared_chars.java @@ -0,0 +1,126 @@ + +package org.forester.applications; + +// $Id: +// FORESTER -- software libraries and applications +// for evolutionary biology research and applications. +// +// Copyright (C) 2008-2011 Christian M. Zmasek +// Copyright (C) 2008-2011 Burnham Institute for Medical Research +// All rights reserved +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +// +// Contact: phylosoft @ gmail . com +// WWW: www.phylosoft.org/forester +// javac -cp ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar +// ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/org/forester/applications/get_shared_chars.java +// java -Xmx2048m -cp +// /home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/:/home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar +// org.forester.applications.get_shared_chars +import java.io.File; +import java.util.List; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.forester.io.parsers.util.ParserUtils; +import org.forester.phylogeny.Phylogeny; +import org.forester.phylogeny.PhylogenyNode; +import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory; +import org.forester.phylogeny.factories.PhylogenyFactory; + +public class get_shared_chars { + + public final static boolean DEBUG = true; + + public static void main( final String args[] ) { + if ( args.length < 2 ) { + System.err.println(); + System.err.println( "get_subtree_specific_chars: wrong number of arguments" ); + System.err.println( "Usage: \"get_shared_chars ... " ); + 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 0000000..f885d06 Binary files /dev/null and b/forester_applications/src/org/forester/applications/get_subtree_specific_chars.class differ 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 0000000..57dc26c Binary files /dev/null and b/forester_applications/src/org/forester/applications/inverted_dcs.class differ diff --git a/forester_applications/src/org/forester/applications/inverted_dcs.java b/forester_applications/src/org/forester/applications/inverted_dcs.java new file mode 100644 index 0000000..e6e6ba3 --- /dev/null +++ b/forester_applications/src/org/forester/applications/inverted_dcs.java @@ -0,0 +1,86 @@ + +package org.forester.applications; + +// $Id: +// FORESTER -- software libraries and applications +// for evolutionary biology research and applications. +// +// Copyright (C) 2008-2011 Christian M. Zmasek +// Copyright (C) 2008-2011 Burnham Institute for Medical Research +// All rights reserved +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +// +// Contact: phylosoft @ gmail . com +// WWW: www.phylosoft.org/forester +// javac -cp ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar +// ~/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/org/forester/applications/inverted_dcs.java +// java -Xmx2048m -cp +// /home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester_applications/src/:/home/czmasek/SOFTWARE_DEV/ECLIPSE_WORKSPACE/forester/java/forester.jar +// org.forester.applications.inverted_dcs +import java.io.File; +import java.util.List; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.forester.phylogeny.Phylogeny; +import org.forester.phylogeny.PhylogenyNode; +import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory; +import org.forester.phylogeny.factories.PhylogenyFactory; + +public class inverted_dcs { + + final static boolean SIMPLE = true; + + public static void main( final String args[] ) { + if ( args.length != 1 ) { + System.err.println(); + System.err.println( "inverted_dcs: wrong number of arguments" ); + System.err.println( "Usage: \"get_subtree_specific_chars " ); + 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 0000000..e09e7b5 Binary files /dev/null and b/forester_applications/src/org/forester/applications/reinv_count.class differ 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 0000000..58da7dc Binary files /dev/null and b/forester_applications/src/org/forester/applications/set_comparator.class differ 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 0000000..9830e0f Binary files /dev/null and b/forester_applications/src/org/forester/applications/shared_chars_in_ext_nodes.class differ 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 0000000..9f0fe1a Binary files /dev/null and b/forester_applications/src/org/forester/applications/simple_node_processor.class differ 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