File: identify_missing_files.py

package info (click to toggle)
qiime 1.8.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 130,508 kB
  • ctags: 10,145
  • sloc: python: 110,826; haskell: 379; sh: 169; makefile: 125
file content (48 lines) | stat: -rwxr-xr-x 1,773 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
#!/usr/bin/env python
# File created on 01 Jun 2011
from __future__ import division

__author__ = "Greg Caporaso"
__copyright__ = "Copyright 2011, The QIIME project"
__credits__ = ["Greg Caporaso", "Jai Ram Rideout"]
__license__ = "GPL"
__version__ = "1.8.0"
__maintainer__ = "Greg Caporaso"
__email__ = "gregcaporaso@gmail.com"
 
from qiime.util import parse_command_line_parameters, make_option
from os.path import exists

script_info = {}
script_info['brief_description'] = "This script checks for the existence of expected files in parallel runs."
script_info['script_description'] = "This script checks for the existence of expected files in parallel runs, and is useful for checking the status of a parallel run or for finding out what poller.py is waiting on in a possibly failed run."
script_info['script_usage'] = [("Example",
"Check for the existence of files listed in expected_out_files.txt from a "
"PyNAST alignment run, and print a warning for any that are missing.",
"%prog -e ALIGN_BQ7_/expected_out_files.txt")]
script_info['output_description']= """
This script does not create any output files.
"""
script_info['required_options'] = [
 make_option('-e','--expected_out_fp',
             type="existing_filepath",
             help='the list of expected output files')
]
script_info['optional_options'] = []
script_info['version'] = __version__

def main():
    option_parser, opts, args = parse_command_line_parameters(**script_info)

    filepaths = [l.strip() for l in open(opts.expected_out_fp,'U')]
    all_exist = True
    for fp in filepaths:
        if not exists(fp):
            print "Filepath doesn't exist: %s" % fp
            all_exist = False
    if all_exist:
        print "All filepaths exist."


if __name__ == "__main__":
    main()