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
|
#!/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"]
__license__ = "GPL"
__version__ = "1.4.0"
__maintainer__ = "Greg Caporaso"
__email__ = "gregcaporaso@gmail.com"
__status__ = "Release"
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 expected file in parallel runs."
script_info['script_description'] = "This script checks for the existence expected file 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'] = [("","Check for the existence of files listed in the expected_out_files.txt from a PyNAST alignment run, and print a warning for any that are missing.","identify_missing_files.py -e ALIGN_BQ7_/expected_out_files.txt")]
script_info['output_description']= ""
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()
|