From 13ccfc2147c1f7c52f8e9fc624fd2cc4aa061105 Mon Sep 17 00:00:00 2001 From: Jake Date: Mon, 5 Feb 2024 13:25:21 -0500 Subject: [PATCH] Adds logging based on historic troubleshooting incidents. Could be expanded in the future based on future issues --- fatools/lib/fautil/cmds.py | 15 ++++++++++++++- fatools/lib/fautil/mixin2.py | 13 ++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/fatools/lib/fautil/cmds.py b/fatools/lib/fautil/cmds.py index 7038456..5190161 100644 --- a/fatools/lib/fautil/cmds.py +++ b/fatools/lib/fautil/cmds.py @@ -140,6 +140,7 @@ def init_argparser(parser=None): def main(args): + cerr('***** Entering main in FATools *****') if args.verbose != 0: set_verbosity(args.verbose) @@ -203,6 +204,7 @@ def main(args): def do_facmds(args, fsa_list, _params, dbh=None): + cerr('***** Entering do_facmds in FATools *****') if args.ladder_rfu_threshold >= 0: _params.ladder.min_rfu = args.ladder_rfu_threshold @@ -286,12 +288,16 @@ def do_align( args, fsa_list, _params, f_bad_files, dbh ): fsa.align(_params) good_fsa.append( (fsa, fsa_index) ) except LadderMismatchException: + cerr('***** LadderMismatchException: {} *****'.format(fsa)) + f_bad_files.write(("LadderMismatch: %s\n") % fsa.filename) - + + cerr('***** good_fsas: {} *****'.format(good_fsa)) return good_fsa def do_call( args, fsa_list, params, dbh ): + cerr('***** Entering do_call *****') cerr('I: Calling non-ladder peaks...') @@ -319,6 +325,7 @@ def do_normalize( args, fsa_list, params ): panel = Panel.get_panel(args.panel) ladder_means = panel.get_ladder_area_means(fsa_list) + cerr('***** ladder_means: {} *****'.format(ladder_means)) # normalize areas for each FSA for (fsa, fsa_index) in fsa_list: @@ -641,6 +648,8 @@ def open_fsa( args, _params ): os.makedirs('.fatools_caches/channels') if args.file: + cerr('***** Reading args.file *****') + for fsa_filename in args.file.split(','): fsa_filename = fsa_filename.strip() @@ -655,6 +664,7 @@ def open_fsa( args, _params ): index += 1 elif args.infile: + cerr('***** Reading args.infile *****') with open(args.infile) as f: buf, delim = detect_buffer( f.read() ) @@ -691,6 +701,8 @@ def open_fsa( args, _params ): index += 1 elif args.indir: + cerr('***** Reading args.indir *****') + import glob for fsa_filename in sorted(glob.glob(args.indir+"/*.fsa")): @@ -700,6 +712,7 @@ def open_fsa( args, _params ): fsa_list.append( (fsa, str(index)) ) index += 1 + cerr('***** fsa_list: {} *****'.format(fsa_list)) return fsa_list diff --git a/fatools/lib/fautil/mixin2.py b/fatools/lib/fautil/mixin2.py index ca54717..8442fd3 100644 --- a/fatools/lib/fautil/mixin2.py +++ b/fatools/lib/fautil/mixin2.py @@ -62,7 +62,9 @@ def assign(self): self.marker = marker - def get_alleles(self, broad_peaks_only=True): + def get_alleles(self, broad_peaks_only=True): + cerr('***** Entering ChannelMixin.get_alleles *****') + if self.status == const.channelstatus.reseted: # create alleles first raise RuntimeError('E: channel needs to be scanned first') @@ -73,6 +75,7 @@ def get_alleles(self, broad_peaks_only=True): # ChannelMixIn scan method def scan(self, parameters): + cerr('***** Entering ChannelMixin.scan *****') if self.status != const.channelstatus.reseted: return @@ -81,6 +84,7 @@ def scan(self, parameters): def preannotate(self, parameters): + cerr('***** Entering ChannelMixin.preannotate *****') params = parameters.ladder if self.is_ladder() else parameters.nonladder @@ -90,6 +94,8 @@ def preannotate(self, parameters): # ChannelMixIn align method def align(self, parameters, ladder=None, anchor_pairs=None, saturated_peak_rtimes=[]): # sanity checks + cerr('***** Entering ChannelMixin.align *****') + if self.marker.code != 'ladder': raise RuntimeError('E: align() must be performed on ladder channel!') @@ -277,6 +283,7 @@ def create_channels(self, params): # FSAMixIn scan method def scan(self, parameters): + cerr('***** Entering FSAMixIn.scan *****') if self.scan_done: return @@ -291,6 +298,7 @@ def scan(self, parameters): # FSAMixIn align method def align(self, parameters=None): + cerr('***** Entering FSAMixIn.align *****') self.scan(parameters) @@ -299,6 +307,7 @@ def align(self, parameters=None): # FSAMixIn call method def call(self, parameters): + cerr('***** Entering FSAMixIn.call *****') if self.call_done: return @@ -335,6 +344,7 @@ def get_ladder_channel(self): for c in self.channels: if c.marker.code == 'ladder': + cerr('***** get_ladder_channel: {} *****'.format(c)) return c raise RuntimeError('E: ladder channel not found') @@ -442,6 +452,7 @@ def get_marker(self, dye): def get_ladder(self): + cerr('***** ladder: {} *****'.format(const.ladders[ self.data['ladder']])) return const.ladders[ self.data['ladder']]