This function requires the path to stacks vcf file(s) as input. There are slots for varying the m parameter from 3-7 (as recommended by Paris et al. 2017). After running stacks with each of the m options, plug the output vcf files into this function to calculate the effect of varying m on depth and number of SNPs/loci built. Plug the output of this function into vis_loci() to visualize the optimal the m parameter for your dataset at the 'R80' cutoff (Paris et al. 2017).

optimize_m(m3 = NULL, m4 = NULL, m5 = NULL, m6 = NULL, m7 = NULL)

Arguments

m3

Path to the input vcf file for a run when m=3

m4

Path to the input vcf file for a run when m=4

m5

Path to the input vcf file for a run when m=5

m6

Path to the input vcf file for a run when m=6

m7

Path to the input vcf file for a run when m=7

Value

A list containing five summary dataframes, 'depth' showing depth per sample for each m value, 'snp' showing the number of non-missing SNPs retained in each sample at each m value, 'loci' showing the number of non-missing loci retained in each sample at each m value, 'snp.R80' showing the total number of SNPs retained at an 80% completeness cutoff, and 'loci.R80' showing the total number of polymorphic loci retained at an 80% completeness cutoff.

Examples

optimize_m(m3=system.file("extdata","m3.vcf.gz",package="RADstackshelpR",mustWork=TRUE))
#> $depth #> m dep #> 908108_H_diadema_Gatokae m3 11.8653846153846 #> 908150_H_dinops_Guadalcanal m3 6.77777777777778 #> 908151_H_diadema_Guadalcanal m3 60.8823529411765 #> 908152_H_diadema_Guadalcanal m3 31.28125 #> 908153a_H_dinops_Guadalcanal m3 138.835616438356 #> 908154_H_dinops_Guadalcanal m3 11.9322033898305 #> 908155_H_dinops_Guadalcanal m3 22.4920634920635 #> 908156_H_diadema_Guadalcanal m3 82.5072463768116 #> 908208_H_diadema_Guadalcanal m3 18.5254237288136 #> KVO150_H_diadema_Isabel m3 4.75 #> KVO168_H_diadema_Isabel m3 9.92682926829268 #> KVO169_H_diadema_Isabel m3 14.6734693877551 #> KVO170_H_diadema_Isabel m3 20.3728813559322 #> KVO171_H_diadema_Isabel m3 8.63414634146342 #> KVO172_H_diadema_Isabel m3 6.95 #> KVO242_H_dinops_Isabel m3 29.0461538461538 #> KVO243_H_dinops_Isabel m3 37.5507246376812 #> KVO244_H_dinops_Isabel m3 72.2857142857143 #> KVO245_H_dinops_Isabel m3 80.5070422535211 #> #> $snp #> var snps #> 1 m3 52 #> 2 m3 18 #> 3 m3 68 #> 4 m3 64 #> 5 m3 73 #> 6 m3 59 #> 7 m3 63 #> 8 m3 69 #> 9 m3 59 #> 10 m3 8 #> 11 m3 41 #> 12 m3 49 #> 13 m3 59 #> 14 m3 41 #> 15 m3 20 #> 16 m3 65 #> 17 m3 69 #> 18 m3 7 #> 19 m3 71 #> #> $loci #> var poly.loci #> 1 m3 52 #> 2 m3 18 #> 3 m3 68 #> 4 m3 64 #> 5 m3 73 #> 6 m3 59 #> 7 m3 63 #> 8 m3 69 #> 9 m3 59 #> 10 m3 8 #> 11 m3 41 #> 12 m3 49 #> 13 m3 59 #> 14 m3 41 #> 15 m3 20 #> 16 m3 65 #> 17 m3 69 #> 18 m3 7 #> 19 m3 71 #> #> $snp.R80 #> var snps.80 #> 1 m3 28 #> #> $loci.R80 #> var poly.loci.80 #> 1 m3 28 #>