@@ -132,11 +132,11 @@ private String getEncounteredKey(int start, Allele ref)
132132 return start + ":" + ref .getBaseString ();
133133 }
134134
135- public void addSite (VariantContext vc )
135+ public void addSite (VariantContext vc , Logger log )
136136 {
137137 Map <Allele , Allele > alleles = _encounteredAlleles .getOrDefault (getEncounteredKey (vc .getStart (), vc .getReference ()), new HashMap <>());
138138 vc .getAlternateAlleles ().forEach (a -> {
139- Allele translated = extractAlleleForPosition (vc , a );
139+ Allele translated = extractAlleleForPosition (vc , a , log );
140140 if (translated != null )
141141 {
142142 if (!alleles .containsKey (a ))
@@ -154,9 +154,15 @@ public boolean isMergedRef()
154154 return _encounteredAlleles .size () > 1 ;
155155 }
156156
157- protected Allele extractAlleleForPosition (VariantContext vc , Allele a )
157+ protected Allele extractAlleleForPosition (VariantContext vc , Allele a , Logger log )
158158 {
159159 int offset = vc .getStart () - _start ;
160+ if (offset < 0 )
161+ {
162+ log .error ("Site located after vc start: " + _start );
163+ log .error (vc .toStringWithoutGenotypes ());
164+ log .error (a .getBaseString ());
165+ }
160166
161167 //deletion
162168 if (a .length () <= offset )
@@ -264,7 +270,7 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
264270 }
265271
266272 //NOTE: the start position of this SiteAndAlleles might differ from the VC
267- siteToAllele .get (key ).addSite (vc );
273+ siteToAllele .get (key ).addSite (vc , ctx . getLogger () );
268274 }
269275 }
270276 }
0 commit comments