#!python
import argparse

import spatialprofilingtoolbox as spt

if __name__=='__main__':
    parser = argparse.ArgumentParser(
        description = ''.join([
            'This program does cell phenotype-phenotype proximity calculations in multiplexed IF images.',
            'It is formulated as a script so that it can be run as part of large HPC batches. '
            'It generally needs to be run as part of spt-pipeline, to ensure proper initialization.',
        ])
    )
    parser.add_argument('--input-file-identifier',
        dest='input_file_identifier',
        type=str,
        required=True,
        help='The input file to process.',
    )
    parser.add_argument('--job-index',
        dest='job_index',
        type=str,
        required=True,
        help='Integer index into job activity table.',
    )
    args = parser.parse_args()

    kwargs = {}
    kwargs['input_file_identifier'] = args.input_file_identifier
    kwargs['job_index'] = args.job_index
    parameters = spt.get_config_parameters_from_file()
    parameters = {**kwargs, **parameters}
    a = spt.get_analyzer(**parameters)
    a.calculate()
