@@ -127,6 +127,7 @@ public void prepareHashingAndCiteSeqFilesIfNeeded(File sourceDir, PipelineJob jo
127127 FieldKey .fromString ("citeseqReadsetId/totalFiles" ),
128128 FieldKey .fromString ("citeseqPanel" ),
129129 FieldKey .fromString ("status" ),
130+ FieldKey .fromString ("plateId" ),
130131 FieldKey .fromString ("readsetId" ))
131132 );
132133
@@ -151,6 +152,7 @@ public void prepareHashingAndCiteSeqFilesIfNeeded(File sourceDir, PipelineJob jo
151152 writer .writeNext (new String []{"ReadsetId" , "CDNA_ID" , "SubjectId" , "Stim" , "Population" , "HashingReadsetId" , "HasHashingReads" , "HTO_Name" , "HTO_Seq" , "CiteSeqReadsetId" , "HasCiteSeqReads" , "CiteSeqPanel" });
152153 Set <String > distinctHTOs = new HashSet <>();
153154 Set <Boolean > hashingStatus = new HashSet <>();
155+ Map <String , Set <String >> plateToHto = new HashMap <>();
154156 AtomicInteger totalWritten = new AtomicInteger (0 );
155157 for (Readset rs : cachedReadsets )
156158 {
@@ -186,10 +188,17 @@ public void prepareHashingAndCiteSeqFilesIfNeeded(File sourceDir, PipelineJob jo
186188 uniqueGex .add (results .getInt (FieldKey .fromString ("readsetId" )));
187189 }
188190
189- boolean useCellHashing = results .getObject (FieldKey .fromString ("sortId/hto" )) != null ;
190- hashingStatus . add ( useCellHashing );
191- if (useCellHashing )
191+ boolean hasHTO = results .getObject (FieldKey .fromString ("sortId/hto" )) != null ;
192+
193+ if (! plateToHto . containsKey ( results . getString ( FieldKey . fromString ( "plateId" ))) )
192194 {
195+ plateToHto .put (results .getString (FieldKey .fromString ("plateId" )), new HashSet <>());
196+ }
197+
198+ if (hasHTO )
199+ {
200+ plateToHto .get (results .getString (FieldKey .fromString ("plateId" ))).add (results .getString (FieldKey .fromString ("sortId/hto" )));
201+
193202 if (results .getObject (FieldKey .fromString ("hashingReadsetId" )) == null )
194203 {
195204 // NOTE: there can be lanes with single HTOs/lane. This will fail down the line
@@ -244,12 +253,17 @@ public void prepareHashingAndCiteSeqFilesIfNeeded(File sourceDir, PipelineJob jo
244253 throw new PipelineJobException ("There is a problem with either cell hashing or CITE-seq. See the file: " + output .getName ());
245254 }
246255
256+ // If there is one HTO per plate, hashing is not actually needed:
257+ for (String plateId : plateToHto .keySet ())
258+ {
259+ Set <String > htos = plateToHto .get (plateId );
260+ hashingStatus .add (htos .size () > 1 );
261+ }
262+
247263 if (hashingStatus .size () > 1 )
248264 {
249265 job .getLogger ().info ("The selected readsets/cDNA records use a mixture of cell hashing and non-hashing." );
250266 }
251-
252- //NOTE: hashingStatus.isEmpty() indicates there are no cDNA records associated with the data
253267 }
254268
255269 if (doH5Caching )
0 commit comments