Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should fix 825: import cadnano - domains that end on deletions #826

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions lib/src/state/design.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2125,6 +2125,23 @@ abstract class Design with UnusedFields implements Built<Design, DesignBuilder>,
else
start = old_base;

bool running = true;
while(running){
switch(Design._cadnano_v2_import_extract_end_deletions(vstrands[old_helix]['skip'], start,end)){
case -1:{
start = start + 1;
}
break;
case 1:{
end = end-1;
}
break;
case 0:{
running = false;
}
}
}

domains.add(Domain(
is_scaffold: strand_type == 'scaf',
helix: old_helix,
Expand Down Expand Up @@ -2174,6 +2191,19 @@ abstract class Design with UnusedFields implements Built<Design, DesignBuilder>,
return to_return;
}


/// Routines which finds cadnano skips that correspond to domain ends. Returns -1 if they appear at the start, +1 if they appear at the end, or 0 if there are no end deletions.
static int _cadnano_v2_import_extract_end_deletions(List<dynamic> skip_table, int start, int end){
if ((skip_table[start] == -1)){
return -1;
}
if (skip_table[end] == -1){
return 1;
} else {
return 0;
}
}

/// Routines which converts cadnano skips to scadnano insertions
static List<Insertion> _cadnano_v2_import_extract_insertions(List<dynamic> loop_table, int start, int end) {
List<Insertion> to_return = [];
Expand Down