File: bwa_samse.py

package info (click to toggle)
giira 0.0.20140210-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 744 kB
  • ctags: 480
  • sloc: java: 8,165; python: 258; xml: 44; sh: 26; makefile: 13
file content (42 lines) | stat: -rw-r--r-- 1,147 bytes parent folder | download | duplicates (3)
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
41
42
# -*- coding: utf-8 -*-
"""
Created on Oct 31 16:29:55 2011
helper script to call bwa samse
Copyright (c) 2013,
Franziska Zickmann, 
ZickmannF@rki.de, Robert Koch-Institute, Berlin, Germany
Distributed under the GNU Lesser General Public License, version 3.0
"""
#!/usr/bin/env python
import os
import optparse
import subprocess

parser = optparse.OptionParser()

args = parser.parse_args()

paras = args[1][0]
orfFile = args[1][1]
alnFile = args[1][2]
rnaFile = args[1][3]
outFile = args[1][4]

callPara = " "
fnull = open(os.devnull, 'w')

if paras == 0:
        syscall = "bwa samse %s %s %s > %s" %(orfFile,alnFile,rnaFile,outFile)
        os.system(syscall)
        result = subprocess.call(syscall, shell = True, stdout = fnull, stderr = fnull)
        fnull.close()
else:
        stringAr = paras[1:(len(paras)-1)].split("_")
        for data in stringAr:
                callPara=callPara+data+" "
        syscall = "bwa samse%s%s %s %s> %s" %(callPara,orfFile,alnFile,rnaFile,outFile)
        os.system(syscall)
	print syscall
        result = subprocess.call(syscall, shell = True, stdout = fnull, stderr = fnull)
        fnull.close()