Skip to content

Commit

Permalink
main function now supplies parameters to client running function so t…
Browse files Browse the repository at this point in the history
…hat it can be reused
  • Loading branch information
jrober84 committed Aug 20, 2024
1 parent 77c411b commit 8bbbbd1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
46 changes: 25 additions & 21 deletions profile_dists/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,24 @@ class CustomFormatter(ArgumentDefaultsHelpFormatter, RawDescriptionHelpFormatter
return parser.parse_args()


def main():
cmd_args = parse_args()
query_profile = cmd_args.query
ref_profile = cmd_args.ref
outdir = cmd_args.outdir
outfmt = cmd_args.outfmt
file_type = cmd_args.file_type
dist_method = cmd_args.distm
missing_threshold = cmd_args.missing_thresh
allele_mapping_file = cmd_args.mapping_file
force = cmd_args.force
match_threshold = cmd_args.match_threshold
sample_qual_thresh = cmd_args.sample_qual_thresh
skip = cmd_args.skip
count_missing_sites = cmd_args.count_missing
max_mem = cmd_args.max_mem
batch_size = cmd_args.batch_size
num_cpus = cmd_args.cpus
columns = cmd_args.columns
def run_profile_dists(params):
query_profile = params['query']
ref_profile = params['ref']
outdir = params['outdir']
outfmt = params['outfmt']
file_type = params['file_type']
dist_method = params['distm']
missing_threshold = params['missing_thresh']
allele_mapping_file = params['mapping_file']
force = params['force']
match_threshold = params['match_threshold']
sample_qual_thresh = params['sample_qual_thresh']
skip = params['skip']
count_missing_sites = params['count_missing']
max_mem = params['max_mem']
batch_size = params['batch_size']
num_cpus = params['cpus']
columns = params['columns']



Expand All @@ -109,7 +108,7 @@ def main():

run_data = RUN_DATA
run_data['analysis_start_time'] = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
run_data['parameters'] = vars(cmd_args)
run_data['parameters'] = params

input_files = [query_profile,ref_profile,allele_mapping_file]
for f in input_files:
Expand Down Expand Up @@ -205,7 +204,6 @@ def main():
rcols_to_remove = set(rdf.columns.values.tolist()) - set(columns)



# remove columns

run_data['loci_removed'] = list(qcols_to_remove)
Expand Down Expand Up @@ -376,6 +374,12 @@ def main():
os.remove(dist_matrix_file)

sys.stdout.flush()
pass


def main():
cmd_args = parse_args()
run_profile_dists(vars(cmd_args))

# call main function
if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion profile_dists/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.1'
__version__ = '1.0.2'

0 comments on commit 8bbbbd1

Please sign in to comment.