task starfusion{
    String sample_id
    File fastq1
    File fastq2
    File database_dir
	
    String docker
    String cluster
    String disk_size

    command <<<
	
        set -o pipefail
        set -e

        mkdir -p ${sample_id}/output

        STAR-Fusion --genome_lib_dir ${database_dir} \
            --left_fq ${fastq1} \
            --right_fq ${fastq2} \
            --CPU 4 \
            --output_dir  ${sample_id}/output

        tar -zcvf ${sample_id}/output/${sample_id}_FusionInspector-validate.tgz ${sample_id}/output/FusionInspector-validate

    >>>
	
    runtime {
        docker : docker
        cluster: cluster
        systemDisk: "cloud_ssd 40"
        dataDisk: "cloud_ssd " + disk_size + " /cromwell_root/"
    }

    output {
        Array[File] starfusion_result=glob("${sample_id}/output/*.tsv")
        Array[File] starfusion_bam=glob("${sample_id}/output/*.bam")
        Array[File] starfusion_tab=glob("${sample_id}/output/*.tab")
        Array[File] starfusion_junction=glob("${sample_id}/output/*.junction")
        Array[File] starfusion_out=glob("${sample_id}/output/*.out")
        Array[File] starfusion_tgz=glob("${sample_id}/output/*.tgz")
    }

}


