Note that there are some explanatory texts on larger screens.

plurals
  1. POawk in python: How to use awk scripts in a python class?
    text
    copied!<p>I am trying to run an awk script using python, so I can process some data.</p> <p>Is there any way to get an awk script to run in a python class without using the system class to invoke it as shell process? The framework where I run these python scripts does not allow the use of a subprocess call, so I am stuck either figuring out a way to convert my awk script in python, or if is possible, running the awk script in python.</p> <p>Any suggestions? My awk script basically read a text file and isolate blocks of proteins that contains a specific chemical compound (the output is generated by our framework; I've add an example of how does it looks like below) and isolate them printing them out on a different file.</p> <pre><code> buildProtein compoundA compoundB begin fusion Calculate : (lots of text here on multiple lines) (more lines) Final result - H20: value CO2: value Compound: value Other Compounds X: Value Y: value Z:value [...another similar block] </code></pre> <p>So for example if I build a protein and I need to see if in the compounds I have CH3COOH in the final result line, if it does I have to take the whole block, starting from the command "buildProtein", until the beginning of the next block; and save it on a file; and then move to the next and see if it has again the compound that I am looking for...if it does not have it I skip to the next, until the end of the file (the file has multiple occurrence of the compound that I search for, sometimes they are contiguous while other times they are alternate with blocks that has not the compound.</p> <p>Any help is more than welcome; banging my head for weeks now and after finding out this site I decided to ask for some help.</p> <p>Thanks in advance for your kindness!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload