Mercurial > repos > greg > assembly_post_processor
comparison assembly_post_processor.py @ 46:b7858b1f64f1 draft
Uploaded
| author | greg |
|---|---|
| date | Wed, 03 May 2017 10:14:03 -0400 |
| parents | |
| children | 9d58af3e459d |
comparison
equal
deleted
inserted
replaced
| 45:e668628f62b7 | 46:b7858b1f64f1 |
|---|---|
| 1 #!/usr/bin/env python | |
| 2 import argparse | |
| 3 import os | |
| 4 import subprocess | |
| 5 | |
| 6 import utils | |
| 7 | |
| 8 OUTPUT_DIR = 'assemblyPostProcessor_dir' | |
| 9 | |
| 10 parser = argparse.ArgumentParser() | |
| 11 parser.add_argument('--dereplicate', dest='dereplicate', default=None, help='Remove duplicate sequences') | |
| 12 parser.add_argument('--gap_trimming', dest='gap_trimming', type=float, default=0, help='Trim alignments') | |
| 13 parser.add_argument('--gene_family_search', dest='gene_family_search', default=None, help='Targeted gene families') | |
| 14 parser.add_argument('--method', dest='method', default=None, help='Protein clustering method') | |
| 15 parser.add_argument('--min_length', dest='min_length', type=int, default=0, help='Minimum sequence length') | |
| 16 parser.add_argument('--num_threads', dest='num_threads', type=int, help='Number of processors') | |
| 17 parser.add_argument('--prediction_method', dest='prediction_method', help='Coding regions prediction method') | |
| 18 parser.add_argument('--scaffold', dest='scaffold', default=None, help='Gene family scaffold') | |
| 19 parser.add_argument('--score_matrices', dest='score_matrices', default=None, help='Scores matrices') | |
| 20 parser.add_argument('--strand_specific', dest='strand_specific', default=None, help='Strand-specific assembly') | |
| 21 parser.add_argument('--transcripts', dest='transcripts', help='Transcriptome assembly fasta file') | |
| 22 | |
| 23 args = parser.parse_args() | |
| 24 | |
| 25 # Build the command line. | |
| 26 cmd = 'AssemblyPostProcessor' | |
| 27 if args.dereplicate is not None: | |
| 28 cmd += ' --dereplicate' | |
| 29 if args.gap_trimming > 0: | |
| 30 cmd += ' --gap_trimming %4f' % args.gap_trimming | |
| 31 if args.gene_family_search is not None: | |
| 32 cmd += ' --gene_family_search %s' % args.gene_family_search | |
| 33 if args.method is not None: | |
| 34 cmd += ' --method %s' % args.method | |
| 35 if args.min_length > 0: | |
| 36 cmd += ' --min_length %d' % args.min_length | |
| 37 cmd += ' --num_threads %d' % args.num_threads | |
| 38 cmd += ' --prediction_method %s' % args.prediction_method | |
| 39 if args.scaffold is not None: | |
| 40 cmd += ' --scaffold %s' % args.scaffold | |
| 41 if args.score_matrices is not None: | |
| 42 cmd += ' --score_matrices %s' % args.score_matrices | |
| 43 if args.strand_specific is not None: | |
| 44 cmd += ' --strand_specific' | |
| 45 cmd += ' --transcripts %s' % args.transcripts | |
| 46 | |
| 47 # Run the command. | |
| 48 proc = subprocess.Popen(args=cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True) | |
| 49 rc = proc.wait() | |
| 50 utils.check_execution_errors(rc, proc.stderr, proc.stdout) |
