name        "SEQFETCHfile - Retrieve nucleotide FASTA entries from a fasta file"
icon    "$BIRCH/public_html/images/birch_black_ico.png"
tip    "Retrieve nucleotide FASTA entries from a fasta file"

var "userfile"
    type        file
    label       "User-created file (FASTA format)"

var "idtype"
    type        chooser
    label       "Name format"
    default     0
    choices
        "plain"     ""
        "NCBI ID eg. >lcl|X62103.1_cds_CAA44013.1_1" "--use-regexp --id-ncbi"

var "where"
    type        chooser
    label       "WHERE TO SEND OUTPUT"
    default     0
    choices
        "bldna"     "(bldna %in1%.tmp; rm %in1%.*)"
        "Textedit window" "($BL_TextEditor %in1%.tmp; rm %in1%.*) "
        "Output file" "mv %in1%.tmp %OUTFILE%; rm %in1%.*;  echo ' SeqFetch completed'"
       
var "in1"
    type        tempfile
    direction   in
    format      tsv
    save        true
var "outfile"
    type        text
    label       "Output file name"
panel
    var "Run"
        type        button
        label       "Run"
        shell       "(grep -v '#' %in1% | tr -d '\042' |cut -f1 > %in1%.nam; (seqkit grep -n -f %in1%.nam %IDTYPE% -o %in1%.tmp %USERFILE% ; %WHERE%))"
        close       true
    var "Help"
        type        button
        label       "Help"
        shell       "$BIRCH/script/chooseviewer.py $doc/seqkit.help"
        close       false
