5353import java .util .Arrays ;
5454import java .util .Collection ;
5555import java .util .Date ;
56+ import java .util .HashMap ;
5657import java .util .HashSet ;
5758import java .util .List ;
5859import java .util .Map ;
@@ -843,7 +844,7 @@ private static void processCSV(PrintWriter writer, boolean printHeader, File inp
843844 try (BufferedReader reader = Readers .getReader (inputCsv ))
844845 {
845846 String line ;
846- int chimericCallsRecovered = 0 ;
847+ Map < String , Integer > chimericCallsRecovered = new HashMap <>() ;
847848 int restoredTRDVAV = 0 ;
848849
849850 int lineIdx = 0 ;
@@ -904,24 +905,28 @@ else if (idx == 9)
904905 // Recover TRDV/TRAJ/TRAC:
905906 if (uniqueChains .size () > 1 )
906907 {
908+ // Defer to the constant region, if known:
907909 if (cGeneChain != null )
908910 {
909911 uniqueChains .clear ();
910912 uniqueChains .add (cGeneChain );
911- chimericCallsRecovered ++;
913+ String key = originalChain + "->" + cGeneChain + " (based on C-GENE)" ;
914+ chimericCallsRecovered .put (key , chimericCallsRecovered .getOrDefault (key , 0 ));
912915 }
913916 else if (uniqueChains .size () == 2 )
914917 {
915918 if ("TRD" .equals (vGeneChain ) && "TRA" .equals (jGeneChain ))
916919 {
917920 uniqueChains .clear ();
918- chimericCallsRecovered ++;
921+ String key = originalChain + "->" + vGeneChain + " (based on V-GENE)" ;
922+ chimericCallsRecovered .put (key , chimericCallsRecovered .getOrDefault (key , 0 ));
919923 uniqueChains .add (vGeneChain );
920924 }
921925 if ("TRA" .equals (vGeneChain ) && "TRD" .equals (jGeneChain ))
922926 {
923927 uniqueChains .clear ();
924- chimericCallsRecovered ++;
928+ String key = originalChain + "->" + vGeneChain + " (based on V-GENE)" ;
929+ chimericCallsRecovered .put (key , chimericCallsRecovered .getOrDefault (key , 0 ));
925930 uniqueChains .add (vGeneChain );
926931 }
927932 }
@@ -934,7 +939,7 @@ else if (uniqueChains.size() == 2)
934939 }
935940 else
936941 {
937- log .error ("Multiple chains detected [" + StringUtils .join (chains , "," )+ "], leaving original call alone: " + originalChain + ". " + tokens [6 ] + "/" + tokens [8 ] + "/" + tokens [9 ]);
942+ log .info ("Multiple chains detected [" + StringUtils .join (chains , "," )+ "], leaving original call alone: " + originalChain + ". " + tokens [6 ] + "/" + tokens [8 ] + "/" + tokens [9 ]);
938943 }
939944
940945 if (acceptableChains .contains (tokens [5 ]))
@@ -943,7 +948,15 @@ else if (uniqueChains.size() == 2)
943948 }
944949 }
945950
946- log .info ("\t Chimeric calls recovered: " + chimericCallsRecovered );
951+ if (!chimericCallsRecovered .isEmpty ())
952+ {
953+ log .info ("\t Chimeric calls recovered: " );
954+ for (String key : chimericCallsRecovered .keySet ())
955+ {
956+ log .info ("\t " + key + ": " + chimericCallsRecovered .get (key ));
957+ }
958+ }
959+
947960 log .info ("\t TRDV/AV calls restored: " + restoredTRDVAV );
948961 }
949962 }
0 commit comments