File: btface.py

package info (click to toggle)
bowtie 1.3.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,816 kB
  • sloc: cpp: 37,094; perl: 5,806; ansic: 1,474; sh: 1,197; python: 462; makefile: 419
file content (36 lines) | stat: -rwxr-xr-x 1,056 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/env python

import os
import logging
import subprocess


class BowtieSuite(object):
    
    def __init__(self,bt_path=''):
        curr_path           = os.path.realpath(bt_path)
        self.bowtie_bin     = os.path.join(curr_path,'bowtie')
        self.bowtie_build   = os.path.join(curr_path,'bowtie-build')
        self.bowtie_inspect = os.path.join(curr_path,'bowtie-inspect')


    def run(self, *args):
        cmd = self.bowtie_bin + " " + " ".join([i for i in args])
        return(subprocess.call(cmd,shell=True))        
        
        
    def silent_run(self, *args):
        cmd = self.bowtie_bin + " " + " ".join([i for i in args])
        return(subprocess.call(cmd,shell=True,stderr=open(os.devnull, 'w')))        
        
        
    def build(self, *args):
        cmd = self.bowtie_build + " " + " ".join([i for i in args])
        curr_dir = os.getcwd()
        os.chdir(os.path.dirname(cmd.split()[-2]))
        ret = subprocess.check_call(cmd,shell=True)
        os.chdir(curr_dir)
        return(ret)