This repository has been archived by the owner on Nov 9, 2023. It is now read-only.
/
identify_missing_files.py
executable file
·51 lines (43 loc) · 1.85 KB
/
identify_missing_files.py
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
#!/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.9.1"
__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()