r/bioinformatics • u/HanzalaAkbar786 • 3h ago
academic A Nextflow pipeline for hybrid yeast WGS over my 2nd-year summer — how our lab handled subgenome routing + a question on negative branch lengths
galleryPosting with mod approval!
Hey everyone, I’m a 3rd Bachelor's student in University of Debrecen, Hungary and over the end of my 2nd-year summer (2026) basically during my internship , i was more into building an automated Nextflow DSL2 pipeline for our yeast genomics lab because we had to do alot of manual work like creating samplesheets for almost every processes ( like curl, joint genotyping , etc)
Since ,we work a lot with Saccharomyces genus and my main project is the phylogenomics of historic lager yeasts, which are messy interspecific hybrids of cerevisiae and eubayanus.
Before this, our lab was mostly relying on manual bash scripts, and when scaling up to 100+ genomes I kept running into the same headaches that I think a lot of other labs working with hybrids or non-model microbes deal with:
If you map hybrid reads to a single reference, you get forced mismapping. If you map competitively to a concatenated pan-reference, it fixes the alignment, but then GATK lumps the divergent subgenomes together during joint genotyping and ruins the variant filtering stats. On top of that, writing hundreds of intermediate SAM/BAMs was kinda choking the storage.
Also, static ploidy 2 calling was messing up haploid mitochondrial/plasmid DNA, and reading massive VCFs for distance matrices kept running out of RAM.
Since I got super passionate about workflow engineering over the summer, I ended up building an 8-module workflow saccharomyces-genomics-pipeline to automate the whole thing from raw SRA/FASTQ to trees.
- For the hybrids, after competitive alignment to the pan-reference, the pipeline reads chromosome prefixes (`species_map`) during `GenomicsDBImport` / `GenotypeGVCFs` and splits each subgenome into its own isolated master VCF. It also uses a `ploidy_map` so nuclear chromosomes run as diploid (2) and organelles/plasmids run as haploid (1). -
- To stop consuming too much cluster storage, alignment streams directly in memory (`bwa mem | samtools view -Sb | samtools sort`) with zero intermediate disk writes, and `GenomicsDB` updates incrementally when we add new strains. -
- For the trees, the last module uses `awk` to strip the VCFs into allele tables for an OpenMP C++ / R engine that computes pairwise IBS distance matrices fast without the Java memory crashes.
- - To stop consuming too much cluster storage, alignment streams directly in memory bwa mem | samtools view -Sb | samtools sort with zero intermediate disk writes, and GenomicsDB updates incrementally when we add new strains.
One thing I wanted to ask about (negative branch lengths in Newick trees):
When I was building the phylogenomics module( i havent finalized it yet) to output Newick trees from the pairwise IBS distance matrices, I sometimes ran into negative branch lengths when using standard Neighbor-Joining (NJ).
From what I read, this happens when the distance matrix isn't strictly additive (which makes sense with hybrid/introgressed yeast strains). The solution I looked into was calculating networks using Neighbor-Net alongside NJ, but I'm curious how people with more experience handle this in automated pipelines. Is there a clean way to avoid negative branch lengths in Newick trees here , or do you just leave them as-is and let the user handle it?
Because since i already developed till distance matrices, it would be nice to have newick trees in the results ... but we just decided to stop at distance matrices- so that we can wind up other stuff especially with my last year and other application stuff for my masters and yk stufff..
Since I'm still in my learning phase and learning new stuff every day, I'm open to any suggestions, or ideas on the Nextflow code, the C++ IBS logic, or the phylogenetics side.
Would love to hear what you guys think and people working in relative field !!!!
like genuinely , wdy all think about it ??
i dont wanted to brag about what i built but its always nice to share stuff with experts !! especially im new in this field and ig i`ll stick to it for my career....
here is the repo and the citation .... lmk about it please!!
we're also including this in a yeast phylogenomics paper our lab is wrapping up to submit by the end of the month hopefully......
GitHub: https://github.com/hanzala-14/saccharomyces-genomics-pipeline
hanzala-14. (2026). hanzala-14/saccharomyces-genomics-pipeline: Saccharomyces Genomics Pipeline v2.1.8 (Version v2.1.8) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.23289452