We also have to allow the window to be (partially) outside the bounds and trimming to the contig size is not enough (thanks to shards). Now we trim to the current bounds too (i.e. if the interval is not completely within current bounds, we create reference context that contains only bases from the overlap between the interval and the bounds).
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3057 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
9053406798
commit
d2944461ef
|
|
@ -157,9 +157,15 @@ public class LocusReferenceView extends ReferenceView {
|
|||
this.referenceSequence = reference.getSubsequenceAt( locus.getContig(), locus.getStart(), locus.getStop() );
|
||||
}
|
||||
|
||||
protected GenomeLoc trimToBounds(GenomeLoc l) {
|
||||
if ( l.getStart() < bounds.getStart() ) l = GenomeLocParser.setStart(l, bounds.getStart());
|
||||
if ( l.getStop() > bounds.getStop() ) l = GenomeLocParser.setStop(l, bounds.getStop());
|
||||
return l;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the reference context associated with this particular point on the genome.
|
||||
* @param genomeLoc Region for which to retrieve the base. GenomeLoc must represent a 1-base region.
|
||||
* Gets the reference context associated with this particular point or extended interval on the genome.
|
||||
* @param genomeLoc Region for which to retrieve the base(s). If region spans beyond contig end or beoynd current bounds, it will be trimmed down.
|
||||
* @return The base at the position represented by this genomeLoc.
|
||||
*/
|
||||
public ReferenceContext getReferenceContext( GenomeLoc genomeLoc ) {
|
||||
|
|
@ -169,6 +175,7 @@ public class LocusReferenceView extends ReferenceView {
|
|||
char[] bases = null;
|
||||
|
||||
if(bounds != null) {
|
||||
window = trimToBounds(window);
|
||||
bases = StringUtil.bytesToString( referenceSequence.getBases(), (int)(window.getStart() - getWindowStart(bounds)), (int)window.size() ).toCharArray();
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue