<commit_before>#!/usr/bin/env python


import os
import subprocess as sp
import argparse
try:
    import shlex
except ImportError as ie:
    sys.exit('Please install {} module before executing this script.'\
             .format(ie))


def prog_options():
    parser = argparse.ArgumentParser(
                description='Iterate through each folder in a file and run '
                            'some command.')
    parser.add_argument('sample_dir',
                        help='Directory containing sample folders.')
    return parser.parse_args()


def main():
    args = prog_options()

    for root, dirs, files in os.walk(args.sample_dir):
        if root != args.sample_dir and 'Data' not in root:
            os.chdir(root)
            print 'root: ', root
            print 'dir: ', dirs
            print 'files: ', files

#             if dirs == 'BaseCalls':
#             for file in files:
#                 cmd = 'mv {} ../../../{}'.format(file, file)
#                 kwargs = shlex.split(cmd)
#                 print 'kwargs', kwargs, '\n'
#                 sp.call(kwargs)

#             for file in files:
#                 if not file.endswith('fastq.gz') and not file.startswith('out') and not file.startswith('flash'):
#                     in1 = 'rm {}'.format(file)
#                     kwargs = shlex.split(in1)
#                     print kwargs
#                     sp.call(kwargs)
    return


if __name__ == '__main__':
    main()<commit_msg>Updated run.py. for generic usage.<commit_after>#!/usr/bin/env python


import os
import subprocess as sp
import argparse
try:
    import shlex
except ImportError as ie:
    sys.exit('Please install {} module before executing this script.'\
             .format(ie))


def prog_options():
    parser = argparse.ArgumentParser(
                description='Iterate through each folder in a file and run '
                            'some command.')
    parser.add_argument('sample_dir',
                        help='Directory containing sample folders.')
    return parser.parse_args()


def main():
    args = prog_options()

    for root, dirs, files in os.walk(args.sample_dir):
        print 'root: ', root
        print 'dir: ', dirs
        print 'files: ', files
    return


if __name__ == '__main__':
    main()
{'fraction_non_alphanumeric': 0.11178773379730318, 'fraction_numerical': 0.0008699434536755111, 'mean_word_length': 1.8360049321824907, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5773080', 'n_tokens_mistral': 654, 'n_tokens_neox': 625, 'n_words': 193}