From 3e752ec96dd2af9aa24b90ff78783d03268082d8 Mon Sep 17 00:00:00 2001 From: David Doty Date: Wed, 6 Sep 2023 17:39:58 -0700 Subject: [PATCH 1/8] bumped version --- lib/src/constants.dart | 125 +++++++++++++++++++++-------------------- 1 file changed, 63 insertions(+), 62 deletions(-) diff --git a/lib/src/constants.dart b/lib/src/constants.dart index eb7e95153..69fea5f9a 100644 --- a/lib/src/constants.dart +++ b/lib/src/constants.dart @@ -8,11 +8,12 @@ import 'state/grid.dart'; // WARNING: Do not modify line below, except for the version string // (and also add new version string to scadnano_versions_to_link). -const String CURRENT_VERSION = "0.19.0"; +const String CURRENT_VERSION = "0.19.1"; const String INITIAL_VERSION = "0.1.0"; // scadnano versions that we deploy so that older versions can be used. final scadnano_older_versions_to_link = [ + "0.19.0", "0.18.10", "0.17.14", // "0.17.13", @@ -75,7 +76,7 @@ const RIGHT_CLICK_BUTTON = 2; const KEY_CODE_SHOW_POTENTIAL_HELIX = KeyCode.H; const KEY_CODE_MOUSEOVER_HELIX_VIEW_INFO = KeyCode.W; final KEY_CODE_COMMAND_MAC = - browser.isFirefox ? 224 : 91; // Meta/Command: https://tosbourn.com/cmd-osx-key-code/ +browser.isFirefox ? 224 : 91; // Meta/Command: https://tosbourn.com/cmd-osx-key-code/ final KEY_CODE_TOGGLE_SELECT_MAC = KEY_CODE_COMMAND_MAC; const KEY_CODE_SELECT = KeyCode.SHIFT; const KEY_CODE_TOGGLE_SELECT = KeyCode.CTRL; @@ -214,18 +215,18 @@ const design_modifications_3p_key = 'modifications_3p_in_design'; const design_modifications_int_key = 'modifications_int_in_design'; const groups_key = 'groups'; final design_keys = [ - version_key, - grid_key, - helices_key, - helices_view_order_key, - potential_helices_key, - strands_key, - design_modifications_key, - design_modifications_5p_key, - design_modifications_3p_key, - design_modifications_int_key, - groups_key, - ] + + version_key, + grid_key, + helices_key, + helices_view_order_key, + potential_helices_key, + strands_key, + design_modifications_key, + design_modifications_5p_key, + design_modifications_3p_key, + design_modifications_int_key, + groups_key, +] + legacy_geometry_keys; // Geometry keys @@ -237,12 +238,12 @@ const minor_groove_angle_key = 'minor_groove_angle'; const legacy_minor_groove_angle_keys = ['groove_angle']; const inter_helix_gap_key = 'inter_helix_gap'; final geometry_keys = [ - rise_per_base_pair_key, - helix_radius_key, - bases_per_turn_key, - minor_groove_angle_key, - inter_helix_gap_key, - ] + + rise_per_base_pair_key, + helix_radius_key, + bases_per_turn_key, + minor_groove_angle_key, + inter_helix_gap_key, +] + legacy_minor_groove_angle_keys + legacy_rise_per_base_pair_keys; @@ -263,21 +264,21 @@ const major_tick_start_key = 'major_tick_start'; const major_tick_periodic_distances_key = 'major_tick_periodic_distances'; const group_key = 'group'; final helix_keys = [ - idx_on_helix_key, - max_offset_key, - min_offset_key, - roll_key, - pitch_key, - yaw_key, - grid_position_key, - svg_position_key, - position_key, - major_ticks_key, - major_tick_distance_key, - major_tick_start_key, - major_tick_periodic_distances_key, - group_key, - ] + + idx_on_helix_key, + max_offset_key, + min_offset_key, + roll_key, + pitch_key, + yaw_key, + grid_position_key, + svg_position_key, + position_key, + major_ticks_key, + major_tick_distance_key, + major_tick_start_key, + major_tick_periodic_distances_key, + group_key, +] + legacy_position_keys; // Cannot have List concatenation in const expressions. // Seems like it won't be fixed soon (related issue): @@ -305,17 +306,17 @@ const modification_5p_key = '5prime_modification'; const modification_3p_key = '3prime_modification'; const modifications_int_key = 'internal_modifications'; final strand_keys = [ - color_key, - dna_sequence_key, - vendor_fields_key, - is_scaffold_key, - substrands_key, - modification_5p_key, - modification_3p_key, - modifications_int_key, - label_key, - name_key, - ] + + color_key, + dna_sequence_key, + vendor_fields_key, + is_scaffold_key, + substrands_key, + modification_5p_key, + modification_3p_key, + modifications_int_key, + label_key, + name_key, +] + legacy_dna_sequence_keys + legacy_vendor_fields_keys + legacy_substrands_keys; @@ -328,12 +329,12 @@ const legacy_mod_vendor_code_keys = ['idt_text']; const mod_allowed_bases_key = 'allowed_bases'; const mod_connector_length_key = 'connector_length'; final modification_keys = [ - mod_location_key, - mod_display_text_key, - mod_vendor_code_key, - mod_allowed_bases_key, - mod_connector_length_key, - ] + + mod_location_key, + mod_display_text_key, + mod_vendor_code_key, + mod_allowed_bases_key, + mod_connector_length_key, +] + legacy_mod_vendor_code_keys; // VendorFields keys @@ -359,16 +360,16 @@ const end_key = 'end'; const deletions_key = 'deletions'; const insertions_key = 'insertions'; final domain_keys = [ - helix_idx_key, - forward_key, - start_key, - end_key, - deletions_key, - insertions_key, - label_key, - name_key, - color_key, - ] + + helix_idx_key, + forward_key, + start_key, + end_key, + deletions_key, + insertions_key, + label_key, + name_key, + color_key, +] + legacy_forward_keys; // Loopout keys From 7395f7f99512494f9b41dc0df4f2756dc30513a3 Mon Sep 17 00:00:00 2001 From: David Doty Date: Thu, 7 Sep 2023 16:20:54 -0700 Subject: [PATCH 2/8] changed "Select all with same..." trait named "IDT fields" to "Vendor fields" --- lib/src/state/selectable.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/state/selectable.dart b/lib/src/state/selectable.dart index ce47fe6e1..66182b373 100644 --- a/lib/src/state/selectable.dart +++ b/lib/src/state/selectable.dart @@ -571,7 +571,7 @@ class SelectableTrait extends EnumClass { static const SelectableTrait modification_3p = _$modification_3p; static const SelectableTrait modification_int = _$modification_int; static const SelectableTrait dna_sequence = _$dna_sequence; - static const SelectableTrait idt = _$idt; + static const SelectableTrait vendor_fields = _$vendor_fields; static const SelectableTrait circular = _$circular; static const SelectableTrait helices = _$helices; @@ -588,7 +588,7 @@ class SelectableTrait extends EnumClass { if (this == modification_3p) return "3' modification"; if (this == modification_int) return "internal modification"; if (this == dna_sequence) return 'DNA sequence'; - if (this == idt) return 'IDT fields'; + if (this == vendor_fields) return 'vendor fields'; if (this == circular) return 'circular'; if (this == helices) return 'helices'; throw AssertionError('unrecognized trait ${this}'); @@ -602,7 +602,7 @@ class SelectableTrait extends EnumClass { if (this == modification_3p) return strand.modification_3p; if (this == modification_int) return strand.modifications_int; if (this == dna_sequence) return strand.dna_sequence; - if (this == idt) return strand.vendor_fields; + if (this == vendor_fields) return strand.vendor_fields; if (this == circular) return strand.circular; if (this == helices) return [for (var domain in strand.domains) domain.helix]; throw AssertionError('unrecognized trait ${this}'); From 21b72871056d3be68b5717d2d5dfdb12d6fb5e9a Mon Sep 17 00:00:00 2001 From: Abhishek Gokhale Date: Wed, 20 Sep 2023 21:07:23 -0700 Subject: [PATCH 3/8] fixes #904 large design should not hide strands on hover --- lib/src/middleware/edit_select_mode_change.dart | 4 +++- lib/src/view/svg_filters.dart | 11 ++++++++++- web/scadnano-styles.css | 3 ++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/src/middleware/edit_select_mode_change.dart b/lib/src/middleware/edit_select_mode_change.dart index 804f190c9..062fe3267 100644 --- a/lib/src/middleware/edit_select_mode_change.dart +++ b/lib/src/middleware/edit_select_mode_change.dart @@ -17,7 +17,9 @@ const selectable_css_style_non_domain_or_end = { }; const selectable_css_style_domain = { - 'filter': 'url("#shadow")', + 'stroke': 'hotpink', + 'stroke-width': '5pt', + // 'filter': 'url("#shadow")', }; const selectable_css_style_end = { diff --git a/lib/src/view/svg_filters.dart b/lib/src/view/svg_filters.dart index 5ce74813f..53300f73e 100644 --- a/lib/src/view/svg_filters.dart +++ b/lib/src/view/svg_filters.dart @@ -33,7 +33,16 @@ add_shadow_filter(svg.SvgSvgElement elt) { 'y': '-100%', 'width': '300%', 'height': '300%', - 'filterUnits': 'userSpaceOnUse', + // 'filterUnits': 'userSpaceOnUse', + + // The above line has been commented because use of this line caused the strands outside the width x height area to disappear on 'hover'. + // Reverting this change and the changes mentioned below from an old PR #480 (Fixes #20, add shadow filter for domains). + // selectable_css_style_domain has been changed in src/middleware/edit_select_mode_change.dart file + // web/scadnano-styles.css has been changed + // .selected ----> .selected:not(.domain-line) + + // However, after making the above mentioned changes, the old issue of domains being highlighted with hotpink on 'hover' instead of shadow comes back. This happens because of issues in SVG Filters that cannot apply the shadow filter to a straight line. Hence, the hotpink substitute is used. + // Because of this, hovering of doamins is slightly different in appearance (hotpink) than the other selectable elements (shadow). }; // not sure why there's no setter provided for this // filter_element.setAttribute('filterUnits', 'userSpaceOnUse'); diff --git a/web/scadnano-styles.css b/web/scadnano-styles.css index 4bb15a8d4..ee21607cd 100644 --- a/web/scadnano-styles.css +++ b/web/scadnano-styles.css @@ -668,7 +668,8 @@ label + select { fill: lightgray; } -.selected { +/* .selected { */ +.selected:not(.domain-line) { filter: url("#shadow"); } From 7da7a684e9588652e5919ddd692123f3b532dda1 Mon Sep 17 00:00:00 2001 From: Abhishek Gokhale Date: Wed, 20 Sep 2023 21:10:39 -0700 Subject: [PATCH 4/8] Formatting changes --- lib/src/constants.dart | 122 ++++++++++++++++++++--------------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/lib/src/constants.dart b/lib/src/constants.dart index 69fea5f9a..b9e5426eb 100644 --- a/lib/src/constants.dart +++ b/lib/src/constants.dart @@ -76,7 +76,7 @@ const RIGHT_CLICK_BUTTON = 2; const KEY_CODE_SHOW_POTENTIAL_HELIX = KeyCode.H; const KEY_CODE_MOUSEOVER_HELIX_VIEW_INFO = KeyCode.W; final KEY_CODE_COMMAND_MAC = -browser.isFirefox ? 224 : 91; // Meta/Command: https://tosbourn.com/cmd-osx-key-code/ + browser.isFirefox ? 224 : 91; // Meta/Command: https://tosbourn.com/cmd-osx-key-code/ final KEY_CODE_TOGGLE_SELECT_MAC = KEY_CODE_COMMAND_MAC; const KEY_CODE_SELECT = KeyCode.SHIFT; const KEY_CODE_TOGGLE_SELECT = KeyCode.CTRL; @@ -215,18 +215,18 @@ const design_modifications_3p_key = 'modifications_3p_in_design'; const design_modifications_int_key = 'modifications_int_in_design'; const groups_key = 'groups'; final design_keys = [ - version_key, - grid_key, - helices_key, - helices_view_order_key, - potential_helices_key, - strands_key, - design_modifications_key, - design_modifications_5p_key, - design_modifications_3p_key, - design_modifications_int_key, - groups_key, -] + + version_key, + grid_key, + helices_key, + helices_view_order_key, + potential_helices_key, + strands_key, + design_modifications_key, + design_modifications_5p_key, + design_modifications_3p_key, + design_modifications_int_key, + groups_key, + ] + legacy_geometry_keys; // Geometry keys @@ -238,12 +238,12 @@ const minor_groove_angle_key = 'minor_groove_angle'; const legacy_minor_groove_angle_keys = ['groove_angle']; const inter_helix_gap_key = 'inter_helix_gap'; final geometry_keys = [ - rise_per_base_pair_key, - helix_radius_key, - bases_per_turn_key, - minor_groove_angle_key, - inter_helix_gap_key, -] + + rise_per_base_pair_key, + helix_radius_key, + bases_per_turn_key, + minor_groove_angle_key, + inter_helix_gap_key, + ] + legacy_minor_groove_angle_keys + legacy_rise_per_base_pair_keys; @@ -264,21 +264,21 @@ const major_tick_start_key = 'major_tick_start'; const major_tick_periodic_distances_key = 'major_tick_periodic_distances'; const group_key = 'group'; final helix_keys = [ - idx_on_helix_key, - max_offset_key, - min_offset_key, - roll_key, - pitch_key, - yaw_key, - grid_position_key, - svg_position_key, - position_key, - major_ticks_key, - major_tick_distance_key, - major_tick_start_key, - major_tick_periodic_distances_key, - group_key, -] + + idx_on_helix_key, + max_offset_key, + min_offset_key, + roll_key, + pitch_key, + yaw_key, + grid_position_key, + svg_position_key, + position_key, + major_ticks_key, + major_tick_distance_key, + major_tick_start_key, + major_tick_periodic_distances_key, + group_key, + ] + legacy_position_keys; // Cannot have List concatenation in const expressions. // Seems like it won't be fixed soon (related issue): @@ -306,17 +306,17 @@ const modification_5p_key = '5prime_modification'; const modification_3p_key = '3prime_modification'; const modifications_int_key = 'internal_modifications'; final strand_keys = [ - color_key, - dna_sequence_key, - vendor_fields_key, - is_scaffold_key, - substrands_key, - modification_5p_key, - modification_3p_key, - modifications_int_key, - label_key, - name_key, -] + + color_key, + dna_sequence_key, + vendor_fields_key, + is_scaffold_key, + substrands_key, + modification_5p_key, + modification_3p_key, + modifications_int_key, + label_key, + name_key, + ] + legacy_dna_sequence_keys + legacy_vendor_fields_keys + legacy_substrands_keys; @@ -329,12 +329,12 @@ const legacy_mod_vendor_code_keys = ['idt_text']; const mod_allowed_bases_key = 'allowed_bases'; const mod_connector_length_key = 'connector_length'; final modification_keys = [ - mod_location_key, - mod_display_text_key, - mod_vendor_code_key, - mod_allowed_bases_key, - mod_connector_length_key, -] + + mod_location_key, + mod_display_text_key, + mod_vendor_code_key, + mod_allowed_bases_key, + mod_connector_length_key, + ] + legacy_mod_vendor_code_keys; // VendorFields keys @@ -360,16 +360,16 @@ const end_key = 'end'; const deletions_key = 'deletions'; const insertions_key = 'insertions'; final domain_keys = [ - helix_idx_key, - forward_key, - start_key, - end_key, - deletions_key, - insertions_key, - label_key, - name_key, - color_key, -] + + helix_idx_key, + forward_key, + start_key, + end_key, + deletions_key, + insertions_key, + label_key, + name_key, + color_key, + ] + legacy_forward_keys; // Loopout keys From 855fe21d312a25ef1a3c221ce9dbb88c8af0a49a Mon Sep 17 00:00:00 2001 From: David Doty Date: Thu, 21 Sep 2023 15:41:51 -0700 Subject: [PATCH 5/8] Update README.md --- README.md | 97 ++++++------------------------------------------------- 1 file changed, 10 insertions(+), 87 deletions(-) diff --git a/README.md b/README.md index ffc284925..2fabe8a42 100644 --- a/README.md +++ b/README.md @@ -182,20 +182,8 @@ It is instructive to see how that example design is represented as a `.sc` file { "grid": "square", "helices": [ - { - "max_offset": 48, - "grid_position": [ - 0, - 0 - ] - }, - { - "max_offset": 48, - "grid_position": [ - 0, - 1 - ] - } + { "max_offset": 48, "grid_position": [ 0, 0 ] }, + { "max_offset": 48, "grid_position": [ 0, 1 ] } ], "modifications_in_design": { "/5Biosg/": { @@ -209,40 +197,10 @@ It is instructive to see how that example design is represented as a `.sc` file "color": "#0066cc", "sequence": "AACGTAACGTAACGTAACGTAACGTAACGTAACGTAACGTAACGTAACGTAACGTAACGTAACGTAACG", "domains": [ - { - "helix": 1, - "forward": false, - "start": 8, - "end": 24, - "deletions": [ - 20 - ] - }, - { - "helix": 0, - "forward": true, - "start": 8, - "end": 40, - "insertions": [ - [ - 14, - 1 - ], - [ - 26, - 2 - ] - ] - }, - { - "loopout": 3 - }, - { - "helix": 1, - "forward": false, - "start": 24, - "end": 40 - } + { "helix": 1, "forward": false, "start": 8, "end": 24, "deletions": [20] }, + { "helix": 0, "forward": true, "start": 8, "end": 40, "insertions": [[14,1], [26,2]] }, + { "loopout": 3 }, + { "helix": 1, "forward": false, "start": 24, "end": 40 } ], "is_scaffold": true }, @@ -250,51 +208,16 @@ It is instructive to see how that example design is represented as a `.sc` file "color": "#f74308", "sequence": "ACGTTACGTTACGTTTTACGTTACGTTACGTT", "domains": [ - { - "helix": 1, - "forward": true, - "start": 8, - "end": 24, - "deletions": [ - 20 - ] - }, - { - "helix": 0, - "forward": false, - "start": 8, - "end": 24, - "insertions": [ - [ - 14, - 1 - ] - ] - } + { "helix": 1, "forward": true, "start": 8, "end": 24, "deletions": [20] }, + { "helix": 0, "forward": false, "start": 8, "end": 24, "insertions": [[14,1]] } ] }, { "color": "#57bb00", "sequence": "ACGTTACGTTACGTTACGCGTTACGTTACGTTAC", "domains": [ - { - "helix": 0, - "forward": false, - "start": 24, - "end": 40, - "insertions": [ - [ - 26, - 2 - ] - ] - }, - { - "helix": 1, - "forward": true, - "start": 24, - "end": 40 - } + { "helix": 0, "forward": false, "start": 24, "end": 40, "insertions": [[26,2]] }, + { "helix": 1, "forward": true, "start": 24, "end": 40 } ], "5prime_modification": "/5Biosg/" } From ca8536007627944858abc52ecb86009625d39c4b Mon Sep 17 00:00:00 2001 From: David Doty Date: Thu, 21 Sep 2023 15:42:56 -0700 Subject: [PATCH 6/8] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2fabe8a42..bd33e4857 100644 --- a/README.md +++ b/README.md @@ -182,8 +182,8 @@ It is instructive to see how that example design is represented as a `.sc` file { "grid": "square", "helices": [ - { "max_offset": 48, "grid_position": [ 0, 0 ] }, - { "max_offset": 48, "grid_position": [ 0, 1 ] } + { "max_offset": 48, "grid_position": [0,0] }, + { "max_offset": 48, "grid_position": [0,1] } ], "modifications_in_design": { "/5Biosg/": { From de91ace468bba377cdd81748394a61c8bc433b75 Mon Sep 17 00:00:00 2001 From: David Doty Date: Thu, 21 Sep 2023 15:45:31 -0700 Subject: [PATCH 7/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bd33e4857..49a0b0f42 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,7 @@ It is instructive to see how that example design is represented as a `.sc` file { "max_offset": 48, "grid_position": [0,0] }, { "max_offset": 48, "grid_position": [0,1] } ], - "modifications_in_design": { + "modifications_5p_in_design": { "/5Biosg/": { "display_text": "B", "vendor_code": "/5Biosg/", From 0f73968e8f228795c9baff04e95bca6403091884 Mon Sep 17 00:00:00 2001 From: David Doty Date: Tue, 10 Oct 2023 15:02:40 -0700 Subject: [PATCH 8/8] fixes bug in reading .sc files with old modification keys --- lib/src/state/design.dart | 67 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 3 deletions(-) diff --git a/lib/src/state/design.dart b/lib/src/state/design.dart index 34c603851..f9f766c3e 100644 --- a/lib/src/state/design.dart +++ b/lib/src/state/design.dart @@ -1409,17 +1409,61 @@ abstract class Design with UnusedFields implements Built, return; } + // lots of ugly checks below for backwards compatibility since we used to write + // "5'-" or "3'-" or "internal-" at the start of keys in the modifications map for (int i = 0; i < strands.length; i++) { var strand = strands[i]; var strand_json = strand_jsons[i]; if (strand_json.containsKey(constants.modification_5p_key)) { var mod_name = strand_json[constants.modification_5p_key]; - Modification5Prime mod = legacy ? all_mods[mod_name] : mods_5p[mod_name]; + Modification5Prime mod; + if (legacy) { + var key = mod_name; + if (!all_mods.containsKey(mod_name)) { + if (key.substring(0, 3) == "5'-") { + key = mod_name.substring(3); + } else { + key = "5'-${mod_name}"; + } + } + mod = all_mods[key]; + } else { + var key = mod_name; + if (!mods_5p.containsKey(mod_name)) { + if (key.substring(0, 3) == "5'-") { + key = mod_name.substring(3); + } else { + key = "5'-${mod_name}"; + } + } + mod = mods_5p[key]; + } strand = strand.rebuild((b) => b..modification_5p.replace(mod)); } if (strand_json.containsKey(constants.modification_3p_key)) { var mod_name = strand_json[constants.modification_3p_key]; - Modification3Prime mod = legacy ? all_mods[mod_name] : mods_3p[mod_name]; + Modification3Prime mod; + if (legacy) { + var key = mod_name; + if (!all_mods.containsKey(mod_name)) { + if (key.substring(0, 3) == "3'-") { + key = mod_name.substring(3); + } else { + key = "3'-${mod_name}"; + } + } + mod = all_mods[key]; + } else { + var key = mod_name; + if (!mods_3p.containsKey(mod_name)) { + if (key.substring(0, 3) == "3'-") { + key = mod_name.substring(3); + } else { + key = "3'-${mod_name}"; + } + } + mod = mods_3p[key]; + } strand = strand.rebuild((b) => b..modification_3p.replace(mod)); } if (strand_json.containsKey(constants.modifications_int_key)) { @@ -1428,7 +1472,24 @@ abstract class Design with UnusedFields implements Built, for (var idx_str in mod_names_by_idx_json.keys) { int offset = int.parse(idx_str); String mod_name = mod_names_by_idx_json[idx_str]; - ModificationInternal mod = legacy ? all_mods[mod_name] : mods_int[mod_name]; + ModificationInternal mod; + if (legacy) { + var key = mod_name; + if (!all_mods.containsKey(mod_name)) { + if (key.substring(0, 9) == "internal-") { + key = mod_name.substring(9); + } else { + key = "internal-${mod_name}"; + } + } + mod = all_mods[key]; + } else { + var key = mod_name; + if (!mods_int.containsKey(mod_name)) { + key = "internal-${mod_name}"; + } + mod = mods_int[key]; + } mods_by_idx[offset] = mod; } strand = strand.rebuild((b) => b..modifications_int.replace(mods_by_idx));