# ref_map.sh - run ref_map on An. darlingi RAD data #ref_map.pl version 1.21 started at 2015-01-13 09:17:46 mkdir $src/filtered_seqs process_radtags -f $src/raw_sequences -o $src/filtered_seqs \ -i fastq -c -q —r # Take all read 1s and align them to the darlingi genome. We will use the resulting # SAM files to run ref_map. mkdir $src/rad_alignments for f in $src/filtered_seqs/*.fastq do echo "Running bowtie alignments on: $f" bowtie /genomes/Anopheles_darlingi/AdarC3 $f -p 30 --sam > ./rad_alignments/$(basename $f | sed 's/\.fastq//').sam 2>>./rad_alignments/alignments.log done # Set up the MYSQL database for the stacks data # This is required for use of the STACKS web browser mysql -e 'CREATE DATABASE darlingi_radtags' mysql darlingi_radtags < /usr/local/share/stacks/sql/stacks.sql mkdir $stacks ref_map.pl -o $stacks -n 0 -T 30 -m 5 -O popmap -b 1 -S \ -B darlingi_radtags -D ‘Melinas RAD database' \ -s ./rad_alignment/A12G002.sam \ -s ./rad_alignment/A12G003.sam \ -s ./rad_alignment/A12G009.sam \ -s ./rad_alignment/A12G010.sam \ -s ./rad_alignment/A12G011.sam \ -s ./rad_alignment/A12G012.sam \ -s ./rad_alignment/A12G013.sam \ -s ./rad_alignment/A12G014.sam \ -s ./rad_alignment/A12G015.sam \ -s ./rad_alignment/A12G016.sam \ -s ./rad_alignment/A12G017.sam \ -s ./rad_alignment/A12G018.sam \ -s ./rad_alignment/A12G019.sam \ -s ./rad_alignment/A12G022.sam \ -s ./rad_alignment/A12G023.sam \ -s ./rad_alignment/A12R012.sam \ -s ./rad_alignment/A12R013.sam \ -s ./rad_alignment/A12R015.sam \ -s ./rad_alignment/A12R016.sam \ -s ./rad_alignment/A12R020.sam \ -s ./rad_alignment/A12R021.sam \ -s ./rad_alignment/A12R022.sam \ -s ./rad_alignment/A12R023.sam \ -s ./rad_alignment/A12R024.sam \ -s ./rad_alignment/A12R026.sam \ -s ./rad_alignment/A12R027.sam \ -s ./rad_alignment/A12R028.sam \ -s ./rad_alignment/A12R030.sam \ -s ./rad_alignment/A12R031.sam \ -s ./rad_alignment/A12R032.sam \ -s ./rad_alignment/A12R033.sam \ -s ./rad_alignment/CS16.sam \ -s ./rad_alignment/CS17.sam \ -s ./rad_alignment/CS18.sam \ -s ./rad_alignment/CS20.sam \ -s ./rad_alignment/CS21.sam \ -s ./rad_alignment/CS22.sam \ -s ./rad_alignment/CS23.sam \ -s ./rad_alignment/CS24.sam \ -s ./rad_alignment/CS25.sam \ -s ./rad_alignment/CS26.sam \ -s ./rad_alignment/CS27.sam \ -s ./rad_alignment/CS28.sam \ -s ./rad_alignment/CS29.sam \ -s ./rad_alignment/CS30.sam # Run the stacks genotype correction module rxstacks -b 1 -P $src/stacks -o ./stacks_cor --prune_haplo \ --lnl_lim -10.0 -t 8 --verbose --lnl_dist cstacks -b 1 -p 15 -o ./stacks_cor \ -s ./stacks_cor/A12G002 \ -s ./stacks_cor/A12G003 \ -s ./stacks_cor/A12G009 \ -s ./stacks_cor/A12G010 \ -s ./stacks_cor/A12G011 \ -s ./stacks_cor/A12G012 \ -s ./stacks_cor/A12G013 \ -s ./stacks_cor/A12G014 \ -s ./stacks_cor/A12G015 \ -s ./stacks_cor/A12G016 \ -s ./stacks_cor/A12G017 \ -s ./stacks_cor/A12G018 \ -s ./stacks_cor/A12G019 \ -s ./stacks_cor/A12G022 \ -s ./stacks_cor/A12G023 \ -s ./stacks_cor/A12R012 \ -s ./stacks_cor/A12R013 \ -s ./stacks_cor/A12R015 \ -s ./stacks_cor/A12R016 \ -s ./stacks_cor/A12R020 \ -s ./stacks_cor/A12R021 \ -s ./stacks_cor/A12R022 \ -s ./stacks_cor/A12R023 \ -s ./stacks_cor/A12R024 \ -s ./stacks_cor/A12R026 \ -s ./stacks_cor/A12R027 \ -s ./stacks_cor/A12R028 \ -s ./stacks_cor/A12R030 \ -s ./stacks_cor/A12R031 \ -s ./stacks_cor/A12R032 \ -s ./stacks_cor/A12R033 \ -s ./stacks_cor/CS16 \ -s ./stacks_cor/CS17 \ -s ./stacks_cor/CS18 \ -s ./stacks_cor/CS20 \ -s ./stacks_cor/CS21 \ -s ./stacks_cor/CS22 \ -s ./stacks_cor/CS23 \ -s ./stacks_cor/CS24 \ -s ./stacks_cor/CS25 \ -s ./stacks_cor/CS26 \ -s ./stacks_cor/CS27 \ -s ./stacks_cor/CS28 \ -s ./stacks_cor/CS29 \ -s ./stacks_cor/CS30 while read f; do sstacks -p 60 -b 1 -c ./stacks_cor/batch_1 \ -s ./stacks_cor/${f} \ -o ./stacks_cor/ &>> ./stacks_cor/Log done < files # Consider all samples as a single population populations -b 1 -P ./stacks_cor -M ./popmap -t 20 -r 0.5 -m 5 --fstats \ --write_single_snp --phylip --structure --log_fst_comp --vcf --genepop # Now to run the structure analysis using runStructure.py wget "http://genome.smcm.edu/emersonLab/runStructure.py" grep -v "#" $src/stacks_cor/batch_1.structure.str $src/structure_input.str ./runStructure.py -i $src/structure_input.str -o $src/structure -p 10 -b 100000 \ -m 1000000 -x 40 -k 40 -n 60