Mercurial > repos > tiagoantao > clone_filter
comparison STACKS_clone_filter.py @ 0:42e64fbf4609 draft
planemo upload commit 60a090d1dc89c2eb383feeb35cd6078b9130e0e5-dirty
author | tiagoantao |
---|---|
date | Tue, 02 Feb 2016 21:15:50 -0500 |
parents | |
children | 1a5ebb16aaea |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:42e64fbf4609 |
---|---|
1 #!/usr/bin/python | |
2 # -*- coding: utf-8 -*- | |
3 | |
4 import shutil | |
5 import subprocess | |
6 import argparse | |
7 | |
8 | |
9 def __main__(): | |
10 parser = argparse.ArgumentParser() | |
11 parser.add_argument('-f', type=str) | |
12 parser.add_argument('-fwd', type=str) | |
13 parser.add_argument('-rev', type=str) | |
14 | |
15 #parser.add_argument('-k', action='store_true') | |
16 | |
17 options = parser.parse_args() | |
18 | |
19 # create the working dir | |
20 os.mkdir('job_outputs') | |
21 os.chdir('job_outputs') | |
22 | |
23 # STACKS_archive | |
24 # check if zipped files are into the tab | |
25 extract_compress_files(options.P, os.getcwd()) | |
26 | |
27 # create the populations command input line | |
28 cmd_line=['clone_filter'] | |
29 if options.f is not None: | |
30 cmd_line.extend(['-f', options.f]) | |
31 else: | |
32 cmd_line.extend(['-1', options.fwd]) | |
33 cmd_line.extend(['-2', options.rev]) | |
34 | |
35 print "[CMD]:"+' '.join(cmd_line) | |
36 subprocess.call(cmd_line) | |
37 | |
38 # postprocesses | |
39 clean_files = glob.glob('*.fq') | |
40 if options.f is not None: | |
41 shutil.copy(clean_files[0], 'clean.fq') | |
42 else: | |
43 shutil.copy(clean_files[0], 'fwd.fq') | |
44 shutil.copy(clean_files[1], 'rev.fq') | |
45 | |
46 | |
47 if __name__ == '__main__': | |
48 __main__() |