sr320 / course-fish546-2018

7 stars 2 forks source link

Intricacies of for loops in jupyter notebook #73

Closed laurahspencer closed 5 years ago

laurahspencer commented 5 years ago

I'm running for loops in a Jupyter Notebook using bash and have encountered a couple issues:

  1. Can't figure out how to redirect the output to a text file. I've tried the suggestions listed in this stackoverflow post, but none have successfully worked. Here's an example of my attempt - also tried >> out.txt inside the loop before done.

image

  1. A variable I set outside the loop (path to a program) isn't working inside the loop

image

sr320 commented 5 years ago
  1. I think you want to write out standard error prior to done

2> $file.err

  1. does not seem to be an impediment?

If you post jupyter nb on github I can troubleshoot.

kubu4 commented 5 years ago
  1. What @sr320 said.

  2. Agree with @sr320 . Also, I don't see that variable defined in that cell. Is it defined earlier in the notebook? Note, @yaaminiv had/has an issue with using variables defined outside of her current cell (https://github.com/RobertsLab/resources/issues/488#issuecomment-439194085) as well.

laurahspencer commented 5 years ago
  1. This is what worked (outside of loop): done >> bowtieout.txt 2>&1

  2. Not an impediment, just annoying. The variable defined previously works between cells, but not within the loop. Oh well!