[Tutor] Search for Text in File

Stephen P. Molnar s.molnar at sbcglobal.net
Thu Aug 15 10:10:32 EDT 2019


I need to find a phrase in i text file in order to read a unique text 
string into a python3 application.

I have become stuck and Google has not been of any use.

Here is my attempt:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
#  Extract.Data.py
#
#
#
#  "


import re

name = input("Enter Molecule Name: ")

name_in = name+'_apo-1acl.dlg'
re.search("RMSD TABLE",name_in())

and here is the portion of the text file (Acetyl_apo-1acl.dlg) 
containing the information:


________________________________________________________________________________
      |           |     |           |     |
Clus | Lowest    | Run | Mean      | Num | Histogram
-ter | Binding   |     | Binding   | in  |
Rank | Energy    |     | Energy    | Clus|    5    10   15   20 25   30   35
_____|___________|_____|___________|_____|____:____|____:____|____:____|____:___
    1 |     -4.39 |  15 |     -4.29 |   2 |##
    2 |     -4.38 |  13 |     -4.27 |   6 |######
    3 |     -4.29 |  11 |     -4.15 |  10 |##########
    4 |     -3.90 |   9 |     -3.90 |   2 |##
_____|___________|_____|___________|_____|______________________________________


Number of multi-member conformational clusters found = 4, out of 20 runs.

     RMSD TABLE
     __________

_____________________________________________________________________
      |      |      |           |         |                 |
Rank | Sub- | Run  | Binding   | Cluster | Reference       | Grep
      | Rank |      | Energy    | RMSD    | RMSD            | Pattern
_____|______|______|___________|_________|_________________|___________
    1      1     15       -4.39      0.00     92.25           RANKING
    1      2     17       -4.19      0.99     92.15           RANKING
    2      1     13       -4.38      0.00     93.14           RANKING
    2      2      6       -4.37      1.21     92.80           RANKING
    2      3     18       -4.35      0.87     93.26           RANKING
    2      4      5       -4.33      1.23     92.85           RANKING
    2      5      3       -4.17      1.17     93.40           RANKING
    2      6      7       -3.99      1.33     92.98           RANKING
    3      1     11       -4.29      0.00     91.37           RANKING
    3      2     19       -4.29      0.31     91.27           RANKING
    3      3     16       -4.25      1.08     91.14           RANKING
    3      4     10       -4.25      0.86     91.13           RANKING
    3      5      1       -4.13      0.94     91.83           RANKING
    3      6     20       -4.11      1.03     91.89           RANKING
    3      7     12       -4.11      0.60     91.28           RANKING
    3      8      2       -4.10      0.86     91.56           RANKING
    3      9      8       -4.09      0.73     91.52           RANKING
    3     10      4       -3.89      1.24     91.91           RANKING
    4      1      9       -3.90      0.00     95.00           RANKING
    4      2     14       -3.90      0.92     94.92           RANKING
_______________________________________________________________________



     INFORMATION ENTROPY ANALYSIS FOR THIS CLUSTERING
     ________________________________________________


Information entropy for this clustering = 0.39  (rmstol = 2.00 Angstrom)

Everything that I have tried returns 'TypeError: 'str' object is not 
callable'.

Assistance will be much appreciated.

Thanks in advance.

-- 
Stephen P. Molnar, Ph.D.            Life is a fuzzy set
http://www.Molecular-Modeling.net   Multivariate and stochastic
614.312.7528 (c)
Skype:  smolnar1



More information about the Tutor mailing list