I have a Bash script that contains three different functions that executes based on the information in samplesheet.txt. Which of the three functions to run is determined by the column Group in samplesheet.txt. All lines in samplesheet that have Group=Both, should be run using process_both. Lines with Group=DNA should run the function process_dna and lines with Group=RNA should run the function process_rna.
How do I specify in my Bash script which function to be run based not he information in samplesheet?
samplesheet.txt:
DNA             RNA            purity    Group
sample_DNA_1    sample_RNA_1    0.8      Both
sample_DNA_2    sample_RNA_2    0.5      Both
NA              sample_RNA_4    0.3      RNA
sample_DNA_3    NA              0.1     DNA
Code:
process_both() {
    local dna=$1
    local rna=$2
    local purity=$3
        singularity exec 
        sing.sif
        ...
        ...
        dna_id {dna}
        rna_id {rna}
        purity {purity}
        ...
        }
    
process_dna() {
    local dna=$1
    local rna=$2
    local purity=$3
        singularity exec 
        sing.sif
        ...
        ...
        dna_id {dna}
        purity {purity}
        ...
        }
process_rna() {
    local dna=$1
    local rna=$2
    local purity=$3
        singularity exec 
        sing.sif
        ...
        ...
        rna_id {rna}
        purity {purity}
        ...
        }
# Run the functions
tail +2 samplesheet.txt | while read dna rna purity
do
    process_both "$dna" "$rna" "$purity"
done
tail +2 samplesheet.txt | while read dna rna purity
do
    process_rna "$dna" "$rna" "$purity"
done    
tail +2 samplesheet.txt | while read dna rna purity
do
    process_dna "$dna" "$rna" "$purity"
done
 
    