Skip to content

Commit

Permalink
Merge pull request #972 from UC-Davis-molecular-computing/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
dave-doty authored Mar 28, 2024
2 parents af78cb4 + c8e5792 commit c79287a
Show file tree
Hide file tree
Showing 38 changed files with 1,148 additions and 159 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# scadnano

[scadnano](http://scadnano.org)
("
scriptable-cadnano", [source code repository here](https://github.com/UC-Davis-molecular-computing/scadnano))
("scriptable-cadnano", [source code repository here](https://github.com/UC-Davis-molecular-computing/scadnano))
is a program for designing synthetic DNA structures such as DNA origami.
The scadnano project is developed and maintained by the UC Davis Molecular Computing group.
Note that [cadnano](https://cadnano.org) is a separate project, developed and maintained by
Expand Down
106 changes: 104 additions & 2 deletions lib/src/actions/actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1571,9 +1571,13 @@ abstract class SelectAllWithSameAsSelected

BuiltList<SelectableTrait> get traits;

bool get exclude_scaffolds;

/************************ begin BuiltValue boilerplate ************************/
factory SelectAllWithSameAsSelected({BuiltList<Selectable> templates, BuiltList<SelectableTrait> traits}) =
_$SelectAllWithSameAsSelected._;
factory SelectAllWithSameAsSelected(
{BuiltList<Selectable> templates,
BuiltList<SelectableTrait> traits,
bool exclude_scaffolds}) = _$SelectAllWithSameAsSelected._;

SelectAllWithSameAsSelected._();

Expand Down Expand Up @@ -2076,6 +2080,8 @@ abstract class ExportDNA with BuiltJsonSerializable implements Action, Built<Exp

bool get include_only_selected_strands;

bool get exclude_selected_strands;

ExportDNAFormat get export_dna_format;

@nullable
Expand All @@ -2093,16 +2099,19 @@ abstract class ExportDNA with BuiltJsonSerializable implements Action, Built<Exp
factory ExportDNA({
bool include_scaffold,
bool include_only_selected_strands,
bool exclude_selected_strands,
ExportDNAFormat export_dna_format,
String delimiter,
String domain_delimiter,
StrandOrder strand_order = null,
bool column_major_strand = true,
bool column_major_plate = true,
}) {
assert(!(include_only_selected_strands && exclude_selected_strands));
return ExportDNA.from((b) => b
..include_scaffold = include_scaffold
..include_only_selected_strands = include_only_selected_strands
..exclude_selected_strands = exclude_selected_strands
..export_dna_format = export_dna_format
..delimiter = delimiter
..domain_delimiter = domain_delimiter
Expand Down Expand Up @@ -2153,6 +2162,27 @@ abstract class ExportSvg with BuiltJsonSerializable implements Action, Built<Exp
ExportSvgType get type;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Export every text in a DNA sequence separately

abstract class ExportSvgTextSeparatelySet
with BuiltJsonSerializable
implements Action, Built<ExportSvgTextSeparatelySet, ExportSvgTextSeparatelySetBuilder> {
bool get export_svg_text_separately;

/************************ begin BuiltValue boilerplate ************************/
factory ExportSvgTextSeparatelySet(bool export_svg_text_separately) =>
ExportSvgTextSeparatelySet.from((b) => b..export_svg_text_separately = export_svg_text_separately);

/************************ begin BuiltValue boilerplate ************************/
factory ExportSvgTextSeparatelySet.from([void Function(ExportSvgTextSeparatelySetBuilder) updates]) =
_$ExportSvgTextSeparatelySet;

ExportSvgTextSeparatelySet._();

static Serializer<ExportSvgTextSeparatelySet> get serializer => _$exportSvgTextSeparatelySetSerializer;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Strand part action

Expand Down Expand Up @@ -3981,6 +4011,22 @@ abstract class ExampleDesignsLoad
static Serializer<ExampleDesignsLoad> get serializer => _$exampleDesignsLoadSerializer;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// pair lines display

abstract class BasePairTypeSet
with BuiltJsonSerializable
implements Action, Built<BasePairTypeSet, BasePairTypeSetBuilder> {
int get selected_idx;

/************************ begin BuiltValue boilerplate ************************/
factory BasePairTypeSet({int selected_idx}) = _$BasePairTypeSet._;

BasePairTypeSet._();

static Serializer<BasePairTypeSet> get serializer => _$basePairTypeSetSerializer;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// change helix position

Expand Down Expand Up @@ -4348,6 +4394,25 @@ abstract class DisablePngCachingDnaSequencesSet
_$disablePngCachingDnaSequencesSetSerializer;
}

abstract class RetainStrandColorOnSelectionSet
with BuiltJsonSerializable
implements Action, Built<RetainStrandColorOnSelectionSet, RetainStrandColorOnSelectionSetBuilder> {
bool get retain_strand_color_on_selection;

/************************ begin BuiltValue boilerplate ************************/
factory RetainStrandColorOnSelectionSet(bool retain_strand_color_on_selection) =>
RetainStrandColorOnSelectionSet.from(
(b) => b..retain_strand_color_on_selection = retain_strand_color_on_selection);

factory RetainStrandColorOnSelectionSet.from(
[void Function(RetainStrandColorOnSelectionSetBuilder) updates]) = _$RetainStrandColorOnSelectionSet;

RetainStrandColorOnSelectionSet._();

static Serializer<RetainStrandColorOnSelectionSet> get serializer =>
_$retainStrandColorOnSelectionSetSerializer;
}

abstract class DisplayReverseDNARightSideUpSet
with BuiltJsonSerializable
implements Action, Built<DisplayReverseDNARightSideUpSet, DisplayReverseDNARightSideUpSetBuilder> {
Expand Down Expand Up @@ -4458,3 +4523,40 @@ abstract class OxdnaExport
@memoized
int get hashCode;
}

abstract class OxviewExport
with BuiltJsonSerializable
implements Action, Built<OxviewExport, OxviewExportBuilder> {
bool get selected_strands_only;

/************************ begin BuiltValue boilerplate ************************/
factory OxviewExport({bool selected_strands_only = false}) {
return OxviewExport.from((b) => b..selected_strands_only = selected_strands_only);
}

OxviewExport._();

factory OxviewExport.from([void Function(OxviewExportBuilder) updates]) = _$OxviewExport;

static Serializer<OxviewExport> get serializer => _$oxviewExportSerializer;

@memoized
int get hashCode;
}

abstract class OxExportOnlySelectedStrandsSet
with BuiltJsonSerializable
implements Action, Built<OxExportOnlySelectedStrandsSet, OxExportOnlySelectedStrandsSetBuilder> {
bool get only_selected;

/************************ begin BuiltValue boilerplate ************************/
factory OxExportOnlySelectedStrandsSet({bool only_selected}) = _$OxExportOnlySelectedStrandsSet._;

OxExportOnlySelectedStrandsSet._();

static Serializer<OxExportOnlySelectedStrandsSet> get serializer =>
_$oxExportOnlySelectedStrandsSetSerializer;

@memoized
int get hashCode;
}
7 changes: 5 additions & 2 deletions lib/src/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +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.1";
const String CURRENT_VERSION = "0.19.2";
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.19.1",
"0.18.10",
"0.17.14",
// "0.17.13",
Expand Down Expand Up @@ -428,8 +428,10 @@ const css_selector_scaffold = 'scaffold';
const css_selector_staple = 'staple';
const css_selector_domain = 'domain-line';
const css_selector_base_pair_line = 'base-pair-line';
const css_selector_base_pair_rect = 'base-pair-rect';
const css_selector_extension = 'extension-line';
const css_selector_crossover = 'crossover-curve';
const css_selector_crossover_same_helix = 'crossover-curve-same-helix';
const css_selector_loopout = 'loopout-curve';
const css_selector_end_5p_strand = 'five-prime-end-first-substrand';
const css_selector_end_3p_strand = 'three-prime-end-last-substrand';
Expand Down Expand Up @@ -465,6 +467,7 @@ const css_selector_deletion = 'deletion-cross';
const css_selector_insertion_group = 'insertion-group';
const css_selector_deletion_group = 'deletion-group';
const css_selector_selected = 'selected';
const css_selector_selected_pink = 'selected-pink';

const css_selector_context_menu_item_disabled = 'context_menu_item_disabled';

Expand Down
31 changes: 23 additions & 8 deletions lib/src/middleware/export_dna_sequences.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ export_dna_sequences_middleware(Store<AppState> store, action, NextDispatcher ne
List<Strand> strands;
if (action.include_only_selected_strands) {
strands = state.ui_state.selectables_store.selected_strands.toList();
} else if (action.exclude_selected_strands) {
strands = state.design.strands.toList();
for (var strand in state.ui_state.selectables_store.selected_strands) {
strands.remove(strand);
}
} else {
strands = state.design.strands.toList();
}
Expand Down Expand Up @@ -107,15 +112,16 @@ Future<void> export_dna() async {

int idx_include_scaffold = 0;
int idx_include_only_selected_strands = 1;
int idx_format_str = 2;
int idx_delimiter = 3;
int idx_domain_delimiter = 4;
int idx_column_major_plate = 5;
int idx_sort = 6;
int idx_column_major_strand = 7;
int idx_strand_order_str = 8;
int idx_exclude_selected_strands = 2;
int idx_format_str = 3;
int idx_delimiter = 4;
int idx_domain_delimiter = 5;
int idx_column_major_plate = 6;
int idx_sort = 7;
int idx_column_major_strand = 8;
int idx_strand_order_str = 9;

List<DialogItem> items = List<DialogItem>.filled(9, null);
List<DialogItem> items = List<DialogItem>.filled(idx_strand_order_str + 1, null);

items[idx_delimiter] = DialogText(label: 'delimiter between IDT fields', value: ',', tooltip: '''\
Delimiter to separate IDT fields in a "bulk input" text file, for instance if set to ";", then a line
Expand All @@ -132,6 +138,7 @@ if it had three domains each of length 5.''');
items[idx_include_scaffold] = DialogCheckbox(label: 'include scaffold', value: false);
items[idx_include_only_selected_strands] =
DialogCheckbox(label: 'include only selected strands', value: false);
items[idx_exclude_selected_strands] = DialogCheckbox(label: 'exclude selected strands', value: false);
items[idx_format_str] = DialogRadio(
label: 'export format',
options: export_options,
Expand Down Expand Up @@ -178,6 +185,10 @@ which part of the strand to use as the address.
title: 'export DNA sequences',
type: DialogType.export_dna_sequences,
items: items,
disable_when_any_checkboxes_on: {
idx_include_only_selected_strands: [idx_exclude_selected_strands],
idx_exclude_selected_strands: [idx_include_only_selected_strands],
},
disable_when_any_checkboxes_off: {
idx_column_major_strand: [idx_sort],
idx_strand_order_str: [idx_sort],
Expand All @@ -199,6 +210,7 @@ which part of the strand to use as the address.

bool include_scaffold = (results[idx_include_scaffold] as DialogCheckbox).value;
bool include_only_selected_strands = (results[idx_include_only_selected_strands] as DialogCheckbox).value;
bool exclude_selected_strands = (results[idx_exclude_selected_strands] as DialogCheckbox).value;
String format_str = (results[idx_format_str] as DialogRadio).value;
bool sort = (results[idx_sort] as DialogCheckbox).value;
StrandOrder strand_order = null;
Expand All @@ -213,9 +225,12 @@ which part of the strand to use as the address.
String delimiter = (results[idx_delimiter] as DialogText).value;
String domain_delimiter = (results[idx_domain_delimiter] as DialogText).value;

assert(!(include_only_selected_strands && exclude_selected_strands));

app.dispatch(actions.ExportDNA(
include_scaffold: include_scaffold,
include_only_selected_strands: include_only_selected_strands,
exclude_selected_strands: exclude_selected_strands,
export_dna_format: format,
delimiter: delimiter,
domain_delimiter: domain_delimiter,
Expand Down
Loading

0 comments on commit c79287a

Please sign in to comment.