Skip to content

Commit

Permalink
add args to vcfanno
Browse files Browse the repository at this point in the history
  • Loading branch information
kmoad committed Apr 24, 2024
1 parent 256cd97 commit ba42a22
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 27 deletions.
14 changes: 11 additions & 3 deletions cravat/oc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from cravat.cravat_report import parser as report_parser
from cravat.vcfanno import vcfanno
import sys
from pathlib import Path

root_p = argparse.ArgumentParser(
description="Open-CRAVAT genomic variant interpreter. https://github.com/KarchinLab/open-cravat"
Expand Down Expand Up @@ -232,9 +233,16 @@
help = 'annotate a vcf',
)
vcfanno_p.add_argument('input_path')
vcfanno_p.add_argument('--annotators','-a',
nargs='*',
)
vcfanno_p.add_argument('-a','--annotators',
nargs = '*',
)
vcfanno_p.add_argument('-t','--threads',
type = int,
help = 'Number of CPU threads to use')
vcfanno_p.add_argument('--temp-dir',
type = Path,
default = Path('temp-vcfanno'),
help = 'Temporary directory for working files')
vcfanno_p.set_defaults(func=vcfanno)

def main():
Expand Down
29 changes: 5 additions & 24 deletions cravat/vcfanno.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,37 +402,18 @@ def vcfanno(args):
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
nthreads = args.threads if args.threads else mp.cpu_count()
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
handlers=[handler]
)
anno = VCFAnnotator(
input_path=str(input_path),
output_path=str(output_path),
temp_dir='temp',
processors=mp.cpu_count(),
input_path = str(input_path),
output_path = str(output_path),
temp_dir = args.temp_dir,
processors = args.threads if args.threads else mp.cpu_count(),
chunk_size=10**4,
chunk_log_frequency=50,
annotators=args.annotators)
anno.process()

# if __name__ == '__main__':
# handler = logging.StreamHandler(sys.stdout)
# handler.setLevel(logging.DEBUG)
# formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
# handler.setFormatter(formatter)
# logging.basicConfig(
# level=logging.DEBUG,
# format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
# handlers=[handler]
# )
# anno = VCFAnnotator(
# input_path='/home/ska/data/gnomad.1.vcf.bgz',
# output_path='gnomad.1.out.vcf.gz',
# temp_dir='temp',
# processors=16,
# chunk_size=10**4,
# chunk_log_frequency=50,
# annotators=['clinvar','dbsnp_common'])
# anno.process()

0 comments on commit ba42a22

Please sign in to comment.