2.3 | RAD read mapping
We first de-multiplexed sequences according to their barcodes using an in-house Perl script, ensuring that no mismatches occurred between the sequenced barcode and its sequence. We then used the FASTX toolkit to end-trim raw reads to a length of 150-bp, and to exclude reads containing one or more bases with a < 10 Phred quality score or which had > 5% of bases receiving a < 20 Phred quality score. We then analyzed the remaining reads in the software pipeline STACKS v.2.64. Next, we aligned clean reads to theSinocyclocheilus grahami reference genome (Yang et al., 2016) using the BWA-MEM algorithm from the bwa v.0.7.15 software (Li & Durbin, 2009). The resulting SAM file was converted to a coordinate-sorted and indexed BAM file using samtools 0.1.16 (Li et al., 2009).