I am tryin to think of how to ask an input to be a text file. It can be any .pdb file like 1abc.pdb, 2abc.pdb, 3drt.pdb, etc.
I am working with upgrading the above script to this:
I am working with upgrading the above script to this:
from subprocess import Popen, PIPE file = raw_input("> ") read_file = file.format open_file = open('read_file', 'r+') cat = ['cat', 'open_file'] get = ['voronota', 'get-balls-from-atoms-file', '--annotated'] calc = ['voronota', 'calculate-contacts', '--annotated'] que = [ 'voronota', 'query-contacts', '--inter-residue', '--match-first', 'R<ARG>', '--match-second', 'c<solvent>'] awk = ['awk', '{sum += $3} END {print sum}'] cat = Popen(cat, stdout=PIPE) get = Popen(get, stdin=cat.stdout, stdout=PIPE) calc = Popen(calc, stdin=get.stdout, stdout=PIPE) que = Popen(que, stdin=calc.stdout, stdout=PIPE) awk = Popen(awk, stdin=que.stdout, stdout=PIPE, stderr=PIPE) out, err = awk.communicate() print(out)but am getting this error:
Error:Traceback (most recent call last):
File "voronota_script.py", line 4, in <module>
open_file = open('read_file', 'r+')
IOError: [Errno 2] No such file or directory: 'read_file'
How is it possible to ask an input to be a txt file (in my case x.pdb where x has 28 different values)?