comparison gene_family_aligner.py @ 14:af8dad310c32 draft

Uploaded
author greg
date Tue, 11 Apr 2017 14:21:35 -0400
parents 43341e97bb08
children 93b1207562d3
comparison
equal deleted inserted replaced
13:d7e6201b8d81 14:af8dad310c32
9 9
10 parser = argparse.ArgumentParser() 10 parser = argparse.ArgumentParser()
11 parser.add_argument('--alignment_method', dest='alignment_method', help='Multiple sequence alignments method') 11 parser.add_argument('--alignment_method', dest='alignment_method', help='Multiple sequence alignments method')
12 parser.add_argument('--automated_trimming', dest='automated_trimming', default=None, help="Trims alignments using trimAl's ML heuristic trimming approach") 12 parser.add_argument('--automated_trimming', dest='automated_trimming', default=None, help="Trims alignments using trimAl's ML heuristic trimming approach")
13 parser.add_argument('--codon_alignments', dest='codon_alignments', default=None, help="Flag for constructing orthogroup multiple codon alignments") 13 parser.add_argument('--codon_alignments', dest='codon_alignments', default=None, help="Flag for constructing orthogroup multiple codon alignments")
14 parser.add_argument('--gap_trimming', dest='gap_trimming', default=None, type=float, help='Remove sites in alignments with gaps of') 14 parser.add_argument('--gap_trimming', dest='gap_trimming', default=0, type=float, help='Remove sites in alignments with gaps of')
15 parser.add_argument('--iterative_realignment', dest='iterative_realignment', type=int, default=None, help='"Maximum number of iterations') 15 parser.add_argument('--iterative_realignment', dest='iterative_realignment', type=int, default=0, help='"Maximum number of iterations')
16 parser.add_argument('--num_threads', dest='num_threads', type=int, help='Number of threads to use for execution') 16 parser.add_argument('--num_threads', dest='num_threads', type=int, help='Number of threads to use for execution')
17 parser.add_argument('--orthogroup_faa', dest='orthogroup_faa', help="Directory of input fasta datasets") 17 parser.add_argument('--orthogroup_faa', dest='orthogroup_faa', help="Directory of input fasta datasets")
18 parser.add_argument('--output', dest='output', help="Output dataset") 18 parser.add_argument('--output', dest='output', help="Output dataset")
19 parser.add_argument('--output_dir', dest='output_dir', help="Output dataset files_path directory") 19 parser.add_argument('--output_dir', dest='output_dir', help="Output dataset files_path directory")
20 parser.add_argument('--pasta_iter_limit', dest='pasta_iter_limit', type=int, default=None, help='"Maximum number of iteration that the PASTA algorithm will execute') 20 parser.add_argument('--pasta_iter_limit', dest='pasta_iter_limit', type=int, default=None, help='"Maximum number of iteration that the PASTA algorithm will execute')
21 parser.add_argument('--pasta_script_path', dest='pasta_script_path', default=None, help='Path to script for executing pasta') 21 parser.add_argument('--pasta_script_path', dest='pasta_script_path', default=None, help='Path to script for executing pasta')
22 parser.add_argument('--remove_sequences', dest='remove_sequences', default=None, type=float, help='Remove sequences with gaps of') 22 parser.add_argument('--remove_sequences', dest='remove_sequences', default=0, type=float, help='Remove sequences with gaps of')
23 23
24 args = parser.parse_args() 24 args = parser.parse_args()
25 25
26 # Build the command line. 26 # Build the command line.
27 cmd = 'GeneFamilyAligner' 27 cmd = 'GeneFamilyAligner'
35 cmd += ' --num_threads %d' % args.num_threads 35 cmd += ' --num_threads %d' % args.num_threads
36 if args.codon_alignments is not None: 36 if args.codon_alignments is not None:
37 cmd += ' --codon_alignments' 37 cmd += ' --codon_alignments'
38 if args.automated_trimming is not None: 38 if args.automated_trimming is not None:
39 cmd += ' --automated_trimming' 39 cmd += ' --automated_trimming'
40 if args.gap_trimming is not None: 40 if args.gap_trimming > 0:
41 cmd += ' --gap_trimming %4f' % args.gap_trimming 41 cmd += ' --gap_trimming %4f' % args.gap_trimming
42 if args.remove_sequences is not None: 42 if args.remove_sequences > 0:
43 cmd += ' --remove_sequences %4f' % args.remove_sequences 43 cmd += ' --remove_sequences %4f' % args.remove_sequences
44 if args.iterative_realignment is not None: 44 if args.iterative_realignment > 0:
45 cmd += ' --iterative_realignment %d' % args.iterative_realignment 45 cmd += ' --iterative_realignment %d' % args.iterative_realignment
46 # Run the command. 46 # Run the command.
47 proc = subprocess.Popen(args=cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True) 47 proc = subprocess.Popen(args=cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True)
48 rc = proc.wait() 48 rc = proc.wait()
49 utils.check_execution_errors(rc, proc.stderr) 49 utils.check_execution_errors(rc, proc.stderr)