Kelsey Florek, PhD, MPH Senior Genomics and Data Scientist Wisconsin State Laboratory of Hygiene June 5, 2024
 
           
          
         
          
         
           
         
         
          
              include { SAMPLESHEET_CHECK } from '../../modules/local/samplesheet_check'
              workflow INPUT_CHECK {
                  take:
                  samplesheet // file: /path/to/samplesheet.csv
              
                  main:
                  SAMPLESHEET_CHECK ( samplesheet )
                      .csv
                      .splitCsv ( header:true, sep:',' )
                      .map { create_fasta_channel(it) }
                      .set { reads }
              
                  emit:
                  // channel: [ val(meta), [ path_to_reads ] ]
                  reads
                  // channel: [ samplesheet.valid.csv ]                   
                  csv = SAMPLESHEET_CHECK.out.csv
                  // channel: [ versions.yml ]
                  versions = SAMPLESHEET_CHECK.out.versions 
              }
              
              // Function to get list of [ meta, [ fasta ] ]
              def create_fasta_channel(LinkedHashMap row) {
                  // create meta map
                  def meta = [:]
                      meta.id         = row.sample
              
                  def fasta_meta = []
              
                  if (!file(row.fasta).exists()) {
                      exit 1
                  } else {
                      fasta_meta = [ meta, [ file(row.fasta) ] ]
                  }
              
                  return fasta_meta
              }        
             
         
         
         
         
         
        
