Skip to content

Feature: Plot BLAST and PAF alignments#25

Merged
Adamtaranto merged 12 commits into
masterfrom
copilot/add-pre-calculated-alignments
Jan 28, 2026
Merged

Feature: Plot BLAST and PAF alignments#25
Adamtaranto merged 12 commits into
masterfrom
copilot/add-pre-calculated-alignments

Conversation

Copilot AI commented Jan 28, 2026

Copy link
Copy Markdown
Contributor

Two bugs fixed: (1) UnboundLocalError when --gff provided without --gff_color_config, and (2) irrelevant "wordsize" appearing in output filenames when using pre-calculated alignments.

GFF Color Auto-Generation

When --gff is set but no config file provided, gff_feat_colors was never assigned in the else branch.

  • Added extract_gff_annotation_types() to parse GFF3 files and extract unique annotation types (column 3)
  • Auto-assigns colors from a predefined palette with warning to use config file for customization
# Before: UnboundLocalError
flexidot -i seqs.fasta -m 0 -g annotations.gff3

# After: auto-generates colors with warning
# WARNING: No GFF color config file provided. Auto-generating colors...
#   micro: #e41a1c (alpha=0.7, zoom=0)
#   ssatar1: #377eb8 (alpha=0.7, zoom=0)

Wordsize in Filenames

When using -a for pre-calculated alignments, wordsize is meaningless but was still in filenames.

  • Added wordsize_suffix variable: empty string when alignments provided, _wordsize%i otherwise
  • Updated all filename generation in selfdotplot, pairdotplot, polydotplot
# With alignments: test-Pairdotplot-1_scaled.png
# With kmer:       test-Pairdotplot_wordsize10_scaled.png
Original prompt

This section details on the original issue you should resolve

<issue_title>Feature: Plot pre-calculated alignments</issue_title>
<issue_description>Flexidot currently indexes k-mers in query and target sequences to find matches between sequences. This option can be slow and sensitive to gaps or mutations between sequences.

We want to add options to supply pre-calculated alignments in either blast fmt 6 or PAF format. If pre-calculated alignments are supplied then skip kmer counting and plot only alignments between each pair of input sequences.

  • Review existing functions and data flow for identifying and plotting matches between sequences
  • Explore current logic for processing alignments in flexidot.utils.matching function find_match_pos_diag()
  • Add support for pre-computed alignments from:
    • blastn (output format 6)
    • PAF format as output by Minimap2
  • Filter redundant alignments where sequences are duplicated between the query and target sets (i.e. equivalent alignment coords present in SeqA vs SeqB and in SeqB vs SeqA)
  • Write pytests for all new functions
  • Add numpydoc style docstrings and typehints to new functions
  • Create markdown file tutorial for new features in docs/ dir</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: Adamtaranto <2160099+Adamtaranto@users.noreply.github.com>
@Adamtaranto Adamtaranto added the enhancement New feature or request label Jan 28, 2026
Co-authored-by: Adamtaranto <2160099+Adamtaranto@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for plotting pre-calculated alignments Add support for plotting pre-calculated alignments (BLAST6/PAF) Jan 28, 2026
Copilot AI requested a review from Adamtaranto January 28, 2026 02:04
Copilot AI and others added 2 commits January 28, 2026 03:52
…d filenames

Co-authored-by: Adamtaranto <2160099+Adamtaranto@users.noreply.github.com>
…plot data file

Co-authored-by: Adamtaranto <2160099+Adamtaranto@users.noreply.github.com>
Copilot AI changed the title Add support for plotting pre-calculated alignments (BLAST6/PAF) Fix GFF color auto-generation and conditional wordsize in filenames Jan 28, 2026
@Adamtaranto Adamtaranto marked this pull request as ready for review January 28, 2026 06:22
@Adamtaranto Adamtaranto changed the title Fix GFF color auto-generation and conditional wordsize in filenames Feature: Plot BLAST and PAF alignments Jan 28, 2026
@Adamtaranto Adamtaranto merged commit 74349bb into master Jan 28, 2026
6 checks passed
@Adamtaranto Adamtaranto deleted the copilot/add-pre-calculated-alignments branch January 28, 2026 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Plot pre-calculated alignments

2 participants