def main()

in src/main/scripts/rna_expression_fastq.py [0:0]


def main(script_name, argv):
    species, read_type, job_name, dir_out, fastq_list, fastq_list_r2, cufflinks_library_type, library_type, project, \
        run, toolset, flag_xenome, cores_per_sample, verbose, sync, genome_load, sample_name_list, master_mode = \
        parse_arguments(script_name, argv)
    if not library_type:
        library_type = "RNASeq"
    if not job_name:
        job_name = "{}_job".format(library_type)
    if not run:
        run = "{}_run".format(library_type)
    if not genome_load:
        genome_load = "LoadAndRemove"
    global_config = GlobalConfig(species, read_type, TEMPLATE, WORKFLOW_NAME, toolset)
    if species == "human":
        global_config_tool_template_name = GLOBAL_CONFIG_TOOL_TEMPLATE_NAME_HUMAN
    elif species == "mouse":
        global_config_tool_template_name = GLOBAL_CONFIG_TOOL_TEMPLATE_NAME_MOUSE
    else:
        raise RuntimeError('Failed to determine "species" parameter. Available species: "human"/"mouse"')

    global_config_path = global_config.create(global_config_tool_template_name, None, flag_xenome=flag_xenome,
                                              cores_per_sample=cores_per_sample, genome_load=genome_load)
    if os.path.isdir(fastq_list):
        fastq_list = FastqSampleManifest(read_type).create_by_folder(fastq_list, WORKFLOW_NAME, library_type)
    elif 'fastq.gz' in str(fastq_list).split(',')[0]:
        sample_name_list = list(str(sample_name_list).split(',')) if sample_name_list else None
        fastq_list = FastqSampleManifest(read_type).create_by_list(list(str(fastq_list).split(',')),
                                                                   list(str(fastq_list_r2).split(',')),
                                                                   WORKFLOW_NAME, library_type,
                                                                   sample_names=sample_name_list)
    study_config = StudyConfig(job_name, dir_out, fastq_list, cufflinks_library_type, library_type, run,
                               project=project)
    study_config_path = study_config.parse(workflow=WORKFLOW_NAME)
    Launcher.launch(global_config_path, study_config_path, sync, java_path=global_config.java_path, verbose=verbose,
                    master=master_mode)