a thoughtful web.
Good ideas and conversation. No ads, no tracking.   Login or Take a Tour!
comment by Cumol
Cumol  ·  2366 days ago  ·  link  ·    ·  parent  ·  post: Pubski: October 4, 2017

I was just trying to figure out how to write a for loop in bash a few minutes ago. I feel like this stuff should be standard curriculum for ANYONE studying science!





lm  ·  2366 days ago  ·  link  ·  

You should most definitely check out https://software-carpentry.org/lessons/ -- it's targeted at non-CS people doing data science and is quite well written.

Also, to toot my own horn, I have written a course on this sort of stuff: http://web.mst.edu/~nmjxv3/cs1001/

Cumol  ·  2365 days ago  ·  link  ·  

Thank you! I will check it out :)

Devac  ·  2366 days ago  ·  link  ·  
This comment has been deleted.
lm  ·  2366 days ago  ·  link  ·  

Extra-fun fact: You can do C++ style for loops too!

  for ((i = 0; i < 10; i++)); do echo $i; done;
Cumol  ·  2366 days ago  ·  link  ·  

I had troubles figuring out something else. I have two input files and 4 output files per sequence and 115 of those. So I needed a for loop that takes the name of the sequence (blabla001_1.seq) finds the second part of the pair (blabla002_2.seq) then feeds that into a java command that gives 4 outputs using the names of the files.

I am used to writing scripts in R so I didn't know how to do that for bash. At the end I found a script that is supposed to do it, took it apart and understood how it works. 10 minutes ago I got my results :)

Devac  ·  2366 days ago  ·  link  ·  
This comment has been deleted.
Cumol  ·  2365 days ago  ·  link  ·  

You are correct, the example was wrong. They bolded numbers should be the same :)

Some things work with xargs or GNU parallel but not everything... :(

Devac  ·  2365 days ago  ·  link  ·  
This comment has been deleted.
Cumol  ·  2365 days ago  ·  link  ·  

As I am rather fresh to programming and (because of bioconductor) my first language is R, I haven't checked out anything else but Python is on my list because more and more data analysis tools are showing up for python...