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

Mutation "chunks" #7

Open
wants to merge 72 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
bc07377
some basic design
molpopgen Apr 27, 2023
28978ad
For a first pass, let's do chunks of 64 mutations
molpopgen May 1, 2023
78af04c
Renaming
molpopgen May 1, 2023
3279200
some musings
molpopgen May 1, 2023
f3b3bad
more musings
molpopgen May 1, 2023
5deda31
baby steps to tests
molpopgen May 1, 2023
cd32eee
more about what we actually need
molpopgen May 1, 2023
cd91cb4
more design notes
molpopgen May 1, 2023
41ccf85
some infrastructure
molpopgen May 1, 2023
2a4ace8
on the wrong path, I think?
molpopgen May 1, 2023
3185bbd
thoughts on what and OO version could look like
molpopgen May 2, 2023
10f9d76
arrayref using std. yay
molpopgen May 2, 2023
fac8e50
some cool tricks. some terrible design
molpopgen May 2, 2023
689c12a
some code re-use
molpopgen May 2, 2023
a6bb532
use Self::CHUNK_SIZE
molpopgen May 2, 2023
5b19cb6
steps towards a working fn
molpopgen May 2, 2023
7f6eb47
the borrow checker stops us.
molpopgen May 2, 2023
7765bd3
use indexes to get around the borrow checker
molpopgen May 2, 2023
b8d3f0c
ugh, maybe struct approach is simpler at first
molpopgen May 2, 2023
1eecc92
defeated by the borrow checker. More to come tomorrow...
molpopgen May 2, 2023
600c532
some notes
molpopgen May 3, 2023
d28bef2
strip to bare bones based on pencil + paper sketches
molpopgen May 3, 2023
7b6553e
Default
molpopgen May 3, 2023
5acb47f
some basic tets
molpopgen May 3, 2023
27caa97
add is_empty
molpopgen May 3, 2023
26101d3
copying one chunk into another
molpopgen May 3, 2023
0912ebe
tests passsing
molpopgen May 3, 2023
c5a44ee
add to occupancy
molpopgen May 3, 2023
d3c6514
comment
molpopgen May 3, 2023
57c1748
note for later
molpopgen May 4, 2023
6325051
Note
molpopgen May 4, 2023
2dd89c2
basic position fetching
molpopgen May 4, 2023
e9aafbe
dedup
molpopgen May 4, 2023
1e59416
simplify
molpopgen May 4, 2023
823cb54
cleanup
molpopgen May 4, 2023
b82227d
FIXME fixed
molpopgen May 4, 2023
aad26db
on a path to ruin here...
molpopgen May 4, 2023
b08b635
getting somewhere
molpopgen May 4, 2023
95e502a
test more complex cases
molpopgen May 4, 2023
9a8db0d
more detailed tests
molpopgen May 4, 2023
de1d446
failing test of single crossover
molpopgen May 8, 2023
6ed8354
notes on what we need.
molpopgen May 8, 2023
e13e854
need mutability here, I think?
molpopgen May 8, 2023
00fbc28
start to work on checking if we need new chunk
molpopgen May 8, 2023
ffeb382
another todo
molpopgen May 12, 2023
df54097
do one todo
molpopgen May 18, 2023
95b9145
fiddle with the error checking a bit
molpopgen May 18, 2023
53ee0f8
and we are gettign the wrong answers from the previous loop...
molpopgen May 18, 2023
8d47cab
and we are gettign the wrong answers from the previous loop...
molpopgen May 18, 2023
0cd5dff
split tests
molpopgen May 18, 2023
d403c60
some more print help
molpopgen May 18, 2023
a0ca991
start to abstract out inner ops
molpopgen May 19, 2023
5930628
fix closure
molpopgen May 19, 2023
8b1bd9b
hit the borrow checker
molpopgen May 19, 2023
368312f
solve borrow checker
molpopgen May 19, 2023
ebcf1a1
baby steps
molpopgen May 19, 2023
ac93ef6
outline next steps
molpopgen May 19, 2023
1350c11
fmt
molpopgen May 19, 2023
b3fb1be
lint
molpopgen May 19, 2023
06ddd45
update other internal stuff that will need to abstract later
molpopgen May 19, 2023
5c406ae
better todo msg
molpopgen May 19, 2023
da7ec78
better better msg
molpopgen May 19, 2023
865e44b
fast path to passing tests
molpopgen May 19, 2023
5a6d452
fill final output
molpopgen May 19, 2023
4356db2
rename
molpopgen May 19, 2023
863c36b
add failing test
molpopgen May 19, 2023
49840e6
cleanz
molpopgen May 19, 2023
8d7c745
cleanz
molpopgen May 19, 2023
540e5ba
better test setup, now failing as expected
molpopgen May 19, 2023
10094cc
start over, using Python prototype as guidance
molpopgen Apr 15, 2024
2de5b31
We need the chunk length
molpopgen Apr 15, 2024
5b1b655
start crossover fn
molpopgen Apr 15, 2024
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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ forrustts = {version = "0.3.0-alpha.0", git = "https://github.com/ForwardSimulat
rand = "0.8.5"
rand_distr = "0.4.3"
clap = { version = "4.2.1", features = ["derive"] }
rclite = "0.2.2"

[dev-dependencies]
proptest = "1.1.0"
Expand Down
68 changes: 68 additions & 0 deletions src/genome_dynamic_chunks.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
use forrustts::genetics::GenerateBreakpoints;
use forrustts::genetics::GeneticMap;
use forrustts::prelude::*;

use crate::common::DiploidGenome;
use crate::common::Mutation;

struct Chunk {
mutations: Vec<usize>,
num_mutations: usize,
count: u32,
}

#[derive(Default, Clone)]
struct Genome {
chunks: Vec<usize>,
}

pub struct DiploidPopulation {
chunk_length: usize,
chunks: Vec<Chunk>,
mutations: Vec<Mutation>,
mutation_counts: Vec<u32>,
individuals: Vec<DiploidGenome>,
genomes: Vec<Genome>,
}

impl DiploidPopulation {
pub fn new(size: usize, chunk_length: usize) -> Self {
let genomes = vec![Genome::default(); 2 * size];
let individuals = vec![
DiploidGenome {
first: 0,
second: 0
};
size
];

Self {
chunk_length,
genomes,
individuals,
mutations: vec![],
mutation_counts: vec![],
chunks: vec![],
}
}
}

fn crossover(
genome1: usize,
genome2: usize,
mutations: &Vec<Mutation>,
crossover_position: Vec<Position>,
new_mutations: Vec<usize>,
genomes: &mut Vec<Genome>,
chunks: &mut Vec<Chunk>,
) -> Genome {
let mut current_genome = genome1;
let mut current_genome_index = 0_usize;
let mut current_genome_index_position = 0_usize;

let mut new_chunks = Vec::<usize>::default();

todo!("not done");

Genome { chunks: new_chunks }
}
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ mod common;

pub mod fwdpp_copy;
pub mod genome_array;
pub mod genome_dynamic_chunks;

// Public "API" for examples
pub use common::SimParams;