Ejemplo n.º 1
0
    def combineArrays_test(self):
        '''
        spotcheck combineArrays
        '''

        parallel = [
            [[0,1],[[100,101],[102,103],[104,105]], [992,993]],
            [[2,3],[[200,201],[202,203],[204,205]], [994,995]],
            [[4,5],[[300,301],[302,303],[304,305]], [996,997]],
            [[6,7],[[400,401],[402,403],[404,405]], [998,999]]
        ]

        truth, results, ids = main.combineArrays(parallel)

        assert numpy.array_equal(truth, [0,1,2,3,4,5,6,7])
        assert numpy.array_equal(results, [ [100,101, 200,201, 300,301, 400,401], [102,103, 202,203, 302,303, 402,403], [104,105, 204,205, 304,305, 404,405] ])
        assert numpy.array_equal(ids, [992, 993, 994, 995, 996, 997, 998, 999])
Ejemplo n.º 2
0
    def combineArrays_test(self):
        '''
        spotcheck combineArrays
        '''

        parallel = [[[0, 1], [[100, 101], [102, 103], [104, 105]], [992, 993]],
                    [[2, 3], [[200, 201], [202, 203], [204, 205]], [994, 995]],
                    [[4, 5], [[300, 301], [302, 303], [304, 305]], [996, 997]],
                    [[6, 7], [[400, 401], [402, 403], [404, 405]], [998, 999]]]

        truth, results, ids = main.combineArrays(parallel)

        assert numpy.array_equal(truth, [0, 1, 2, 3, 4, 5, 6, 7])
        assert numpy.array_equal(results,
                                 [[100, 101, 200, 201, 300, 301, 400, 401],
                                  [102, 103, 202, 203, 302, 303, 402, 403],
                                  [104, 105, 204, 205, 304, 305, 404, 405]])
        assert numpy.array_equal(ids, [992, 993, 994, 995, 996, 997, 998, 999])
Ejemplo n.º 3
0
    testNames.sort()
    print('{} quality control checks have been found'.format(len(testNames)))
    testNames = main.checkQCTestRequirements(testNames)
    print('{} quality control checks are able to be run:'.format(
        len(testNames)))
    for testName in testNames:
        print('  {}'.format(testName))

    # Identify data files and create a profile list.
    filenames = main.readInput('datafiles.json')
    profiles = main.extractProfiles(filenames)
    data.ds.profiles = profiles
    print('\n{} file(s) will be read containing {} profiles'.format(
        len(filenames), len(profiles)))

    # Parallel processing.
    print('\nPlease wait while QC is performed\n')
    processFile.parallel = main.parallel_function(processFile, sys.argv[2])
    parallel_result = processFile.parallel(filenames)

    # Recombine results
    truth, results, profileIDs = main.combineArrays(parallel_result)

    # Print summary statistics and write output file.
    main.printSummary(truth, results, testNames)
    main.generateCSV(truth, results, testNames, profileIDs, sys.argv[1])
else:
    print 'Please add command line arguments to name your output file and set parallelization:'
    print 'python AutoQC myFile 4'
    print 'will result in output written to results-myFile.csv, and will run the calculation parallelized across 4 cores.'
Ejemplo n.º 4
0
  # Identify and import tests
  testNames = main.importQC('qctests')
  testNames.sort()
  print('{} quality control checks have been found'.format(len(testNames)))
  testNames = main.checkQCTestRequirements(testNames)
  print('{} quality control checks are able to be run:'.format(len(testNames)))
  for testName in testNames:
    print('  {}'.format(testName))

  # Identify data files and create a profile list.
  filenames = main.readInput('datafiles.json')
  profiles  = main.extractProfiles(filenames)
  data.ds.profiles = profiles
  print('\n{} file(s) will be read containing {} profiles'.format(len(filenames), len(profiles)))

  # Parallel processing.
  print('\nPlease wait while QC is performed\n')
  processFile.parallel = main.parallel_function(processFile, sys.argv[2])
  parallel_result = processFile.parallel(filenames)

  # Recombine results
  truth, results, profileIDs = main.combineArrays(parallel_result)

  # Print summary statistics and write output file.
  main.printSummary(truth, results, testNames)
  main.generateCSV(truth, results, testNames, profileIDs, sys.argv[1])
else:
  print 'Please add command line arguments to name your output file and set parallelization:'
  print 'python AutoQC myFile 4'
  print 'will result in output written to results-myFile.csv, and will run the calculation parallelized across 4 cores.'