This file is indexed.

/usr/share/pyshared/cogent/app/knetfold.py is in python-cogent 1.5.3-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/env python 

from cogent.app.util import CommandLineApplication,\
    CommandLineAppResult, ResultPath
from cogent.app.parameters import Parameter, FlagParameter, ValuedParameter,\
    MixedParameter,Parameters, _find_synonym

__author__ = "Shandy Wikman"
__copyright__ = "Copyright 2007-2012, The Cogent Project"
__contributors__ = ["Shandy Wikman", "Daniel McDonald"]
__license__ = "GPL"
__version__ = "1.5.3"
__maintainer__ = "Shandy Wikman"
__email__ = "ens01svn@cs.umu.se"
__status__ = "Development"
                                      
class Knetfold(CommandLineApplication): 
    """Application controller for Knetfold v1.4.4b application"""

    _parameters = {'-i':ValuedParameter(Prefix='-',Name='i',Delimiter=' '),
                   '-n':ValuedParameter(Prefix='-',Name='n',Delimiter=' '),
                   '-d':ValuedParameter(Prefix='-',Name='d',Delimiter=' '),
                   '-m':ValuedParameter(Prefix='-',Name='m',Delimiter=' '),
                   '-q':ValuedParameter(Prefix='-',Name='q',Delimiter=' '),
                   '-o':ValuedParameter(Prefix='-',Name='o',Delimiter=' '),
                   '-r':ValuedParameter(Prefix='-',Name='r',Delimiter=' '),
                   '-f':ValuedParameter(Prefix='-',Name='f',Delimiter=' '),
                   '-h':ValuedParameter(Prefix='-',Name='h',Delimiter=' '),}
    

    _command = 'knetfold.pl'
    _input_handler = '_input_as_string'

    def _input_as_lines(self,data):
        """
        Infile needs to be set with parameter -i
        """
        filename = self._input_filename = self.getTmpFilename(self.WorkingDir)
        data_file = open(filename,'w')
        data_to_file = '\n'.join([str(d).strip('\n') for d in data])
        data_file.write(data_to_file)
        data_file.write('\n')
        data_file.close()

        #set input flag and give it the input filename
        self.Parameters['-i'].on(filename)
        return ''

    def _input_as_string(self,data):
        """Makes data the value of a specific parameter
        
        This method returns the empty string. The parameter will be printed
        automatically once set.
        """
        if data:
            self.Parameters['-i'].on(data)
        return ''

    def _get_result_paths(self,data):
        """
        Adds output files to the resultpath
        """
        result = {}

        if isinstance(data,list):
            filename=self._input_filename.split('/')[-1]
        else:
            filename=(data.split('/')[-1]).split('.')[0]
        #output files created in extensions list
        extensions = ['ct','coll','sec','fasta','pdf']
        #file = '%s%s%s' % (self.WorkingDir,filename,'_knet')
        file = ''.join([self.WorkingDir, filename, '_knet'])
        for ext in extensions:
            try:
                path = '%s.%s' % (file,ext)
                f = open(path)
                f.close()
                result[ext]=\
                    ResultPath(Path=(path))
            except IOError:
                pass
         
        number = 0
        #Unknown number of mx files, try/except to find all
        #file = '%s%s%s%d' % (self.WorkingDir,filename,'_knet.mx',number)
        file_base = ''.join([self.WorkingDir, filename, '_knet.mx'])
        while(True):
            try:
                file = file_base + str(number)
                f = open(file)
                result['%s%d' % ('mx',number)]= ResultPath(Path=(file))
                f.close()
                number +=1
            except IOError: #No more mx files
                break 
        return result