Skip to content

Concatenate the reference contigs into one "flat" reference#607

Open
marcelm wants to merge 1 commit into
mainfrom
flatref
Open

Concatenate the reference contigs into one "flat" reference#607
marcelm wants to merge 1 commit into
mainfrom
flatref

Conversation

@marcelm

@marcelm marcelm commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Instead of addressing a position on the genome with a (reference_id, reference_start) tuple, this uses a single 64-bit ref_start integer.

Advantages:

  • Slightly simpler code in some places
  • It appears to be slightly faster
  • No more separate limit on the number of contigs and the length of each contig. Instead, the limit is on the total genome length (currently 64 bit).
  • This should allow us to later reduce the number of bits needed for the reference coordinate.

A downside is that recovering the chromosome a position is on requires a binary search. This is in this draft only done once when converting the output to SAM and comes at essentially no cost.

However, there are a couple of places in the code (currently marked with a TODO comment) where we iterate over anchors or chains from left to right and where we would previously do something when transitioning from one contig to another. Now, we can theoretically 1) chain from one contig to another and 2) pair one read with one on another contig. We’ll have to think a bit more about how much we need to prevent this.

The randstrobes generated in N regions change slightly because the pseudorandom nucleotide that the N wildcards are replaced with depends on the position, which is now relative to the start of the genome and not the start of the contig.

Closes #227
See #597

@marcelm marcelm force-pushed the flatref branch 2 times, most recently from 3c1948a to 37e3baa Compare July 1, 2026 20:55
Instead of addressing a position on the genome with a (reference_id,
reference_start) tuple, we now use a single 64-bit `ref_start` integer.


Advantages:
- Slightly simpler code in some places
- This should allow us to later reduce the number of bits needed for the
  reference coordinate.
- 

A downside is that recovering the chromosome a position is on requires a
binary search, but this only needs to be done essentially once when
converting the output to SAM.

The randstrobes generated in N regions change slightly because the
pseudorandom nucleotide that the N wildcards are replaced with depends on
the position, which is now relative to the start of the genome and not the
start of the contig.

Closes #227
See #597
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A potential way to save space for genomes smaller than 2^32nt.

1 participant