diff --git a/src/bin/friends_emma.rs b/src/bin/friends_emma.rs index 7b0eaa9a..306e952b 100644 --- a/src/bin/friends_emma.rs +++ b/src/bin/friends_emma.rs @@ -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); + } } } diff --git a/tests/friends_emma.sh b/tests/friends_emma.sh index 95885aee..e9286e3b 100644 --- a/tests/friends_emma.sh +++ b/tests/friends_emma.sh @@ -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";