Index: resources/lang/Messages.properties =================================================================== diff -u -N -r2e9e0527943d0c42a6059ebbb8e7e69346c38206 -rd4a6a8430fa8d954b0fc5ecdcc6a7bda424224ad --- resources/lang/Messages.properties (.../Messages.properties) (revision 2e9e0527943d0c42a6059ebbb8e7e69346c38206) +++ resources/lang/Messages.properties (.../Messages.properties) (revision d4a6a8430fa8d954b0fc5ecdcc6a7bda424224ad) @@ -30,7 +30,9 @@ action.close_all = Close all action.load_project = Load Project action.save_project = Save Project +action.save_project_as = Save Project as... action.quit = Quit +label.quit_jalview = Quit Jalview? action.expand_views = Expand Views action.gather_views = Gather Views action.page_setup = Page Setup... @@ -118,10 +120,8 @@ action.new_view = New View action.close = Close action.add = Add -action.save_as_default = Save as default action.save_as = Save as... action.save = Save -action.cancel_fetch = Cancel Fetch action.change_font = Change Font action.change_font_tree_panel = Change Font (Tree Panel) action.colour = Colour @@ -132,6 +132,8 @@ action.deselect_all = Deselect all action.invert_selection = Invert selection action.using_jmol = Using Jmol +action.undo_changes_to_feature_settings = Undo all unapplied changes to feature settings +action.undo_changes_to_feature_settings_and_close_the_dialog = Undo all pending changes and close the feature settings dialog action.link = Link action.group_link = Group Link action.show_chain = Show Chain @@ -140,7 +142,6 @@ action.view_flanking_regions = Show flanking regions label.view_flanking_regions = Show sequence data either side of the subsequences involved in this alignment label.structures_manager = Structures Manager -label.nickname = Nickname: label.url = URL label.url\: = URL: label.input_file_url = Enter URL or Input File @@ -162,7 +163,6 @@ label.service_action = Service Action: label.post_url = POST URL: label.url_suffix = URL Suffix -label.sequence_source = Sequence Source label.per_seq = per Sequence label.result_vertically_separable = Results are vertically separable label.amend = Amend @@ -172,10 +172,9 @@ label.average_distance_identity = Average Distance Using % Identity label.neighbour_joining_identity = Neighbour Joining Using % Identity label.choose_calculation = Choose Calculation -label.treecalc_title = {0} Using {1} +label.calc_title = {0} Using {1} label.tree_calc_av = Average Distance label.tree_calc_nj = Neighbour Joining -label.select_score_model = Select score model label.score_model_pid = % Identity label.score_model_blosum62 = BLOSUM62 label.score_model_pam250 = PAM 250 @@ -188,21 +187,22 @@ label.occupancy = Occupancy # delete Clustal - use FileFormat name instead label.clustal = Clustal -# label.colourScheme_ as in JalviewColourScheme +# label.colourScheme_ as in JalviewColourScheme, spaces removed label.colourScheme_clustal = Clustalx label.colourScheme_blosum62 = BLOSUM62 Score -label.colourScheme_%_identity = Percentage Identity +label.colourScheme_%identity = Percentage Identity label.colourScheme_zappo = Zappo label.colourScheme_taylor = Taylor label.colourScheme_hydrophobic = Hydrophobicity -label.colourScheme_helix_propensity = Helix Propensity -label.colourScheme_strand_propensity = Strand Propensity -label.colourScheme_turn_propensity = Turn Propensity -label.colourScheme_buried_index = Buried Index +label.colourScheme_helixpropensity = Helix Propensity +label.colourScheme_strandpropensity = Strand Propensity +label.colourScheme_turnpropensity = Turn Propensity +label.colourScheme_buriedindex = Buried Index label.colourScheme_purine/pyrimidine = Purine/Pyrimidine label.colourScheme_nucleotide = Nucleotide -label.colourScheme_t-coffee_scores = T-Coffee Scores -label.colourScheme_rna_helices = By RNA Helices +label.colourScheme_t-coffeescores = T-Coffee Scores +label.colourScheme_rnahelices = By RNA Helices +label.colourScheme_sequenceid = Sequence ID Colour label.blc = BLC label.fasta = Fasta label.msf = MSF @@ -230,6 +230,7 @@ label.protein = Protein label.nucleotides = Nucleotides label.proteins = Proteins +label.CDS = CDS label.to_new_alignment = To New Alignment label.to_this_alignment = Add To This Alignment label.apply_colour_to_all_groups = Apply Colour To All Groups @@ -266,11 +267,12 @@ label.autoadd_secstr = Add secondary structure annotation to alignment label.autoadd_temp = Add Temperature Factor annotation to alignment label.structure_viewer = Default structure viewer -label.chimera_path = Path to Chimera program -label.chimera_path_tip = Jalview will first try any path entered here, else standard installation locations.
Double-click to browse for file. -label.invalid_chimera_path = Chimera path not found or not executable -label.chimera_missing = Chimera structure viewer not found.
Please enter the path to Chimera (if installed),
or download and install UCSF Chimera. -label.chimera_failed = Error opening Chimera - is it installed?\nCheck path in Preferences, Structure +label.double_click_to_browse = Double-click to browse for file +label.viewer_path = Path to {0} program +label.viewer_path_tip = Jalview will first try any path entered here, else standard installation locations.
Double-click to browse for file. +label.invalid_viewer_path = Path not found or not executable +label.viewer_missing = Structure viewer not found.
Please enter the path to the executable (if installed),
or download and install the program. +label.open_viewer_failed = Error opening {0} - is it installed?\nCheck path in Preferences, Structure label.min_colour = Minimum Colour label.max_colour = Maximum Colour label.no_colour = No Colour @@ -326,6 +328,7 @@ label.paste_your_alignment_file = Paste your alignment file here label.paste_your = Paste your label.finished_searching = Finished searching +label.subsequence_matches_found = {0} subsequence matches found label.search_results= Search results {0} : {1} label.found_match_for = Found match for {0} label.font = Font: @@ -352,32 +355,25 @@ label.channels = Channels label.channel_title_item_count = {0} ({1}) label.blog_item_published_on_date = {0} {1} -label.select_das_service_from_table = Select a DAS service from the table to read a full description here. -label.session_update = Session Update -label.new_vamsas_session = New Vamsas Session -action.load_vamsas_session = Load Vamsas Session... -action.save_vamsas_session = Save Vamsas Session -label.select_vamsas_session_opened_as_new_vamsas_session= Select a vamsas session to be opened as a new vamsas session. -label.open_saved_vamsas_session = Open a saved VAMSAS session label.groovy_console = Groovy Console... label.lineart = Lineart label.dont_ask_me_again = Don't ask me again -label.select_eps_character_rendering_style = Select EPS character rendering style +label.select_character_rendering_style = {0} character rendering style +label.select_character_style_title = {0} Rendering options label.invert_selection = Invert Selection label.optimise_order = Optimise Order label.seq_sort_by_score = Sequence sort by Score label.load_colours = Load Colours label.save_colours = Save Colours label.load_colours_tooltip = Load feature colours and filters from file label.save_colours_tooltip = Save feature colours and filters to file -label.fetch_das_features = Fetch DAS Features label.selected_database_to_fetch_from = Selected {0} database {1} to fetch from {2} label.database_param = Database: {0} label.example = Example label.example_param = Example: {0} label.select_file_format_before_saving = You must select a file format before saving! label.file_format_not_specified = File format not specified -label.couldnt_save_file = Couldn't save file: {0} +label.couldnt_save_file = Couldn''t save file: {0} label.error_saving_file = Error Saving File label.remove_from_default_list = Remove from default list? label.remove_user_defined_colour = Remove user defined colour @@ -402,37 +398,25 @@ label.enter_view_name = Enter View Name label.enter_label = Enter label label.enter_label_for_the_structure = Enter a label for the structure -label.pdb_entry_is_already_displayed = {0} is already displayed.\nDo you want to re-use this viewer ? -label.map_sequences_to_visible_window = Map Sequences to Visible Window: {0} -label.add_pdbentry_to_view = Do you want to add {0} to the view called\n{1}\n -label.align_to_existing_structure_view = Align to existing structure view label.pdb_entries_couldnt_be_retrieved = The following pdb entries could not be retrieved from the PDB\:\n{0}\nPlease retry, or try downloading them manually. label.couldnt_load_file = Couldn't load file label.couldnt_find_pdb_id_in_file = Couldn't find a PDB id in the file supplied. Please enter an Id to identify this structure. label.no_pdb_id_in_file = No PDB Id in File label.couldnt_read_pasted_text = Couldn't read the pasted text {0} label.error_parsing_text = Error parsing text -label.enter_local_das_source = Enter Nickname & URL of Local DAS Source -label.you_can_only_edit_or_remove_local_das_sources = You can only edit or remove local DAS Sources! -label.public_das_source = Public DAS source - not editable label.input_alignment_from_url = Input Alignment From URL label.input_alignment = Input Alignment -label.couldnt_import_as_vamsas_session = Couldn't import {0} as a new vamsas session. label.vamsas_document_import_failed = Vamsas Document Import Failed -label.couldnt_locate = Couldn't locate {0} +label.couldnt_locate = Couldn''t locate {0} label.url_not_found = URL not found label.new_sequence_url_link = New sequence URL link -label.cannot_edit_annotations_in_wrapped_view = Cannot edit annotations in wrapped view -label.wrapped_view_no_edit = Wrapped view - no edit label.error_retrieving_data = Error Retrieving Data label.user_colour_scheme_must_have_name = User colour scheme must have a name label.no_name_colour_scheme = No name for colour scheme label.invalid_url = Invalid URL ! label.error_loading_file = Error loading file label.problems_opening_file = Encountered problems opening {0}!! label.file_open_error = File open error -label.no_das_sources_selected_warn = No das sources were selected.\nPlease select some sources and\ntry again. -label.no_das_sources_selected_title = No DAS Sources Selected label.colour_scheme_exists_overwrite = Colour scheme {0} exists.\nContinue saving colour scheme as {1}?" label.duplicate_scheme_name = Duplicate scheme name label.jalview_new_questionnaire = There is a new Questionnaire available. Would you like to complete it now ?\n @@ -505,11 +489,14 @@ label.create_sequence_feature = Create Sequence Feature... label.edit_sequence = Edit Sequence label.edit_sequences = Edit Sequences +label.insert_gap = Insert 1 gap +label.insert_gaps = Insert {0} gaps +label.delete_gap = Delete 1 gap +label.delete_gaps = Delete {0} gaps label.sequence_details = Sequence Details -label.jmol_help = Jmol Help -label.chimera_help = Chimera Help +label.viewer_help = {0} Help label.close_viewer = Close Viewer -label.confirm_close_chimera = This will close Jalview''s connection to {0}.
Do you want to close the Chimera window as well? +label.confirm_close_viewer = This will close Jalview''s connection to {0}.
Do you want to close the {1} window as well? label.all = All label.sort_by = Sort alignment by label.sort_by_score = Sort by Score @@ -525,9 +512,13 @@ label.retrieve_parse_sequence_database_records_alignment_or_selected_sequences = Retrieve and parse sequence database records for the alignment or the currently selected sequences label.standard_databases = Standard Databases label.fetch_embl_uniprot = Fetch from EMBL/EMBLCDS or Uniprot/PDB and any selected DAS sources +label.fetch_uniprot_references = Fetch Uniprot references +label.search_3dbeacons = Find models with 3D-Beacons +label.3dbeacons = 3D-Beacons +label.fetch_references_for = Fetch database references for {0} sequences ? +label.fetch_references_for_3dbeacons = 3D Beacons needs Uniprot References. Fetch database references for {0} sequences ? label.reset_min_max_colours_to_defaults = Reset min and max colours to defaults from user preferences. label.align_structures_using_linked_alignment_views = Superpose structures using {0} selected alignment view(s) -label.connect_to_session = Connect to session {0} label.threshold_feature_display_by_score = Threshold the feature display by score. label.threshold_feature_no_threshold = No Threshold label.threshold_feature_above_threshold = Above Threshold @@ -561,9 +552,6 @@ label.sequence_id_tooltip = Sequence ID Tooltip label.no_services = label.select_copy_raw_html = Select this if you want to copy raw html -label.share_data_vamsas_applications = Share data with other vamsas applications -label.connect_to = Connect to -label.join_existing_vamsas_session = Join an existing vamsas session label.from_url = from URL label.any_trees_calculated_or_loaded_alignment_automatically_sort = When selected, any trees calculated or loaded onto the alignment will automatically sort the alignment label.sort_with_new_tree = Sort With New Tree @@ -573,7 +561,6 @@ label.tools = Tools label.fetch_sequences = Fetch Sequences action.fetch_sequences = Fetch Sequences... -label.stop_vamsas_session = Stop Vamsas Session label.collect_garbage = Collect Garbage label.show_memory_usage = Show Memory Usage label.show_java_console = Show Java Console @@ -596,14 +583,22 @@ label.prot_alignment_colour = Protein Alignment Colour label.nuc_alignment_colour = Nucleotide Alignment Colour label.address = Address +label.host = Host label.port = Port label.default_browser_unix = Default Browser (Unix) label.send_usage_statistics = Send usage statistics label.check_for_questionnaires = Check for questionnaires label.check_for_latest_version = Check for latest version label.url_linkfrom_sequence_id = URL link from Sequence ID -label.use_proxy_server = Use a proxy server -label.eps_rendering_style = EPS rendering style +label.no_proxy = No proxy servers +label.system_proxy = System proxy servers (http={0}; https={1}) +label.use_proxy_server = Use these proxy servers +label.auth_required = Authentication required +label.username = Username +label.password = Password +label.proxy_password_required = Proxy password required +label.not_stored = not stored in Preferences file +label.rendering_style = {0} rendering style label.append_start_end = Append /start-end (/15-380) label.full_sequence_id = Full Sequence Id label.smooth_font = Smooth Font @@ -625,11 +620,9 @@ label.connections = Connections label.output = Output label.editing = Editing -label.das_settings = DAS Settings label.web_services = Web Services label.right_click_to_edit_currently_selected_parameter = Right click to edit currently selected parameter. label.let_jmol_manage_structure_colours = Let Jmol manage structure colours -label.let_chimera_manage_structure_colours = Let Chimera manage structure colours label.fetch_chimera_attributes = Fetch Chimera attributes label.fetch_chimera_attributes_tip = Copy Chimera attribute to Jalview feature label.marks_leaves_tree_not_associated_with_sequence = Marks leaves of tree not associated with a sequence @@ -641,11 +634,7 @@ label.details = Details label.options = Options label.parameters = Parameters -label.available_das_sources = Available DAS Sources -label.full_details = Full Details -label.authority = Authority -label.type = Type -label.proxy_server = Proxy Server +label.proxy_servers = Proxy Servers label.file_output = File Output label.select_input_type = Select input type label.set_options_for_type = Set options for type @@ -689,7 +678,7 @@ label.sequence_name = Sequence Name label.sequence_description = Sequence Description label.edit_sequence_name_description = Edit Sequence Name/Description -label.spaces_converted_to_backslashes = Spaces have been converted to _ +label.spaces_converted_to_underscores = Spaces have been converted to _ label.no_spaces_allowed_sequence_name = No spaces allowed in Sequence Name label.select_outline_colour = Select Outline Colour label.web_browser_not_found_unix = Unixers\: Couldn't find default web browser.\nAdd the full path to your browser in Preferences." @@ -713,24 +702,20 @@ label.add_sequences = Add Sequences label.new_window = New Window label.split_window = Split Window -label.refresh_available_sources = Refresh Available Sources -label.use_registry = Use Registry -label.add_local_source = Add Local Source label.set_as_default = Set as Default label.show_labels = Show labels action.background_colour = Background Colour... label.associate_nodes_with = Associate Nodes With label.link_name = Link Name label.pdb_file = PDB file label.colour_with_jmol = Colour with Jmol -label.colour_with_chimera = Colour with Chimera +label.let_viewer_manage_structure_colours = Let viewer manage structure colours +label.colour_with_viewer = Colour in structure viewer label.superpose_structures = Superpose Structures error.superposition_failed = Superposition failed: {0} label.insufficient_residues = Not enough aligned residues ({0}) to perform superposition -label.jmol = Jmol -label.chimera = Chimera -label.create_chimera_attributes = Write Jalview features -label.create_chimera_attributes_tip = Set Chimera residue attributes for visible features +label.create_viewer_attributes = Write Jalview features +label.create_viewer_attributes_tip = Set structure residue attributes for Jalview features label.attributes_set = {0} attribute values set on Chimera label.sort_alignment_by_tree = Sort Alignment By Tree label.mark_unlinked_leaves = Mark Unlinked Leaves @@ -774,13 +759,16 @@ label.view_and_change_parameters_before_running_calculation = View and change parameters before running calculation label.view_documentation = View documentation label.select_return_type = Select return type -label.translation_of_params = Translation of {0} +label.translation_of_params = Translation of {0} (Table {1}) label.features_for_params = Features for - {0} label.annotations_for_params = Annotations for - {0} label.generating_features_for_params = Generating features for - {0} label.generating_annotations_for_params = Generating annotations for - {0} label.varna_params = VARNA - {0} label.sequence_feature_settings = Sequence Feature Settings +label.sequence_feature_settings_for = Sequence Feature Settings for {0} +label.sequence_feature_settings_for_view = Sequence Feature Settings for view "{0}" +label.sequence_feature_settings_for_CDS_and_Protein = Sequence Feature Settings for CDS and Protein label.pairwise_aligned_sequences = Pairwise Aligned Sequences label.original_data_for_params = Original Data for {0} label.points_for_params = Points for {0} @@ -856,7 +844,6 @@ label.unable_start_web_service_analysis = Unable to start web service analysis label.job_couldnt_be_started_check_input = The Job couldn't be started. Please check your input, and the Jalview console for any warning messages. label.prompt_each_time = Prompt each time -label.use_source = Use Source label.couldnt_save_project = Couldn't save project label.error_whilst_saving_current_state_to = Error whilst saving current state to {0} label.error_whilst_loading_project_from = Error whilst loading project from {0} @@ -882,22 +869,16 @@ label.save_alignment_to_file = Save Alignment to file label.save_features_to_file = Save Features to File label.save_annotation_to_file = Save Annotation to File -label.no_features_on_alignment = No features found on alignment label.save_pdb_file = Save PDB File label.save_text_to_file = Save Text to File label.save_state = Save State label.restore_state = Restore State label.saving_jalview_project = Saving jalview project {0} -label.loading_jalview_project = Loading jalview project {0} -label.save_vamsas_document_archive = Save Vamsas Document Archive -label.saving_vamsas_doc = Saving VAMSAS Document to {0} label.load_feature_colours = Load Feature Colours label.save_feature_colours = Save Feature Colour Scheme label.select_startup_file = Select startup file label.select_default_browser = Select default web browser label.save_tree_as_newick = Save tree as newick file -label.create_eps_from_tree = Create EPS file from tree -label.create_png_from_tree = Create PNG image from tree label.save_colour_scheme = Save colour scheme label.edit_params_for = Edit parameters for {0} label.choose_filename_for_param_file = Choose a filename for this parameter file @@ -912,7 +893,6 @@ label.select_unselect_visible_regions_from = select and unselected {0} regions from {1} label.visible_region_of = visible region of label.webservice_job_title_on = {0} using {1} on {2} -label.updating_vamsas_session = Updating vamsas session label.loading_file = Loading File: {0} label.edit_params = Edit {0} label.as_percentage = As Percentage @@ -953,29 +933,20 @@ label.cancelled_params = Cancelled {0} error.implementation_error_cannot_show_view_alignment_frame = Implementation error: cannot show a view from another alignment in an AlignFrame. error.implementation_error_dont_know_about_threshold_setting = Implementation error: don't know about threshold setting for current AnnotationColourGradient. -error.eps_generation_not_implemented = EPS Generation not yet implemented -error.png_generation_not_implemented = PNG Generation not yet implemented -error.try_join_vamsas_session_another = Trying to join a vamsas session when another is already connected -error.invalid_vamsas_session_id = Invalid vamsas session id label.groovy_support_failed = Jalview Groovy Support Failed label.couldnt_create_groovy_shell = Couldn't create the groovy Shell. Check the error log for the details of what went wrong. error.unsupported_version_calcIdparam = Unsupported Version for calcIdparam {0} error.implementation_error_cant_reorder_tree = Implementation Error: Can't reorder this tree. Not DefaultMutableTreeNode. -error.invalid_value_for_option = Invalid value {0} for option {1} +error.invalid_value_for_option = Invalid value ''{0}'' for option ''{1}'' error.implementation_error_cannot_import_vamsas_doc = Implementation Error - cannot import existing vamsas document into an existing session, Yet! label.vamsas_doc_couldnt_be_opened_as_new_session = VAMSAS Document could not be opened as a new session - please choose another -error.implementation_error_vamsas_operation_not_init = Impementation error! Vamsas Operations when client not initialised and connected -error.jalview_no_connected_vamsas_session = Jalview not connected to Vamsas session -error.implementation_error_cannot_recover_vamsas_object_mappings = IMPLEMENTATION ERROR: Cannot recover vamsas object mappings - no backup was made error.setstatus_called_non_existent_job_pane = setStatus called for non-existent job pane {0} error.implementation_error_cannot_find_marshaller_for_param_set =Implementation error: Can't find a marshaller for the parameter set error.implementation_error_old_jalview_object_not_bound =IMPLEMENTATION ERROR: old jalview object is not bound ! ({0}) error.implementation_error_vamsas_doc_class_should_bind_to_type = Implementation Error: Vamsas Document Class {0} should bind to a {1} (found a {2}) error.invalid_vamsas_rangetype_cannot_resolve_lists = Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice! -error.implementation_error_maplist_is_null = Implementation error. MapList is null for initMapType. error.implementation_error_cannot_have_null_alignment = Implementation error: Cannot have null alignment property key error.implementation_error_null_fileparse = Implementation error. Null FileParse in copy constructor -error.implementation_error_cannot_map_alignment_sequences = IMPLEMENTATION ERROR: Cannot map an alignment of sequences from different datasets into a single alignment in the vamsas document. error.implementation_error_structure_selection_manager_null = Implementation error. Structure selection manager's context is 'null' exception.ssm_context_is_null = SSM context is null error.idstring_seqstrings_only_one_per_sequence = idstrings and seqstrings contain one string each per sequence @@ -990,7 +961,6 @@ error.implementation_error_msawbjob_called = Implementation error - StartJob(MsaWSJob) called on a WSJobInstance {0} error.implementation_error_cannot_attach_ws_menu_entry = IMPLEMENTATION ERROR: cannot attach WS Menu Entry without service handle reference! error.parameter_migration_not_implemented_yet = Parameter migration not implemented yet -error.implementation_error_cannot_set_jaba_option = Implementation error: cannot set Jaba Option to a value outside its allowed value range! error.implementation_error_valuetype_doesnt_support_jabaws_type = IMPLEMENTATION ERROR: jalview.ws.params.ValueConstrainI.ValueType does not support the JABAWS type : {0} error.cannot_create_jabaws_param_set = Cannot create a JabaWSParamSet from non-JabaWS parameters error.cannot_set_arguments_to_jabaws_param_set = Cannot set arguments to a JabaWSParamSet that are not JabaWS arguments @@ -1012,11 +982,13 @@ error.implementation_error_dbinstance_must_implement_interface = Implmentation Error - getDbInstances must be given a class that implements jalview.ws.seqfetcher.DbSourceProxy (was given{0}) error.implementation_error_must_init_dbsources =Implementation error. Must initialise dbSources label.view_controller_toggled_marked = {0} {1} columns {2} features of type {3} across {4} sequence(s) +label.no_highlighted_regions_marked = No highlighted regions marked label.toggled = Toggled label.marked = Marked label.containing = containing label.not_containing = not containing -label.no_feature_of_type_found = No features of type {0} found. +label.no_feature_of_type_found = No features of type {0} found +label.no_feature_found_selection = No features of type {0} found in selection label.submission_params = Submission {0} label.empty_alignment_job = Empty Alignment Job label.add_new_sbrs_service = Add a new Simple Bioinformatics Rest Service @@ -1025,7 +997,7 @@ label.pca_calculating = Calculating PCA label.select_foreground_colour = Choose foreground colour label.select_colour_for_text = Select Colour for Text -label.adjunst_foreground_text_colour_threshold = Adjust Foreground Text Colour Threshold +label.adjust_foreground_text_colour_threshold = Adjust Foreground Text Colour Threshold label.select_subtree_colour = Select Sub-Tree Colour label.create_new_sequence_features = Create New Sequence Feature(s) label.amend_delete_features = Amend/Delete Features for {0} @@ -1082,9 +1054,6 @@ exception.invocation_target_calling_url = InvocationTargetException while calling openURL: {0} exception.illegal_access_calling_url = IllegalAccessException while calling openURL: {0} exception.interrupted_launching_browser = InterruptedException while launching browser: {0} -exception.das_source_doesnt_support_sequence_command = Source {0} does not support the sequence command. -exception.invalid_das_source = Invalid das source: {0} -exception.ebiembl_retrieval_failed_on = EBI EMBL XML retrieval failed on {0}:{1} exception.no_pdb_records_for_chain = No PDB Records for {0} chain {1} exception.unexpected_handling_rnaml_translation_for_pdb = Unexpected exception when handling RNAML translation of PDB data exception.couldnt_recover_sequence_properties_for_alignment = Couldn't recover sequence properties for alignment @@ -1099,7 +1068,6 @@ exception.jobsubmission_invalid_params_set = Invalid parameter set. Check Jalview implementation exception.notvaliddata_group_contains_less_than_min_seqs = Group contains less than {0} sequences. exception.outofmemory_loading_pdb_file = Out of memory loading PDB File -exception.eps_coudnt_write_output_file = Could not write to the output file: {0} exception.eps_method_not_supported = Method not currently supported by EpsGraphics2D version {0} exception.eps_unable_to_get_inverse_matrix = Unable to get inverse of matrix: {0} warn.job_cannot_be_cancelled_close_window = This job cannot be cancelled.\nJust close the window. @@ -1124,48 +1092,36 @@ status.finished_searching_for_sequences_from = Finished searching for sequences from {0} label.eps_file = EPS file label.png_image = PNG image -status.saving_file = Saving {0} -status.export_complete = {0} Export completed. +status.export_complete = {0} Export completed status.fetching_pdb = Fetching PDB {0} status.refreshing_news = Refreshing news -status.importing_vamsas_session_from = Importing VAMSAS session from {0} status.opening_params = Opening {0} -status.waiting_sequence_database_fetchers_init = Waiting for Sequence Database Fetchers to initialise -status.init_sequence_database_fetchers = Initialising Sequence Database Fetchers status.fetching_sequence_queries_from = Fetching {0} sequence queries from {1} status.finshed_querying = Finished querying status.parsing_results = Parsing results. status.processing = Processing... status.refreshing_web_service_menus = Refreshing Web Service Menus status.collecting_job_results = Collecting job results. -status.fetching_das_sequence_features = Fetching DAS Sequence Features -status.no_das_sources_active = No DAS Sources Active -status.das_feature_fetching_cancelled = DAS Feature Fetching Cancelled -status.das_feature_fetching_complete = DAS Feature Fetching Complete status.fetching_db_refs = Fetching db refs status.loading_cached_pdb_entries = Loading Cached PDB Entries status.searching_for_pdb_structures = Searching for PDB Structures +status.searching_3d_beacons = Searching 3D Beacons +status.no_structures_discovered_from_3d_beacons = No models discovered from 3D Beacons status.opening_file_for = opening file for -status.colouring_chimera = Colouring Chimera +status.colouring_structures = Colouring structures label.font_doesnt_have_letters_defined = Font doesn't have letters defined\nso cannot be used\nwith alignment data label.font_too_small = Font size is too small -label.error_loading_file_params = Error loading file {0} -label.error_loading_jalview_file = Error loading Jalview file warn.out_of_memory_when_action = Out of memory when {0}\!\!\nSee help files for increasing Java Virtual Machine memory. warn.out_of_memory_loading_file = Out of memory loading file {0}\!\!\nSee help files for increasing Java Virtual Machine memory. label.out_of_memory = Out of memory label.invalid_id_column_width = Invalid ID Column width warn.user_defined_width_requirements = The user defined width for the\nannotation and sequence ID columns\nin exported figures must be\nat least 12 pixels wide. -label.couldnt_create_sequence_fetcher = Couldn't create SequenceFetcher -warn.couldnt_create_sequence_fetcher_client = Could not create the sequence fetcher client. Check error logs for details. warn.server_didnt_pass_validation = Service did not pass validation.\nCheck the Jalview Console for more details. warn.url_must_contain = Sequence URL must contain $SEQUENCE_ID$, $DB_ACCESSION$, or a regex warn.urls_not_contacted = URLs that could not be contacted warn.urls_no_jaba = URLs without any JABA Services info.validate_jabaws_server = Validate JabaWS Server ?\n(Look in console output for results) label.test_server = Test Server? -info.you_want_jalview_to_find_uniprot_accessions = Do you want Jalview to find\nUniprot Accession ids for given sequence names? -label.find_uniprot_accession_ids = Find Uniprot Accession Ids label.new_sequence_fetcher = New Sequence Fetcher label.additional_sequence_fetcher = Additional Sequence Fetcher label.select_database_retrieval_source = Select Database Retrieval Source @@ -1184,6 +1140,7 @@ action.choose_annotations = Choose Annotations... label.choose_annotations = Choose Annotations label.find = Find +label.in = in label.invalid_search = Search string invalid error.invalid_regex = Invalid regular expression label.ignore_gaps_consensus = Ignore Gaps In Consensus @@ -1218,7 +1175,6 @@ label.result = result label.results = results label.structure_chooser = Structure Chooser -label.select = Select : label.invert = Invert label.select_pdb_file = Select PDB File info.select_filter_option = Select Filter Option/Manual Entry @@ -1252,14 +1208,10 @@ label.structure_chooser_no_of_structures = Structure Chooser - {0} Found ({1}) info.no_pdb_entry_found_for = No PDB entry found for {0} exception.unable_to_detect_internet_connection = Jalview is unable to detect an internet connection -exception.fts_rest_service_no_longer_available = {0} rest services no longer available! -exception.resource_not_be_found = The requested resource could not be found -exception.fts_server_error = There seems to be an error from the {0} server exception.fts_server_unreachable = Jalview is unable to reach the {0} server. \nPlease ensure that you are connected to the internet and try again. label.nw_mapping = Needleman & Wunsch Alignment label.sifts_mapping = SIFTs Mapping label.mapping_method = Sequence \u27f7 Structure mapping method -status.waiting_for_user_to_select_output_file = Waiting for user to select {0} file status.cancelled_image_export_operation = Cancelled {0} export operation info.error_creating_file = Error creating {0} file exception.outofmemory_loading_mmcif_file = Out of memory loading mmCIF File @@ -1271,8 +1223,6 @@ action.prev_page= << label.next_page_tooltip=Next Page label.prev_page_tooltip=Previous Page -exception.bad_request=Bad request. There is a problem with your input. -exception.service_not_available=Service not available. The server is being updated, try again later. status.launching_3d_structure_viewer = Launching 3D Structure viewer... status.fetching_3d_structures_for_selected_entries = Fetching 3D Structures for selected entries... status.fetching_dbrefs_for_sequences_without_valid_refs = Fetching db refs for {0} sequence(s) without valid db ref required for SIFTS mapping @@ -1288,7 +1238,6 @@ label.SEQUENCE_ID_for_DB_ACCESSION2 = URL links using '$SEQUENCE_ID$' for DB accessions now use '$DB_ACCESSION$'. label.do_not_display_again = Do not display this message again exception.url_cannot_have_duplicate_id = {0} cannot be used as a label for more than one line -label.filter = Filter text: action.customfilter = Custom only action.showall = Show All label.insert = Insert: @@ -1303,7 +1252,6 @@ warn.name_cannot_be_duplicate = User-defined URL names must be unique and cannot be MIRIAM ids label.output_seq_details = Output Sequence Details to list all database references label.urllinks = Links -label.default_cache_size = Default Cache Size action.clear_cached_items = Clear Cached Items label.togglehidden = Show hidden regions label.quality_descr = Alignment Quality based on Blosum62 scores @@ -1342,21 +1290,20 @@ label.filter = Filter label.filters = Filters label.join_conditions = Join conditions with +label.delete_condition = Delete this condition label.score = Score label.colour_by_label = Colour by label label.variable_colour = Variable colour... -label.select_colour = Select colour +label.select_colour_for = Select colour for {0} option.enable_disable_autosearch = When ticked, search is performed automatically option.autosearch = Autosearch label.retrieve_ids = Retrieve IDs label.display_settings_for = Display settings for {0} features -label.simple = Simple label.simple_colour = Simple Colour label.colour_by_text = Colour by text label.graduated_colour = Graduated Colour label.by_text_of = By text of label.by_range_of = By range of -label.filters_tooltip = Click to set or amend filters label.or = Or label.and = And label.sequence_feature_colours = Sequence Feature Colours @@ -1367,6 +1314,89 @@ label.most_polymer_residues = Most Polymer Residues label.cached_structures = Cached Structures label.free_text_search = Free Text Search +label.annotation_name = Annotation Name +label.annotation_description = Annotation Description +label.edit_annotation_name_description = Edit Annotation Name/Description +label.alignment = alignment +label.pca = PCA +label.create_image_of = Create {0} image of {1} +label.click_to_edit = Click to edit, right-click for menu +label.backupfiles_confirm_delete = Confirm delete +label.backupfiles_confirm_delete_old_files = Delete the following older backup files? (see the Backups tab in Preferences for more options) +label.backupfiles_confirm_save_file = Confirm save file +label.backupfiles_confirm_save_file_backupfiles_roll_wrong = Something possibly went wrong with the backups of this file. +label.backupfiles_confirm_save_new_saved_file_ok = The new saved file seems okay. +label.backupfiles_confirm_save_new_saved_file_not_ok = The new saved file might not be okay. +label.continue_operation = Continue operation? +label.backups = Backups +label.backup = Backup +label.backup_files = Backup Files +label.enable_backupfiles = Enable backup files +label.backup_filename_strategy = Backup filename strategy +label.append_to_filename = Append to filename (%n is replaced by the backup number) +label.append_to_filename_tooltip = %n in the text will be replaced by the backup number. The text will appear after the filename. See the summary box above. +label.index_digits = Number of digits to use for the backup number (%n) +label.scheme_examples = Scheme examples +label.increment_index = Increase appended text numbers - newest file has largest number. +label.reverse_roll = "Roll" appended text numbers - newest backup file is always number 1. +label.keep_files = Deleting old backup files +label.keep_all_backup_files = Do not delete old backup files +label.keep_only_this_number_of_backup_files = Keep only this number of most recent backup files +label.autodelete_old_backup_files = Auto-delete old backup files: +label.always_ask = Always ask +label.auto_delete = Automatically delete +label.filename = filename +label.braced_oldest = (oldest) +label.braced_newest = (most recent) +label.configuration = Configuration +label.configure_feature_tooltip = Click to configure variable colour or filters +label.schemes = Schemes +label.customise = Customise +label.custom = Custom +label.default = Default +label.single_file = Single backup +label.keep_all_versions = Keep all versions +label.rolled_backups = Rolled backup files +label.customise_description = Select Customise, make changes, and click on OK to save your own custom scheme +label.custom_description = Your own saved scheme +label.default_description = Keep the last three versions of the file +label.single_file_description = Keep the last version of the file +label.keep_all_versions_description = Keep all previous versions of the file +label.rolled_backups_description = Keep the last nine versions of the file from _bak.1 (newest) to _bak.9 (oldest) +label.cancel_changes_description = Cancel changes made to your last saved Custom scheme +label.no_backup_files = NO BACKUP FILES +label.include_backup_files = Include backup files +label.cancel_changes = Cancel changes +label.warning_confirm_change_reverse = Warning!\nIf you change the increment/decrement of the backup filename number, without changing the suffix or number of digits,\nthis may cause loss of backup files created with the previous backup filename scheme.\nAre you sure you wish to do this? +label.change_increment_decrement = Change increment/decrement? +label.newerdelete_replacement_line = Backup file\n''{0}''\t(modified {2}, size {4})\nis to be deleted and replaced by apparently older file\n''{1}''\t(modified {3}, size {5}). +label.confirm_deletion_or_rename = Confirm deletion of ''{0}'' or rename to ''{1}''? +label.newerdelete_line = Backup file\n''{0}''\t(modified {2}, size {4})\nis to be deleted but is newer than the oldest remaining backup file\n''{1}''\t(modified {3}, size {5}). +label.confirm_deletion = Confirm deletion of ''{0}''? +label.delete = Delete +label.rename = Rename +label.keep = Keep +label.file_info = (modified {0}, size {1}) +label.annotation_name = Annotation Name +label.annotation_description = Annotation Description +label.edit_annotation_name_description = Edit Annotation Name/Description +label.alignment = alignment +label.pca = PCA +label.create_image_of = Create {0} image of {1} +label.click_to_edit = Click to edit, right-click for menu +label.by_annotation_tooltip = Annotation Colour is configured from the main Colour menu +label.show_linked_features = Show {0} features +label.on_top = on top +label.include_linked_features = Include {0} features +label.include_linked_tooltip = Include visible {0} features
converted to local sequence coordinates +label.features_not_shown = {0} feature(s) not shown +label.no_features_to_sort_by = No features to sort by +label.ignore_hidden = Ignore hidden columns +label.ignore_hidden_tooltip = Ignore any characters in hidden columns when matching +label.log_level = Log level +label.log_level_tooltip = Temporarily set the log level for this console. The log level will revert to {0} when this Java console is closed. +label.copy_to_clipboard = Copy to clipboard +label.copy_to_clipboard_tooltip = Copy all of the log text in this console to the system clipboard label.bam_file_options = BAM File Options label.bam_chromosome = Chromosome to load: label.bam_range = Region to load: Index: src/jalview/io/AlignFile.java =================================================================== diff -u -N -r9289ad58228571a63fdf54ef720603a590d58adc -rd4a6a8430fa8d954b0fc5ecdcc6a7bda424224ad --- src/jalview/io/AlignFile.java (.../AlignFile.java) (revision 9289ad58228571a63fdf54ef720603a590d58adc) +++ src/jalview/io/AlignFile.java (.../AlignFile.java) (revision d4a6a8430fa8d954b0fc5ecdcc6a7bda424224ad) @@ -72,9 +72,22 @@ long end; - private boolean parseCalled; + /** + * true if parse() has been called + */ + private boolean parseCalled = false; + private boolean parseImmediately = true; + /** + * @return if doParse() was called at construction time + */ + protected boolean isParseImmediately() + { + return parseImmediately; + } + + /** * Creates a new AlignFile object. */ public AlignFile() @@ -99,7 +112,7 @@ * @param sourceType * What type of file to read from (File, URL, Pasted String) */ - public AlignFile(String dataObject, DataSourceType sourceType) + public AlignFile(Object dataObject, DataSourceType sourceType) throws IOException { this(true, dataObject, sourceType); @@ -117,9 +130,10 @@ * What type of file to read from (File, URL) * @throws IOException */ - public AlignFile(boolean parseImmediately, String dataObject, + public AlignFile(boolean parseImmediately, Object dataObject, DataSourceType sourceType) throws IOException { + // BH allows File or String super(dataObject, sourceType); initData(); if (parseImmediately) @@ -153,6 +167,11 @@ { super(source); initData(); + + // stash flag in case parse needs to know if it has to autoconfigure or was + // configured after construction + this.parseImmediately = parseImmediately; + if (parseImmediately) { doParse(); Index: src/jalview/io/AlignmentFileReaderI.java =================================================================== diff -u -N -r9289ad58228571a63fdf54ef720603a590d58adc -rd4a6a8430fa8d954b0fc5ecdcc6a7bda424224ad --- src/jalview/io/AlignmentFileReaderI.java (.../AlignmentFileReaderI.java) (revision 9289ad58228571a63fdf54ef720603a590d58adc) +++ src/jalview/io/AlignmentFileReaderI.java (.../AlignmentFileReaderI.java) (revision d4a6a8430fa8d954b0fc5ecdcc6a7bda424224ad) @@ -20,6 +20,8 @@ */ package jalview.io; +import jalview.api.AlignExportSettingsI; +import jalview.api.AlignmentViewPanel; import jalview.api.FeatureSettingsModelI; import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceI; Index: src/jalview/io/AppletFormatAdapter.java =================================================================== diff -u -N -r9289ad58228571a63fdf54ef720603a590d58adc -rd4a6a8430fa8d954b0fc5ecdcc6a7bda424224ad --- src/jalview/io/AppletFormatAdapter.java (.../AppletFormatAdapter.java) (revision 9289ad58228571a63fdf54ef720603a590d58adc) +++ src/jalview/io/AppletFormatAdapter.java (.../AppletFormatAdapter.java) (revision d4a6a8430fa8d954b0fc5ecdcc6a7bda424224ad) @@ -20,7 +20,9 @@ */ package jalview.io; -import jalview.api.AlignExportSettingI; +import java.util.Locale; + +import jalview.api.AlignExportSettingsI; import jalview.api.AlignmentViewPanel; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; @@ -30,6 +32,7 @@ import jalview.datamodel.SequenceI; import jalview.ext.jmol.JmolParser; import jalview.structure.StructureImportSettings; +import jalview.util.Platform; import java.io.File; import java.io.IOException; @@ -73,8 +76,10 @@ */ protected String newline = System.getProperty("line.separator"); - private AlignExportSettingI exportSettings; + private AlignExportSettingsI exportSettings; + private File selectedFile; + public static String INVALID_CHARACTERS = "Contains invalid characters"; /** @@ -98,7 +103,7 @@ } public AppletFormatAdapter(AlignmentViewPanel alignPanel, - AlignExportSettingI settings) + AlignExportSettingsI settings) { viewpanel = alignPanel; exportSettings = settings; @@ -147,20 +152,31 @@ public AlignmentI readFile(String file, DataSourceType sourceType, FileFormatI fileFormat) throws IOException { - if (alignFile == null) - { - prepareFileReader(file, sourceType, fileFormat); - } - else - { - alignFile.parse(); - } - return buildAlignmentFromFile(); + return readFile(null, file, sourceType, fileFormat); } - public void prepareFileReader(String file, DataSourceType sourceType, + public AlignmentI readFile(File selectedFile, String file, DataSourceType sourceType, FileFormatI fileFormat) throws IOException { + + if (alignFile == null) + { + prepareFileReader(selectedFile, file, sourceType, fileFormat); + } + else + { + alignFile.parse(); + } + return buildAlignmentFromFile(); + } + public void prepareFileReader(File selectedFile, String file, DataSourceType sourceType, + FileFormatI fileFormat) throws IOException + { + this.selectedFile = selectedFile; + if (selectedFile != null) + { + this.inFile = selectedFile.getPath(); + } this.inFile = file; try { @@ -175,20 +191,23 @@ localSecondaryStruct, serviceSecondaryStruct); if (isParseWithJMOL) { - alignFile = new JmolParser(inFile, sourceType); + // needs a File option + alignFile = new JmolParser(selectedFile == null ? inFile : selectedFile, sourceType); } else { - // todo is MCview parsing obsolete yet? JAL-2120 + // todo is mc_view parsing obsolete yet? JAL-2120 StructureImportSettings.setShowSeqFeatures(true); - alignFile = new MCview.PDBfile(annotFromStructure, + alignFile = new mc_view.PDBfile(annotFromStructure, localSecondaryStruct, serviceSecondaryStruct, inFile, sourceType); } ((StructureFile) alignFile).setDbRefType( FileFormat.PDB.equals(fileFormat) ? Type.PDB : Type.MMCIF); } - else + else if (selectedFile != null) { + alignFile = fileFormat.getReader(new FileParse(selectedFile, sourceType)); + } else { alignFile = fileFormat.getReader(new FileParse(inFile, sourceType)); } @@ -263,7 +282,7 @@ else { StructureImportSettings.setShowSeqFeatures(true); - alignFile = new MCview.PDBfile(annotFromStructure, + alignFile = new mc_view.PDBfile(annotFromStructure, localSecondaryStruct, serviceSecondaryStruct, source); } ((StructureFile) alignFile).setDbRefType(Type.PDB); @@ -419,29 +438,46 @@ return null; } + /** * Determines the protocol (i.e DataSourceType.{FILE|PASTE|URL}) for the input * data + * + * BH 2018 allows File or String, and can return RELATIVE_URL * - * @param data + * @param dataObject File or String * @return the protocol for the input data */ - public static DataSourceType checkProtocol(String data) + public static DataSourceType checkProtocol(Object dataObject) { + if(dataObject instanceof File) + { + return DataSourceType.FILE; + } + + String data = dataObject.toString(); DataSourceType protocol = DataSourceType.PASTE; - String ft = data.toLowerCase().trim(); + String ft = data.toLowerCase(Locale.ROOT).trim(); if (ft.indexOf("http:") == 0 || ft.indexOf("https:") == 0 || ft.indexOf("file:") == 0) { protocol = DataSourceType.URL; } + else if (Platform.isJS()) + { + protocol = DataSourceType.RELATIVE_URL; + } else if (new File(data).exists()) { protocol = DataSourceType.FILE; } return protocol; } + /** + * @param args + * @j2sIgnore + */ public static void main(String[] args) { int i = 0; Index: src/jalview/io/FileFormat.java =================================================================== diff -u -N -r4cc3017f070e0bc1b291d9cfaf572b1c9c5e76d3 -rd4a6a8430fa8d954b0fc5ecdcc6a7bda424224ad --- src/jalview/io/FileFormat.java (.../FileFormat.java) (revision 4cc3017f070e0bc1b291d9cfaf572b1c9c5e76d3) +++ src/jalview/io/FileFormat.java (.../FileFormat.java) (revision d4a6a8430fa8d954b0fc5ecdcc6a7bda424224ad) @@ -20,13 +20,14 @@ */ package jalview.io; +import java.io.IOException; + import jalview.datamodel.AlignmentI; +import jalview.datamodel.DBRefSource; import jalview.datamodel.PDBEntry; import jalview.ext.jmol.JmolParser; import jalview.structure.StructureImportSettings; -import java.io.IOException; - public enum FileFormat implements FileFormatI { Fasta("Fasta", "fa, fasta, mfa, fastq", true, true) @@ -243,6 +244,37 @@ return new PhylipFile(); } }, + GenBank("GenBank Flatfile", "gb", true, false) + { + @Override + public AlignmentFileReaderI getReader(FileParse source) + throws IOException + { + return new GenBankFile(source, "GenBank"); + } + + @Override + public AlignmentFileWriterI getWriter(AlignmentI al) + { + return null; + } + }, + Embl("ENA Flatfile", "txt", true, false) + { + @Override + public AlignmentFileReaderI getReader(FileParse source) + throws IOException + { + // Always assume we import from EMBL for now + return new EmblFlatFile(source, DBRefSource.EMBL); + } + + @Override + public AlignmentFileWriterI getWriter(AlignmentI al) + { + return null; + } + }, Jnet("JnetFile", "", false, false) { @Override @@ -306,7 +338,7 @@ else { StructureImportSettings.setShowSeqFeatures(true); - return new MCview.PDBfile( + return new mc_view.PDBfile( StructureImportSettings.isVisibleChainAnnotation(), StructureImportSettings.isProcessSecondaryStructure(), StructureImportSettings.isExternalSecondaryStructure(), @@ -368,7 +400,7 @@ return false; } }, - Jalview("Jalview", "jar,jvp", true, true) + Jalview("Jalview", "jvp, jar", true, true) { @Override public AlignmentFileReaderI getReader(FileParse source) @@ -392,7 +424,7 @@ @Override public boolean isIdentifiable() { - return false; + return true; } }; @@ -428,8 +460,8 @@ * @param shortName * @param extensions * comma-separated list of file extensions associated with the format - * @param isReadable - * @param isWritable + * @param isReadable - can be recognised by IdentifyFile and imported with the given reader + * @param isWritable - can be exported with the returned writer */ private FileFormat(String shortName, String extensions, boolean isReadable, boolean isWritable) Index: src/jalview/io/FileLoader.java =================================================================== diff -u -N -r0725af253ee4f4e70e232cfdb673f6ccffbdf2df -rd4a6a8430fa8d954b0fc5ecdcc6a7bda424224ad --- src/jalview/io/FileLoader.java (.../FileLoader.java) (revision 0725af253ee4f4e70e232cfdb673f6ccffbdf2df) +++ src/jalview/io/FileLoader.java (.../FileLoader.java) (revision d4a6a8430fa8d954b0fc5ecdcc6a7bda424224ad) @@ -20,6 +20,13 @@ */ package jalview.io; +import java.io.File; +import java.io.IOException; +import java.util.StringTokenizer; +import java.util.Vector; + +import javax.swing.SwingUtilities; + import jalview.api.ComplexAlignFile; import jalview.api.FeatureSettingsModelI; import jalview.api.FeaturesDisplayedI; @@ -34,21 +41,14 @@ import jalview.gui.AlignViewport; import jalview.gui.BamFileOptionsChooser; import jalview.gui.Desktop; -import jalview.gui.Jalview2XML; import jalview.gui.JvOptionPane; import jalview.json.binding.biojson.v1.ColourSchemeMapper; +import jalview.project.Jalview2XML; import jalview.schemes.ColourSchemeI; import jalview.structure.StructureSelectionManager; import jalview.util.MessageManager; import jalview.ws.utils.UrlDownloadClient; -import java.io.File; -import java.io.IOException; -import java.util.StringTokenizer; -import java.util.Vector; - -import javax.swing.SwingUtilities; - public class FileLoader implements Runnable { String file; @@ -72,6 +72,8 @@ boolean raiseGUI = true; + private File selectedFile; + /** * default constructor always raised errors in GUI dialog boxes */ @@ -91,11 +93,15 @@ this.raiseGUI = raiseGUI; } - public void LoadFile(AlignViewport viewport, String file, + public void LoadFile(AlignViewport viewport, Object file, DataSourceType protocol, FileFormatI format) { this.viewport = viewport; - LoadFile(file, protocol, format); + if (file instanceof File) { + this.selectedFile = (File) file; + file = selectedFile.getPath(); + } + LoadFile(file.toString(), protocol, format); } public void LoadFile(String file, DataSourceType protocol, @@ -159,6 +165,24 @@ } /** + * Load alignment from (file, protocol) of type format and wait till loaded + * + * @param file + * @param sourceType + * @param format + * @return alignFrame constructed from file contents + */ + public AlignFrame LoadFileWaitTillLoaded(File file, + DataSourceType sourceType, FileFormatI format) + { + this.selectedFile = file; + this.file = file.getPath(); + this.protocol = sourceType; + this.format = format; + return _LoadFileWaitTillLoaded(); + } + + /** * Load alignment from FileParse source of type format and wait till loaded * * @param source @@ -177,32 +201,21 @@ } /** - * start thread and wait until finished, then return the alignFrame that's - * (hopefully) been read. + * runs the 'run' method (in this thread), then return the alignFrame that's + * (hopefully) been read * * @return */ protected AlignFrame _LoadFileWaitTillLoaded() { - Thread loader = new Thread(this); - loader.start(); + this.run(); - while (loader.isAlive()) - { - try - { - Thread.sleep(500); - } catch (Exception ex) - { - } - } - return alignFrame; } public void updateRecentlyOpened() { - Vector recent = new Vector(); + Vector recent = new Vector<>(); if (protocol == DataSourceType.PASTE) { // do nothing if the file was pasted in as text... there is no filename to @@ -218,7 +231,7 @@ String type = protocol == DataSourceType.FILE ? "RECENT_FILE" : "RECENT_URL"; - String historyItems = jalview.bin.Cache.getProperty(type); + String historyItems = Cache.getProperty(type); StringTokenizer st; @@ -228,7 +241,7 @@ while (st.hasMoreTokens()) { - recent.addElement(st.nextElement().toString().trim()); + recent.addElement(st.nextToken().trim()); } } @@ -273,6 +286,9 @@ format = new IdentifyFile().identify(source, false); // identify stream and rewind rather than close } + else if (selectedFile != null) { + format = new IdentifyFile().identify(selectedFile, protocol); + } else { format = new IdentifyFile().identify(file, protocol); @@ -314,7 +330,7 @@ FormatAdapter fa = new FormatAdapter(); if (source == null) { - fa.prepareFileReader(file, protocol, format); + fa.prepareFileReader(null, file, protocol, format); source = fa.getAlignFile(); } if (!((BamFile) source).parseSuffix()) @@ -355,47 +371,55 @@ "IMPLEMENTATION ERROR: Cannot read consecutive Jalview XML projects from a stream."); // We read the data anyway - it might make sense. } - alignFrame = new Jalview2XML(raiseGUI).loadJalviewAlign(file); + // BH 2018 switch to File object here instead of filename + alignFrame = new Jalview2XML(raiseGUI).loadJalviewAlign(selectedFile == null ? file : selectedFile); } else { String error = AppletFormatAdapter.getSupportedFormats(); try { - if (al == null) + if (source != null) { - if (source != null) + // read from the provided source + al = new FormatAdapter().readFromFile(source, format); + } + else + { + + // open a new source and read from it + FormatAdapter fa = new FormatAdapter(); + boolean downloadStructureFile = format.isStructureFile() + && protocol.equals(DataSourceType.URL); + if (downloadStructureFile) { - // read from the provided source - al = new FormatAdapter().readFromFile(source, format); + String structExt = format.getExtensions().split(",")[0]; + String urlLeafName = file.substring( + file.lastIndexOf( + System.getProperty("file.separator")), + file.lastIndexOf(".")); + String tempStructureFileStr = createNamedJvTempFile( + urlLeafName, structExt); + + // BH - switching to File object here so as to hold + // ._bytes array directly + File tempFile = new File(tempStructureFileStr); + UrlDownloadClient.download(file, tempFile); + + al = fa.readFile(tempFile, DataSourceType.FILE, + format); + source = fa.getAlignFile(); } else { - - // open a new source and read from it - FormatAdapter fa = new FormatAdapter(); - boolean downloadStructureFile = format.isStructureFile() - && protocol.equals(DataSourceType.URL); - if (downloadStructureFile) - { - String structExt = format.getExtensions().split(",")[0]; - String urlLeafName = file.substring( - file.lastIndexOf( - System.getProperty("file.separator")), - file.lastIndexOf(".")); - String tempStructureFileStr = createNamedJvTempFile( - urlLeafName, structExt); - UrlDownloadClient.download(file, tempStructureFileStr); - al = fa.readFile(tempStructureFileStr, DataSourceType.FILE, - format); - source = fa.getAlignFile(); - } - else - { + if (selectedFile == null) { al = fa.readFile(file, protocol, format); - source = fa.getAlignFile(); // keep reference for later if - // necessary. - } + + } else { + al = fa.readFile(selectedFile, protocol, format); + } + source = fa.getAlignFile(); // keep reference for later if + // necessary. } } } catch (java.io.IOException ex) @@ -429,12 +453,9 @@ .getFeatureColourScheme(); if (viewport != null) { - if (proxyColourScheme != null) - { - viewport.applyFeaturesStyle(proxyColourScheme); - } // append to existing alignment viewport.addAlignment(al, title); + viewport.applyFeaturesStyle(proxyColourScheme); } else { @@ -475,13 +496,14 @@ if (!(protocol == DataSourceType.PASTE)) { alignFrame.setFileName(file, format); + alignFrame.setFileObject(selectedFile); // BH 2018 SwingJS } if (proxyColourScheme != null) { alignFrame.getViewport() .applyFeaturesStyle(proxyColourScheme); } - alignFrame.statusBar.setText(MessageManager.formatMessage( + alignFrame.setStatus(MessageManager.formatMessage( "label.successfully_loaded_file", new String[] { title })); Index: src/jalview/io/FileParse.java =================================================================== diff -u -N -r0725af253ee4f4e70e232cfdb673f6ccffbdf2df -rd4a6a8430fa8d954b0fc5ecdcc6a7bda424224ad --- src/jalview/io/FileParse.java (.../FileParse.java) (revision 0725af253ee4f4e70e232cfdb673f6ccffbdf2df) +++ src/jalview/io/FileParse.java (.../FileParse.java) (revision d4a6a8430fa8d954b0fc5ecdcc6a7bda424224ad) @@ -20,13 +20,9 @@ */ package jalview.io; -import jalview.api.AlignExportSettingI; -import jalview.api.AlignViewportI; -import jalview.api.AlignmentViewPanel; -import jalview.api.FeatureSettingsModelI; -import jalview.util.MessageManager; - +import java.io.BufferedInputStream; import java.io.BufferedReader; +import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileReader; @@ -35,23 +31,44 @@ import java.io.InputStreamReader; import java.io.Reader; import java.io.StringReader; +import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; +import java.net.URLConnection; import java.util.zip.GZIPInputStream; +import jalview.api.AlignExportSettingsI; +import jalview.api.AlignViewportI; +import jalview.api.AlignmentViewPanel; +import jalview.api.FeatureSettingsModelI; +import jalview.bin.Cache; +import jalview.util.MessageManager; +import jalview.util.Platform; + /** * implements a random access wrapper around a particular datasource, for * passing to identifyFile and AlignFile objects. */ public class FileParse { + protected static final String SPACE = " "; + + protected static final String TAB = "\t"; + /** * text specifying source of data. usually filename or url. */ private String dataName = "unknown source"; public File inFile = null; + private byte[] bytes; // from JavaScript + + public byte[] getBytes() + { + return bytes; + } + /** * a viewport associated with the current file operation. May be null. May * move to different object. @@ -61,7 +78,7 @@ /** * specific settings for exporting data from the current context */ - private AlignExportSettingI exportSettings; + private AlignExportSettingsI exportSettings; /** * sequence counter for FileParse object created from same data source @@ -178,31 +195,94 @@ } if (!error) { - if (fileStr.toLowerCase().endsWith(".gz")) + try { - try - { - dataIn = tryAsGzipSource(new FileInputStream(fileStr)); - dataName = fileStr; - return error; - } catch (Exception x) - { - warningMessage = "Failed to resolve as a GZ stream (" - + x.getMessage() + ")"; - // x.printStackTrace(); - } - ; + dataIn = checkForGzipStream(new FileInputStream(fileStr)); + dataName = fileStr; + } catch (Exception x) + { + warningMessage = "Failed to resolve " + fileStr + + " as a data source. (" + x.getMessage() + ")"; + // x.printStackTrace(); + error = true; } - - dataIn = new BufferedReader(new FileReader(fileStr)); - dataName = fileStr; + ; } return error; } - private BufferedReader tryAsGzipSource(InputStream inputStream) + /** + * Recognise the 2-byte magic header for gzip streams + * + * https://recalll.co/ask/v/topic/java-How-to-check-if-InputStream-is-Gzipped/555aadd62bd27354438b90f6 + * + * @param bytes + * - at least two bytes + * @return + * @throws IOException + */ + public static boolean isGzipStream(InputStream input) throws IOException + { + if (!input.markSupported()) + { + Cache.log.error( + "FileParse.izGzipStream: input stream must support mark/reset"); + return false; + } + input.mark(4); + + // get first 2 bytes or return false + byte[] bytes = new byte[2]; + int read = input.read(bytes); + input.reset(); + if (read != bytes.length) + { + return false; + } + + int header = (bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00); + return (GZIPInputStream.GZIP_MAGIC == header); + } + + /** + * Returns a Reader for the given input after wrapping it in a buffered input + * stream, and then checking if it needs to be wrapped by a GZipInputStream + * + * @param input + * @return + */ + private BufferedReader checkForGzipStream(InputStream input) throws Exception { + // NB: stackoverflow + // https://stackoverflow.com/questions/4818468/how-to-check-if-inputstream-is-gzipped + // could use a PushBackInputStream rather than a BufferedInputStream + if (!input.markSupported()) + { + input = new BufferedInputStream(input, 16); + } + if (isGzipStream(input)) + { + return getGzipReader(input); + } + // return a buffered reader for the stream. + InputStreamReader isReader = new InputStreamReader(input); + BufferedReader toReadFrom = new BufferedReader(isReader); + return toReadFrom; + } + + /** + * Returns a {@code BufferedReader} which wraps the input stream with a + * GZIPInputStream. Throws a {@code ZipException} if a GZIP format error + * occurs or the compression method used is unsupported. + * + * @param inputStream + * @return + * @throws Exception + */ + private BufferedReader getGzipReader(InputStream inputStream) + throws Exception + { BufferedReader inData = new BufferedReader( new InputStreamReader(new GZIPInputStream(inputStream))); inData.mark(2048); @@ -211,44 +291,79 @@ return inData; } - private boolean checkURLSource(String fileStr) + /** + * Tries to read from the given URL. If successful, saves a reader to the + * response in field {@code dataIn}, otherwise (on exception, or HTTP response + * status not 200), throws an exception. + *

+ * If the response status includes + * + *

+   * Content-Type : application/x-gzip
+   * 
+ * + * then tries to read as gzipped content. + * + * @param urlStr + * @throws IOException + * @throws MalformedURLException + */ + private void checkURLSource(String urlStr) throws IOException, MalformedURLException { errormessage = "URL NOT FOUND"; - URL url = new URL(fileStr); - // - // GZIPInputStream code borrowed from Aquaria (soon to be open sourced) via - // Kenny Sabir - Exception e = null; - if (fileStr.toLowerCase().endsWith(".gz")) + URL url = new URL(urlStr); + URLConnection _conn = url.openConnection(); + if (_conn instanceof HttpURLConnection) { + HttpURLConnection conn = (HttpURLConnection) _conn; + int rc = conn.getResponseCode(); + if (rc != HttpURLConnection.HTTP_OK) + { + throw new IOException( + "Response status from " + urlStr + " was " + rc); + } + } + else + { try { - InputStream inputStream = url.openStream(); - dataIn = tryAsGzipSource(inputStream); - dataName = fileStr; - return false; + dataIn = checkForGzipStream(_conn.getInputStream()); + dataName = urlStr; + } catch (IOException ex) + { + throw new IOException("Failed to handle non-HTTP URI stream", ex); } catch (Exception ex) { - e = ex; + throw new IOException( + "Failed to determine type of input stream for given URI", + ex); } + return; } - - try + String encoding = _conn.getContentEncoding(); + String contentType = _conn.getContentType(); + boolean isgzipped = "application/x-gzip".equalsIgnoreCase(contentType) + || "gzip".equals(encoding); + Exception e = null; + InputStream inputStream = _conn.getInputStream(); + if (isgzipped) { - dataIn = new BufferedReader(new InputStreamReader(url.openStream())); - } catch (IOException q) - { - if (e != null) + try { + dataIn = getGzipReader(inputStream); + dataName = urlStr; + } catch (Exception e1) + { throw new IOException(MessageManager .getString("exception.failed_to_resolve_gzip_stream"), e); } - throw q; + return; } - // record URL as name of datasource. - dataName = fileStr; - return false; + + dataIn = new BufferedReader(new InputStreamReader(inputStream)); + dataName = urlStr; + return; } /** @@ -299,23 +414,46 @@ * Create a datasource for input to Jalview. See AppletFormatAdapter for the * types of sources that are handled. * - * @param fileStr - * - datasource locator/content + * @param file + * - datasource locator/content as File or String * @param sourceType * - protocol of source * @throws MalformedURLException * @throws IOException */ - public FileParse(String fileStr, DataSourceType sourceType) + public FileParse(Object file, DataSourceType sourceType) throws MalformedURLException, IOException { - this.dataSourceType = sourceType; + if (file instanceof File) + { + parse((File) file, ((File) file).getPath(), sourceType, true); + } + else + { + parse(null, file.toString(), sourceType, false); + } + } + + private void parse(File file, String fileStr, DataSourceType sourceType, + boolean isFileObject) throws IOException + { + bytes = Platform.getFileBytes(file); + dataSourceType = sourceType; error = false; if (sourceType == DataSourceType.FILE) { - if (checkFileSource(fileStr)) + + if (bytes != null) { + // this will be from JavaScript + inFile = file; + dataIn = new BufferedReader( + new InputStreamReader(new ByteArrayInputStream(bytes))); + dataName = fileStr; + } + else if (checkFileSource(fileStr)) + { String suffixLess = extractSuffix(fileStr); if (suffixLess != null) { @@ -335,6 +473,15 @@ } } } + else if (sourceType == DataSourceType.RELATIVE_URL) + { + // BH 2018 hack for no support for access-origin + bytes = Platform.getFileAsBytes(fileStr); + dataIn = new BufferedReader( + new InputStreamReader(new ByteArrayInputStream(bytes))); + dataName = fileStr; + + } else if (sourceType == DataSourceType.URL) { try @@ -382,8 +529,7 @@ else if (sourceType == DataSourceType.CLASSLOADER) { errormessage = "RESOURCE CANNOT BE LOCATED"; - java.io.InputStream is = getClass() - .getResourceAsStream("/" + fileStr); + InputStream is = getClass().getResourceAsStream("/" + fileStr); if (is == null) { String suffixLess = extractSuffix(fileStr); @@ -394,7 +540,7 @@ } if (is != null) { - dataIn = new BufferedReader(new java.io.InputStreamReader(is)); + dataIn = new BufferedReader(new InputStreamReader(is)); dataName = fileStr; } else @@ -581,7 +727,7 @@ /** * @return the currently configured exportSettings for writing data. */ - public AlignExportSettingI getExportSettings() + public AlignExportSettingsI getExportSettings() { return exportSettings; } @@ -592,7 +738,7 @@ * @param exportSettings * the exportSettings to set */ - public void setExportSettings(AlignExportSettingI exportSettings) + public void setExportSettings(AlignExportSettingsI exportSettings) { this.exportSettings = exportSettings; } @@ -627,4 +773,61 @@ { return dataSourceType; } + + /** + * Returns a buffered reader for the input object. Returns null, or throws + * IOException, on failure. + * + * @param file + * a File, or a String which is a name of a file + * @param sourceType + * @return + * @throws IOException + */ + public BufferedReader getBufferedReader(Object file, + DataSourceType sourceType) throws IOException + { + BufferedReader in = null; + byte[] bytes; + + switch (sourceType) + { + case FILE: + if (file instanceof String) + { + return new BufferedReader(new FileReader((String) file)); + } + bytes = Platform.getFileBytes((File) file); + if (bytes != null) + { + return new BufferedReader( + new InputStreamReader(new ByteArrayInputStream(bytes))); + } + return new BufferedReader(new FileReader((File) file)); + case URL: + URL url = new URL(file.toString()); + in = new BufferedReader(new InputStreamReader(url.openStream())); + break; + case RELATIVE_URL: // JalviewJS only + bytes = Platform.getFileAsBytes(file.toString()); + if (bytes != null) + { + in = new BufferedReader( + new InputStreamReader(new ByteArrayInputStream(bytes))); + } + break; + case PASTE: + in = new BufferedReader(new StringReader(file.toString())); + break; + case CLASSLOADER: + InputStream is = getClass().getResourceAsStream("/" + file); + if (is != null) + { + in = new BufferedReader(new InputStreamReader(is)); + } + break; + } + + return in; + } } Index: src/jalview/io/FormatAdapter.java =================================================================== diff -u -N -r2e9e0527943d0c42a6059ebbb8e7e69346c38206 -rd4a6a8430fa8d954b0fc5ecdcc6a7bda424224ad --- src/jalview/io/FormatAdapter.java (.../FormatAdapter.java) (revision 2e9e0527943d0c42a6059ebbb8e7e69346c38206) +++ src/jalview/io/FormatAdapter.java (.../FormatAdapter.java) (revision d4a6a8430fa8d954b0fc5ecdcc6a7bda424224ad) @@ -20,7 +20,9 @@ */ package jalview.io; -import jalview.api.AlignExportSettingI; +import java.util.Locale; + +import jalview.api.AlignExportSettingsI; import jalview.api.AlignmentViewPanel; import jalview.bin.Cache; import jalview.datamodel.Alignment; @@ -32,6 +34,7 @@ import jalview.datamodel.SequenceI; import jalview.util.Comparison; +import java.io.File; import java.io.IOException; /** @@ -55,7 +58,7 @@ } public FormatAdapter(AlignmentViewPanel alignPanel, - AlignExportSettingI settings) + AlignExportSettingsI settings) { super(alignPanel, settings); } @@ -161,7 +164,7 @@ public boolean getCacheSuffixDefault(FileFormatI format) { - return Cache.getDefault(format.getName().toUpperCase() + "_JVSUFFIX", + return Cache.getDefault(format.getName().toUpperCase(Locale.ROOT) + "_JVSUFFIX", true); } @@ -235,6 +238,13 @@ return al; } + public AlignmentI readFile(File file, DataSourceType sourceType, + FileFormatI fileFormat) throws IOException + { + AlignmentI al = super.readFile(file, null, sourceType, fileFormat); + return al; + } + @Override public AlignmentI readFromFile(FileParse source, FileFormatI format) throws IOException Index: src/jalview/io/IdentifyFile.java =================================================================== diff -u -N -r0725af253ee4f4e70e232cfdb673f6ccffbdf2df -rd4a6a8430fa8d954b0fc5ecdcc6a7bda424224ad --- src/jalview/io/IdentifyFile.java (.../IdentifyFile.java) (revision 0725af253ee4f4e70e232cfdb673f6ccffbdf2df) +++ src/jalview/io/IdentifyFile.java (.../IdentifyFile.java) (revision d4a6a8430fa8d954b0fc5ecdcc6a7bda424224ad) @@ -20,6 +20,9 @@ */ package jalview.io; +import java.util.Locale; + +import java.io.File; import java.io.IOException; /** @@ -30,6 +33,40 @@ */ public class IdentifyFile { + + public FileFormatI identify(Object file, DataSourceType protocol) throws FileFormatException + { + // BH 2018 + return (file instanceof File ? identify((File) file, protocol) : identify((String) file, protocol)); + + } + + public FileFormatI identify(File file, DataSourceType sourceType) + throws FileFormatException + { + // BH 2018 + String emessage = "UNIDENTIFIED FILE PARSING ERROR"; + FileParse parser = null; + try + { + parser = new FileParse(file, sourceType); + if (parser.isValid()) + { + return identify(parser); + } + } catch (Exception e) + { + System.err.println("Error whilst identifying " + file); + e.printStackTrace(System.err); + emessage = e.getMessage(); + } + if (parser != null) + { + throw new FileFormatException(parser.errormessage); + } + throw new FileFormatException(emessage); + } + /** * Identify a datasource's file content. * @@ -55,7 +92,7 @@ } } catch (Exception e) { - System.err.println("Error whilst identifying"); + System.err.println("Error whilst identifying " + file); e.printStackTrace(System.err); emessage = e.getMessage(); } @@ -131,10 +168,10 @@ { String fileStr = source.inFile == null ? source.getDataName() : source.inFile.getName(); - // possibly a Jalview archive. - if (fileStr.lastIndexOf(".jar") > -1 - || fileStr.lastIndexOf(".zip") > -1) + if (fileStr.contains(".jar") + || fileStr.contains(".zip") || fileStr.contains(".jvp")) { + // possibly a Jalview archive (but check further) reply = FileFormat.Jalview; // TODO shouldn't there be a break here? } @@ -146,17 +183,30 @@ } if (!lineswereskipped && data.startsWith("PK")) { - reply = FileFormat.Jalview; // archive. + reply = FileFormat.Jalview; // archive break; } } - data = data.toUpperCase(); + data = data.toUpperCase(Locale.ROOT); if (data.startsWith(ScoreMatrixFile.SCOREMATRIX)) { reply = FileFormat.ScoreMatrix; break; } + if (data.startsWith("LOCUS")) + { + reply = FileFormat.GenBank; + break; + } + if (data.startsWith("ID ")) + { + if (data.substring(2).trim().split(";").length == 7) + { + reply = FileFormat.Embl; + break; + } + } if (data.startsWith("H ") && !aaIndexHeaderRead) { aaIndexHeaderRead = true; @@ -291,7 +341,7 @@ if ((lessThan > -1)) // possible Markup Language data i.e HTML, // RNAML, XML { - String upper = data.toUpperCase(); + String upper = data.toUpperCase(Locale.ROOT); if (upper.substring(lessThan).startsWith(" [ ...]"); } } + + } Index: utils/checkstyle/import-control.xml =================================================================== diff -u -N -r18dbee572ff61918cb5939f5f89f14d09e7a5f3f -rd4a6a8430fa8d954b0fc5ecdcc6a7bda424224ad --- utils/checkstyle/import-control.xml (.../import-control.xml) (revision 18dbee572ff61918cb5939f5f89f14d09e7a5f3f) +++ utils/checkstyle/import-control.xml (.../import-control.xml) (revision d4a6a8430fa8d954b0fc5ecdcc6a7bda424224ad) @@ -95,6 +95,7 @@ + @@ -117,7 +118,13 @@ +<<<<<<< HEAD + + + +======= +>>>>>>> origin/features/JAL-2909_bamImport2_11