-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforest.py
40 lines (33 loc) · 1.22 KB
/
forest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python
import click
import logging
@click.group()
def cli():
pass
@cli.command()
@click.argument('genefamily', type=click.Path(exists=True))
@click.option('--protein', '-p', help='Protein file in fasta.')
@click.option('--cds', '-c', help='CDS file in fasta.')
@click.option('--wkdir', '-w', default='temp', help='Working directory.')
def trees(**kwargs):
"""Build gene trees"""
_trees(**kwargs)
def _trees(genefamily, protein, cds, wkdir):
from tools.genefamily import read_gene_families
gfs = read_gene_families(genefamily, protein, cds, wkdir)
for gf in gfs:
gf.obtain_msa()
gf.build_phylo()
@cli.command()
@click.argument('genefamily', type=click.Path(exists=True))
@click.option('-max', '-x', default=200, help='Maximum number of genes in a gene family.')
@click.option('-min', '-m', default=4, help='Minimum number of genes in a gene family.')
@click.option('-num', '-n', default=2, help='Number of split sets.')
def splitgf(**kwargs):
"""Split a large set of gene families"""
_splitgf(**kwargs)
def _splitgf(genefamily, max, min, num):
from tools.genefamily import split_gene_families
split_gene_families(genefamily, max, min, num)
if __name__ == '__main__':
cli()