Skip to content

Commit

Permalink
Merge pull request #749 from UC-Davis-molecular-computing/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
dave-doty authored Feb 18, 2022
2 parents 8e1a0fc + d2784ba commit c5dbfc0
Show file tree
Hide file tree
Showing 97 changed files with 3,660 additions and 1,115 deletions.
20 changes: 20 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--- Provide a general summary of your changes in the Title above -->

## Description
<!--- Describe your changes in detail -->

## Related Issue
<!--- If suggesting a new feature or change, please discuss it in an issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
<!--- Please link to the issue here: -->

## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->

## Screenshots (if appropriate):
18 changes: 14 additions & 4 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Dart CI

on: [pull_request]
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

jobs:
build:
run_unit_tests:
if: github.event.pull_request.draft == false

runs-on: ubuntu-18.04

Expand All @@ -17,11 +20,18 @@ jobs:
- name: Setup Dart SDK Step 4
run: sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
- name: Setup Dart SDK Step 5
run: wget -O /tmp/dart_2.9.3-1_amd64.deb https://storage.googleapis.com/dart-archive/channels/stable/release/2.9.3/linux_packages/dart_2.9.3-1_amd64.deb
run: wget -O /tmp/dart_2.13.4-1_amd64.deb https://storage.googleapis.com/dart-archive/channels/stable/release/2.13.4/linux_packages/dart_2.13.4-1_amd64.deb
- name: Setup Dart SDK Step 6
run: sudo apt install /tmp/dart_2.9.3-1_amd64.deb
run: sudo apt install /tmp/dart_2.13.4-1_amd64.deb
- uses: actions/checkout@v1
- name: Install dependencies
run: PATH="$PATH:/usr/lib/dart/bin" pub get
- name: Run tests
run: PATH="$PATH:/usr/lib/dart/bin" pub run build_runner test

fail_if_pull_request_is_draft:
if: github.event.pull_request.draft == true
runs-on: ubuntu-18.04
steps:
- name: Fails in order to indicate that pull request needs to be marked as ready to review and unit tests workflow needs to pass.
run: exit 1
10 changes: 6 additions & 4 deletions .github/workflows/gh-pages-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Checkout dev branch
uses: actions/checkout@v2
with:
ref: dev

- uses: actions/checkout@v2
- name: Checkout gh-pages branch
uses: actions/checkout@v2
with:
ref: gh-pages
path: gh-pages-repo
Expand All @@ -29,9 +31,9 @@ jobs:
- name: Setup Dart SDK Step 4
run: sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
- name: Setup Dart SDK Step 5
run: wget -O /tmp/dart_2.9.3-1_amd64.deb https://storage.googleapis.com/dart-archive/channels/stable/release/2.9.3/linux_packages/dart_2.9.3-1_amd64.deb
run: wget -O /tmp/dart_2.13.4-1_amd64.deb https://storage.googleapis.com/dart-archive/channels/stable/release/2.13.4/linux_packages/dart_2.13.4-1_amd64.deb
- name: Setup Dart SDK Step 6
run: sudo apt install /tmp/dart_2.9.3-1_amd64.deb
run: sudo apt install /tmp/dart_2.13.4-1_amd64.deb

- name: Install dependencies
run: PATH="$PATH:/usr/lib/dart/bin" pub get
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Checkout main branch
uses: actions/checkout@v2

- uses: actions/checkout@v2
- name: Checkout gh-pages branch
uses: actions/checkout@v2
with:
ref: gh-pages
path: gh-pages-repo
Expand All @@ -27,9 +29,9 @@ jobs:
- name: Setup Dart SDK Step 4
run: sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
- name: Setup Dart SDK Step 5
run: wget -O /tmp/dart_2.9.3-1_amd64.deb https://storage.googleapis.com/dart-archive/channels/stable/release/2.9.3/linux_packages/dart_2.9.3-1_amd64.deb
run: wget -O /tmp/dart_2.13.4-1_amd64.deb https://storage.googleapis.com/dart-archive/channels/stable/release/2.13.4/linux_packages/dart_2.13.4-1_amd64.deb
- name: Setup Dart SDK Step 6
run: sudo apt install /tmp/dart_2.9.3-1_amd64.deb
run: sudo apt install /tmp/dart_2.13.4-1_amd64.deb
- name: Install dependencies
run: PATH="$PATH:/usr/lib/dart/bin" pub get

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.dart_tool/
.packages
# Remove the following pattern if you wish to check in your lock file
pubspec.lock
# pubspec.lock

# Conventional directory for build outputs
build/
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ For any more significant change that is made (e.g., closing an issue, adding a n
7. Commit the changes. In the commit message, reference the issue using the phrase "fixes #123" (for bug fixes) or "closes #123" (for new features) (see [here](https://docs.github.com/en/enterprise/2.16/user/github/managing-your-work-on-github/closing-issues-using-keywords)). Also, in the commit message, describe the issue that was fixed (one easy way is to copy the title of the issue); this message will show up in automatically generated release notes, so this is part of the official documentation of what changed.
8. Create a pull request (PR). **WARNING:** by default, it will want to merge into the `master` branch. Change the destination branch to `dev`.
8. Create a pull request (PR). **WARNING:** by default, it will want to merge into the `master` branch. Change the destination branch to `dev`. Fill in the automatically provided template.
9. Wait for all checks to complete (see next section), and then merge the changes from the new branch into `dev`. This will typically require someone else to review the code first and possibly request changes.
Expand Down Expand Up @@ -546,4 +546,4 @@ and WebStorm offers a [plugin](https://plugins.jetbrains.com/plugin/6351-dart).
The line length should be configured to 110, as the style guide limit of 80
is a bit too restrictive.
We also follow the [OverReact style guide](https://github.com/Workiva/over_react#component-formatting), in particular, using trailing commas so that dartfmt (Dart's formatting tool) lines up the components nicely.
We also follow the [OverReact style guide](https://github.com/Workiva/over_react#component-formatting), in particular, using trailing commas so that dartfmt (Dart's formatting tool) lines up the components nicely.
152 changes: 136 additions & 16 deletions lib/src/actions/actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import 'package:built_value/serializer.dart';
import 'package:color/color.dart';
import 'package:js/js.dart';
import 'package:built_collection/built_collection.dart';
import 'package:scadnano/src/dna_file_type.dart';
import 'package:scadnano/src/state/dna_assign_options.dart';
import 'package:scadnano/src/state/domains_move.dart';
import 'package:scadnano/src/state/export_dna_format_strand_order.dart';
import 'package:scadnano/src/state/geometry.dart';
Expand Down Expand Up @@ -236,6 +238,21 @@ abstract class LocalStorageDesignChoiceSet
static Serializer<LocalStorageDesignChoiceSet> get serializer => _$localStorageDesignChoiceSetSerializer;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// erase localStorage stored design and storable UI settings

abstract class ResetLocalStorage
with BuiltJsonSerializable
implements Action, Built<ResetLocalStorage, ResetLocalStorageBuilder> {

/************************ begin BuiltValue boilerplate ************************/
factory ResetLocalStorage() = _$ResetLocalStorage._;

ResetLocalStorage._();

static Serializer<ResetLocalStorage> get serializer => _$resetLocalStorageSerializer;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Clear helix selection when loading new design

Expand Down Expand Up @@ -705,17 +722,17 @@ abstract class SetOnlyDisplaySelectedHelices
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// invert y-axis

abstract class InvertXYSet
abstract class InvertYSet
with BuiltJsonSerializable
implements Action, SvgPngCacheInvalidatingAction, Built<InvertXYSet, InvertXYSetBuilder> {
bool get invert_xy;
implements Action, SvgPngCacheInvalidatingAction, Built<InvertYSet, InvertYSetBuilder> {
bool get invert_y;

/************************ begin BuiltValue boilerplate ************************/
factory InvertXYSet({bool invert_xy}) = _$InvertXYSet._;
factory InvertYSet({bool invert_y}) = _$InvertYSet._;

InvertXYSet._();
InvertYSet._();

static Serializer<InvertXYSet> get serializer => _$invertXYSetSerializer;
static Serializer<InvertYSet> get serializer => _$invertYSetSerializer;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -765,7 +782,11 @@ abstract class LoadDNAFile

/************************ begin BuiltValue boilerplate ************************/
factory LoadDNAFile(
{String content, String filename, bool write_local_storage = true, bool unit_testing = false, DNAFileType dna_file_type = DNAFileType.scadnano_file}) {
{String content,
String filename,
bool write_local_storage = true,
bool unit_testing = false,
DNAFileType dna_file_type = DNAFileType.scadnano_file}) {
return LoadDNAFile.from((b) => b
..content = content
..filename = filename
Expand Down Expand Up @@ -1591,6 +1612,7 @@ abstract class HelixMinOffsetSetByDomainsAll
_$helixMinOffsetSetByDomainsAllSerializer;
}

// when we want each helix to have its own max based on its domains
abstract class HelixMaxOffsetSetByDomainsAll
with BuiltJsonSerializable, UndoableAction
implements Action, Built<HelixMaxOffsetSetByDomainsAll, HelixMaxOffsetSetByDomainsAllBuilder> {
Expand All @@ -1603,6 +1625,21 @@ abstract class HelixMaxOffsetSetByDomainsAll
_$helixMaxOffsetSetByDomainsAllSerializer;
}

// when we want the same max to be applied to all helices
abstract class HelixMaxOffsetSetByDomainsAllSameMax
with BuiltJsonSerializable, UndoableAction
implements
Action,
Built<HelixMaxOffsetSetByDomainsAllSameMax, HelixMaxOffsetSetByDomainsAllSameMaxBuilder> {
/************************ begin BuiltValue boilerplate ************************/
factory HelixMaxOffsetSetByDomainsAllSameMax() = _$HelixMaxOffsetSetByDomainsAllSameMax;

HelixMaxOffsetSetByDomainsAllSameMax._();

static Serializer<HelixMaxOffsetSetByDomainsAllSameMax> get serializer =>
_$helixMaxOffsetSetByDomainsAllSameMaxSerializer;
}

abstract class HelixOffsetChangeAll
with BuiltJsonSerializable, UndoableAction
implements Built<HelixOffsetChangeAll, HelixOffsetChangeAllBuilder> {
Expand Down Expand Up @@ -1770,13 +1807,17 @@ abstract class ConvertCrossoverToLoopout

int get length;

@nullable
String get dna_sequence;

StrandPart get strand_part => crossover;

/************************ begin BuiltValue boilerplate ************************/
factory ConvertCrossoverToLoopout(Crossover crossover, int length) =>
factory ConvertCrossoverToLoopout(Crossover crossover, int length, [String dna_sequence = null]) =>
ConvertCrossoverToLoopout.from((b) => b
..crossover.replace(crossover)
..length = length);
..length = length
..dna_sequence = dna_sequence);

factory ConvertCrossoverToLoopout.from([void Function(ConvertCrossoverToLoopoutBuilder) updates]) =
_$ConvertCrossoverToLoopout;
Expand Down Expand Up @@ -1850,6 +1891,29 @@ abstract class JoinStrandsByCrossover
static Serializer<JoinStrandsByCrossover> get serializer => _$joinStrandsByCrossoverSerializer;
}

// used to move a linker (crossover or loopout, stored as potential_crossover.linker)
// so that one end stays fixed (stored in potential_crossover.dna_end_first_clicked)
// while the other end moves to dna_end_second_click, editing two strands
abstract class MoveLinker
with BuiltJsonSerializable, UndoableAction
implements Action, Built<MoveLinker, MoveLinkerBuilder> {
PotentialCrossover get potential_crossover;

DNAEnd get dna_end_second_click;

/************************ begin BuiltValue boilerplate ************************/
@memoized
int get hashCode;

factory MoveLinker({PotentialCrossover potential_crossover, DNAEnd dna_end_second_click}) = _$MoveLinker._;

factory MoveLinker.from([void Function(MoveLinkerBuilder) updates]) = _$MoveLinker;

MoveLinker._();

static Serializer<MoveLinker> get serializer => _$moveLinkerSerializer;
}

// JoinStrandsByCrossover cannot be in a BatchAction since the reducer for it looks up strands
// from the Design, which are invalidated as the Design is modified.
// Also, to keep the complex logic in the reducer and out of the view code,
Expand Down Expand Up @@ -2166,8 +2230,12 @@ abstract class DomainsMoveStartSelectedDomains
implements Action, Built<DomainsMoveStartSelectedDomains, DomainsMoveStartSelectedDomainsBuilder> {
Address get address;

BuiltMap<int, int> get original_helices_view_order_inverse;

/************************ begin BuiltValue boilerplate ************************/
factory DomainsMoveStartSelectedDomains({Address address}) = _$DomainsMoveStartSelectedDomains._;
factory DomainsMoveStartSelectedDomains(
{Address address,
BuiltMap<int, int> original_helices_view_order_inverse}) = _$DomainsMoveStartSelectedDomains._;

DomainsMoveStartSelectedDomains._();

Expand Down Expand Up @@ -2379,15 +2447,22 @@ abstract class AssignDNA
implements Built<AssignDNA, AssignDNABuilder> {
Strand get strand;

String get dna_sequence;
DNAAssignOptions get dna_assign_options;

bool get assign_complements;
// convenience getters since we already have a lot of code referencing some of these from the old
// design of this Action
String get dna_sequence => dna_assign_options.dna_sequence;

bool get warn_on_change;
bool get use_predefined_dna_sequence => dna_assign_options.use_predefined_dna_sequence;

bool get assign_complements => dna_assign_options.assign_complements;

bool get disable_change_sequence_bound_strand => dna_assign_options.disable_change_sequence_bound_strand;

int get m13_rotation => dna_assign_options.m13_rotation;

/************************ begin BuiltValue boilerplate ************************/
factory AssignDNA({Strand strand, String dna_sequence, bool assign_complements, bool warn_on_change}) =
_$AssignDNA._;
factory AssignDNA({Strand strand, DNAAssignOptions dna_assign_options}) = _$AssignDNA._;

AssignDNA._();

Expand Down Expand Up @@ -2783,6 +2858,31 @@ abstract class ModificationRemove
static Serializer<ModificationRemove> get serializer => _$modificationRemoveSerializer;
}

abstract class ModificationConnectorLengthSet
with BuiltJsonSerializable
implements Action, Built<ModificationConnectorLengthSet, ModificationConnectorLengthSetBuilder> {
Strand get strand;

Modification get modification;

int get connector_length;

/************************ begin BuiltValue boilerplate ************************/
@memoized
int get hashCode;

factory ModificationConnectorLengthSet({Strand strand, Modification modification, int connector_length}) =
_$ModificationConnectorLengthSet._;

factory ModificationConnectorLengthSet.from(
[void Function(ModificationConnectorLengthSetBuilder) updates]) = _$ModificationConnectorLengthSet;

ModificationConnectorLengthSet._();

static Serializer<ModificationConnectorLengthSet> get serializer =>
_$modificationConnectorLengthSetSerializer;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// modification edit

Expand Down Expand Up @@ -3223,7 +3323,7 @@ abstract class AutofitSet with BuiltJsonSerializable implements Action, Built<Au
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// show or hide helix circles/text in main view
// show or hide helix circles/text, or entire helix (including offset lines) in main view

abstract class ShowHelixCirclesMainViewSet
with BuiltJsonSerializable
Expand All @@ -3238,6 +3338,26 @@ abstract class ShowHelixCirclesMainViewSet
static Serializer<ShowHelixCirclesMainViewSet> get serializer => _$showHelixCirclesMainViewSetSerializer;
}

abstract class ShowHelixComponentsMainViewSet
with BuiltJsonSerializable
implements Action, Built<ShowHelixComponentsMainViewSet, ShowHelixComponentsMainViewSetBuilder> {
bool get show_helix_components;

/************************ begin BuiltValue boilerplate ************************/
@memoized
int get hashCode;

factory ShowHelixComponentsMainViewSet({bool show_helix_components}) = _$ShowHelixComponentsMainViewSet._;

factory ShowHelixComponentsMainViewSet.from(
[void Function(ShowHelixComponentsMainViewSetBuilder) updates]) = _$ShowHelixComponentsMainViewSet;

ShowHelixComponentsMainViewSet._();

static Serializer<ShowHelixComponentsMainViewSet> get serializer =>
_$showHelixComponentsMainViewSetSerializer;
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// show or hide the edit menu

Expand Down
Loading

0 comments on commit c5dbfc0

Please sign in to comment.