...
 
Commits (2)
......@@ -346,12 +346,12 @@ class AssociationSearch:
statement = None
if self.trait:
self.chrom_for_trait()
#self.chrom_for_trait()
# single quotes here enable values with '.'s in them to be interpretted by pytables
conditions.append("{trait} == '{id}'".format(trait=PHEN_DSET, id=str(self.trait)))
if self.gene:
self.chrom_for_gene()
#self.chrom_for_gene()
conditions.append("{gene} == {id}".format(gene=GENE_DSET, id=str(self.gene)))
if self.bp_interval:
......
......@@ -62,5 +62,5 @@ TO_STORE_DSETS_DEFAULT = {SNP_DSET, PVAL_DSET, STUDY_DSET, CHR_DSET, BP_DSET, EF
TO_QUERY_DSETS_DEFAULT = {SNP_DSET, PVAL_DSET, STUDY_DSET, CHR_DSET, BP_DSET, BETA_DSET, RSID_DSET, MUTATION_DSET, AC_DSET, AN_DSET, FREQ_DSET, R2_DSET, EXPR_DSET,
EFFECT_DSET, OTHER_DSET, TISSUE_DSET}
TO_INDEX = [PHEN_DSET, BP_DSET, PVAL_DSET, SNP_DSET, GENE_DSET]
TRAIT_FILE_INDEX = ['phenotype_id', 'gene_id']
CHROMOSOMES = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', 'X', 'Y', 'MT']
......@@ -29,16 +29,26 @@ class H5Indexer():
col.remove_index()
col.create_csindex()
def reindex_trait_file(self):
with pd.HDFStore(self.h5file) as store:
group = store.keys()[0]
for i in TRAIT_FILE_INDEX:
self.create_index(i, group)
def main():
argparser = argparse.ArgumentParser()
argparser.add_argument('-f', help='The path to the HDF5 file to be processed', required=True)
argparser.add_argument('-filetype', help='The type HDF5 file to be processed', default='sumstats', choices=['sumstats', 'trait_meta'], required=False)
args = argparser.parse_args()
file = args.f
indexer = H5Indexer(file)
indexer.reindex_file()
if args.filetype == 'sumstats':
indexer.reindex_file()
if args.filetype == 'trait_meta':
indexer.reindex_trait_file()
if __name__ == "__main__":
......