Sovereign 8s.is mirror of standardgalactic/NucFlag
  • Python 98.4%
  • Shell 0.9%
  • Makefile 0.7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Keith Oshima 7514bebca4
Some checks failed
CI / build (3.12) (push) Has been cancelled
CI / build (3.13) (push) Has been cancelled
CI / build (3.11) (push) Has been cancelled
CI / build (3.14) (push) Has been cancelled
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
CI / test (3.13) (push) Has been cancelled
CI / test (3.14) (push) Has been cancelled
Update README.md
2026-06-02 09:55:18 -04:00
.github/workflows Drop 3.10 support due to tomllib. 2026-02-16 23:49:14 -05:00
docs [no ci] Update doc image. 2026-02-04 00:29:34 -05:00
nucflag Fix overlapping regions in status causing over 100% in calls. 2026-06-02 01:52:43 -04:00
test Fix overlapping regions in status causing over 100% in calls. 2026-06-02 01:52:43 -04:00
.gitignore Add --status_by_region flag to generate status rows by region/window. 2026-02-24 15:56:24 -05:00
.pre-commit-config.yaml Added ability to ignore misassemblies in overlap regions. Refactor IO so cleaner. Update ignored relative regions at start instead of calculating. 2024-07-26 08:55:31 -04:00
LICENSE Add files via upload 2023-09-07 08:14:08 -07:00
Makefile Refactor tests. Fix incorrect error type for empty list of dfs edge-case. Bumped version to v0.0.5. 2024-05-19 09:31:28 -04:00
nucflag.toml [no ci] Fix not writing to fh for qv command. Fix ignore_mtypes not saving zscore and af column. Remove StrEnum since no longer user input allowing for support of python versions <3.12. Add low_quality and het_or_mismap calls from rs-nucflag v0.1.8. Bump version. 2026-02-11 00:24:56 -05:00
pyproject.toml Remove alpha on plot. Final bump. 2026-06-01 22:39:14 -04:00
README.md Update README.md 2026-06-02 09:55:18 -04:00
requirements-dev.txt Update test output labels with new nucflag version and bump py-nucflag version. 2026-03-03 19:17:19 -05:00
requirements.txt Update test output labels with new nucflag version and bump py-nucflag version. 2026-03-03 19:17:19 -05:00

NucFlag

CI PyPI - Version install with bioconda

Generates nucleotide frequency plots and genome misassembly BED files. Fork of NucFreq.

Labeled Misassemblies

Quickstart

# Requires Python>=3.11
pip install nucflag==1.0.0

Align long-reads to assembly.

# Align long reads to assembly generated from those reads.
minimap2 -x lr:hqae -I 8G asm.fa.gz reads.fq.gz | samtools view -bh -o asm.bam
samtools index asm.bam

Detect misassemblies.

# Call putative misassemblies from read alignments on a whole genome.
nucflag call -i asm.bam -f asm.fa.gz -o misassemblies.bed
# Or on a set of regions...
nucflag call -i asm.bam -f asm.fa.gz -b regions.bed -o misassemblies.bed
# Also runs on ONT read alignments.
nucflag call -i asm_ont_r9.bam -f asm.fa.gz -x ont_r9 -o misassemblies.bed
nucflag call -i asm_ont_r10.bam -f asm.fa.gz -x ont_r10 -o misassemblies.bed
# Provide a configfile for finer control.
nucflag call -i asm.bam -f asm.fa.gz -o misassemblies.bed -c config.toml

Visualize misassemblies in a number of ways.

# Generate NucFreq plots.
nucflag call -i asm.bam -f asm.fa.gz -d plots
# And add any number of tracks...
nucflag call -i asm.bam -f asm.fa.gz -d plots --tracks repeatmasker.bed segdups.bed
# Or generate bigWigs of specific signals and then merge them with `bigtools`.
# For use in IGV or other genome browsers.
nucflag call -i asm.bam -f asm.fa.gz -d plots \
    --output_pileup_dir bigwigs \
    --add_pileup_data cov mismatch mapq
bigwigmerge -l <(find bigwigs -name "*_first.bw") merged_first.bw

Generate status BED or breakdown showing distribution of assembly issues.

nucflag status -i misassemblies.bed > status.bed
# Get status of specific regions from a given BED file.
nucflag status -i misassemblies.bed -b censat.bed -g name > status_censat.bed
# Or plot by "length"
nucflag breakdown -i misassemblies.bed -o breakdown -t percent

Estimate QV from BED file.

nucflag qv -i misassemblies.bed > qv.bed

Generate ideogram.

nucflag ideogram -i misassemblies.bed -o ideogram
# Add cytobands with a BED file with chrom, start, end, name, and btype.
nucflag ideogram -i misassemblies.bed -c cytobands.bed -o ideogram

Get consensus misassembly calls by intersection.

nucflag consensus -i nucflag_ont.bed nucflag_hifi.bed hmm_flagger_hifi.bed hmm_flagger_ont.bed > consensus.bed

Generate sample config.

nucflag config -x ont_r10 > config_r10.toml

Input

  • BAM file of PacBio HiFi, ONT R9, or ONT R10 reads aligned to an assembly.
  • (Recommended) Assembly.
  • (Optional) BED file of regions.

Output

  • BED file of misassemblies.
  • (Optional) Plots with coverage and mismatch pileup with misassemblies flagged.
  • (Optional) bigWigs of pileup signals.
  • (Optional) BED file of assembly status.

Documentation

Read the docs at the NucFlag wiki for more information.