jbrowseLoc="/path/to/jbrowse2/folder";
mkdir -p /tmp/jbrowse/bam
mkdir -p ${jbrowseLoc}/bam
for bc in $(awk '{print $2}' barcode_counts.txt);
basename="mapped/mm2_${runName}_called_${bc}_vs_genome";
samtools index ${basename}.bam;
# copy JBrowse2 config file to temporary folder
cp -v ${jbrowseLoc}/config.json /tmp/jbrowse/
# copy and create track in Jbrowse2 config file
jbrowse add-track ${basename}.bam --load symlink --out /tmp/jbrowse --subDir bam
# copy BAM files and updated config file to JBrowse 2 folder
cp -v /tmp/jbrowse/config.json ${jbrowseLoc}
cp -v ${basename}.bam ${basename}.bam.bai ${jbrowseLoc}/bam