def create_one_wormtable(schema_path, inp_file, out_file): """ Create a single wormtable database from the input file and an .xml schema. """ cachesize = '16G ' if WIN_PLATFORM_NONFREE: cachesize = '4G ' # to deal with BDB error... runargs = '-q --schema ' + schema_path + ' --cache-size=' + cachesize + \ inp_file + ' ' + out_file #run vcf2wt as a library function, no system calls try: wt.vcf2wt_main(runargs.split()) except: raise #return quietly # add row index for this wormtable # supersedes add_all_rowid_indexes() and add_one_rowid_index() # doing it here means we avail of the thread/process that is already spawned # sys.stderr.write('Indexing %s\n' % (out_file,)) runargs = 'add -q --cache-size=' + cachesize + out_file + ' row_id' wt.wtadmin_main(runargs.split()) return
def create_general_schema(out_folder): """ Create the general .xml schema which will be used as template for the creation of several other schemas (one for each field in the .vcf file). """ schema_file = "" preproc_file = out_folder + '/pre_processed_inp_file.vcf.gz' if WIN_PLATFORM_NONFREE: schema_file = out_folder schema_file = schema_file.replace('\\', '\\\\') schema_file += '\\\\schema.xml' preproc_file = preproc_file.replace('\\', '\\\\') preproc_file = preproc_file.replace('/', '\\\\') else: schema_file = out_folder + '/schema.xml' runargs = '-q -g ' + preproc_file + ' ' + schema_file # call vcf2wt as a library function wt.vcf2wt_main(runargs.split()) return schema_file
import wormtable as wt if __name__ == "__main__": wt.vcf2wt_main()
def setUp(self): super(WtadminTest, self).setUp() wt.vcf2wt_main([EXAMPLE_VCF, self._homedir, "-fq"]) self._table = wt.open_table(self._homedir)