Utility method added: getQualsInCycleOrder(read) - examines the read and returns its quals in the order the machine read them (i.e. always from cycle 1 to cycle N). Simply inverts quals if the read happens to be rc-aligned :)

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3183 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
asivache 2010-04-16 00:15:57 +00:00
parent f4673efd2f
commit 6dc1275cfb
1 changed files with 13 additions and 0 deletions

View File

@ -339,4 +339,17 @@ public class AlignmentUtils {
&& r.getAlignmentStart() != SAMRecord.NO_ALIGNMENT_START ) return false ;
return true;
}
/** Returns the array of base qualitites in the order the bases were read on the machine (i.e. always starting from
* cycle 1). In other words, if the read is unmapped or aligned in the forward direction, the read's own base
* qualities are returned as stored in the SAM record; if the read is aligned in the reverse direction, the array
* of read's base qualitites is inverted (in this case new array is allocated and returned).
* @param read
* @return
*/
public static byte [] getQualsInCycleOrder(SAMRecord read) {
if ( isReadUnmapped(read) || ! read.getReadNegativeStrandFlag() ) return read.getBaseQualities();
return BaseUtils.reverse(read.getBaseQualities());
}
}