Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for a vcf index before indexing #26

Merged
merged 1 commit into from
May 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions vcf2gwas/starter.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,11 +595,14 @@

#index VCF
Log.print_log("\nIndexing VCF file..")
timer = time.perf_counter()
Converter.index_vcf(snp_file2)
timer_end = time.perf_counter()
timer_total = round(timer_end - timer, 2)
Log.print_log(f'VCF file successfully indexed (Duration: {runtime_format(timer_total)})')
if not os.path.exists(f"{snp_file2}.csi"):
timer = time.perf_counter()
Converter.index_vcf(snp_file2)
timer_end = time.perf_counter()
timer_total = round(timer_end - timer, 2)
Log.print_log(f'VCF file successfully indexed (Duration: {runtime_format(timer_total)})')
else:
Log.print_log(f'VCF file already indexed')

chr2, chr_num = Converter.check_chrom(snp_file2, chr)
chr_list = chr2
Expand Down Expand Up @@ -889,4 +892,4 @@
if model != None:
shutil.move(os.path.join(path, f'vcf2gwas{pc_prefix}.log.txt'), os.path.join(path, f'vcf2gwas_{snp_prefix}{pc_prefix2}_{timestamp2}.log.txt'))

shutil.rmtree(dir_temp, ignore_errors=True)
shutil.rmtree(dir_temp, ignore_errors=True)