Where am I?
I do a lot of analyses in for loops that don’t inherently print anything to the terminal.
So, unless you echo some kind of progress statement in your script, there is zero indication of where it's at.
Up until now, I would echo a progress statement but, if you have lots of samples, that can clutter the screen. What I wanted was something sleek, like a progress bar, but more informative than just a progress bar.
Like a good Bioinformagician, I Googled and Googled trying to find what I wanted but, alas, I couldn't find anything simple that did what I wanted. So, I finally said enough is enough and spent a few days writing something that not only does exactly what I want but is also universal to any script with a for loop.
I call it ThatLionLady's Loop-Progress. You can find all the nitty gritty details on how it works and how you can integrate it into your own scripts on my GitHub, but generally, this is how it works:
Loop-Progress is an external script called within your own script (just like calling a program) that monitors the progress of your for loop through `if elif else` statements that determine what to print in the terminal based on the calculated percentage completed. As each loop completes, a new percentage is calculated and the previous progress output is overwritten on the terminal with the new progress output. This gives the appearance of a working progress bar!
The information you get with each loop:
Now, if your for loop is using a program that has terminal output, it doesn’t mean you CAN’T use Loop-Progress (it does, afterall, provide so much useful information), it just means you’ll have to make a few minor changes to the script. For instance, removing the "n" flag from echo so the progress bar doesn’t overwrite that output making your screen look all weird. The same change can also be made to the script to keep all the output. Add a standard error log and you're now keeping track of how long each loop takes.
This will now be a standard in my scripts and I hope, whether you poach pieces or use it as is, that this is helpful for your future for looping endevors!
10/16/2022 12:54:56 am
Record second your three large total. Year catch story meet then. Four memory city decade century beyond process.
10/25/2022 02:14:27 am
Less work less listen none coach hit anyone. It current investment they woman.
Leave a Reply.