This commit is contained in:
Tamir Duberstein 2015-04-21 21:27:29 -07:00
parent 8871c17b76
commit 41ff911ae8
2 changed files with 3 additions and 5 deletions

View File

@ -13,8 +13,6 @@
// multi tasking k-nucleotide
#![allow(bad_style)]
use std::ascii::AsciiExt;
use std::cmp::Ordering::{self, Less, Greater, Equal};
use std::collections::HashMap;
@ -47,7 +45,7 @@ fn sort_and_fmt(mm: &HashMap<Vec<u8> , usize>, total: usize) -> String {
}
// sort by key, then by value
fn sortKV(mut orig: Vec<(Vec<u8> ,f64)> ) -> Vec<(Vec<u8> ,f64)> {
fn sort_kv(mut orig: Vec<(Vec<u8> ,f64)> ) -> Vec<(Vec<u8> ,f64)> {
orig.sort_by(|&(ref a, _), &(ref b, _)| a.cmp(b));
orig.sort_by(|&(_, a), &(_, b)| f64_cmp(b, a));
orig
@ -60,7 +58,7 @@ fn sort_and_fmt(mm: &HashMap<Vec<u8> , usize>, total: usize) -> String {
pairs.push(((*key).clone(), pct(val, total)));
}
let pairs_sorted = sortKV(pairs);
let pairs_sorted = sort_kv(pairs);
let mut buffer = String::new();
for &(ref k, v) in &pairs_sorted {

View File

@ -205,7 +205,7 @@ fn parallel<I: Iterator, F>(iter: I, ref f: F)
fn main() {
let mut data = Vec::with_capacity(1024 * 1024);
io::stdin().read_to_end(&mut data);
io::stdin().read_to_end(&mut data).unwrap();
let tables = &Tables::new();
parallel(mut_dna_seqs(&mut data), |seq| reverse_complement(seq, tables));
io::stdout().write_all(&data).unwrap();