Skip to content

Commit

Permalink
add pushing to chroms and chrLens in prep prep for bigiwig creation #1
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldcampbelljr committed Mar 18, 2024
1 parent 9dad085 commit ca68db4
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions genimtools/src/uniwig/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub fn uniwig_main(sorted: bool, _smoothsize:i32, _writesize:i32, combinedbedpat
file_names[1] = format!("{}_{}", bwfileheader, "end.bw");
file_names[2] = format!("{}_{}", bwfileheader, "core.bw");

let _chrom_sizes = match read_chromosome_sizes(combinedbedpath) {
let chrom_sizes = match read_chromosome_sizes(combinedbedpath) {
Ok(chrom_sizes) => chrom_sizes,
Err(err) => {
println!("Error reading chromosome sizes: {}", err);
Expand All @@ -173,7 +173,20 @@ pub fn uniwig_main(sorted: bool, _smoothsize:i32, _writesize:i32, combinedbedpat

println!("Sorted is true");

let mut _chromosomes: Vec<Chromosome> = read_bed_vec(combinedbedpath);
let mut chromosomes: Vec<Chromosome> = read_bed_vec(combinedbedpath);

let num_chromosomes = chromosomes.len();
// Preallocate memory based on number of chromsomes from previous step
let mut chroms: Vec<String> = Vec::with_capacity(num_chromosomes);
let mut chr_lens: Vec<i32> = Vec::with_capacity(num_chromosomes);

for chromosome in chromosomes.iter(){
let chrom_name = chromosome.chrom.clone();
chroms.push(chrom_name);
chr_lens.push(chrom_sizes[&chromosome.chrom]); // retrieve size from hashmap


}


} else{
Expand Down

0 comments on commit ca68db4

Please sign in to comment.