void PFMatrixBuildWorker::registerProto() { QList<PortDescriptor*> p; QList<Attribute*> a; QMap<Descriptor, DataTypePtr> m; Descriptor id(BasePorts::IN_MSA_PORT_ID(), PFMatrixBuildWorker::tr("Input alignment"), PFMatrixBuildWorker::tr("Input multiple sequence alignment for building statistical model.")); m[BaseSlots::MULTIPLE_ALIGNMENT_SLOT()] = BaseTypes::MULTIPLE_ALIGNMENT_TYPE(); DataTypePtr t(new MapDataType(Descriptor("build.pfmatrix.content"), m)); Descriptor od(FMATRIX_OUT_PORT_ID, PFMatrixBuildWorker::tr("Frequency matrix"), PFMatrixBuildWorker::tr("Produced statistical model of specified TFBS data.")); p << new PortDescriptor(id, t, true /*input*/); QMap<Descriptor, DataTypePtr> outM; outM[PFMatrixWorkerFactory::FMATRIX_SLOT] = PFMatrixWorkerFactory::FREQUENCY_MATRIX_MODEL_TYPE(); p << new PortDescriptor(od, DataTypePtr(new MapDataType("fmatrix.build.out", outM)), false /*input*/, true /*multi*/); { Descriptor td(TYPE_ATTR, PWMatrixBuildWorker::tr("Matrix type"), PWMatrixBuildWorker::tr("Dinucleic matrices are more detailed, while mononucleic one are more useful for small input data sets.")); a << new Attribute(td, BaseTypes::BOOL_TYPE(), true, false /* false = mononucleic, true = dinucleic */); } Descriptor desc(ACTOR_ID, tr("Build Frequency Matrix"), tr("Builds frequency matrix. Frequency matrices are used for probabilistic recognition of transcription factor binding sites.")); ActorPrototype* proto = new IntegralBusActorPrototype(desc, p, a); QMap<QString, PropertyDelegate*> delegates; { QVariantMap modeMap; modeMap[tr("Mononucleic")] = QVariant(false); modeMap[tr("Dinucleic")] = QVariant(true); delegates[TYPE_ATTR] = new ComboBoxDelegate(modeMap); } proto->setPrompter(new PFMatrixBuildPrompter()); proto->setEditor(new DelegateEditor(delegates)); proto->setIconPath(":weight_matrix/images/weight_matrix.png"); WorkflowEnv::getProtoRegistry()->registerProto(BaseActorCategories::CATEGORY_TRANSCRIPTION(), proto); }
void CollocationWorkerFactory::init() { QMap<Descriptor, DataTypePtr> m; { m[BaseSlots::DNA_SEQUENCE_SLOT()] = BaseTypes::DNA_SEQUENCE_TYPE(); m[BaseSlots::ANNOTATION_TABLE_SLOT()] = BaseTypes::ANNOTATION_TABLE_LIST_TYPE(); } DataTypePtr inSet(new MapDataType(Descriptor("regioned.sequence"), m)); DataTypeRegistry* dr = WorkflowEnv::getDataTypeRegistry(); assert(dr); dr->registerEntry(inSet); QList<PortDescriptor*> p; QList<Attribute*> a; p << new PortDescriptor(Descriptor(BasePorts::IN_SEQ_PORT_ID(), CollocationWorker::tr("Input data"), CollocationWorker::tr("An input sequence and a set of annotations to search in.")), inSet, true /*input*/); QMap<Descriptor, DataTypePtr> outM; outM[BaseSlots::ANNOTATION_TABLE_SLOT()] = BaseTypes::ANNOTATION_TABLE_TYPE(); p << new PortDescriptor(Descriptor(BasePorts::OUT_ANNOTATIONS_PORT_ID(), CollocationWorker::tr("Group annotations"), CollocationWorker::tr("Annotated regions containing found collocations.")), DataTypePtr(new MapDataType(Descriptor("collocation.annotations"), outM)), false /*input*/, true/*multi*/); static const QString newAnnsStr = CollocationWorker::tr("Create new annotations"); { Descriptor nd(NAME_ATTR, CollocationWorker::tr("Result annotation"), CollocationWorker::tr("Name of the result annotations to mark found collocations.")); Descriptor ad(ANN_ATTR, CollocationWorker::tr("Group of annotations"), CollocationWorker::tr("A list of annotation names to search. Found regions will contain all the named annotations.")); Descriptor ld(LEN_ATTR, CollocationWorker::tr("Region size"), CollocationWorker::tr("Effectively this is the maximum allowed distance between the interesting annotations in a group.")); Descriptor fd(FIT_ATTR, CollocationWorker::tr("Must fit into region"), CollocationWorker::tr("Whether the interesting annotations should entirely fit into the specified region to form a group.")); Descriptor td(TYPE_ATTR, CollocationWorker::tr("Result type"), CollocationWorker::tr("Copy original annotations or annotate found regions with new ones.")); Descriptor id(INC_BOUNDARY_ATTR, CollocationWorker::tr("Include boundaries"), CollocationWorker::tr("Include most left and most right boundary annotations regions into result or exclude them.")); Attribute *nameAttr = new Attribute(nd, BaseTypes::STRING_TYPE(), true, QVariant("misc_feature")); Attribute *typeAttr = new Attribute(td, BaseTypes::STRING_TYPE(), false, NEW_TYPE_ATTR); Attribute *boundAttr = new Attribute(id, BaseTypes::BOOL_TYPE(), false, true); a << typeAttr; a << nameAttr; a << boundAttr; a << new Attribute(ad, BaseTypes::STRING_TYPE(), true); a << new Attribute(ld, BaseTypes::NUM_TYPE(), false, QVariant(1000)); a << new Attribute(fd, BaseTypes::BOOL_TYPE(), false, QVariant(false)); nameAttr->addRelation(new VisibilityRelation(TYPE_ATTR, NEW_TYPE_ATTR)); boundAttr->addRelation(new VisibilityRelation(TYPE_ATTR, NEW_TYPE_ATTR)); } Descriptor desc(ACTOR_ID, CollocationWorker::tr("Collocation Search"), CollocationWorker::tr("Finds groups of specified annotations in each supplied set of annotations, stores found regions as annotations.")); ActorPrototype* proto = new IntegralBusActorPrototype(desc, p, a); QMap<QString, PropertyDelegate*> delegates; { QVariantMap lenMap; lenMap["minimum"] = QVariant(0); lenMap["maximum"] = QVariant(INT_MAX); delegates[LEN_ATTR] = new SpinBoxDelegate(lenMap); delegates[FIT_ATTR] = new ComboBoxWithBoolsDelegate(); QVariantMap typeMap; typeMap[CollocationWorker::tr("Copy original annotations")] = COPY_TYPE_ATTR; typeMap[newAnnsStr] = NEW_TYPE_ATTR; delegates[TYPE_ATTR] = new ComboBoxDelegate(typeMap); } proto->setEditor(new DelegateEditor(delegates)); proto->setValidator(new CollocationValidator()); proto->setIconPath(":annotator/images/regions.png"); proto->setPrompter(new CollocationPrompter()); WorkflowEnv::getProtoRegistry()->registerProto(BaseActorCategories::CATEGORY_BASIC(), proto); DomainFactory* localDomain = WorkflowEnv::getDomainRegistry()->getById(LocalDomainFactory::ID); localDomain->registerEntry(new CollocationWorkerFactory()); }
void RepeatWorkerFactory::init() { QList<PortDescriptor*> p; QList<Attribute*> a; { Descriptor id(BasePorts::IN_SEQ_PORT_ID(), RepeatWorker::tr("Input sequences"), RepeatWorker::tr("A nucleotide sequence to search repeats in.")); Descriptor od(BasePorts::OUT_ANNOTATIONS_PORT_ID(), RepeatWorker::tr("Repeat annotations"), RepeatWorker::tr("A set of annotations marking repeats found in the sequence.")); QMap<Descriptor, DataTypePtr> inM; inM[BaseSlots::DNA_SEQUENCE_SLOT()] = BaseTypes::DNA_SEQUENCE_TYPE(); p << new PortDescriptor(id, DataTypePtr(new MapDataType("repeat.seq", inM)), true /*input*/); QMap<Descriptor, DataTypePtr> outM; outM[BaseSlots::ANNOTATION_TABLE_SLOT()] = BaseTypes::ANNOTATION_TABLE_TYPE(); p << new PortDescriptor(od, DataTypePtr(new MapDataType("repeat.annotations", outM)), false /*input*/, true /*multi*/); } { Descriptor nd(NAME_ATTR, RepeatWorker::tr("Annotate as"), RepeatWorker::tr("Name of the result annotations marking found repeats.")); Descriptor idd(IDENTITY_ATTR, RepeatWorker::tr("Identity"), RepeatWorker::tr("Repeats identity.")); Descriptor ld(LEN_ATTR, RepeatWorker::tr("Min length"), RepeatWorker::tr("Minimum length of repeats.")); Descriptor mid(MIN_DIST_ATTR, RepeatWorker::tr("Min distance"), RepeatWorker::tr("Minimum distance between repeats.")); Descriptor mad(MAX_DIST_ATTR, RepeatWorker::tr("Max distance"), RepeatWorker::tr("Maximum distance between repeats.")); Descriptor ind(INVERT_ATTR, RepeatWorker::tr("Inverted"), RepeatWorker::tr("Search for inverted repeats.")); Descriptor nsd(NESTED_ATTR, RepeatWorker::tr("Filter algorithm"), RepeatWorker::tr("Filter repeats algorithm.")); Descriptor ald(ALGO_ATTR, RepeatWorker::tr("Algorithm"), RepeatWorker::tr("Control over variations of algorithm.")); Descriptor thd(THREADS_ATTR, RepeatWorker::tr("Parallel threads"), RepeatWorker::tr("Number of parallel threads used for the task.")); Descriptor tan(TANMEDS_ATTR, RepeatWorker::tr("Exclude tandems"), RepeatWorker::tr("Exclude tandems areas before find repeat task is run.")); Descriptor umaxd(USE_MAX_DISTANCE_ATTR, RepeatWorker::tr("Apply 'Max distance' attribute"), RepeatWorker::tr("Apply 'Max distance' attribute.")); Descriptor umind(USE_MIN_DISTANCE_ATTR, RepeatWorker::tr("Apply 'Min distance' attribute"), RepeatWorker::tr("Apply 'Max distance' attribute.")); FindRepeatsTaskSettings cfg = FindRepeatsDialog::defaultSettings(); Attribute *aa; a << new Attribute(nd, BaseTypes::STRING_TYPE(), true, "repeat_unit"); aa = new Attribute(ld, BaseTypes::NUM_TYPE(), false); aa->setAttributeValue(cfg.minLen); a << aa; aa = new Attribute(idd, BaseTypes::NUM_TYPE(), false); aa->setAttributeValue(cfg.getIdentity()); a << aa; a << new Attribute(umind, BaseTypes::BOOL_TYPE(), false, true); aa = new Attribute(mid, BaseTypes::NUM_TYPE(), false); aa->setAttributeValue(cfg.minDist); aa->addRelation(new VisibilityRelation(USE_MIN_DISTANCE_ATTR, true)); a << aa; a << new Attribute(umaxd, BaseTypes::BOOL_TYPE(), false, true); aa = new Attribute(mad, BaseTypes::NUM_TYPE(), false); aa->setAttributeValue(cfg.maxDist); aa->addRelation(new VisibilityRelation(USE_MAX_DISTANCE_ATTR, true)); a << aa; aa = new Attribute(ind, BaseTypes::BOOL_TYPE(), false); aa->setAttributeValue(cfg.inverted); a << aa; aa = new Attribute(nsd, BaseTypes::NUM_TYPE(), false); aa->setAttributeValue(cfg.filter); a << aa; aa = new Attribute(ald, BaseTypes::NUM_TYPE(), false); aa->setAttributeValue(cfg.algo); a << aa; aa = new Attribute(thd, BaseTypes::NUM_TYPE(), false); aa->setAttributeValue(cfg.nThreads); a << aa; aa = new Attribute(tan, BaseTypes::BOOL_TYPE(), false); aa->setAttributeValue(cfg.excludeTandems); a << aa; } Descriptor desc(ACTOR_ID, RepeatWorker::tr("Find Repeats"), RepeatWorker::tr("Finds repeats in each supplied sequence, stores found regions as annotations.") ); ActorPrototype* proto = new IntegralBusActorPrototype(desc, p, a); QMap<QString, PropertyDelegate*> delegates; delegates[USE_MIN_DISTANCE_ATTR] = new ComboBoxWithBoolsDelegate(); delegates[USE_MAX_DISTANCE_ATTR] = new ComboBoxWithBoolsDelegate(); { QVariantMap m; m["minimum"] = 0; m["maximum"] = INT_MAX; m["suffix"] = L10N::suffixBp(); delegates[MIN_DIST_ATTR] = new SpinBoxDelegate(m); m["specialValueText"] = RepeatWorker::tr("Any"); delegates[MAX_DIST_ATTR] = new SpinBoxDelegate(m); m["minimum"] = 2; delegates[LEN_ATTR] = new SpinBoxDelegate(m); } { QVariantMap m; m["minimum"] = 50; m["maximum"] = 100; m["suffix"] = "%"; delegates[IDENTITY_ATTR] = new SpinBoxDelegate(m); } { QVariantMap m; m["specialValueText"] = "Auto"; delegates[THREADS_ATTR] = new SpinBoxDelegate(m); } { QVariantMap m; m["Auto"] = RFAlgorithm_Auto; m["Diagonals"] = RFAlgorithm_Diagonal; m["Suffix index"] = RFAlgorithm_Suffix; delegates[ALGO_ATTR] = new ComboBoxDelegate(m); } { QVariantMap m; m["Disjoint repeats"] = DisjointRepeats; m["No filtering"] = NoFiltering; m["Unique repeats"] = UniqueRepeats; delegates[NESTED_ATTR] = new ComboBoxDelegate(m); } proto->setPrompter(new RepeatPrompter()); proto->setEditor(new DelegateEditor(delegates)); proto->setIconPath(":repeat_finder/images/repeats.png"); WorkflowEnv::getProtoRegistry()->registerProto(BaseActorCategories::CATEGORY_BASIC(), proto); DomainFactory* localDomain = WorkflowEnv::getDomainRegistry()->getById(LocalDomainFactory::ID); localDomain->registerEntry(new RepeatWorkerFactory()); }