Running a program multiple times to search pattern and assign structure

Hi all,
I have a big file (n.txt) with following pattern:

ATOM      1  N    SER A   1     122.392 152.261 138.190  1.00  0.00     N  
ATOM      2  CA  SER A   1     122.726 151.241 139.183  1.00  0.00     C  
TER
ENDMDL
ATOM      1  N    SER A   1     114.207 142.287 135.439  1.00  0.00      N  
ATOM      2  CA  SER A   1     113.667 143.509 134.894  1.00  0.00      C 
TER
ENDMDL

I am using following script to read pattern and assign structure to them using another program st giving 2 output files-fn.str -m.mol:

pattern_txt=n.txt
npattern=`grep -c ENDMDL $pattern_txt`
echo $npattern patterns. Assigning_structure:
echo $npattern > st_input
seq -w 1 $npattern >> st_input
st $pattern_txt -fn.str -mn.mol

But this script is reading only first pattern and giving structure of that pattern by running st program. I wish to have structure for all patterns.

Please guide.

What are the parameters to st? Does it need other input than the pattern file? So you produced

cat st_input
2
1
2
  • what do you do with it? It is not used anywhere.
1 Like

Thanks.
st is a program that read a pattern and produces 2 files n.str (for summary) and n.mol (detail).
I want st to read each pattern from big file, predict the structure and compile all in one n.str and n.mol

So you need to extract each of the (multi line?) patterns from "big file" and provide it to st ? I still don't have the slightest clue what you need, or, what st needs resp., and what st_input is/was for.