File: Applications.py

package info (click to toggle)
python-biopython 1.42-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 17,584 kB
  • ctags: 12,272
  • sloc: python: 80,461; xml: 13,834; ansic: 7,902; cpp: 1,855; sql: 1,144; makefile: 203
file content (76 lines) | stat: -rw-r--r-- 2,960 bytes parent folder | download
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
"""Definitions for interacting with AlignAce.
"""
from Bio import Application
from Bio.Application import _Option,_Argument

class AlignAceCommandline(Application.AbstractCommandline):
    """Create a commandline for the AlignAce program.

    XXX This could use more checking for valid paramters to the program.
    """
    def __init__(self, cmd = "AlignACE"):

        Application.AbstractCommandline.__init__(self)
        self.program_name = cmd

        self.parameters = \
          [
            _Option(["-i","input","Sequence File"],["input"],lambda x : x.__class__== str,1,
                    "Input Sequence file in FASTA format."),
            
            _Option(["-numcols","numcols","number of columns to align"],["input"],lambda x : x.__class__== int,0,
                    "Number of columns to align"),

            _Option(["-expect","expect","number of sites expected in model "],["input"],lambda x : x.__class__== int,0,
                    "number of sites expected in model "),
            
            _Option(["-gcback","gcback","background fractional GC content of input sequence"],["input"],lambda x : x.__class__== float,0,
                    "background fractional GC content of input sequence"),
            
            _Option(["-minpass","minpass","minimum number of non-improved passes in phase 1"],["input"],lambda x : x.__class__== int,0,
                    "minimum number of non-improved passes in phase 1"),
            
            _Option(["-seed","seed","set seed for random number generator (time)"],["input"],lambda x : x.__class__== int,0,
                    "set seed for random number generator (time)"),
            
            _Option(["-undersample","undersample","possible sites / (expect * numcols * seedings)"],["input"],lambda x : x.__class__== int,0,
                    "possible sites / (expect * numcols * seedings)"),

            _Option(["-oversample","oversample","1/undersample"],["input"],lambda x : x.__class__== int,0,
                    "1/undersample"),
          ]

    def run(self):
        return Application.generic_run(self)



class CompareAceCommandline(Application.AbstractCommandline):
    """Create a commandline for the CompareAce program.

    XXX This could use more checking for valid paramters to the program.
    """
    def __init__(self, cmd = "CompareACE"):

        Application.AbstractCommandline.__init__(self)
        self.program_name = cmd

        self.parameters = \
          [
            _Argument(["motif1"],["input","file"], _file_exists,1,"name of file containing motif 1"),
            _Argument(["motif2"],["input","file"], _file_exists,1,"name of file containing motif 2"),
          ]

    def run(self):
        return Application.generic_run(self)

def _file_exists(file_name):
    """
    Checks whether a given file exists
    """
    import os
    try:
        os.stat(file_name)
        return True
    except OSError:
        return False