Skip to content

Commit

Permalink
fixed emma pe mode and added testing
Browse files Browse the repository at this point in the history
  • Loading branch information
lskatz committed Apr 18, 2018
1 parent 370d8f8 commit 2fff2e3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/bin/friends_emma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,18 @@ fn main(){
qual_cigar.push(qual_recalc_char);
}

println!("@{}\n{}\n+\n{}",seq_counter,seq,qual_cigar);
if paired_end {
// split the seq and qual for paired end
let separator_pos = seq.find(READ_SEPARATOR).expect("ERROR finding read separator");
let r1_seq = seq[0..separator_pos].to_string();
let r2_seq = seq[separator_pos+1..].to_string();
let r1_qual= qual_cigar[0..separator_pos].to_string();
let r2_qual= qual_cigar[separator_pos+1..].to_string();
println!("@{}/1\n{}\n+\n{}",seq_counter,r1_seq,r1_qual);
println!("@{}/2\n{}\n+\n{}",seq_counter,r2_seq,r2_qual);
} else {
println!("@{}\n{}\n+\n{}",seq_counter,seq,qual_cigar);
}
}
}

Expand Down
12 changes: 12 additions & 0 deletions tests/friends_emma.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,16 @@ if [ "$total_quals" != "259.31" ]; then
exit 1
fi

pe_collapsed=$(cat $INPUT $INPUT $INPUT | ./target/debug/friends_emma --paired-end | ./target/debug/friends_rachel --each-read)
IDs=$(echo "$pe_collapsed" | cut -f 1 | tail -n +2 | paste -sd+)
pe_quals=$(echo "$pe_collapsed" | cut -f 3 | tail -n +2 | paste -sd+ | bc -l)
if [ "$IDs" != "1/1+1/2+2/1+2/2+3/1+3/2+4/1+4/2" ]; then
echo "Test failed for total expected quality when collapsing three sets of reads using --paired-end"
exit 1
fi
if [ "$total_quals" != "$pe_quals" ]; then
echo "Test failed for having the same quality scores in SE mode as PE mode"
exit 1
fi

echo "$0 passed";

0 comments on commit 2fff2e3

Please sign in to comment.