name        "ClustalOmega - multiple alignment"
icon    "$BIRCH/dat/blprotein/PCD/Alignment/clustalo_title.png"
tip    "Multiple sequence alignment"
system
    linux    x86_64,x86
    osx      x86_64

var "in1"
    type        tempfile
    direction   in
    format      fasta
    save        false

tabset
    # - - - - - - - - - - - - - - - - - - - - - - -
    tab "General"

        var "hmm"
            type        chooser
            label       "Use HMM file?"
            default     1
            choices
                "Yes" "--hmm-in=%HMMFILE%"
                "No" ""

        var "hmmfile"
            type        file
            label       "     HMM filename:"
            default     "none"

        var "usekimura"
            type        chooser
            label       "Use Kimura distance correction"
            default     1
            choices
                "Yes"  "--use-kimura"
                "No" ""

        var "threads"
             type        number
             label       "Number of threads to use"
             min         1
             max         $BL_CORES_MAX
             default     $BL_CORES_DEFAULT

    # - - - - - - - - - - - - - - - - - - - - - - -
    tab "Iterations"

        var "iterations"
             type        number
             label       "Number of iterations"
             min         1
             max         10
             default     1

        var "guideiter"
             type        number
             label       "Number of guide tree iterations"
             min         1
             max         10
             default     1

        var "hmmiter"
             type        number
             label       "Number of HMM iterations"
             min         1
             max         10
             default     1

        var "clguidetree"
            type        combobox
            label       "Clustering guide-tree"
            default     0
            choices
                "mBed (default)"  ""
                "full dist. matrix (slow)" "--full"
                "full dist. matrix for guide tree only " "--full-iter"

    # - - - - - - - - - - - - - - - - - - - - - - -
    tab "Output"
        var "outorder"
            type        chooser
            label       "Output order"
            default     1
            choices
                "same as input"  "--output-order=input-order"
                "order sequences by aligned similarity" "--output-order=tree-order"

        var "outname"
            type        text
            label       "Output file name"
            default     "clustalo.fsa"

panel
    # remove * at end of sequences, if they exist
    # Otherwise, if *'s are included in an alignment, they falsely
    # act as amino acids at a position, which throws the alignment off.
    var "Run1"
        type        button
        label       "Run - Output to screen"
        shell       "sed ""s/\*$//"" < %in1% > %in1%.tmp; clustalo -i %in1%.tmp --seqtype=Protein %USEKIMURA%  --threads=%THREADS% --iter=%ITERATIONS% --max-guidetree-iterations=%GUIDEITER% --max-hmm-iterations=%HMMITER% %CLGUIDETREE% -o %in1%.aln; cat %in1%.aln |sed -e 's/^>/%/' >%in1%.fsa; (blpalign %in1%.fsa; rm %in1%.tmp %in1%.aln %in1%.fsa)"

        close       true
    var "Run2"
        type        button
        label       "Run - Output to file"
        shell       "sed ""s/\*$//"" < %in1% > %in1%.tmp; (clustalo -i %in1%.tmp --seqtype=Protein %USEKIMURA% --threads=%THREADS% --iter=%ITERATIONS% --max-guidetree-iterations=%GUIDEITER% --max-hmm-iterations=%HMMITER% %CLGUIDETREE% -o %OUTNAME%; rm %in1%.tmp; echo'ClustalOmega completed')&"
        close       true
    var "Help"
        type        button
        label       "Manual"
        shell       "$BL_TextEditor $BIRCH/doc/clustal/clustalo.man"
        close       false
