# How the FineDNA biology text was found The `bio_*` subsets of FineDNA are web pages, papers and forum posts that contain DNA sequences inside normal text. They were found in two steps. ## 1. Regex filter: does the document contain DNA? (`1_regex_filter.py`) We ran this filter over FineWeb-Edu, FinePDFs, PubMed Central, bioRxiv and Biostars. A document is kept when it - contains a run of **15 or more nucleotide letters** (A, T, C, G, U, N, any case), - that run uses **at least 3 different letters**, so `AAAAAAAAAAAAAAA` does not count, - the run is **not inside curly braces**, which in scraped text is usually LaTeX, and - the document mentions **at least one molecular-biology keyword**: dna, rna, nucleotide, genome, gene, base pair, codon, primer, pcr, amplification, sequencing, nucleic acid, oligonucleotide, plasmid, transcription, translation, mrna, ribosome, trna, rrna or uracil. ```bash python 1_regex_filter.py --input hf://datasets/HuggingFaceFW/fineweb-edu/sample/10BT --output ./dna_regex/fineweb_edu ``` ## 2. p90 split: how long is the DNA? (`2_p90_split.py`) Many regex hits are short: a primer, a restriction site, a motif. Training on documents with real sequences worked better, so we measure the **longest DNA word** in each document with `tag_dna_sequences.py`: a whitespace-delimited token of at least 6 letters that is pure A/C/G/T (or IUPAC codes, 12+ letters, at most 20% ambiguous), with punctuation and 5'/3' markers stripped. - Longest DNA word **at least 39 bp** (the 90th percentile across the regex data): `bio_p90_*`. - Everything else: `bio_rest`. ```bash python 2_p90_split.py --input ./dna_regex/fineweb_edu --p90 ./p90/fineweb_edu --rest ./rest/fineweb_edu ``` In the Carbon-X mix, p90 gets as much weight as all of `bio_rest` and is read about seven times; `bio_rest` about twice. ## Requirements `pip install datatrove` for step 1. Step 2 needs only the Python standard library and `tag_dna_sequences.py`, which sits next to it.