# Load loci in pgsql statements if row[0] in rsidList and rsidList[row[0]] > 0: # If RSID value is present, load with PK insStr = "INSERT INTO locus (mrna_acc, gene, class, snp_id) VALUES ('{0}', '{1}', '{2}', {3})".format(row[1], row[2], row[3], rsidList[row[0]]) lociInserts.append(insStr) # Data for reporting result.lociLoadEnd = time.time() result.totalLoci = len(lociInserts) # Create new cursor, enter loci data into pgsql cursor = postgresConnection.cursor() print "Chromosome " + str(curChr) + ". Inserting loci data." # Log current run start time and number of loci result.lociInsertStart = time.time() # Insert each locus for locus in lociInserts: cursor.execute(locus) # Commit data to pgsql postgresConnection.commit() # Log end time and total pgsql time result.lociInsertEnd = time.time() # Close pgsql cursor cursor.close() print result.toTerm()