#!/usr/bin/env python import sys from cafysis.file_io.ninfo import NinfoFile from cafysis.elements.ninfo import NinfoSet if len(sys.argv) != 3: print("Usage: SCRIPT [input ninfo 1] [input ninfo 2]") sys.exit(2) nf = NinfoFile(sys.argv[1]) nf.open_to_read() ns1 = NinfoSet() nf.read_all(ns1) nf.close() nf = NinfoFile(sys.argv[2]) nf.open_to_read() ns2 = NinfoSet() nf.read_all(ns2) nf.close() nhb1 = len(ns1.hbondDTs) nhb2 = len(ns2.hbondDTs) # Do not use index 0 flag1 = [False] * (nhb1 + 1) flag2 = [False] * (nhb2 + 1)
#!/usr/bin/env python import sys from cafysis.file_io.ninfo import NinfoFile from cafysis.elements.ninfo import NinfoSet if len(sys.argv) != 3: print ('Usage: SCRIPT [input ninfo] [output ninfo]') sys.exit(2) ninfo = NinfoFile(sys.argv[1]) ninfo.open_to_read() ns = NinfoSet() ninfo.read_all(ns) ninfo.close() ns.update_info() ns.sort_by_mp() ns.reassign_id() ninfo = NinfoFile(sys.argv[-1]) ninfo.open_to_write() ninfo.write_all(ns) ninfo.close()
# delta2 = mp2 - 1 # first = False if side == 1: #aln[mp1 - delta1] = mp2 - delta2 aln[mp1] = mp2 elif side == 2: #aln[mp2 - delta2] = mp1 - delta1 aln[mp2] = mp1 else: print('"side" is not acceptable. See usage') sys.exit(2) ns = NinfoSet() file_ninfo = NinfoFile(sys.argv[1]) file_ninfo.open_to_read() file_ninfo.read_all(ns) file_ninfo.close() ns_new = NinfoSet() # 両方のユニットともターゲットのときは、 # 両方のIDがalnに含まれていないとaddしない # BondLengths add1 = False add2 = False for ni in ns.bondlengths: if ni.iunit1 == target: if ni.imp1un in aln: ni.imp1un = aln[ni.imp1un] add1 = True
import sys from cafysis.file_io.ninfo import NinfoFile from cafysis.elements.ninfo import NinfoSet if __name__ == '__main__': if len(sys.argv) != 10: print( 'Usage: SCRIPT [ninfo (one-by-one)] [unit] [dist] [side] [unit] [dist] [side] [edc (post_edc.out)] [out]' ) print('') sys.exit(2) fninfo_in = NinfoFile(sys.argv[1]) fninfo_in.open_to_read() ns = NinfoSet() fninfo_in.read_all(ns) ns.update_info() fninfo_in.close() fninfo_out = NinfoFile(sys.argv[-1]) fninfo_out.open_to_write() unit_aln1 = int(sys.argv[2]) aln1 = {} side = int(sys.argv[4]) for line in open(sys.argv[3]): linesp = line.split() res1 = int(linesp[0]) # Dunkle res mp1 = int(linesp[1]) # Dunkle mp res2 = int(linesp[2]) # Jenner res mp2 = int(linesp[3]) # Jenner mp
def show_usage(): print('') print(' usage: ninfo_split.py [ninfo file] [prefix (can be dir)]') print('') if len(sys.argv) != 3: show_usage() sys.exit(2) f_ninfo = NinfoFile(sys.argv[1]) f_ninfo.open_to_read() ninfo = NinfoSet() f_ninfo.read_all(ninfo) f_ninfo.close() out_prefix = sys.argv[2] ninfo.update_info() nUnit = ninfo.max_unit print(nUnit) ninfo_out = {} for i in range(1, nUnit + 1): for j in range(i, nUnit + 1): ninfo_out[(i, j)] = NinfoSet() for bd in ninfo.bondlengths: ninfo_out[(bd.iunit1, bd.iunit2)].bondlengths.append(bd) for ba in ninfo.bondangles:
#!/usr/bin/env python import sys from cafysis.file_io.ninfo import NinfoFile from cafysis.elements.ninfo import NinfoSet if len(sys.argv) < 3: print("Usage: SCRIPT [input ninfo] [factor] [output ninfo]") sys.exit(2) f_ninfo_in = NinfoFile(sys.argv[1]) f_ninfo_in.open_to_read() ninfo = NinfoSet() f_ninfo_in.read_all(ninfo) f_ninfo_in.close() k_factor = float(sys.argv[2]) f_ninfo_out = NinfoFile(sys.argv[-1]) f_ninfo_out.open_to_write() for con in ninfo.contacts: con.coef = con.coef * k_factor * con.factor con.factor = 1.0 f_ninfo_out.write_all(ninfo) f_ninfo_out.close()
re3 = re.match('^\d+$', linesp[3]) if re1: linesp[1] = int(linesp[1]) if re2: linesp[2] = int(linesp[2]) if re3: linesp[3] = int(linesp[3]) cmds.append(tuple(linesp)) elif linesp[0] == 'def_ninfo': name = linesp[1] filename = linesp[2] nf = NinfoFile(filename) nf.open_to_read() ns = NinfoSet() nf.read_all(ns) nf.close() defs[name] = ('ninfo', filename, ns) elif linesp[0] == 'q': cmds.append(tuple(linesp)) elif linesp[0] == 'dock': cmds.append(tuple(linesp)) elif linesp[0] == 'enc': cmds.append(tuple(linesp)) elif linesp[0] == 'polar': cmds.append(tuple(linesp))