#@UGENE_WORKFLOW
#Search for transcription factor binding sites (TFBS) with weight matrices



workflow "Search weight matrix"{

    read-sequence {
        type:read-sequence;
        name:"Read sequence";
        url-in {
            dataset:"Dataset 1";
        }
    }
    wmatrix-read {
        type:wmatrix-read;
        name:"Read weight matrix";
    }
    wmatrix-search {
        type:wmatrix-search;
        name:"Search for TFBS with weight matrix";
        strand:0;
    }
    write-genbank {
        type:write-sequence;
        name:"Write Genbank";
        document-format:genbank;
    }


    .actor-bindings {
        read-sequence.out-sequence->wmatrix-search.in-sequence
        wmatrix-read.out-wmatrix->wmatrix-search.in-wmatrix
        wmatrix-search.out-annotations->write-genbank.in-sequence
    }

    read-sequence.sequence->wmatrix-search.in-sequence.sequence
    wmatrix-read.wmatrix->wmatrix-search.in-wmatrix.wmatrix
    read-sequence.annotations->write-genbank.in-sequence.annotations
    wmatrix-search.annotations->write-genbank.in-sequence.annotations
    read-sequence.sequence->write-genbank.in-sequence.sequence

    .meta {
        parameter-aliases {
            read-sequence.url-in {
                alias:seq;
                description:"Input sequence";
            }
            wmatrix-read.url-in {
                alias:matrix;
                description:"Input weight matrix";
            }
            wmatrix-search.min-score {
                alias:min-score;
                description:"Minimum score to detect transcription factor binding site (using '85' percents by default)";
            }
            wmatrix-search.result-name {
                alias:name;
                description:"Annotation name for marking found regions (using 'misc_feature' by default)";
            }
            wmatrix-search.strand {
                alias:strand;
                description:"Search strand";
            }
            write-genbank.accumulate {
                alias:accumulate;
                description:"Accumulate all incoming data in one file or create separate files for each input. In the latter case, an incremental numerical suffix is added to the file name (using 'True' by default)";
            }
            write-genbank.url-out {
                alias:out;
                description:"Output file with annotations";
            }
        }
        visual {
            read-sequence {
                pos:"-765 -585";
                style:ext;
                bg-color-ext:"0 128 128 64";
                out-sequence.angle:360;
            }
            wmatrix-read {
                pos:"-765 -390";
                style:ext;
                bg-color-ext:"0 128 128 64";
                out-wmatrix.angle:360;
            }
            wmatrix-search {
                pos:"-585 -480";
                style:ext;
                bg-color-ext:"0 128 128 64";
                in-sequence.angle:150;
                in-wmatrix.angle:210;
                out-annotations.angle:360;
            }
            write-genbank {
                pos:"-285 -480";
                style:ext;
                bg-color-ext:"0 128 128 64";
                in-sequence.angle:180;
            }
            read-sequence.out-sequence->wmatrix-search.in-sequence {
                text-pos:"-27.5 -24";
            }
            wmatrix-read.out-wmatrix->wmatrix-search.in-wmatrix {
                text-pos:"-37.5 -24";
            }
            wmatrix-search.out-annotations->write-genbank.in-sequence {
                text-pos:"-45 -37";
            }
        }
    }
}

