@seqera/node-red-seqera
Version:
Node-RED nodes for interacting with the Seqera Platform API
140 lines (139 loc) • 4.95 kB
JSON
[
{
"id": "2bb4977ed09ed3de",
"type": "tab",
"label": "Launch on file upload",
"disabled": false,
"info": "This flow uses the _Poll files_ node to periodically check for the presence\nof a file called `RTAcomplete.txt` within a Seqera Data Link (eg. an s3 bucket).\n\nThese files are typically uploaded by illumina sequencers when base calling is complete.\nBut you could configure it to look for the upload of any file path.\n\nWhen the file is detected, a _List files_ node is used to list all of the files within\nthat Data Link (bucket - could be configured to use the location that the `RTAcomplete.txt` file is found).\n\nA Node-RED _Function_ node with some javascript then constructs a sample sheet from these filenames.\nThis is passed to the \"Add Dataset\" node, which saves it as a Seqera Platform Dataset.\n\nFinally, this is passed to the _Launch workflow_ node, which fires off a pipeline run.\n\nSome configuration is needed to make this flow work:\n\n* All Seqera nodes need a Seqera configuration to be assigned\n* _Poll files_ and _List files_ need to be configured with the name of a Data Link within Platform\n* _Add dataset_ needs a dataset name to be set somehow (dynamically to avoid name clashes)\n* _Launch workflow_ needs configuring with the name of a Launchpad pipeline, and parameters.",
"env": []
},
{
"id": "e09f6870800295be",
"type": "seqera-datalink-poll",
"z": "2bb4977ed09ed3de",
"name": "",
"seqera": "",
"dataLinkName": "",
"dataLinkNameType": "str",
"basePath": "",
"basePathType": "str",
"prefix": "RTAComplete.txt",
"prefixType": "str",
"pattern": "",
"patternType": "str",
"maxResults": "100",
"maxResultsType": "num",
"depth": "0",
"depthType": "num",
"workspaceId": "",
"workspaceIdType": "str",
"pollFrequency": "15",
"returnType": "files",
"x": 100,
"y": 100,
"wires": [["2b7682159053d63c"], []]
},
{
"id": "2b7682159053d63c",
"type": "seqera-datalink-list",
"z": "2bb4977ed09ed3de",
"name": "",
"seqera": "",
"dataLinkName": "",
"dataLinkNameType": "str",
"basePath": "",
"basePathType": "str",
"prefix": "",
"prefixType": "str",
"pattern": "\\.fastq\\.gz$",
"patternType": "str",
"maxResults": "100",
"maxResultsType": "num",
"depth": "0",
"depthType": "num",
"workspaceId": "",
"workspaceIdType": "str",
"returnType": "files",
"x": 280,
"y": 100,
"wires": [["a530ee2b5e6841d1"]]
},
{
"id": "a530ee2b5e6841d1",
"type": "function",
"z": "2bb4977ed09ed3de",
"name": "Build sample sheet",
"func": "const files = msg.files;\nconst groups = {};\n\nfor (let i = 0; i < files.length; i++) {\n const match = files[i].match(/([^\\/]+)_T1/);\n const sampleId = match[1];\n if (!groups[sampleId]) groups[sampleId] = [];\n groups[sampleId].push(files[i]);\n}\n\nconst lines = [\"sample,fastq_1,fastq_2,strandedness\"];\nfor (const sample in groups) {\n const files = groups[sample];\n const fastq_1 = files.find(f => f.includes(\"_1.fastq.gz\"));\n const fastq_2 = files.find(f => f.includes(\"_2.fastq.gz\"));\n lines.push(`${sample},${fastq_1},${fastq_2},reverse`);\n}\n\nmsg.payload = lines.join(\"\\n\");\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 450,
"y": 100,
"wires": [["0b4091f89d0bd588"]]
},
{
"id": "0b4091f89d0bd588",
"type": "seqera-dataset-add",
"z": "2bb4977ed09ed3de",
"name": "",
"seqera": "",
"datasetName": "",
"datasetNameType": "str",
"fileContents": "payload",
"fileContentsType": "msg",
"workspaceId": "",
"workspaceIdType": "str",
"description": "",
"descriptionType": "str",
"fileType": "csv",
"x": 160,
"y": 200,
"wires": [["4d08ce1fad55a0b7"]]
},
{
"id": "4d08ce1fad55a0b7",
"type": "seqera-workflow-launch",
"z": "2bb4977ed09ed3de",
"name": "",
"seqera": "",
"launchpadName": "",
"launchpadNameType": "str",
"paramsKey": "{\"input\": payload.version.url}",
"paramsKeyType": "jsonata",
"workspaceId": "",
"workspaceIdType": "str",
"sourceWorkspaceId": "",
"sourceWorkspaceIdType": "str",
"x": 370,
"y": 200,
"wires": [["5f9a2c3b8e4d1a67"]]
},
{
"id": "5f9a2c3b8e4d1a67",
"type": "seqera-workflow-monitor",
"z": "2bb4977ed09ed3de",
"name": "",
"seqera": "",
"workflowId": "workflowId",
"workflowIdType": "msg",
"workspaceId": "",
"workspaceIdType": "str",
"keepPolling": true,
"poll": "15",
"pollUnits": "seconds",
"x": 570,
"y": 200,
"wires": [[], [], []]
},
{
"id": "2801ba6dc68b2335",
"type": "global-config",
"env": [],
"modules": {
"@seqera/node-red-seqera": "1.4.1"
}
}
]