askimed / nf-test

Simple test framework for Nextflow pipelines
https://www.nf-test.com
MIT License
146 stars 25 forks source link

support for loading multiline strings in yaml params files #257

Open seanrjohnson opened 2 months ago

seanrjohnson commented 2 months ago

For pipeline tests, the params load config file function parses multiline strings in yml files differently than supplying them to nextFlow via the command line -params-file option.

params {
   load("example_params.yml")
}

Json file parsed correctly:

{
  "query_sequence": ">A0A2G2JID1\nMPIAQIHILEGRSDEQKETLIREVSEAISRSLDAPLTSVRVIITEMAKGHFGIGGELASKVRR\n>A0A8G5FSM5\nMPIAQLYILEGRSDEQKESLIREISEAMSRSLDAPIERVRVIITEMPKNHFGIGGEPASKLNR\n>A0A0F9USC8\nMPIAQLHILEGRTDEQKEALIREVSEAIARALDAPMPSIRVIISEMPKAHFGIGGEPASKVRR\n>A0A3S8ND41\nMPVAQINILEGRSDEQKETLIREVSEAISRSLGAPVENVRIIITEMPKQHFGIGGQSAKKRGR\n",
  "query_file": null,
  "identity": 100,
  "fasta_type": "protein",
  "algorithm": "cd-hit",
  "output_type": "genbank",
  "count": "prefix"
}

.yml file not parsed correctly (deletes newlines in "query_sequence"):

query_sequence: ">A0A2G2JID1\nMPIAQIHILEGRSDEQKETLIREVSEAISRSLDAPLTSVRVIITEMAKGHFGIGGELASKVRR\n>A0A8G5FSM5\nMPIAQLYILEGRSDEQKESLIREISEAMSRSLDAPIERVRVIITEMPKNHFGIGGEPASKLNR\n>A0A0F9USC8\nMPIAQLHILEGRTDEQKEALIREVSEAIARALDAPMPSIRVIISEMPKAHFGIGGEPASKVRR\n>A0A3S8ND41\nMPVAQINILEGRSDEQKETLIREVSEAISRSLGAPVENVRIIITEMPKQHFGIGGQSAKKRGR\n"
query_file:
identity: 100
fasta_type: protein
algorithm: cd-hit
output_type: genbank
count: prefix

.yml file also not parsed correctly (deletes newlines in "query_sequence"):

query_sequence: |
  >A0A2G2JID1
  MPIAQIHILEGRSDEQKETLIREVSEAISRSLDAPLTSVRVIITEMAKGHFGIGGELASKVRR
  >A0A8G5FSM5
  MPIAQLYILEGRSDEQKESLIREISEAMSRSLDAPIERVRVIITEMPKNHFGIGGEPASKLNR
  >A0A0F9USC8
  MPIAQLHILEGRTDEQKEALIREVSEAIARALDAPMPSIRVIISEMPKAHFGIGGEPASKVRR
  >A0A3S8ND41
  MPVAQINILEGRSDEQKETLIREVSEAISRSLGAPVENVRIIITEMPKQHFGIGGQSAKKRGR
query_file:
identity: 100
fasta_type: protein
algorithm: cd-hit
output_type: genbank
count: prefix