Total Complexity | 2 |
Total Lines | 56 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | #!/usr/bin/env python |
||
2 | # -*- coding: utf-8 -*- |
||
3 | """rna_download_rfam.py - download all cm and seeds |
||
4 | |||
5 | For the list grep seed file:: |
||
6 | |||
7 | (base) rnahub@rnahub:~/db/rfam$ grep '#=GF AC' Rfam.seed | wc -l |
||
8 | #=GF AC RF04297 |
||
9 | #=GF AC RF04298 |
||
10 | #=GF AC RF04299 |
||
11 | #=GF AC RF04300 |
||
12 | |||
13 | or cm:: |
||
14 | |||
15 | (base) rnahub@rnahub:~/db/rfam$ grep ACC Rfam.cm |
||
16 | ACC RF04235 |
||
17 | ACC RF04235 |
||
18 | ACC RF04236 |
||
19 | ACC RF04236 |
||
20 | |||
21 | |||
22 | """ |
||
23 | from __future__ import print_function |
||
24 | import argparse |
||
25 | from icecream import ic |
||
26 | import sys |
||
27 | ic.configureOutput(outputFunction=lambda *a: print(*a, file=sys.stderr)) |
||
28 | ic.configureOutput(prefix='> ') |
||
29 | import os |
||
30 | |||
31 | def process_rfam(family_id, job_path='./rfam'): |
||
32 | os.system(f"wget https://rfam.org/family/{family_id}/alignment/stockholm -O {job_path}/{family_id}.seed.sto") |
||
33 | os.system(f"wget https://rfam.org/family/{family_id}/alignment/fastau -O {job_path}/{family_id}.seed.fa") |
||
34 | os.system(f"wget https://rfam.org/family/{family_id}/cm -O {job_path}/{family_id}.cm") |
||
35 | |||
36 | def get_parser(): |
||
37 | parser = argparse.ArgumentParser( |
||
38 | description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) |
||
39 | |||
40 | #parser.add_argument('-', "--", help="", default="") |
||
41 | |||
42 | parser.add_argument("-v", "--verbose", |
||
43 | action="store_true", help="be verbose") |
||
44 | parser.add_argument("file", help="", default="") # nargs='+') |
||
45 | return parser |
||
46 | |||
47 | |||
48 | if __name__ == '__main__': |
||
49 | parser = get_parser() |
||
50 | args = parser.parse_args() |
||
51 | |||
52 | for l in open(args.file): |
||
53 | rfam_id = l.split()[2] |
||
54 | print(rfam_id) |
||
55 | process_rfam(rfam_id) |
||
56 |