The panda pipeline is devised for building and inspecting a feature-level pangenome from pairwise genome alignments and genome annotations, with a current focus on Saccharomyces cerevisiae gene annotations.
The core workflow lives in mrk/panda.Rmd. It stages GFF annotations, converts them to BED, runs impg against a PAF alignment, reduces overlapping feature intervals into nonredundant sub-blocks, computes presence statistics, and checks how systematic yeast gene names are represented in the resulting pangenome.
The different chunks of code can be also found, e.g. mrk/c2.R.
The markdown mrk/panda.Rmd reports a detailed description of the chunks and extensive comments.
This repository is not yet distributed as a packaged software. Instead, the workflow is executed in a local environment where all required tools and R packages are pre-installed.
All the following step are documented below:
- clone the repository
git clone https://github.com/lt11/panda.git
cd panda
-
install dependencies (e.g.
impg) and make sure they are accessible in your$PATH -
install R packages, e.g.:
Rscript -e 'install.packages(c(
"data.table",
"rmarkdown"
))'
-
configure external inputs
-
check
impgversion compatibility
Top-level directories:
ids/input lists of strain-haplotype identifiers used to define the analysis set and output column order.aln/input alignments in PAF format.anno/staged annotation files produced during the workflow.mrk/the R Markdown analysis and helper scripts.png/primary pangenome output tables produced by the notebook.sts/downstream summary statistics, currently focused on gene sub-blocks.check-sys/validation outputs comparing systematic gene names in the pangenome against source GFF annotations.
Key source files:
- mrk/panda.Rmd: end-to-end notebook.
- mrk/c1.sh: copies and normalises input GFF files.
- mrk/c2.R: converts GFF annotations to BED.
- mrk/c3.R: computes the feature pangenome from
impgoutput. - mrk/c4.R: checks systematic genes between annotations and the pangenome.
- mrk/c5.R: additional systematic-gene validation/reporting step.
- mrk/run-profvis.R: helper to profile an R script with
profvis.
The workflow expects three main inputs:
- A single PAF alignment in
aln/. E.g. you can use a PAF file generated fromPGGBor directly fromwfmash. - A list of strain-haplotype identifiers in
ids/ids-ps.txt, one per line, such asSGDref-0orCMF-1. - A directory of source GFF annotations outside this repository, configured in mrk/c1.sh and in the corresponding chunk inside mrk/panda.Rmd.
Naming conventions matter:
- Contigs in the PAF use PanSN-style names with
#, for exampleSGDref#0#chrI. - Annotation files are named with
-, for exampleSGDref-0-features.gff. ids/ids-ps.txtdefines both the haplotypes (e.g. for exampleSGDref-0to analyse and the order of the output columns.
The notebook runs the analysis in four main stages.
- Stage GFF files.
mrk/c1.shcopies the requested annotation files intoanno/gff/, optionally merging mitochondrial annotations. - Convert GFF to BED.
mrk/c2.Rfilters feature classes, normalises coordinates, and writes BED files toanno/bed/. - Build the pangenome.
mrk/c3.Rrunsimpgfor each haplotype BED file against the single PAF alignment, merges overlapping hits into nonredundant feature sub-blocks, and writes the main pangenome tables topng/. - Summarise and validate gene sub-blocks.
mrk/c4.Rderives gene-level summary tables insts/gene/and compares systematic yeast gene names in the pangenome against the original GFF annotations, writing reports tocheck-sys/.
This repository is not packaged as an R package. The analysis assumes a local environment with:
Rscriptrmarkdownto render the notebookimpg
R packages used in the scripts include:
data.tablethis.pathscriptNameGenomicRangestictocprofvis
The notebook notes an impg version difference:
impg 0.2.0:impg -I -p file.paf -b file.bedimpg 0.2.3:impg query -I -p file.paf -b file.bed
Adjust the command in mrk/c3.R or the matching chunk in mrk/panda.Rmd to match the installed version.
There is no executable or standalone CLI entrypoint; the repository is driven from the notebook or by running a single chunk, as described below.
Before rendering:
- place exactly one input
.paffile inaln/ - update
ids/ids-ps.txtfor the genomes/haplotypes to analyse - set the external annotations directory in the first notebook chunk
- decide whether mitochondrial annotations should be included with
with_mito - confirm the
impgcommand variant for the installed version - review notebook chunks marked with
eval = FALSE
Then render:
Rscript -e 'rmarkdown::render("mrk/panda.Rmd")'If you prefer to run the stages individually, the scripts map to the notebook sections:
bash mrk/c1.sh
Rscript mrk/c2.R
Rscript mrk/c3.R
Rscript mrk/c4.R
Rscript mrk/c5.RThis can be useful if you want to profile the scripts on your machine.
Profiling helper:
Rscript mrk/run-profvis.R c3.RRun that command from mrk/ if you want run-profvis.R to resolve the target script as written.
Primary outputs are written to png/:
png/pan-features.txt: the feature pangenome table. The first columns areClass_idandFeatures_id; remaining columns are haplotypes such asSGDref#0andS288C#0, containing genomic intervals orMA(i.e. missing annotation) when absent.png/generators.txt: theclass:feature#strandentries that generated each output row.pan-features.RData: an R object with the same table.
Gene-level summaries are written to sts/gene/:
sts/gene/sts-by-haplos.txt: haplotype-based presence table withΝ_pres,F_pres,N_feats,N_feats_sys, andN_feats_rid.sts/gene/sts-by-genomes.txt: genome-collapsed version of the same summary.n-sblocks-regs.txtandn-rid-private.txt: additional sub-block count summaries.
Systematic-gene checks are written to check-sys/:
check-sys/sys-summary.txt: per-genome counts of systematic genes seen in the pangenome versus the source GFF, plus gains/losses.gene-lost-*.txtandgene-gained-*.txt: per-genome discrepancy lists.
- The analysis currently focuses on
geneandpseudogeneannotations in the BED conversion step, although the scripts contain commented alternatives for additional feature classes. mrk/panda.Rmddocuments a known warning fromimpg 0.2.0related to asymmetricwfmashalignments.
This repository is distributed under the MIT License.