@@ -0,0 +1,1404 @@
+import sqlite3%0Afrom os import path%0Aimport argparse%0Afrom os.path import isfile, join%0A%0Aparser = argparse.ArgumentParser(description='command line argument')%0A%0Aparser.add_argument('--pdb_id', dest = 'pdb_id', type=str,%0A                    help='the pdb id', default = None)%0Aargs = parser.parse_args()%0Aif args.pdb_id is None:%0A  print 'User must supply pdb_id.'%0A  exit (0)%0A%0Apdb_id = args.pdb_id%0A%0Aconn = sqlite3.connect('pdb_coordinates.sqlite')%0Acur = conn.cursor()%0A%0Adef anomalyCheck(anomalies):%0A    for anomaly in anomalies:%0A        entry = anomaly%5B1%5D.lower()%0A        if entry in %5B'y','n'%5D:%0A            pass%0A        else:%0A            print 'Invaid entry for %25s' %25 anomaly%5B0%5D%0A%0A%0A%0Aanomalies = %5B%0A    %5B'Anomaly1', raw_input('Anomaly1 (y/n)')%5D,%0A    %5B'Anomaly2', raw_input('Anomaly2 (y/n)')%5D,%0A    %5B'Anomaly3', raw_input('Anomaly3 (y/n)')%5D%0A%5D%0AanomalyCheck(anomalies)%0A%0Acur.execute('''%0ASELECT id FROM PDB_id WHERE pdb_id=%22%25s%22 ''' %25 (pdb_id))%0Apdb_pk = (cur.fetchone())%5B0%5D%0Acur.execute('''%0ASELECT id FROM SWEEPS WHERE SWEEPS.pdb_id_id=%22%25s%22%0A''' %25 (pdb_pk))%0Asweep_pk_list = cur.fetchall()%5B-1:%5D%0Asweep_pk = sweep_pk_list%5B0%5D%5B0%5D%0A%0Acur.execute('''%0AINSERT INTO Anomalies (sweep_id) VALUES (%25s) ''' %25 (%0Asweep_pk))%0A%0Afor anomaly in anomalies:%0A    cur.executescript('''%0A    ALTER TABLE Anomalies ADD %25s TEXT;%0A    UPDATE Anomalies SET %25s = %22%25s%22 WHERE sweep_id = %25s%0A    ''' %25 (anomaly%5B0%5D, anomaly%5B0%5D, anomaly%5B1%5D, sweep_pk))%0A%0Aconn.commit()%0A

Create anomaly_table.py