@@ -1184,19 +1184,23 @@ def get_noindex_stats(self, sub_demux):
11841184 runstats_json_path = os .path .join (
11851185 self .run_dir , f"Demultiplexing_{ sub_demux } " , "RunStats.json"
11861186 )
1187+ if not os .path .exists (runstats_json_path ):
1188+ logger .error (
1189+ f"No RunStats.json file found for sub-demultiplexing { sub_demux } . Unable to process NoIndex samples. Skipping."
1190+ )
1191+ raise FileNotFoundError
11871192 samples = []
11881193 for sample_row in sample_rows :
11891194 sample_name = sample_row .split ("," )[0 ]
11901195 lane = sample_row .split ("," )[3 ]
11911196 # Extract NumPolonies from RunStats.json
1192- if os .path .exists (runstats_json_path ):
1193- with open (runstats_json_path ) as json_file :
1194- demux_info = json .load (json_file )
1195- demuxed_lanes = demux_info .get ("Lanes" )
1196- for demuxed_lane in demuxed_lanes :
1197- if demuxed_lane .get ("Lane" ) == int (lane ):
1198- polonies = demuxed_lane .get ("NumPolonies" )
1199- break
1197+ with open (runstats_json_path ) as json_file :
1198+ demux_info = json .load (json_file )
1199+ demuxed_lanes = demux_info .get ("Lanes" )
1200+ for demuxed_lane in demuxed_lanes :
1201+ if demuxed_lane .get ("Lane" ) == int (lane ):
1202+ polonies = demuxed_lane .get ("NumPolonies" )
1203+ break
12001204 sample_info = {
12011205 "SampleName" : sample_name ,
12021206 "I1" : "" ,
0 commit comments