Mercurial > repos > cpt > cpt_get_orfs
comparison get_orfs_or_cdss.py @ 4:f97bc7f587a1 draft
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
author | cpt |
---|---|
date | Mon, 05 Jun 2023 02:43:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
3:29242397252f | 4:f97bc7f587a1 |
---|---|
1 #!/usr/bin/env python | |
2 import argparse | |
3 import logging | |
4 from cpt import OrfFinder | |
5 | |
6 logging.basicConfig() | |
7 log = logging.getLogger() | |
8 | |
9 | |
10 if __name__ == "__main__": | |
11 parser = argparse.ArgumentParser(description="Get open reading frames") | |
12 parser.add_argument("fasta_file", type=argparse.FileType("r"), help="Fasta file") | |
13 | |
14 parser.add_argument( | |
15 "-f", | |
16 "--format", | |
17 dest="seq_format", | |
18 default="fasta", | |
19 help="Sequence format (e.g. fasta, fastq, sff)", | |
20 ) | |
21 parser.add_argument( | |
22 "--table", dest="table", default=1, help="NCBI Translation table", type=int | |
23 ) | |
24 parser.add_argument( | |
25 "-t", | |
26 "--ftype", | |
27 dest="ftype", | |
28 choices=("CDS", "ORF"), | |
29 default="ORF", | |
30 help="Find ORF or CDSs", | |
31 ) | |
32 parser.add_argument( | |
33 "-e", | |
34 "--ends", | |
35 dest="ends", | |
36 choices=("open", "closed"), | |
37 default="closed", | |
38 help="Open or closed. Closed ensures start/stop codons are present", | |
39 ) | |
40 parser.add_argument( | |
41 "-m", | |
42 "--mode", | |
43 dest="mode", | |
44 choices=("all", "top", "one"), | |
45 default="all", | |
46 help="Output all ORFs/CDSs from sequence, all ORFs/CDSs " | |
47 "with max length, or first with maximum length", | |
48 ) | |
49 parser.add_argument( | |
50 "--min_len", dest="min_len", default=10, help="Minimum ORF/CDS length", type=int | |
51 ) | |
52 parser.add_argument( | |
53 "--strand", | |
54 dest="strand", | |
55 choices=("both", "forward", "reverse"), | |
56 default="both", | |
57 help="select strand", | |
58 ) | |
59 | |
60 parser.add_argument( | |
61 "--on", | |
62 dest="out_nuc", | |
63 type=argparse.FileType("w"), | |
64 default="out.fna", | |
65 help="Output nucleotide sequences", | |
66 ) | |
67 parser.add_argument( | |
68 "--op", | |
69 dest="out_prot", | |
70 type=argparse.FileType("w"), | |
71 default="out.fa", | |
72 help="Output protein sequences", | |
73 ) | |
74 parser.add_argument( | |
75 "--ob", | |
76 dest="out_bed", | |
77 type=argparse.FileType("w"), | |
78 default="out.bed", | |
79 help="Output BED file", | |
80 ) | |
81 parser.add_argument( | |
82 "--og", | |
83 dest="out_gff3", | |
84 type=argparse.FileType("w"), | |
85 default="out.gff3", | |
86 help="Output GFF3 file", | |
87 ) | |
88 parser.add_argument("-v", action="version", version="0.3.0") | |
89 args = parser.parse_args() | |
90 | |
91 of = OrfFinder(args.table, args.ftype, args.ends, args.min_len, args.strand) | |
92 of.locate(args.fasta_file, args.out_nuc, args.out_prot, args.out_bed, args.out_gff3) |