pub fn random_contigs() -> Vec<Vec<u8>> {
    // Generate a bunch of sequence chunks
    let mut rng = rand::thread_rng();

    let gamma_dist = Gamma::new(0.6, 25.0);

    let nchunks = max(5, gamma_dist.sample(&mut rng) as u32);
    let chunk_sample = Range::new(0, nchunks);

    let length_dist = Gamma::new(1.5, 200.0);

    let mut chunks: Vec<Vec<u8>> = Vec::new();
    for _ in 0..nchunks {
        let len = max(10, length_dist.sample(&mut rng) as usize);
        let seq = random_dna(len);
        chunks.push(seq);
    }

    // Now make a bunch of chromosomes by pasting together chunks
    let nchrom = max(4, gamma_dist.sample(&mut rng) as u32);

    let mut chroms = Vec::new();
    for _ in 0..nchrom {
        let chrom_chunks = max(4, gamma_dist.sample(&mut rng) as u32);

        let mut chrom_seq = Vec::new();
        for _ in 0..chrom_chunks {
            let chunk_idx = chunk_sample.sample(&mut rng) as usize;
            chrom_seq.extend(chunks[chunk_idx].clone());
        }
        chroms.push(chrom_seq);
    }

    chroms
}
// Generate random contigs with complicated repeats
Generate random contigs with complicated repeats
Generate random contigs with complicated repeats
pub fn random_contigs() -> Vec<Vec<u8>> {
    // Generate a bunch of sequence chunks
    let mut rng = rand::thread_rng();
    let gamma_dist = Gamma::new(0.6, 25.0);
    let nchunks = max(5, gamma_dist.sample(&mut rng) as u32);
    let chunk_sample = Range::new(0, nchunks);
    let length_dist = Gamma::new(1.5, 200.0);
    let mut chunks: Vec<Vec<u8>> = Vec::new();
    for _ in 0..nchunks {
        let len = max(10, length_dist.sample(&mut rng) as usize);
        let seq = random_dna(len);
        chunks.push(seq);
    }
    // Now make a bunch of chromosomes by pasting together chunks
    let nchrom = max(4, gamma_dist.sample(&mut rng) as u32);
    let mut chroms = Vec::new();
    for _ in 0..nchrom {
        let chrom_chunks = max(4, gamma_dist.sample(&mut rng) as u32);
        let mut chrom_seq = Vec::new();
        for _ in 0..chrom_chunks {
            let chunk_idx = chunk_sample.sample(&mut rng) as usize;
            chrom_seq.extend(chunks[chunk_idx].clone());
        }
        chroms.push(chrom_seq);
    }
    chroms
}
pub fn random_contigs ( ) -> Vec < Vec < u8 > > { // Generate a bunch of sequence chunks let mut rng = rand :: thread_rng ( ) ; let gamma_dist = Gamma :: new ( 0.6 , 25.0 ) ; let nchunks = max ( 5 , gamma_dist . sample ( & mut rng ) as u32 ) ; let chunk_sample = Range :: new ( 0 , nchunks ) ; let length_dist = Gamma :: new ( 1.5 , 200.0 ) ; let mut chunks : Vec < Vec < u8 > > = Vec :: new ( ) ; for _ in 0 .. nchunks { let len = max ( 10 , length_dist . sample ( & mut rng ) as usize ) ; let seq = random_dna ( len ) ; chunks . push ( seq ) ; } // Now make a bunch of chromosomes by pasting together chunks let nchrom = max ( 4 , gamma_dist . sample ( & mut rng ) as u32 ) ; let mut chroms = Vec :: new ( ) ; for _ in 0 .. nchrom { let chrom_chunks = max ( 4 , gamma_dist . sample ( & mut rng ) as u32 ) ; let mut chrom_seq = Vec :: new ( ) ; for _ in 0 .. chrom_chunks { let chunk_idx = chunk_sample . sample ( & mut rng ) as usize ; chrom_seq . extend ( chunks [ chunk_idx ] . clone ( ) ) ; } chroms . push ( chrom_seq ) ; } chroms }
Generate random contigs with complicated repeats
Generate random contigs with complicated repeats