# Set file paths for current chromosome curSnpFilePath = snpFilePath.format(curChr) curLociFilePath = lociFilePath.format(curChr) if len(path) > 0: curSnpFilePath = path.rstrip('\\').rstrip('/') + '\\' + curSnpFilePath curLociFilePath = path.rstrip('\\').rstrip('/') + '\\' + curLociFilePath # Clear dictionaries for loading multiple chromosomes snpInserts.clear() lociInserts = [] rsidList.clear() # Print status and flush stdout for nohup print "Chromosome " + str(curChr) + ". Reading SNP Data" result.snpLoadStart = time.time() sys.stdout.flush() # Read in data from SNP file and create insert statements with open(curSnpFilePath,'r') as csvfile: data = csv.reader(csvfile,delimiter='\t') for row in data: if(len(row) == 3): hasSig = False if row[2] != '' and row[2] != 'false': hasSig = True rsidList[row[0]] = 0 insStr = "INSERT INTO snp (rsid, chr, has_sig) VALUES ('{0}', '{1}', {2}) RETURNING id".format(row[0], row[1], hasSig) snpInserts[row[0]] = insStr # Data for reporting