Test for missing read group
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4192 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
acd6bd2430
commit
590bb50d16
|
|
@ -86,7 +86,7 @@ public class CoverageUtils {
|
|||
Map<SAMReadGroupRecord, int[]> countsByRG = new HashMap<SAMReadGroupRecord,int[]>();
|
||||
for ( PileupElement e : context.getBasePileup() ) {
|
||||
if ( e.getMappingQual() >= minMapQ && e.getMappingQual() <= maxMapQ && ( e.getQual() >= minBaseQ && e.getQual() <= maxBaseQ || e.isDeletion() ) ) {
|
||||
SAMReadGroupRecord readGroup = e.getRead().getReadGroup();
|
||||
SAMReadGroupRecord readGroup = getReadGroup(e.getRead());
|
||||
if ( ! countsByRG.keySet().contains(readGroup) ) {
|
||||
countsByRG.put(readGroup,new int[6]);
|
||||
updateCounts(countsByRG.get(readGroup),e);
|
||||
|
|
@ -112,4 +112,16 @@ public class CoverageUtils {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static SAMReadGroupRecord getReadGroup(SAMRecord r) {
|
||||
SAMReadGroupRecord rg = r.getReadGroup();
|
||||
if ( rg == null ) {
|
||||
String msg = "Read "+r.getReadName()+" lacks read group information.";
|
||||
msg += " Please associate all reads with read groups [recommended]\n";
|
||||
msg += " Or run with -rf MissingReadGroup [not recommended]";
|
||||
throw new StingException(msg);
|
||||
}
|
||||
|
||||
return rg;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue