void Server::slotSendMsg(qintptr sockd, char *outbuf, uint outlen, quint16 shPdu) { QByteArray outBa; QDataStream outD(&outBa, QIODevice::ReadWrite); outD << shPdu; outD.writeRawData(outbuf, outlen); outlen = outBa.length(); QDataStream chkD(&outBa, QIODevice::ReadOnly); qint16 shRet; chkD >> shPdu; chkD >> shRet; QMap<qintptr, TcpClientSocket*>::iterator clientIt; clientIt = clientList.find(sockd); if (clientIt != clientList.end()) { (clientIt.value())->write(outBa.data(), (qint64)outlen); qDebug() << "void Server::slotSendMsg() - outlen=[" << outlen << "], sockd=" << sockd << " ,shPdu=" << shPdu << " ,shRet" << shRet; } }
void Server::slotSendMsg(QString szClientName, char *outbuf, uint outlen, quint16 shPdu) { QByteArray outBa; QDataStream outD(&outBa, QIODevice::ReadWrite); outD << shPdu; outD.writeRawData(outbuf, outlen); outlen = outBa.length(); QDataStream chkD(&outBa, QIODevice::ReadOnly); chkD >> shPdu; QMap<qintptr, TcpClientSocket*>::iterator clientIt = clientList.begin(); for (; clientIt!=clientList.end(); clientIt++) { if ((clientIt.value())->getClientName() == szClientName) { (clientIt.value())->write(outBa.data(), (qint64)outlen); qDebug() << "void Server::slotSendMsg(username) - outlen=[" << outlen << "] ,shPdu=" << shPdu; break; } } }
void MergeFastqWorkerFactory::init() { Descriptor desc( ACTOR_ID, MergeFastqWorker::tr("FASTQ Merger"), MergeFastqWorker::tr("Merges input sequences to one output file") ); QList<PortDescriptor*> p; { Descriptor inD(BaseNGSWorker::INPUT_PORT, MergeFastqWorker::tr("Input File"), MergeFastqWorker::tr("Set of FASTQ reads files")); Descriptor outD(BaseNGSWorker::OUTPUT_PORT, MergeFastqWorker::tr("Output File"), MergeFastqWorker::tr("Output FASTQ file")); QMap<Descriptor, DataTypePtr> inM; inM[BaseSlots::URL_SLOT()] = BaseTypes::STRING_TYPE(); p << new PortDescriptor(inD, DataTypePtr(new MapDataType("cf.input-url", inM)), true); QMap<Descriptor, DataTypePtr> outM; outM[BaseSlots::URL_SLOT()] = BaseTypes::STRING_TYPE(); p << new PortDescriptor(outD, DataTypePtr(new MapDataType("cf.output-url", outM)), false, true); } QList<Attribute*> a; { Descriptor outDir(BaseNGSWorker::OUT_MODE_ID, MergeFastqWorker::tr("Output directory"), MergeFastqWorker::tr("Select an output directory. <b>Custom</b> - specify the output directory in the 'Custom directory' parameter. " "<b>Workflow</b> - internal workflow directory. " "<b>Input file</b> - the directory of the input file.")); Descriptor customDir(BaseNGSWorker::CUSTOM_DIR_ID, MergeFastqWorker::tr("Custom directory"), MergeFastqWorker::tr("Select the custom output directory.")); Descriptor outName(BaseNGSWorker::OUT_NAME_ID, MergeFastqWorker::tr("Output file name"), MergeFastqWorker::tr("A name of an output file. If default of empty value is provided the output name is the name of the first file with additional extention.")); a << new Attribute(outDir, BaseTypes::NUM_TYPE(), false, QVariant(FileAndDirectoryUtils::WORKFLOW_INTERNAL)); Attribute* customDirAttr = new Attribute(customDir, BaseTypes::STRING_TYPE(), false, QVariant("")); customDirAttr->addRelation(new VisibilityRelation(BaseNGSWorker::OUT_MODE_ID, FileAndDirectoryUtils::CUSTOM)); a << customDirAttr; a << new Attribute( outName, BaseTypes::STRING_TYPE(), false, QVariant(BaseNGSWorker::DEFAULT_NAME)); } QMap<QString, PropertyDelegate*> delegates; { QVariantMap directoryMap; QString fileDir = MergeFastqWorker::tr("Input file"); QString workflowDir = MergeFastqWorker::tr("Workflow"); QString customD = MergeFastqWorker::tr("Custom"); directoryMap[fileDir] = FileAndDirectoryUtils::FILE_DIRECTORY; directoryMap[workflowDir] = FileAndDirectoryUtils::WORKFLOW_INTERNAL; directoryMap[customD] = FileAndDirectoryUtils::CUSTOM; delegates[BaseNGSWorker::OUT_MODE_ID] = new ComboBoxDelegate(directoryMap); delegates[BaseNGSWorker::CUSTOM_DIR_ID] = new URLDelegate("", "", false, true); } ActorPrototype* proto = new IntegralBusActorPrototype(desc, p, a); proto->setEditor(new DelegateEditor(delegates)); proto->setPrompter(new MergeFastqPrompter()); WorkflowEnv::getProtoRegistry()->registerProto(BaseActorCategories::CATEGORY_NGS_BASIC(), proto); DomainFactory *localDomain = WorkflowEnv::getDomainRegistry()->getById(LocalDomainFactory::ID); localDomain->registerEntry(new MergeFastqWorkerFactory()); }
void QualityTrimWorkerFactory::init() { Descriptor desc( ACTOR_ID, QualityTrimWorker::tr("FASTQ Quality Trimmer"), QualityTrimWorker::tr("The workflow scans each input sequence from the end to find the first position where the quality is greater or equal to the minimum quality threshold. " "Then it trims the sequence to that position. If a the whole sequence has quality less than the threshold or the length of the output sequence less than " "the minimum length threshold then the sequence is skipped.") ); QList<PortDescriptor*> p; { Descriptor inD(BaseNGSWorker::INPUT_PORT, QualityTrimWorker::tr("Input File"), QualityTrimWorker::tr("Set of FASTQ reads files")); Descriptor outD(BaseNGSWorker::OUTPUT_PORT, QualityTrimWorker::tr("Output File"), QualityTrimWorker::tr("Output FASTQ files")); QMap<Descriptor, DataTypePtr> inM; inM[BaseSlots::URL_SLOT()] = BaseTypes::STRING_TYPE(); p << new PortDescriptor(inD, DataTypePtr(new MapDataType("cf.input-url", inM)), true); QMap<Descriptor, DataTypePtr> outM; outM[BaseSlots::URL_SLOT()] = BaseTypes::STRING_TYPE(); p << new PortDescriptor(outD, DataTypePtr(new MapDataType("cf.output-url", outM)), false, true); } QList<Attribute*> a; { Descriptor outDir(BaseNGSWorker::OUT_MODE_ID, QualityTrimWorker::tr("Output directory"), QualityTrimWorker::tr("Select an output directory. <b>Custom</b> - specify the output directory in the 'Custom directory' parameter. " "<b>Workflow</b> - internal workflow directory. " "<b>Input file</b> - the directory of the input file.")); Descriptor customDir(BaseNGSWorker::CUSTOM_DIR_ID, QualityTrimWorker::tr("Custom directory"), QualityTrimWorker::tr("Select the custom output directory.")); Descriptor outName(BaseNGSWorker::OUT_NAME_ID, QualityTrimWorker::tr("Output file name"), QualityTrimWorker::tr("A name of an output file. If default of empty value is provided the output name is the name of the first file with additional extention.")); Descriptor qualT(QUALITY_ID, QualityTrimWorker::tr("Quality threshold"), QualityTrimWorker::tr("Quality threshold for trimming.")); Descriptor lenT(LEN_ID, QualityTrimWorker::tr("Min Length"), QualityTrimWorker::tr("Too short reads are discarded by the filter.")); Descriptor bothD(BOTH_ID, QualityTrimWorker::tr("Trim both ends"), QualityTrimWorker::tr("Trim the both ends of a read or not. Usually, you need to set <b>True</b> for <b>Sanger</b> sequencing and <b>False</b> for <b>NGS</b>")); a << new Attribute(outDir, BaseTypes::NUM_TYPE(), false, QVariant(FileAndDirectoryUtils::WORKFLOW_INTERNAL)); Attribute* customDirAttr = new Attribute(customDir, BaseTypes::STRING_TYPE(), false, QVariant("")); customDirAttr->addRelation(new VisibilityRelation(BaseNGSWorker::OUT_MODE_ID, FileAndDirectoryUtils::CUSTOM)); a << customDirAttr; a << new Attribute( outName, BaseTypes::STRING_TYPE(), false, QVariant(BaseNGSWorker::DEFAULT_NAME)); a << new Attribute( qualT, BaseTypes:: NUM_TYPE(), false, QVariant(30)); a << new Attribute( lenT, BaseTypes::NUM_TYPE(), false, QVariant(0)); a << new Attribute( bothD, BaseTypes::BOOL_TYPE(), false, true); } QMap<QString, PropertyDelegate*> delegates; { QVariantMap directoryMap; QString fileDir = QualityTrimWorker::tr("Input file"); QString workflowDir = QualityTrimWorker::tr("Workflow"); QString customD = QualityTrimWorker::tr("Custom"); directoryMap[fileDir] = FileAndDirectoryUtils::FILE_DIRECTORY; directoryMap[workflowDir] = FileAndDirectoryUtils::WORKFLOW_INTERNAL; directoryMap[customD] = FileAndDirectoryUtils::CUSTOM; delegates[BaseNGSWorker::OUT_MODE_ID] = new ComboBoxDelegate(directoryMap); delegates[BaseNGSWorker::CUSTOM_DIR_ID] = new URLDelegate("", "", false, true); QVariantMap len; len["minimum"] = 0; len["maximum"] = INT_MAX; delegates[QUALITY_ID] = new SpinBoxDelegate(len); delegates[LEN_ID] = new SpinBoxDelegate(len); } ActorPrototype* proto = new IntegralBusActorPrototype(desc, p, a); proto->setEditor(new DelegateEditor(delegates)); proto->setPrompter(new QualityTrimPrompter()); WorkflowEnv::getProtoRegistry()->registerProto(BaseActorCategories::CATEGORY_NGS_BASIC(), proto); DomainFactory *localDomain = WorkflowEnv::getDomainRegistry()->getById(LocalDomainFactory::ID); localDomain->registerEntry(new QualityTrimWorkerFactory()); }