returns an array (sample,bam)
from a bam or a file.
it gets the SAM header from a BAM or a CRAM and extracts the identifier from the sam read groups https://samtools.github.io/htsjdk/javadoc/htsjdk/htsjdk/samtools/SAMReadGroupRecord.html
Would be the equivalent of:
find "${params.bamdir}" -type f -name "*.bam" | while read F