dataesr/scientific-paragraphs-categorization huggingface dataset:
We calculated the genotype error rate as the relationship between the number of correct and incorrect sites, discarding missing data. The script also removes the incorrect and missing genotypes and outputs a filtered VCF file. Using this pipeline, we calculated the genotype accuracy of different datasets to test: (1) the effect of non-endogenous contamination and DNA degradation, (2) the effect of PCR duplicates and (3) the effect of variant filters: 1. Faecal mucus samples are more likely to be degraded, as observed when DNA samples were submitted to gel electrophoresis analysis (Figure  S1 ). We hypothesize that these samples contain DNA damage and breaks that prevent some loci from being sequenced and lead to erroneous SNP calling, thus the genotype error rate is higher for faecal mucus samples in comparison with biopsy samples.
We also tested the effect of high non-endogenous contamination levels by comparing the genotype error rate between contaminated (<90% mapping) and non-contaminated (>90% mapping) faecal mucus samples. We considered exclusively the offspring sample type, as trios sharing the same sample type were rare (e. g. only three trios had DNA extracted exclusively from faecal mucus). The genotype error rate comparison between contaminated faecal mucus samples (N = 43) and non-contaminated biopsy (N = 75) and faecal mucus (N = 40) samples was done using the dataset 'High coverage SNP-filtered' (Table  S3 ). 2. We hypothesize that the presence of PCR duplicates will lead to an increase in the genotype error rate, as it spuriously increases homozygosity. To test this hypothesis, we compared the PCR duplicates filtered and unfiltered datasets.
The only difference between the datasets is the presence/absence of the PCR duplicates filter during preprocessing. We grouped samples according to the number of PCR cycles used during library preparation, as this directly impacts PCR duplicate levels. The subgroups included 100, 39 and 19 trios with 8, 10 and 12 PCR cycles, respectively. We also conducted this analysis including only samples with the same sampling type (biopsy) and DNA input concentration (100 ng), in order to eliminate confounding effects that can also impact the genotype accuracy and PCR duplicate rate. We also evaluated the effect of coverage on genotype accuracy by simulating datasets with low coverage. We subsampled only the offspring individuals, as the error classification was based on the offspring genotype assuming that the parents' genotypes were correct.
We used Samtools (-s option) to subsample the bam files to ~13× coverage and ran the SNP calling with a Stacks reference-based pipeline. The summary statistics of the low and high coverage, and PCR duplicates filtered and unfiltered datasets are presented in Table  S3. 3. The effect of SNP filters on genotype accuracy was evaluated after each SNP filtering step separately and after combining all filtering steps. The rationale for the different filters (minimum depth, maximum depth, missing rate, minimum allele frequency) and the chosen thresholds (10, 110, 0. 8, 0. 05, respectively) are described in Table  S2. We predicted that DNA degradation, PCR duplicates and the lack of SNP filters would result in reduced genotype accuracy and reduced precision of genetic measures, especially at the individual level.
Statistical analyses were performed using a linear mixed model to study the fixed effects of coverage, number of PCR cycles and PCR duplicates filter on the (log) genotype error rate while accounting for the dependence between observations stemming from the same samples using a random intercept. We considered all possible two-way interactions as well as the triple interaction among all three predictor variables. The p-values were computed using the R package lmerTest v3. 1-3  (Kuznetsova et al. , 2017)  using the so-called "Satterthwaite" method to compute the denominator degrees of freedom after fitting the model using the lme4 R package v1. 1-34  (Bates et al. , 2015). Prediction and 95% confidence intervals were computed using the R package spaMM v4. 3. 20  (Rousset & Ferdy, 2014)  using the setting "predVar" to compute the intervals.
The model was fitted by maximum likelihood in both lme4 and spaMM and produced identical estimates. We used the parametric one-way analysis of variance (ANOVA) with post hoc t-test with Holm correction to compare the genotype error rate and missing rate for samples grouped by DNA source and contamination level (non-contaminated biopsy, non-contaminated mucus and contaminated mucus). The same statistical test was used to compare the percentage of PCR duplicates between groups of samples that underwent 8, 10 or 12 PCR cycles and datasets treated with different SNP filters. Pearson coefficient and its respective p-value were calculated for correlation analysis. These tests were performed using SciPy v1. 10. 1  (Virtanen et al. , 2020)  or scikit-postdocs  (Terpilowski, 2019)  Python packages and a two-tailed p-value less than.
7%, 0. 86%, 28. 6% and 0. 39% of Bacteria, Platyhelminthes, Hyaenidae and Bovidae hits, respectively. Among the remaining samples, 761 samples were sequenced with high coverage, and 143 samples presented read numbers after spike-in that were too low to allow for subsequent balancing (i. e. >18 μL of sample would have been required), and thus were not included in the final library pool. The percentage of reads mapping to the C. crocuta genome for the spike-in data was overall highly correlated (r =. 98) to the highoutput data (Figure  S5A ) and showed that even a low number of reads (~1000) is informative enough to quantify the per-sample contamination level (Figure  S5B ). Out of the 14 libraries, two libraries presenting read numbers below 1000 showed high levels of variance in the mapping difference (calculated as the percentage of mapping for the high-output data minus the percentage of mapping for the spike-in data).
Another three libraries presented a higher mapping percentage for the spike-in data than for the high-output data (>2%-Figure  S5C ). No association with mapping quality, DNA source, PCR duplicate rate or coverage was observed (data not shown). The Snakemake pipeline streamlined the preprocessing filtering steps for the analysis of the spike-in data. For the final high-output dataset, the number of reads after each preprocessing step is shown in Figure  S3C. The two filtering steps responsible for the greatest reduction in read number were PCR duplicates (29. 4%) and restriction site filters (26. 9%). In the latter filter, reads cut by the third restriction enzyme (NheI) represented 68% of the removed reads. These fragments represent remnants of NheI-EcoRI combinations that were intended to be digested by the third enzyme.
| The impact of PCR duplicates, number of PCR cycles and coverage on genotype accuracy The percentage of PCR duplicates varied according to the number of PCR cycles, showing an average of 13. 9%, 14. 5% and 31. 3% for 8, 10 and 12 PCR cycles, respectively (Figure  3a ). The results of the one-way ANOVA test indicated a statistically significant difference among the three groups (F 2,1648 = 2386, p <. 0001), revealing an increase of 4. 5% from 8 to 10 PCR cycles (post-hoc t-test with Holm correction, p =. 0023) and a substantial increase of 115. 7% from 10 to 12 PCR cycles (p <. 0001). Predictably, higher coverage per locus was observed for the dataset with no PCR-duplicates filter  (27. 67 ± 6. 02)  in relation to the PCR-duplicates filtered dataset (25. 84 ± 5. 05). PCR duplicates are also expected to result in larger variance in the locus coverage  (Andrews et al.
, 2016; Flanagan & Jones, 2018). Our results supported this hypothesis, as the PCR-duplicates unfiltered dataset had higher variance in coverage (1022. 6) than the PCR-duplicates filtered dataset (752. 3). Genotype error rate calculated for the datasets after SNP filters (Table  S3 ) was influenced by the number of PCR cycles, the presence or absence of PCR-duplicates filtering, the coverage and interactions between these variables (Linear mixed model: LRT χ 2 = 527, df = 11, p <. 0001; Figure  3b , Table  S4 ). The overall effect (accounting for the main term and interactions) was clear for each experimental variable (PCR cycles: χ 2 = 57. 7, df = 8, p <. 0001; PCR-duplicates filtering: χ 2 = 187, df = 6, p <. 0001; coverage: χ 2 = 422, df = 6, p <. 0001). The only interaction reaching significance was the two-way interaction between the number of PCR cycles and the PCR-duplicates filtering (F 2,474 = 14.
The slightly higher genotype error rate observed for 8 PCR cycles compared to 10 PCR cycles may be attributed to the presence of outliers (Figure  S6 ) and lower coverage in the 8 PCR cycles group (12. 3× and 13. 3× for 8 and 10 PCR cycles, respectively, for the low coverage PCR-duplicates unfiltered dataset), as partially confirmed when outliers were excluded (Figure  S7 ). Within the datasets, an overall weak correlation between the genotype error rate and coverage (minimum 9× for the low-coverage datasets) was observed (Figure  S6 ). Considering that both DNA input mass and number of PCR cycles can potentially impact the PCR duplicate rate and genotype accuracy  (Rochette et al. , 2023) , we conducted an analysis including only samples with the same sampling type (biopsy) and DNA input amount (100 ng).
Despite the low sample size (14, 4 and 5 samples for 8, 10 and 12 PCR cycles, respectively), a significant increase in PCR duplicates (F 2,266 = 5177, p <. 0001) and genotype error rates was observed when 12 PCR cycles were performed compared to 8 and 10 PCR cycles for all datasets, irrespective to PCR-duplicates filtering or coverage (Linear mixed model: LRT χ 2 = 94. 61, df = 11, p <. 0001, Figure  S8 ).
| The impact of minor allele frequency, minimum and maximum coverage and missing rate on genotype accuracy Despite our efforts to obtain a similar fragment range across libraries, the upper limit differed across 3RADseq libraries (Figure  4a ). The coverage per locus for the Stacks output showed a large variation across the fragment length distribution and the presence of outliers, including the two loci that appear as peaks at 326 and 417 bp fragment lengths (Figure  4b ). They likely represent repetitive collapsed paralogous loci, which should be removed from the final dataset to avoid genetic estimations based on non-orthologous loci. Thus, we decided to perform further SNP filtering aimed at removing potential paralogues and dropout alleles, spurious variant calls due to low coverage, and variant calls present in low frequency and with a high missing rate.
We compared the effect of each SNP filter independently (datasets named according to the unique filter) and all filters combined ('All filters' dataset) in relation to the dataset with only Stacks baseline filters ('Stacks output' dataset). In general, applying different SNP filters resulted in a decrease in the number of SNPs (Figure  4d ) and missing rate per individual (Figure  4f ), and in an increase in the coverage per individual (Figure  4e ) and in the heterozygosity (Figure  4g ). An exception was the dataset 'Maximum coverage', which had little impact on the estimations compared to the 'Stacks output' dataset, as it removed only 62 out of 107,256 SNPs. Low variation was observed in the inbreeding coefficient among the datasets (Figure  4h ). The genotype error rate varied between 1.
4%, when only the MAF filter was applied, to 0. 4%, when all filters were applied. Filtering SNPs with low coverage ('Minimum coverage' dataset), high missing rate ('Missing rate' dataset), or combining all filters ('All filters' dataset) led to a statistically significant decrease in the genotype error rate (p <. 01, Figure  4c ). Surprisingly, filtering by MAF led to an increase in genotype error rate in comparison with the baselinefiltered dataset ('Stacks output') (p <. 01). A similar increase in genotype error rate was observed when MAF threshold was reduced to 0. 01 (data not shown). Despite that, the absolute number of incorrect genotypes decreased in the MAF dataset in relation to the baseline-filtered dataset, suggesting that the increase in the genotype error rate is associated with the exclusion of true heterozygous variants by the MAF filter.
Among the SNP filters, removing variant sites with coverage lower than 10× caused the greatest decrease in the genotype error rate, leading to similar error rates between the 'All filters' and 'Minimum coverage' datasets (p =. 12). Aiming to explore the variation observed in the summary statistics and genotype error rate within each dataset, we investigated the consistency among individuals pooled in different libraries. Both datasets, before ('Stacks output') and after ('All filters') applying enhanced SNP filters, presented a large variation in the mean coverage, missing rate and genotype error rate among libraries (Figure  5 ). Heterozygosity estimations were similar among libraries (Figure  5c ).
| DISCUSS ION We present here an innovative approach to handle large RADseq datasets, with particular emphasis on its value for the processing of non-invasively collected samples that are commonly used and highly valuable for conservation but that are often contaminated. Based on our findings, we present a series of recommendations for RADseq library preparation and data preprocessing to overcome technical or biological artefacts that can bias downstream analyses. Datasets with uneven sample representation and excessive (>100×) or poor (<10×) individual coverage present a challenge for accurate locus building and variant calling  (Christiansen et al. , 2021). It has been common practice until now to balance libraries using DNA quantification to control for the quantity of input DNA used in the DNA digestion reaction of RADseq protocols  (Peterson et al.
Despite these benefits, the addition of a third enzyme also can incur additional costs, as misleading adapter ligation to reads cut by the third enzyme was shown to occur at a relatively high frequency (18. 2% of the sequenced reads, in our dataset). Additional sequencing effort can compensate for this issue. Furthermore, we show the importance of taking into account endogenous DNA content for the pooling of non-invasive samples. Our results, combined with previous evidence  (Hernandez-Rodriguez et al. , 2018) , indicate that weighted pooling can minimize the loss in representation of low endogenous DNA content samples in relation to samples with higher endogenous content in the pool. This is the first time, to our knowledge, that faecal mucus samples from hyenas were tested as a potential source of DNA for SNPbased genetic studies.
| Improving genotype accuracy Our results show that minimizing PCR cycles and optimizing SNP filters can significantly improve genotype accuracy. Regarding the first, the genotype error rate was higher in the PCR duplicates unfiltered than in the filtered dataset. PCR duplicates are a perennial concern in the production of RADseq libraries, particularly when a greater number of PCR cycles are used (Díaz-Arce & Rodríguez-Ezpeleta, 2019; Flanagan & Jones, 2018). PCR duplicates impact population genomics analyses by spuriously increasing homozygosity, making PCR errors appear to be true alleles and resulting in false confidence in downstream variant calls as a result of the increased read coverage  (Andrews et al. , 2016; Casbon et al. , 2011; Schweyen et al. , 2014). Several studies have shown that PCR duplicate rate is associated with the number of PCR cycles  (Ebbert et al.
, 2016). Our results corroborate this, as the low-coverage datasets (offspring subsampled to ~13×) presented a higher genotype error rate than the high-coverage (~56×) datasets. PCR duplicates impact genotype accuracy by causing overdispersion of the allelic ratios observed at heterozygous sites, leading to a bias against heterozygotes  (Rochette et al. , 2023). The high coverage observed in our dataset (~56×) likely permitted the heterozygote likelihood to be significantly larger than the homozygous likelihood, resulting in a lower genotype error rate than the low coverage dataset. We showed the importance of applying posterior SNP filters, which resulted in a decrease of 60% in the genotype error rate (from 0. 01 with no filters applied to 0. 004 when all filters were applied). We highlight here the importance of filtering by minimum coverage, considering a study-appropriate minimum threshold (in our case, ≥10), as this parameter had the greatest impact on the genotype error rate in our analysis.
Filtering by maximum coverage was also important to remove potentially collapsed paralogues that passed Stacks SNP caller requirements. In order to set minimum and maximum coverage thresholds, it is necessary to use other tools (e. g. VCFtools), as Stacks does not provide this option. We note that we did not test the impact of different SNP filter thresholds on the genotype error rate. Indeed, SNP filter thresholds should be tested for appropriate settings  (Nazareno & Knowles, 2021)  and chosen according to the studied taxon, specific research goals and dataset features (Díaz-Arce & Rodríguez-Ezpeleta, 2019). For example, studies focused on linkage disequilibrium should aim for higher coverage than a study based on allele frequencies  (Pool et al. , 2010). Several technical factors can bias the summary statistics of a RADseq dataset  (DaCosta & Sorenson, 2014).
We point out that inconsistency among individuals pooled in different libraries can, in part, explain the variation observed within each dataset. While variation in the mean coverage and missing rate among individuals from different libraries is to be expected, we also found a surprising pattern in the genotype error rate associated with libraries even after applying SNP-filters (Figure  5d ). This is probably connected to the coverage and missing rate results. This emphasizes the need for RADseq users to consider the bias that can be introduced by individual libraries when designing library pools. Genotyping errors can have serious consequences on downstream analysis, including overestimates of inbreeding, impact on the resolution of tree topologies and erroneous demographic and population structure inferences  (Martín-Hernanz et al.
, 2019; Mastretta-Yanes et al. , 2015; Pool et al. , 2010). The innovative bioinformatic pipeline provided here is a powerful tool for estimating genotype accuracy based on trio datasets and filtering a VCF file for Mendelian errors. A limitation of our pipeline is that it does not incorporate allele frequency in the population to assign errors  (Douglas et al. , 2002). We also only take into account Mendelian compatible errors (i. e. errors that produce genotypes that are consistent with Mendelian inheritance among relatives), which might represent only 61% of existing errors  (Geller & Ziegler, 2002; Pompanon et al. , 2005). Regardless, we recommend checking and filtering for Mendelian errors when there is the potential for related individuals to exist within a dataset, as some errors remain even after further SNP filters are applied.
for 1142 individuals, mostly from faecal mucus samples collected non-invasively and varying in DNA degradation and non-endogenous contamination level. We demonstrate how to control library preparation and efficiently reduce costs by using a weighted re-pooling strategy that considers the endogenous DNA content. Using small-scale sequencing to obtain a low number of reads per individual, we screened samples for endogenous DNA content, filtered out highly contaminated samples, confirmed overlap fragment length between libraries and balanced individual representation in a sequencing pool. Furthermore, we take advantage of a special characteristic of our dataset, which is composed of several related individuals, to identify parent-offspring trios and measure genotype error rate based on patterns of Mendelian inheritance.
Thus, we evaluate the impact of (1) DNA degradation and non-endogenous contamination of non-invasive samples, (2) PCR duplicates and (3) different SNP filters on genotype accuracy based on trio datasets. 2 | MATERIAL S AND ME THODS 2. 1 | Sampling Samples were collected from spotted hyenas inhabiting the Ngorongoro Crater in Tanzania between April 1996 and December 2020, as part of the long-term monitoring of behaviour and life history of all individually known spotted hyenas in this population (https://hyena -proje ct. com/, Davidian et al. , 2016). Non-invasive samples were collected from faecal mucus (N = 573), blood on faeces (N = 2) or grass (N = 1), hair (N = 17) or tissues from dead animals: muscle (N = 9), skin (N = 5), liver (N = 1), ear (N = 1), and heart (N = 1). Mucus covering the hyena faeces, which contains intestinal epithelial cells, was collected immediately after defaecation to ensure reliable individual assignment.
Unmapped reads were submitted to Blastn analysis implemented in NCBI's BLAST+ package (v. 2. 8. 1+) with a maximum e-value of 10 -20 for taxon identification. We created a custom database by adding the C. crocuta and Hyaena hyaena genomes to the NT NCBI database. Blastn results were visualized in MEGAN v. 6. 19. 2 (Huson F I G U R E 1 Strategy to obtain a balanced library across a large dataset. (a) Workflow showing the first library tests (red), contamination check (only samples with mapping rates higher than 50% continue being analysed) and weighted re-pooling library preparation (blue), (b) Number of reads per individual displayed in a 96-well plate before (red) and after (after) re-pooling, and (c) Variance in the number of reads per individual before and after the balancing procedure.
), despite the difference in the mapping percentage. Due to the observed DNA degradation of non-invasive samples, we compared the missing rate and F I G U R E 2 Evaluation of the impact of DNA degradation and non-endogenous contamination on the datasets. Comparisons between the percentage of mapping (a), the number of reads per individual (b), the mean coverage per SNP per individual (c), the missing rate (d) and genotype error rate (e) are shown for non-contaminated biopsy (blue) and mucus (light pink) samples and contaminated mucus samples (red). Contamination was defined as <90% mapping to the Crocuta crocuta genome. genotype accuracy between contaminated and non-contaminated biopsy and faecal mucus samples. No significant difference was observed among the three groups for both parameters (one-way ANOVA: F 2,155 = 2.
I G U R E 3 The impact of PCR duplicates, number of PCR cycles and coverage on genotype accuracy. (a) Percentage of PCR duplicates in libraries grouped according to the number of PCR cycles used in library preparation for the high coverage dataset. (b) Genotype error rate compared between PCR-duplicates filtered and unfiltered in low-and high-coverage datasets. Individuals were grouped according to the number of PCR cycles that they underwent during library preparation. Points represent the means and error bars represent 95% confidence intervals.
I G U R E 4 The impact of different SNP filters on summary statistics, genetic diversity and genotype error rate. (a) Fragment length distribution of two individuals of each of the 14 libraries, which are displayed in different colours. The upper limit differs among individuals belonging to different libraries. The two peaks at 326 and 417 bp are likely repetitive paralogous loci. (b) Coverage per locus along the fragment length distribution for the Stacks output. The collapsed paralogues remain in the baseline-filtered dataset. (c) Genotype error rate, (d) number of SNPs, (e) coverage per individual, (f) missing rate per individual, (g) heterozygosity and (h) inbreeding coefficient for the datasets with no posterior SNP filtering (Stacks output), and treated with unique or combined SNP filters.