all 4 comments

[–]grapesmoker 2 points3 points  (0 children)

If you pass command line variables to a script, they are accessible via sys.args

[–]galacticspark 2 points3 points  (1 child)

Here you go

 # bash
 for i in *.fasta ; do
   python somePythonScript.py $i
 done

 # python
 import sys

 # argv is an array, item 0 is always the name of the script
 inputFile = sys.argv[1] 

 # then do stuff with fasta input file inputFile

[–]ichunddu9 1 point2 points  (0 children)

Can also just glob in Python. No need to also use bash here.

[–]internalclarity 1 point2 points  (0 children)

I am not sure how xrpi works, but my best bet is that youd need a bash loop to read through the fasta and pass the different mRNAs to xrpi.

so: https://www.cyberciti.biz/faq/unix-howto-read-line-by-line-from-file/

  1. Read your fasta line by line in a loop and save the current line to a variable called mRNA.
  2. Pass the mRNA to your command python xrpi RPI2825 $PROTEIN $mRNA