extern crate getopts;
extern crate fasten;
use std::fs::File;
use std::io::BufReader;
use fasten::fasten_base_options;
use fasten::fasten_base_options_matches;
use fasten::io::fastq;
use fasten::io::seq::Cleanable;
use fasten::logmsg;
#[test]
fn challenge_dataset () {
let challenge_file = File::open("testdata/four_reads.gt_16_lines.fastq").expect("Could not open testdata/four_reads.gt_16_lines.fastq");
let challenge_buffer=BufReader::new(challenge_file);
let challenge_reader=fastq::FastqReader::new_careful(challenge_buffer);
let mut challenge_string = String::new();
for seq_obj in challenge_reader {
challenge_string.push_str(&seq_obj.to_string());
}
let easy_file = File::open("testdata/four_reads.fastq").expect("Could not open testdata/four_reads.fastq");
let easy_buffer= BufReader::new(easy_file);
let easy_reader=fastq::FastqReader::new(easy_buffer);
let mut easy_string = String::new();
for seq_obj in easy_reader {
easy_string.push_str(&seq_obj.to_string());
}
assert_eq!(challenge_string,easy_string);
}
fn main(){
let opts = fasten_base_options();
let matches = fasten_base_options_matches("Convert a fastq file to a standard 4-lines-per-entry format", opts);
if matches.opt_present("paired-end") {
logmsg("WARNING: --paired-end is not utilized in this script");
}
let my_file = File::open("/dev/stdin").expect("Could not open file");
let my_buffer=BufReader::new(my_file);
let fastq_reader=fastq::FastqReader::new_careful(my_buffer);
for seq in fastq_reader {
seq.print();
}
}