Skip to content

Commit

Permalink
sync re sites on load
Browse files Browse the repository at this point in the history
  • Loading branch information
David O'Connor committed Oct 16, 2024
1 parent f7245f6 commit 91c14b2
Show file tree
Hide file tree
Showing 8 changed files with 132 additions and 106 deletions.
4 changes: 3 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ ureq = { version = "^2.10.1", features = ["tls"], default-features = false } #
strum = "^0.26.3"
strum_macros = "^0.26.4"

na_seq = { path = "../na_seq" }
#na_seq = "^0.2.0"
#na_seq = { path = "../na_seq" }
na_seq = "^0.2.1"

[build-dependencies]
# These are for embedding an application icon, on Windows.
Expand Down
201 changes: 108 additions & 93 deletions src/backbones.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/gui/cloning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ pub fn cloning_page(state: &mut State, ui: &mut Ui) {
ScrollArea::vertical().id_salt(100).show(ui, |ui| {
let mut sync = false;

ui.heading("Cloning");
ui.heading("Cloning (Currently supports PCR-based cloning only");
// ui.label("For a given insert, automatically select a backbone, and either restriction enzymes, or PCR primers to use\
// to clone the insert into the backbone.");

Expand Down
4 changes: 2 additions & 2 deletions src/gui/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
};

/// Handle hotkeys and clicks that affect all pages.
fn handle_global(state: &mut State, ip: &InputState){
fn handle_global(state: &mut State, ip: &InputState) {
if ip.key_pressed(Key::A) && ip.modifiers.ctrl && !state.ui.text_edit_active {
if !state.get_seq().is_empty() {
state.ui.text_selection = Some(RangeIncl::new(1, state.get_seq().len()))
Expand Down Expand Up @@ -167,7 +167,7 @@ pub fn handle_input(state: &mut State, ui: &mut Ui) {
}

let i = i + 1; // Insert after this nucleotide; not before.
// Don't allow accidental nt insertion when the user is entering into the search bar.
// Don't allow accidental nt insertion when the user is entering into the search bar.

// Add NTs.
if ip.key_pressed(Key::A) && !ip.modifiers.ctrl {
Expand Down
6 changes: 5 additions & 1 deletion src/gui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,11 @@ pub fn draw(state: &mut State, ctx: &Context) {
("🔓", Color32::from_rgb(255, 210, 140))
};
// todo: IDeally bigger font size, but without making the whole line take up more vertical space.
if ui.button(RichText::new(lock_text).color(lock_color)).on_hover_text("Prevent edits to the sequence").clicked() {
if ui
.button(RichText::new(lock_text).color(lock_color))
.on_hover_text("Prevent edits to the sequence")
.clicked()
{
state.ui.seq_edit_lock = !state.ui.seq_edit_lock;
}

Expand Down
8 changes: 7 additions & 1 deletion src/gui/protein.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const CHART_HEIGHT: f32 = 200.;
const CHART_LINE_WIDTH: f32 = 2.;
const CHART_LINE_COLOR: Color32 = Color32::from_rgb(255, 100, 100);

const NUM_X_TICKS: usize = 12;

// todo: Color-code AAs, start/stop codons etc.

// todo: Eval how cacheing and state is handled.
Expand Down Expand Up @@ -84,7 +86,11 @@ fn hydrophobicity_chart(data: &Vec<(usize, f32)>, ui: &mut Ui) {
let line = Shape::Path(PathShape::line(points, stroke));

let mut x_axis = Vec::new();
const NUM_X_TICKS: usize = 12;

if data.len() == 0 {
return;
}

let data_range = data[data.len() - 1].0 - data[0].0;
let dr_nt = data_range / NUM_X_TICKS;

Expand Down
9 changes: 4 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,11 @@ use crate::{
misc_types::{find_search_matches, FeatureDirection, FeatureType, SearchMatch, MIN_SEARCH_LEN},
pcr::{PcrParams, PolymeraseType},
portions::PortionsState,
primer::TM_TARGET,
primer::{Primer, TM_TARGET},
protein::{proteins_from_seq, sync_cr_orf_matches},
tags::TagMatch,
util::{get_window_title, RangeIncl},
};
use crate::primer::Primer;

mod alignment;
mod amino_acids;
Expand Down Expand Up @@ -800,16 +799,14 @@ impl State {
pub fn sync_seq_related(&mut self, primer_i: Option<usize>) {
self.sync_primer_matches(primer_i);

// todo: We have removed this here for now, because it is slow.
// todo: Make sure, elsewhere, this is synced.
// We have removed RE sync here for now, because it is slow. Call when able.
// self.sync_re_sites();

self.sync_reading_frame();
self.sync_search();

sync_cr_orf_matches(self);


self.volatile[self.active].proteins = proteins_from_seq(
self.get_seq(),
&self.generic[self.active].features,
Expand Down Expand Up @@ -849,6 +846,8 @@ impl State {
self.sync_pcr();
self.sync_primer_metrics();
self.sync_seq_related(None);
self.sync_re_sites();

self.ui.seq_input = seq_to_str(self.get_seq());

self.sync_portions();
Expand Down

0 comments on commit 91c14b2

Please sign in to comment.