I tried to print those lines having C value missing by: import re expr = re.compile("C = None") f = open("/home/amrita/helix.dat") for line in f: if expr.search(line): print line
but it is not giving any value. > > Hi, > > I have two large files: > > FileA > 15 ALA H = 8.05 N = 119.31 CA = 52.18 HA = 4.52 C = > 21 ALA H = 7.66 N = 123.58 CA = 54.33 HA = C = 179.35 > 23 ALA H = 8.78 N = CA = HA = C = 179.93................. > > and > > FileB > 21 ALA helix (helix_alpha, helix2) > 23 ALA helix (helix_alpha, helix3) > 38 ALA helix (helix_alpha, helix3)........... > > now what i want that i will make another file in which i will join the two > file in such a way that only matching entries will come like here 21 and > 23 ALA is in both files, so the output will be something like:- > > 21 ALA H = 7.66 N = 123.58 CA = 54.33 HA = C = 179.35| 21 ALA helix > (helix_alpha, helix2) > 23 ALA H = 8.78 N = CA = HA = C = 179.93|23 ALA helix (helix_alpha, > helix3) > > and further i will make another file in which i will be able to put those > lines form this file based on the missing atom value, like for 21 ALA HA > is not defined so i will put it another file based on its HA missing value > similarly i will put 23 ALA on another file based on its missing N,CA and > HA value. > > I tried to join the two file based on their matching entries by:--- >>>>from collections import defaultdict >>>> >>>> if __name__ == "__main__": > ... a = open("/home/amrita/alachems/chem100.txt") > ... c = open("/home/amrita/secstr/secstr100.txt") > ... >>>> def source(stream): > ... return (line.strip() for line in stream) > ... > ... >>>> def merge(sources): > ... for m in merge([source(a),source(c)]): > ... print "|".join(c.ljust(10) for c in m) > ... > > but it is not giving any value. > > > > > > > Thanks, > Amrita Kumari > Research Fellow > IISER Mohali > Chandigarh > INDIA > Amrita Kumari Research Fellow IISER Mohali Chandigarh INDIA -- http://mail.python.org/mailman/listinfo/python-list