You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
1.6 KiB

#!/usr/bin/env python3
# standard library
import csv
# pip
import click
import pprint
from pprint import pprint
# local modules
import utils.fs
from utils.fs import search_dir
from import write_json
jfs2003id_loci = [
def convert(ctx):
@click.argument('input_dir', type=click.Path())
@click.argument('output_dir', type=click.Path())
def jfs2003id(ctx, input_dir, output_dir):
input_files = search_dir(input_dir, '*.csv')
output_dict = {}
for file_path in input_files:
with open(file_path, 'r') as f:
reader = csv.DictReader(f)
race_list = []
for row in reader:
tmp_dict = {}
name = row['Sample Info']
tmp_dict['name'] = name
for locus in jfs2003id_loci:
alleles = []
for i in range(2):
key = '%s %d' % (locus, (i+1))
tmp_dict[locus] = alleles
output_dict[file_path.stem.split('-')[1]] = race_list
write_json('%s/jfs2003id.json' % output_dir, output_dict)