added a fix for overlapping reads in the locus context

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1153 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
aaron 2009-07-02 02:08:59 +00:00
parent 6570ce0b5b
commit bb92eb8b1c
1 changed files with 7 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package org.broadinstitute.sting.gatk.datasources.providers;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.Utils;
import net.sf.picard.reference.ReferenceSequence;
import net.sf.samtools.util.StringUtil;
/**
@ -63,8 +64,12 @@ public class LocusReferenceView extends ReferenceView {
* at the end of the locus (inclusive).
*/
public char[] getReferenceBases( GenomeLoc genomeLoc ) {
ReferenceSequence subsequence = reference.getSubsequenceAt(genomeLoc.getContig(),genomeLoc.getStart(),genomeLoc.getStop());
return StringUtil.bytesToString(subsequence.getBases()).toCharArray();
long stop = genomeLoc.getStop();
if (reference.getSequence(genomeLoc.getContig()).length() > genomeLoc.getStart()) {
stop = reference.getSequence(genomeLoc.getContig()).length();
}
ReferenceSequence subsequence = reference.getSubsequenceAt(genomeLoc.getContig(),genomeLoc.getStart(),stop);
return (StringUtil.bytesToString(subsequence.getBases()) + Utils.dupString('X', (int)(genomeLoc.getStop() - stop)) ).toCharArray();
}
/**