2

I would like to run the python script where the input is taken from unix cat function but I also want to give it few additional arguments in sys.argv, it should run in the following way:

cat my_fasta_sequence.txt | get_region.py 193 445

get_region function will take an input from fasta sequence slice from 193 445 and save it as a new file.

I use sys.stdin to take the input from cat function, however I am not sure how to make python to take the numbers (193,445) as an input at the same time.

4
  • sys.argv[1] will be '193' and sys.argv[2] will be '445' in your example Commented Sep 27, 2020 at 20:06
  • In other words, sys.argv input is independent of sys.stdin arguments. Commented Sep 27, 2020 at 20:09
  • How do you have your incoming args setup in the script, looks the two numbers are passed upon command line execution. Possible solutions within this SO post. Commented Sep 27, 2020 at 20:09
  • Anthony Sottile, when I set it as you say I am getting IndexError: list index out of range Commented Sep 27, 2020 at 20:16

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.