Die with appropriate error message if we try to read past the end
of a chromosome. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@261 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
24e8581c30
commit
3248176118
|
|
@ -123,11 +123,16 @@ public class ReferenceIterator implements Iterator<ReferenceIterator> {
|
|||
assert seekContigName.equals(currentContig.getName()) : String.format("only works on this contig, but the current %s and sought %s contigs are different!", currentContig.getName(), seekContigName);
|
||||
|
||||
// we're somewhere on this contig
|
||||
if ( seekOffset < offset || seekOffset >= currentContig.length() ) {
|
||||
// bad boy -- can't go backward safely or just beyond the contig length
|
||||
if ( seekOffset < offset ) {
|
||||
// bad boy -- can't go backward safely
|
||||
throw new IllegalArgumentException(String.format("Invalid seek to %s from %s, which is usually due to out of order reads%n",
|
||||
new GenomeLoc(currentContig.getName(), seekOffset), new GenomeLoc(currentContig.getName(), offset)));
|
||||
}
|
||||
else if ( seekOffset >= currentContig.length() ) {
|
||||
// bad boy -- can't go beyond the contig length
|
||||
throw new IllegalArgumentException(String.format("Invalid seek to %s, which is beyond the end of the contig%n",
|
||||
new GenomeLoc(currentContig.getName(), seekOffset+1)));
|
||||
}
|
||||
else {
|
||||
offset = seekOffset - 1;
|
||||
return next();
|
||||
|
|
|
|||
Loading…
Reference in New Issue