comparison STACKS_clone_filter.py @ 5:1a5ebb16aaea draft

planemo upload commit 4d00a0b7a4b859b642eceb3c7cd4adb1453903a0-dirty
author tiagoantao
date Thu, 04 Feb 2016 07:50:26 -0500
parents 42e64fbf4609
children a8b87bc0c3ad
comparison
equal deleted inserted replaced
4:f4b429a3494a 5:1a5ebb16aaea
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 3
4 import argparse
5 import glob
6 import os
7 import subprocess
4 import shutil 8 import shutil
5 import subprocess
6 import argparse
7 9
8 10
9 def __main__(): 11 def __main__():
10 parser = argparse.ArgumentParser() 12 parser = argparse.ArgumentParser()
11 parser.add_argument('-f', type=str) 13 parser.add_argument('-f', type=str)
18 20
19 # create the working dir 21 # create the working dir
20 os.mkdir('job_outputs') 22 os.mkdir('job_outputs')
21 os.chdir('job_outputs') 23 os.chdir('job_outputs')
22 24
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 25 # create the populations command input line
28 cmd_line=['clone_filter'] 26 cmd_line=['clone_filter']
29 if options.f is not None: 27 if options.f is not None:
30 cmd_line.extend(['-f', options.f]) 28 cmd_line.extend(['-f', options.f])
31 else: 29 else:
34 32
35 print "[CMD]:"+' '.join(cmd_line) 33 print "[CMD]:"+' '.join(cmd_line)
36 subprocess.call(cmd_line) 34 subprocess.call(cmd_line)
37 35
38 # postprocesses 36 # postprocesses
39 clean_files = glob.glob('*.fq') 37 clean_files = glob.glob('*.fq*')
40 if options.f is not None: 38 if options.f is not None:
41 shutil.copy(clean_files[0], 'clean.fq') 39 shutil.copy(clean_files[0], 'clean.fq')
42 else: 40 else:
43 shutil.copy(clean_files[0], 'fwd.fq') 41 shutil.copy(clean_files[0], 'fwd.fq')
44 shutil.copy(clean_files[1], 'rev.fq') 42 shutil.copy(clean_files[1], 'rev.fq')