@@ -125,7 +125,7 @@ public Allele getRenamedAllele(VariantContext vc, Allele toCheck)
125125 Map <Allele , Allele > map = _encounteredAlleles .get (getEncounteredKey (vc .getStart (), vc .getReference ()));
126126 if (map == null )
127127 {
128- throw new IllegalArgumentException ("Ref not found: " + vc .toStringWithoutGenotypes ());
128+ throw new IllegalArgumentException ("Ref not found at pos " + _start + " : " + vc .toStringWithoutGenotypes () + ", existing: " + StringUtils . join ( _encounteredAlleles . keySet (), ";" ));
129129 }
130130
131131 Allele ret = map .get (toCheck );
@@ -151,11 +151,6 @@ public void addSite(VariantContext vc, Logger log)
151151 _encounteredAlleles .put (getEncounteredKey (vc .getStart (), vc .getReference ()), alleles );
152152 }
153153
154- public boolean isMergedRef ()
155- {
156- return _encounteredAlleles .size () > 1 ;
157- }
158-
159154 protected Allele extractAlleleForPosition (VariantContext vc , Allele a , Logger log )
160155 {
161156 int offset = _start - vc .getStart ();
@@ -293,7 +288,7 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
293288 int idx = 0 ;
294289 try (CSVWriter writer = new CSVWriter (IOUtil .openFileForBufferedUtf8Writing (output ), '\t' , CSVWriter .NO_QUOTE_CHARACTER ))
295290 {
296- writer .writeNext (new String []{"OutputFileId" , "ReadsetId" , "Contig" , "Start" , "End" , "Ref" , "AltAlleles" , "OrigRef" , "OrigAlts" , " Depth" , "RefAF" , "AltAFs" , "NonRefCount" , "AltCounts" });
291+ writer .writeNext (new String []{"OutputFileId" , "ReadsetId" , "Contig" , "Start" , "End" , "Ref" , "AltAlleles" , "Depth" , "RefAF" , "AltAFs" , "NonRefCount" , "AltCounts" });
297292
298293 for (Pair <String , Integer > site : whitelistSites )
299294 {
@@ -328,8 +323,6 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
328323 int depth = getReadDepth (so .getFile (), contigToOffset , site .getLeft (), site .getRight ());
329324 if (depth < minDepth )
330325 {
331- line .add ("" );
332- line .add ("" );
333326 line .add (String .valueOf (depth ));
334327 line .add ("ND" );
335328 line .add ("ND" );
@@ -338,8 +331,6 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
338331 }
339332 else
340333 {
341- line .add ("" );
342- line .add ("" );
343334 line .add (String .valueOf (depth ));
344335 line .add ("1" );
345336 line .add (";0" .repeat (siteDef ._alternates .size ()).substring (1 ));
@@ -355,10 +346,9 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
355346 {
356347 Integer siteDepth = null ;
357348 Double totalAltAf = 0.0 ;
358- Integer totalAltDepth = 0 ;
349+ int totalAltDepth = 0 ;
359350 Map <Allele , Double > alleleToAf = new HashMap <>();
360351 Map <Allele , Integer > alleleToDp = new HashMap <>();
361- Set <Allele > refs = new HashSet <>();
362352
363353 while (it .hasNext ())
364354 {
@@ -438,35 +428,6 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
438428 }
439429
440430 List <String > toWrite = new ArrayList <>(line );
441- if (!siteDef .isMergedRef ())
442- {
443- toWrite .add ("" );
444- toWrite .add ("" );
445- }
446- else
447- {
448- refs .remove (siteDef ._ref );
449- if (refs .isEmpty ())
450- {
451- toWrite .add ("" );
452- toWrite .add ("" );
453- }
454- else
455- {
456- toWrite .add (refs .stream ().map (Allele ::getBaseString ).collect (Collectors .joining (";" )));
457- List <String > alleleSets = new ArrayList <>();
458- refs .forEach (r -> {
459- if (!siteDef ._encounteredAlleles .containsKey (r ))
460- {
461- throw new IllegalArgumentException ("Reference not found: " + r .toString () + ", at site: " + siteDef ._start + ", all refs: " + refs .stream ().map (Allele ::toString ).collect (Collectors .joining ("," )) + ", allowed: " + StringUtils .join (siteDef ._encounteredAlleles .keySet (), "," ));
462- }
463-
464- alleleSets .add (StringUtils .join (siteDef ._encounteredAlleles .get (r ).keySet (), "," ));
465- });
466- toWrite .add (StringUtils .join (alleleSets , ";" ));
467- }
468- }
469-
470431 toWrite .add (String .valueOf (siteDepth ));
471432 toWrite .add (String .valueOf (1 - totalAltAf ));
472433
0 commit comments