Loading nested/cli/nester.py +14 −2 Original line number Diff line number Diff line #!/usr/bin/env python3 import os import sys import click import glob Loading @@ -19,11 +20,12 @@ from nested.core.sequence_thread import SequenceThread @click.option('--sketch', '-s', is_flag=True, default=False, help='Sketch output.') @click.option('--format', '-f', default='genome_browser', help='Format for GFF.') @click.option('--output_fasta_offset', '-o', default=0, help='Number of bases around the element included in output fasta files.') @click.option('--output_folder', '-d', default="", type=click.Path(writable=True, resolve_path=True), help='Output data folder.') @click.option('--output_folder', '-d', default="", type=click.Path(writable=True), help='Output data folder.') @click.option('--initial_threshold', '-t', type=int, default=500, help='Initial threshold value.') @click.option('--threshold_multiplier', '-m', type=float, default=1, help='Threshold multiplier.') @click.option('--threads', '-n', type=int, default=1, help='Number of threads') def main(input_fasta, sketch, format, output_fasta_offset, output_folder, initial_threshold, threshold_multiplier, threads): check_permissions(output_folder, os.W_OK | os.X_OK) number_of_errors = [0] start_time = datetime.now() sequences = list(SeqIO.parse(open(input_fasta), 'fasta')) Loading Loading @@ -64,6 +66,16 @@ def process_sequence(sequence, sketcher, sketch, format, output_fasta_offset, ou errors[0] += 1 print('Processing {}: UNEXPECTED ERROR:'.format(sequence.id[:strlen]), sys.exc_info()[0]) def check_permissions(path, permissions): path = os.getcwd() if len(path) == 0 else path if not os.path.exists('{}/data'.format(path)): try: os.makedirs('{}/data'.format(path)) except PermissionError: raise click.BadParameter("Path \"{}\" is not writable.".format(path), param=path, param_hint='\"--output_folder\" / \"-d\"') except Exception: return def cleanup(): for file in glob.glob("*ltrs.fa"): os.remove(file) Loading nested/output/sketcher.py +1 −1 File changed.Contains only whitespace changes. Show changes Loading
nested/cli/nester.py +14 −2 Original line number Diff line number Diff line #!/usr/bin/env python3 import os import sys import click import glob Loading @@ -19,11 +20,12 @@ from nested.core.sequence_thread import SequenceThread @click.option('--sketch', '-s', is_flag=True, default=False, help='Sketch output.') @click.option('--format', '-f', default='genome_browser', help='Format for GFF.') @click.option('--output_fasta_offset', '-o', default=0, help='Number of bases around the element included in output fasta files.') @click.option('--output_folder', '-d', default="", type=click.Path(writable=True, resolve_path=True), help='Output data folder.') @click.option('--output_folder', '-d', default="", type=click.Path(writable=True), help='Output data folder.') @click.option('--initial_threshold', '-t', type=int, default=500, help='Initial threshold value.') @click.option('--threshold_multiplier', '-m', type=float, default=1, help='Threshold multiplier.') @click.option('--threads', '-n', type=int, default=1, help='Number of threads') def main(input_fasta, sketch, format, output_fasta_offset, output_folder, initial_threshold, threshold_multiplier, threads): check_permissions(output_folder, os.W_OK | os.X_OK) number_of_errors = [0] start_time = datetime.now() sequences = list(SeqIO.parse(open(input_fasta), 'fasta')) Loading Loading @@ -64,6 +66,16 @@ def process_sequence(sequence, sketcher, sketch, format, output_fasta_offset, ou errors[0] += 1 print('Processing {}: UNEXPECTED ERROR:'.format(sequence.id[:strlen]), sys.exc_info()[0]) def check_permissions(path, permissions): path = os.getcwd() if len(path) == 0 else path if not os.path.exists('{}/data'.format(path)): try: os.makedirs('{}/data'.format(path)) except PermissionError: raise click.BadParameter("Path \"{}\" is not writable.".format(path), param=path, param_hint='\"--output_folder\" / \"-d\"') except Exception: return def cleanup(): for file in glob.glob("*ltrs.fa"): os.remove(file) Loading