Skip to content

Commit

Permalink
cleanup warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Henk den Bakker authored and Henk den Bakker committed Nov 29, 2018
1 parent 7878675 commit ff7e5bb
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 23 deletions.
3 changes: 1 addition & 2 deletions src/batch_search_pe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use fasthash;
use fnv;
use kmer;
use reports;
use std;
use std::collections::HashMap;
use std::time::SystemTime;

Expand Down Expand Up @@ -61,7 +60,7 @@ pub fn batch_search(
let mut first = kmer_slices[0].to_owned();
for i in 1..num_hash {
let j = i as usize;
first.intersect(&kmer_slices[j]).to_owned();
first.intersect(&kmer_slices[j]);
}
let mut hits = Vec::new();
for i in 0..first.len() {
Expand Down
6 changes: 0 additions & 6 deletions src/bigsi.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
use bincode::{deserialize, deserialize_from, serialize};
use bit_vec::BitVec;
use fnv;
use std;
use std::collections::HashMap;
use std::fs;
use std::fs::File;
use std::fs::OpenOptions;
use std::io;
use std::io::prelude::*;
use std::io::BufReader;
use std::io::Write;
use std::path::Path;

#[derive(Serialize, Deserialize, PartialEq, Debug)]
pub struct BigsyMap {
Expand Down
1 change: 0 additions & 1 deletion src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use std::collections::HashMap;
use std::fs::File;
use std::io;
use std::io::prelude::*;
use std::sync::Arc;

pub fn tab_to_map(filename: String) -> fnv::FnvHashMap<std::string::String, Vec<String>> {
let mut map = fnv::FnvHashMap::default();
Expand Down
1 change: 0 additions & 1 deletion src/kmer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use fnv;
use seq;
use std;
use std::cmp;
use std::collections::HashMap;
use std::fs::File;
use std::io;
use std::io::prelude::*;
Expand Down
2 changes: 0 additions & 2 deletions src/perfect_search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ use bit_vec::BitVec;
use fasthash;
use fnv;
use kmer;
use std;
use std::collections::HashMap;

pub fn batch_search(
files: Vec<&str>,
Expand Down
22 changes: 13 additions & 9 deletions src/read_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub fn tab_to_map(
map
}

#[allow(unused_assignments)]
pub fn read_filter_pe(
class_map: std::collections::HashMap<std::string::String, String>,
filenames: Vec<&str>,
Expand Down Expand Up @@ -81,20 +82,20 @@ pub fn read_filter_pe(
if !class_map.contains_key(v[0]) {
gz1.write_all(
format!("{}\n{}\n+\n{}\n", header1, seq1, qual1).as_bytes(),
);
).expect("could not write R1!");
gz2.write_all(
format!("{}\n{}\n+\n{}\n", header2, seq2, qual2).as_bytes(),
);
).expect("could not write R2!");
excluded += 1;
}
} else {
if class_map.contains_key(v[0]) {
gz1.write_all(
format!("{}\n{}\n+\n{}\n", header1, seq1, qual1).as_bytes(),
);
).expect("could not write R1!");
gz2.write_all(
format!("{}\n{}\n+\n{}\n", header2, seq2, qual2).as_bytes(),
);
).expect("could not write R2!");
included += 1;
}
}
Expand All @@ -104,8 +105,8 @@ pub fn read_filter_pe(
}
line_count += 1;
}
gz1.finish();
gz2.finish();
gz1.finish().expect("Could not close new R1 file");
gz2.finish().expect("Could not close new R2 file");
if exclude == true {
eprintln!(
"Excluded {} read pairs with classification containing '{}' from output files",
Expand All @@ -120,6 +121,7 @@ pub fn read_filter_pe(
}

//quicker to adjust the function to se
#[allow(unused_assignments)]
pub fn read_filter_se(
class_map: std::collections::HashMap<std::string::String, String>,
filenames: Vec<&str>,
Expand Down Expand Up @@ -149,19 +151,21 @@ pub fn read_filter_se(
let v: Vec<&str> = header1.split(' ').collect();
if exclude == true {
if !class_map.contains_key(v[0]) {
gz1.write_all(format!("{}\n{}\n+\n{}\n", header1, seq1, qual1).as_bytes());
gz1.write_all(format!("{}\n{}\n+\n{}\n", header1, seq1, qual1).as_bytes())
.expect("Could not write forward read(-s) to file");
excluded += 1;
}
} else {
if class_map.contains_key(v[0]) {
gz1.write_all(format!("{}\n{}\n+\n{}\n", header1, seq1, qual1).as_bytes());
gz1.write_all(format!("{}\n{}\n+\n{}\n", header1, seq1, qual1).as_bytes())
.expect("Could not write reverse read(-s) to file");
included += 1;
}
}
}
line_count += 1;
}
gz1.finish();
gz1.finish().expect("Could not close new read file");
if exclude == true {
eprintln!(
"Excluded {} read pairs with classification containing '{}' from output files",
Expand Down
5 changes: 3 additions & 2 deletions src/read_id_mt_pe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ use fasthash;
use flate2::read::MultiGzDecoder;
use fnv;
use kmer;
use kmer::minimerize_vector;
use murmurhash64::murmur_hash64a;
use probability::prelude::*;
use rayon::prelude::*;
use rayon::ThreadPoolBuilder;
Expand Down Expand Up @@ -254,6 +252,7 @@ impl Fasta {
}
}

#[allow(unused_assignments)]
pub fn stream_fasta(
filenames: Vec<&str>,
bigsi_map: &fnv::FnvHashMap<usize, BitVec>, //has to be an Arc ?
Expand Down Expand Up @@ -431,6 +430,7 @@ pub fn false_prob(m: f64, k: f64, n: f64) -> f64 {
(1.0 - e.powf(-((k * (n + 0.5)) / (m - 1.0)))).powf(k)
}

#[allow(unused_assignments)]
pub fn per_read_stream_pe(
filenames: Vec<&str>,
bigsi_map: &fnv::FnvHashMap<usize, BitVec>, //has to be an Arc
Expand Down Expand Up @@ -630,6 +630,7 @@ pub fn per_read_stream_pe(
}
}

#[allow(unused_assignments)]
pub fn per_read_stream_se(
filenames: Vec<&str>,
bigsi_map: &fnv::FnvHashMap<usize, BitVec>, //has to be an Arc ?
Expand Down

0 comments on commit ff7e5bb

Please sign in to comment.