Fix: Support for chromosomes >1GB in size#36
Open
ad3002 wants to merge 2 commits intoBenson-Genomics-Lab:masterfrom
Open
Fix: Support for chromosomes >1GB in size#36ad3002 wants to merge 2 commits intoBenson-Genomics-Lab:masterfrom
ad3002 wants to merge 2 commits intoBenson-Genomics-Lab:masterfrom
Conversation
…nd consistency for amphibian chromosomes large than 1-2Gb
…uild and Apple Silicon support - Add build.sh: a dependency-free build script (uses CC env var, detects platform/arch, compiles src/trf.c) - Add Makefile.simple: minimal Makefile for building, versioned binary creation, install and test targets - Update README.md: document the simple build (build.sh), Makefile.simple usage, one-command gcc build, and native ARM Mac (Apple Silicon) support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
TRF crashed when processing T2T (telomere-to-telomere) chromosome assemblies longer than 1-2 GB. The errors varied depending on chromosome size, initially appearing to be a genome size issue but actually stemming from individual chromosome length limitations. Example Lissotriton helveticus genome assembly, chromosome: 4_1
The root cause was the use of 32-bit integer types (
int,unsigned int) for sequence indices and lengths, which limited processing to ~2GB (2^31 bytes for signed int).Solution
Replaced 32-bit integer types with 64-bit
size_ttypes throughout the codebase for all sequence-related indices, positions, and lengths. This enables TRF to process sequences up to system memory limits (theoretically 2^64 bytes).Changes by file
tr30dat.h - Core data type replacements:
int Length→size_t Length(global sequence length variable)unsigned int maxwraplength→size_t maxwraplengthFASTASEQUENCE,pairalign,TRFPARAMSET,bestperiodlistelement,distanceentry,distancelist,distanceseenarrayelement,distancelistelementtrfrun.h - Index and position variables:
index_liststructure (repeat positions)charcount,flankstart,flankendLoadSequenceFromFileBenson,LoadSequenceFromFileEugenetrf.c - Command-line parsing:
ParseSize()function usingstrtoull()for 64-bit values-lparameter parsing formaxwraplengthtr30dat.c - Memory allocation:
new1Darrayfuncmacro for correct memory allocation%d→%zufor all outputTesting
Successfully processes amphibian chromosomes and T2T assemblies exceeding 1-2 GB without crashes.