パンゲノム解析は、ゲノムダイナミクスを研究する上で重要な手法である。原核生物のパンゲノムマップを作成することで、遺伝的多様性や生態学的適応性に関する貴重な知見を得ることができる。しかし、既存の解析手法は精度と計算効率のバランスを取るのに苦労することが多く、主に定性的な結果しか得られない傾向がある。本研究では、データ品質管理、パンゲノム解析、結果の可視化など、さまざまなプロセスを簡素化する統合ソフトウェアパッケージであるPGAP2を紹介する。PGAP2は、制約領域内でのきめ細かな特徴分析を用いることで、オルソロガス遺伝子とパラロガス遺伝子の迅速かつ正確な同定を可能にする。シミュレーションデータセットとゴールドスタンダードデータセットを用いた体系的な評価により、PGAP2は大規模パンゲノムデータにおいて、最先端のツールよりも精度が高く、堅牢で、拡張性に優れていることが実証された。さらに、PGAP2はクラスター間またはクラスター内の距離から導出される4つの定量的パラメータを導入し、相同性クラスターの詳細な特性評価を可能にする。最後に、PGAP2を用いて2794株の動物由来Streptococcus suis株の全ゲノムプロファイルを構築することで、定量的な結果を検証した。この解析により、S. suisの遺伝的多様性に関する新たな知見が得られ、ゲノム構造の理解が深まるだろう。PGAP2はhttps://github.com/bucongfan/PGAP2で無料で入手できる。
Wiki
https://github.com/bucongfan/PGAP2/wiki
インストール
Windows11 WSLでテストした。macでは依存関係が不足していて導入できなかった(dockerは使える)。
- Python 3.10以上
Github
#mamba
mamba create -n pgap2 -c conda-forge -c bioconda python=3.10 pgap2 -y
conda activate pgap2
#pipでも導入できる
pip install pgap2
#docker
docker pull quay.io/biocontainers/pgap2:2.2--pyhdfd78af_0
>pgap2
usage: pgap2 [-h] [-V] {prep,main,add,merge,minus,neigh,post,sqlite} ...
Pan-Genome Analysis Pipeline
positional arguments:
{prep,main,add,merge,minus,neigh,post,sqlite}
prep Preprocess the input files
main Core functions of PGAP2
add Add one or more genomes to an existing PGAP2 project
merge Merge two independent PGAP2 results into one pangenome
minus Remove strains from an existing PGAP2 result
neigh Conserved gene neighborhood (synteny block) analysis.
Runs the full partition pipeline then discovers
conserved gene neighborhoods across genomes
(spacedust-style).
post Postprocess the output files
sqlite Generate a SQLite database from PGAP2 output files
options:
-h, --help show this help message and exit
-V, --version show program's version number and exit
> pgap2 prep -h
usage: pgap2 prep [-h] --indir INDIR [--outdir OUTDIR] [--dup_id DUP_ID]
[--orth_id ORTH_ID] [--para_id PARA_ID]
[--type-filter TYPE_FILTER] [--id-attr-key ID_ATTR_KEY]
[--min_falen MIN_FALEN] [--accurate]
[--max_targets MAX_TARGETS] [--LD LD] [--AS AS] [--AL AL]
[--evalue EVALUE] [--aligner {diamond,blast}]
[--clust_method {cdhit,mmseqs2}] [--marker MARKER]
[--ani_thre ANI_THRE] [--annot] [--retrieve] [--gcode GCODE]
[--exclude_outlier] [--nodraw] [--single_file] [--verbose]
[--debug] [--disable] [--threads THREADS]
options:
-h, --help show this help message and exit
--indir INDIR, -i INDIR
Input file contained, same prefix seems as the same
strain. (default: None)
--outdir OUTDIR, -o OUTDIR
Output directory (default: .)
--dup_id DUP_ID The maximum identity between the most recent
duplication envent. (default: 0.99)
--orth_id ORTH_ID The maximum identity between the most similar
panclusters, 0 means automatic selection. (default:
0.98)
--para_id PARA_ID Use this identity as the paralogous identity, 0 means
automatic selection. (default: 0.7)
--type-filter TYPE_FILTER
Only for gff file as input, feature type (3rd column)
to include, Only lines matching these types will be
processed. (default: CDS)
--id-attr-key ID_ATTR_KEY
Only for gff file as input, Attribute key to extract
from the 9th column as the record ID (e.g., 'ID',
'gene', 'locus_tag'). (default: ID)
--min_falen MIN_FALEN, -l MIN_FALEN
protein length of throw_away_sequences, at least 11
(default: 20)
--accurate, -a Apply bidirection check for paralogous gene partition.
(default: False)
--max_targets MAX_TARGETS, -k MAX_TARGETS
The maximum targets for each query in alignment.
Improves accuracy for large-scale analyses, but
increases runtime and memory usage. (default: 2000)
--LD LD Minimum gene length difference proportion between two
genes. (default: 0.6)
--AS AS Coverage for the shorter sequence. (default: 0.6)
--AL AL Coverage for the longer sequence. (default: 0.6)
--evalue EVALUE The evalue of aligner. (default: 1e-05)
--aligner {diamond,blast}
The aligner used to pairwise alignment. (default:
diamond)
--clust_method {cdhit,mmseqs2}
The method used to cluster the genes. (default:
mmseqs2)
--marker MARKER Assigned darb or outlier strain used to filter the
input. See detail in marker.cfg in the main path
(default: None)
--ani_thre ANI_THRE Expect ani threshold (default: 95)
--annot Discard original annotation, and re-annote the genome
privately using prodigal (default: False)
--retrieve Retrieving gene that may lost with annotations
(default: False)
--gcode GCODE The genetic code of your species. Default is [11]
(bacteria). (default: 11)
--exclude_outlier Exclude outlier strains from the output pkl. When set,
low-quality or dissimilar strains will be removed from
the pangenome data. By default, all strains are kept
in the pkl (outliers are flagged but not removed).
(default: False)
--nodraw Only output flat file, but no drawing plot (default:
False)
--single_file, -s Output each vector plot as a single file (default:
False)
--verbose, -V Verbose output (default: False)
--debug, -D Debug mode. Note: very verbose (default: False)
--disable Disable progress bar (default: False)
--threads THREADS, -t THREADS
threads used in parallel (default: 1)
> pgap2 main -h
usage: pgap2 main [-h] --indir INDIR [--outdir OUTDIR] [--dup_id DUP_ID]
[--orth_id ORTH_ID] [--para_id PARA_ID]
[--type-filter TYPE_FILTER] [--id-attr-key ID_ATTR_KEY]
[--hconf_thre HCONF_THRE] [--exhaust_orth]
[--sensitivity {soft,moderate,strict}] [--ins] [--fast]
[--accurate] [--retrieve] [--threads THREADS]
[--max_targets MAX_TARGETS] [--LD LD] [--AS AS] [--AL AL]
[--evalue EVALUE] [--aligner {diamond,blastp}]
[--clust_method {cdhit,mmseqs2}] [--radius RADIUS]
[--min_falen MIN_FALEN] [--gcode GCODE] [--annot]
[--verbose] [--debug] [--disable]
options:
-h, --help show this help message and exit
--indir INDIR, -i INDIR
Input file contained, same prefix seems as the same
strain. (default: None)
--outdir OUTDIR, -o OUTDIR
Output directory (default: .)
--dup_id DUP_ID The maximum identity between the most recent
duplication envent. (default: 0.99)
--orth_id ORTH_ID The maximum identity between the most similar
panclusters. (default: 0.98)
--para_id PARA_ID Use this identity as the paralogous identity.
(default: 0.7)
--type-filter TYPE_FILTER
Only for gff file as input, feature type (3rd column)
to include, Only lines matching these types will be
processed. (default: CDS)
--id-attr-key ID_ATTR_KEY
Only for gff file as input, Attribute key to extract
from the 9th column as the record ID (e.g., 'ID',
'gene', 'locus_tag'). (default: ID)
--hconf_thre HCONF_THRE
The threshold to define high confidence cluster which
is used to evaluate the cluster diversity. Loose this
value when your input is too large or too diverse,
such as 0.95. (default: 1)
--exhaust_orth, -e Try to split every paralogs gene exhausted (default:
False)
--sensitivity {soft,moderate,strict}, -s {soft,moderate,strict}
The degree of connectedness between each node of
clust. (default: strict)
--ins, -n Ignore the influence of insertion sequence. (default:
False)
--fast, -f Do not apply fine feature analysis just partition
according to the gene identity and synteny. (default:
False)
--accurate, -a Apply bidirection check for paralogous gene partition
(useless if exhaust_orth asigned). (default: False)
--retrieve, -r Retrieve gene that may lost with annotations (default:
False)
--threads THREADS, -t THREADS
threads used in parallel (default: 1)
--max_targets MAX_TARGETS, -k MAX_TARGETS
The maximum targets for each query in alignment.
Improves accuracy for large-scale analyses, but
increases runtime and memory usage. (default: 2000)
--LD LD Minimum gene length difference proportion between two
genes. (default: 0.6)
--AS AS Coverage for the shorter sequence. (default: 0.6)
--AL AL Coverage for the longer sequence. (default: 0.6)
--evalue EVALUE The evalue of aligner. (default: 1e-05)
--aligner {diamond,blastp}
The aligner used to pairwise alignment. (default:
diamond)
--clust_method {cdhit,mmseqs2}
The method used to cluster the genes. (default:
mmseqs2)
--radius RADIUS The radius of search region. (default: 3)
--min_falen MIN_FALEN, -m MIN_FALEN
protein length of throw_away_sequences, at least 11
(default: 20)
--gcode GCODE The genetic code of your species. (default: 11)
--annot Discard original annotation, and re-annote the genome
privately using prodigal (default: False)
--verbose, -v Verbose output (default: False)
--debug, -D Debug mode. Note: very verbose (default: False)
--disable Disable progress bar (default: False)
> pgap2 add -h
usage: pgap2 add [-h] --indir INDIR [--outdir OUTDIR] [--previous PREVIOUS]
[--aligner {diamond,blastp}] [--clust_method {cdhit,mmseqs2}]
[--type-filter TYPE_FILTER] [--id-attr-key ID_ATTR_KEY]
[--retrieve] [--threads THREADS] [--min_falen MIN_FALEN]
[--gcode GCODE] [--annot] [--verbose] [--debug] [--disable]
options:
-h, --help show this help message and exit
--indir INDIR, -i INDIR
Input file contained, same prefix seems as the same
strain. (default: None)
--outdir OUTDIR, -o OUTDIR
Output directory (default: .)
--previous PREVIOUS, -p PREVIOUS
The previous PGAP2 result directory, used to resume
the partition step quickly. (default: None)
--aligner {diamond,blastp}
The aligner used to pairwise alignment. (default:
diamond)
--clust_method {cdhit,mmseqs2}
The method used to cluster the genes. (default:
mmseqs2)
--type-filter TYPE_FILTER
Only for gff file as input, feature type (3rd column)
to include, Only lines matching these types will be
processed. (default: CDS)
--id-attr-key ID_ATTR_KEY
Only for gff file as input, Attribute key to extract
from the 9th column as the record ID (e.g., 'ID',
'gene', 'locus_tag'). (default: ID)
--retrieve, -r Retrieve gene that may lost with annotations (default:
False)
--threads THREADS, -t THREADS
threads used in parallel (default: 1)
--min_falen MIN_FALEN, -m MIN_FALEN
protein length of throw_away_sequences, at least 11
(default: 20)
--gcode GCODE The genetic code of your species. (default: 11)
--annot Discard original annotation, and re-annote the genome
privately using prodigal (default: False)
--verbose, -v Verbose output (default: False)
--debug, -D Debug mode. Note: very verbose (default: False)
--disable Disable progress bar (default: False)
> pgap2 merge -h
usage: pgap2 merge [-h] --dir_a DIR_A --dir_b DIR_B [--outdir OUTDIR]
[--aligner {diamond,blastp}]
[--clust_method {cdhit,mmseqs2}]
[--type-filter TYPE_FILTER] [--id-attr-key ID_ATTR_KEY]
[--retrieve] [--threads THREADS] [--min_falen MIN_FALEN]
[--gcode GCODE] [--annot] [--verbose] [--debug] [--disable]
options:
-h, --help show this help message and exit
--dir_a DIR_A, -a DIR_A
First PGAP2 result directory (output from pgap2 main
or pgap2 add). (default: None)
--dir_b DIR_B, -b DIR_B
Second PGAP2 result directory (output from pgap2 main
or pgap2 add). (default: None)
--outdir OUTDIR, -o OUTDIR
Output directory for merged results. (default: .)
--aligner {diamond,blastp}
The aligner used for pairwise alignment. (default:
diamond)
--clust_method {cdhit,mmseqs2}
The clustering method used in previous runs. (default:
mmseqs2)
--type-filter TYPE_FILTER
Only for gff file as input, feature type to filter.
(default: CDS)
--id-attr-key ID_ATTR_KEY
Only for gff file as input, attribute key for record
ID. (default: ID)
--retrieve, -r Retrieve genes that may be lost with annotations.
(default: False)
--threads THREADS, -t THREADS
Threads used in parallel. (default: 1)
--min_falen MIN_FALEN, -m MIN_FALEN
Protein length of throw_away_sequences, at least 11.
(default: 20)
--gcode GCODE The genetic code of your species. (default: 11)
--annot Discard original annotation, re-annotate using
prodigal. (default: False)
--verbose, -v Verbose output. (default: False)
--debug, -D Debug mode. Note: very verbose. (default: False)
--disable Disable progress bar. (default: False)
> pgap2 minus -h
usage: pgap2 minus [-h] --prev_dir PREV_DIR --removal_file REMOVAL_FILE
[--outdir OUTDIR] [--threads THREADS] [--verbose] [--debug]
[--disable]
options:
-h, --help show this help message and exit
--prev_dir PREV_DIR, -p PREV_DIR
Previous PGAP2 result directory (output from pgap2
main, add, or merge). (default: None)
--removal_file REMOVAL_FILE, -r REMOVAL_FILE
Text file listing strain names to remove (one per
line). (default: None)
--outdir OUTDIR, -o OUTDIR
Output directory for results after removal. (default:
.)
--threads THREADS, -t THREADS
Threads used in parallel. (default: 1)
--verbose, -v Verbose output. (default: False)
--debug, -D Debug mode. Note: very verbose. (default: False)
--disable Disable progress bar. (default: False)
> pgap2 neigh -h
usage: pgap2 neigh [-h] --indir INDIR [--outdir OUTDIR] [--dup_id DUP_ID]
[--orth_id ORTH_ID] [--para_id PARA_ID]
[--type-filter TYPE_FILTER] [--id-attr-key ID_ATTR_KEY]
[--hconf_thre HCONF_THRE] [--exhaust_orth]
[--sensitivity {soft,moderate,strict}] [--ins] [--fast]
[--accurate] [--retrieve] [--threads THREADS]
[--max_targets MAX_TARGETS] [--LD LD] [--AS AS] [--AL AL]
[--evalue EVALUE] [--aligner {diamond,blastp}]
[--clust_method {cdhit,mmseqs2}] [--radius RADIUS]
[--min_falen MIN_FALEN] [--gcode GCODE] [--annot]
[--max_gap MAX_GAP] [-mg MIN_GENES] [--pval PVAL]
[--use_order] [-mgs MIN_GENOMES] [-re RESOLUTION]
[--verbose] [--debug] [--disable]
options:
-h, --help show this help message and exit
--indir INDIR, -i INDIR
Input directory containing genome files. Same prefix =
same strain. (default: None)
--outdir OUTDIR, -o OUTDIR
Output directory (default: .)
--dup_id DUP_ID Maximum identity for most recent duplication events.
(default: 0.99)
--orth_id ORTH_ID Maximum identity between most similar pan-clusters.
(default: 0.98)
--para_id PARA_ID Paralogous identity threshold. (default: 0.7)
--type-filter TYPE_FILTER
GFF feature type (3rd column) to include. (default:
CDS)
--id-attr-key ID_ATTR_KEY
GFF attribute key for record ID. (default: ID)
--hconf_thre HCONF_THRE
High confidence cluster threshold. (default: 1)
--exhaust_orth, -e Exhaustive paralog splitting. (default: False)
--sensitivity {soft,moderate,strict}, -s {soft,moderate,strict}
Node connectivity sensitivity. (default: strict)
--ins, -n Ignore insertion sequence influence. (default: False)
--fast, -f Fast mode (skip fine feature analysis). (default:
False)
--accurate, -a Bidirection check for paralog partition. (default:
False)
--retrieve, -r Retrieve genes lost during annotation. (default:
False)
--threads THREADS, -t THREADS
Number of threads. (default: 1)
--max_targets MAX_TARGETS, -k MAX_TARGETS
Maximum alignment targets per query. (default: 2000)
--LD LD Minimum gene length difference proportion. (default:
0.6)
--AS AS Coverage for shorter sequence. (default: 0.6)
--AL AL Coverage for longer sequence. (default: 0.6)
--evalue EVALUE Aligner E-value threshold. (default: 1e-05)
--aligner {diamond,blastp}
Pairwise aligner. (default: diamond)
--clust_method {cdhit,mmseqs2}
Gene clustering method. (default: mmseqs2)
--radius RADIUS Search region radius. (default: 3)
--min_falen MIN_FALEN, -m MIN_FALEN
Minimum protein length (at least 11). (default: 20)
--gcode GCODE Genetic code. (default: 11)
--annot Re-annotate genomes with Prodigal. (default: False)
--verbose, -v Verbose output (default: False)
--debug, -D Debug mode (very verbose) (default: False)
--disable Disable progress bar (default: False)
Neighborhood parameters:
Parameters specific to conserved gene neighborhood detection.
--max_gap MAX_GAP Maximum gene gap allowed between hits for merging into
a syntenic block. Larger values allow more intervening
genes. (default: 3)
-mg MIN_GENES, --min_genes MIN_GENES
Minimum number of genes to define a syntenic block.
(default: 2)
--pval PVAL P-value threshold for gene-order filtering (only used
when --use_order is enabled). (default: 0.01)
--use_order Enable gene-order conservation filtering. When set,
blocks are filtered by P_order <= --pval, edge weights
use -log10(P_order), and neighborhood P-values are
computed via Fisher's combined test. Default: off
(accept blocks purely based on --min_genes co-
localization). (default: False)
-mgs MIN_GENOMES, --min_genomes MIN_GENOMES
Minimum number of genomes a neighborhood must span to
be reported. (default: 2)
-re RESOLUTION, --resolution RESOLUTION
Louvain resolution parameter. Higher values produce
smaller, more focused neighborhoods; lower values
produce larger, more inclusive ones. Try 2.0-10.0 if
neighborhoods are too large. (default: 1.0)
> pgap2 sqlite -h
usage: pgap2 sqlite [-h] --indir INDIR [--output OUTPUT] [--name NAME]
[--species SPECIES] [--description DESCRIPTION]
options:
-h, --help show this help message and exit
--indir INDIR, -i INDIR
PGAP2 output directory (contains .pav, .detail.tsv,
etc.) (default: None)
--output OUTPUT, -o OUTPUT
Output SQLite file path (default: <indir>/pgap2.db)
(default: None)
--name NAME, -n NAME Project name (auto-detected from README.md if present)
(default: None)
--species SPECIES, -s SPECIES
Species name (auto-detected from README.md if present)
(default: None)
--description DESCRIPTION, -d DESCRIPTION
Optional project description (default: )
> pgap2 post -h
usage: pgap2 post [-h]
{stat,profile,singletree,baps,tajimas_d,graph,neigh} ...
positional arguments:
{stat,profile,singletree,baps,tajimas_d,graph,neigh}
stat Statistical analysis
profile To generate the pangenome profile using PAV matrix, it
is the subset of [stat] module
singletree Workflow for bayesian analysis of population structure
baps Workflow for bayesian analysis of population structure
tajimas_d Workflow for Tajima's D test
graph Generate annotated pangenome graph with reference-
based layout
neigh Conserved gene neighborhood (synteny block) analysis
on an existing partition output.
options:
-h, --help show this help message and exit
> pgap2 post stat -h
usage: pgap2 post stat [-h] --indir INDIR [--outdir OUTDIR] [--nodraw]
[--single_file] [--S S] [--N N] [--R R] [--K K]
[--method {TR,DG}] [--threads THREADS] [--verbose]
[--debug] [--disable]
options:
-h, --help show this help message and exit
--indir INDIR, -i INDIR
Input directory generated by partition step
--outdir OUTDIR, -o OUTDIR
Output directory
--nodraw Only output flat file, but no drawing plot
--single_file, -s Output each vector plot as a single file
--S S Number of strains to sample in each bin
--N N Number of bins to sample
--R R Number of repeats for every sample
--K K Inflated cof for DG method
--method {TR,DG} Sampling method. TR: total random; DG: diversity
guided
--threads THREADS, -t THREADS
threads used in parallel
--verbose, -V Verbose output
--debug Debug mode. Note: very verbose
--disable Disable progress bar
> pgap2 post profile -h
usage: pgap2 post profile [-h] --pav PAV [--outdir OUTDIR] [--nodraw]
[--single_file] [--S S] [--N N] [--R R] [--K K]
[--method {TR,DG}] [--threads THREADS] [--disable]
[--verbose] [--debug]
options:
-h, --help show this help message and exit
--pav PAV, -p PAV The pav matrix (default: None)
--outdir OUTDIR, -o OUTDIR
Output directory (default: .)
--nodraw Only output flat file, but no drawing plot (default:
False)
--single_file, -s Output each vector plot as a single file (default:
False)
--S S Number of strains to sample in each bin (default: 100)
--N N Number of bins to sample (default: 100)
--R R Number of repeats for every sample (default: 1)
--K K Inflated cof for DG method (default: 3)
--method {TR,DG} Sampling method. TR: total random; DG: diversity
guided (default: TR)
--threads THREADS, -t THREADS
Number of threads (default: 1)
--disable Disable progress bar (default: False)
--verbose Verbose output (default: False)
--debug Debug mode. Note: very verbose (default: False)
> pgap2 post singletree -h
usage: pgap2 post singletree [-h] --indir INDIR [--outdir OUTDIR] [--nodraw]
[--verbose] [--debug] [--disable]
[--threads THREADS]
[--msa_method {mafft,muscle,tcoffee}]
[--tree_method {fasttree,raxml,iqtree}]
[--para_strategy {drop,best}] [--also_pan]
[--core_threshold CORE_THRESHOLD]
[--step {1,2,3,4,5,6}] [--add_paras ADD_PARAS]
[--no-partition]
options:
-h, --help show this help message and exit
--indir INDIR, -i INDIR
Input directory generated by partition (default: None)
--outdir OUTDIR, -o OUTDIR
Output directory (default: .)
--nodraw Only output flat file, but no drawing plot (default:
False)
--verbose, -V Verbose output (default: False)
--debug Debug mode. Note: very verbose (default: False)
--disable Disable progress bar (default: False)
--threads THREADS, -t THREADS
threads used in parallel (default: 1)
--msa_method {mafft,muscle,tcoffee}
The method of multiple sequence alignment. (default:
mafft)
--tree_method {fasttree,raxml,iqtree}
The method of tree building. (default: iqtree)
--para_strategy {drop,best}
The strategy of paralog including cluster. best: keep
the best one; drop: drop all paralogs contained
clusters. (default: best)
--also_pan Also output pan genome alignment (default: False)
--core_threshold CORE_THRESHOLD
Core threshold to extract for tree construction
(default: 0.95)
--step {1,2,3,4,5,6} Terminate at this step. 1. Extract core cds and prot.
2. Multiple sequence alignment using --msa_method
assigned. 3. Codon alignment: Trans multiple protein
alignment to corresponding nucleotide alignment. 4.
Trim alignment using ClipKit. 5. Core alignment
concatenation 6. Phylogeny tree construction using
tree_method assigned software. (default: 6)
--add_paras ADD_PARAS
Add additional parameters in the step. Format like
"Step number:Parameters.", such as: 6:-pseudo
(default: None)
--no-partition Do not generate the partition model file
(core_gene_alignment.partitions) during concatenation
(default: False)
> pgap2 post baps -h
usage: pgap2 post baps [-h] --indir INDIR [--outdir OUTDIR] [--nodraw]
[--verbose] [--debug] [--disable] [--threads THREADS]
[--msa_method {mafft,muscle,tcoffee}]
[--tree_method {fasttree,raxml,iqtree}]
[--para_strategy {drop,best}] [--also_pan]
[--fastbaps_levels FASTBAPS_LEVELS]
[--fastbaps_prior {symmetric,baps,optimise.symmetric,optimise.baps}]
[--core_threshold CORE_THRESHOLD]
[--step {1,2,3,4,5,6,7,8,9,10}] [--add_paras ADD_PARAS]
[--no-partition]
options:
-h, --help show this help message and exit
--indir INDIR, -i INDIR
Input directory generated by partition (default: None)
--outdir OUTDIR, -o OUTDIR
Output directory (default: .)
--nodraw Only output flat file, but no drawing plot (default:
False)
--verbose, -V Verbose output (default: False)
--debug Debug mode. Note: very verbose (default: False)
--disable Disable progress bar (default: False)
--threads THREADS, -t THREADS
threads used in parallel (default: 1)
--msa_method {mafft,muscle,tcoffee}
The method of multiple sequence alignment. (default:
mafft)
--tree_method {fasttree,raxml,iqtree}
The method of tree building. (default: fasttree)
--para_strategy {drop,best}
The strategy of paralog including cluster. best: keep
the best one; drop: drop all paralogs contained
clusters. (default: best)
--also_pan Also output pan genome alignment. (default: False)
--fastbaps_levels FASTBAPS_LEVELS
Parameter of fastbaps (default: 2)
--fastbaps_prior {symmetric,baps,optimise.symmetric,optimise.baps}
Parameter of fastbaps (default: symmetric)
--core_threshold CORE_THRESHOLD
Core threshold to extract for tree construction
(default: 0.95)
--step {1,2,3,4,5,6,7,8,9,10}
Terminate at this step. 1. Extract core cds and prot.
2. Multiple sequence alignment using --msa_method
assigned. 3. Codon alignment: Trans multiple protein
alignment to corresponding nucleotide alignment. 4.
Trim alignment using ClipKit. 5. Core alignment
concatenation 6. Phylogeny tree construction using
FastTree. 7. Recombination inference using
ClonalFrameML. 8. Musk the recombination region using
maskrc-svg. 9. Reconstruct the phylogeny tree. 10.
Population structure analysis using fastbaps.
(default: 10)
--add_paras ADD_PARAS
Add additional parameters in the step. Format like
"Step number:Parameters.", such as: 7:--kappa 4.232
(default: None)
--no-partition Do not generate the partition model file
(core_gene_alignment.partitions) during concatenation
(default: False)
> pgap2 post tajimas_d -h
usage: pgap2 post tajimas_d [-h] --indir INDIR [--outdir OUTDIR] [--nodraw]
[--verbose] [--debug] [--disable]
[--threads THREADS]
[--msa_method {mafft,muscle,tcoffee}]
[--para_strategy {drop,best}] [--clusts CLUSTS]
[--step {1,2,3,4,5}] [--add_paras ADD_PARAS]
options:
-h, --help show this help message and exit
--indir INDIR, -i INDIR
Input directory generated by partition (default: None)
--outdir OUTDIR, -o OUTDIR
Output directory (default: .)
--nodraw Only output flat file, but no drawing plot (default:
False)
--verbose, -V Verbose output (default: False)
--debug Debug mode. Note: very verbose (default: False)
--disable Disable progress bar (default: False)
--threads THREADS, -t THREADS
threads used in parallel (default: 1)
--msa_method {mafft,muscle,tcoffee}
The method of multiple sequence alignment. (default:
mafft)
--para_strategy {drop,best}
The strategy of paralog including cluster. best: keep
the best one; drop: drop all paralogs contained
clusters. (default: best)
--clusts CLUSTS A file containing one line per cluster for which
Tajima's D test needs to be performed. By default, all
clusters will be used. (default: None)
--step {1,2,3,4,5} Terminate at this step. 1. Extract core cds and prot.
2. Multiple sequence alignment using --msa_method
assigned. 3. Codon alignment: Trans multiple protein
alignment to corresponding nucleotide alignment. 4.
Trim alignment using ClipKit. 5. Tajima's D Test.
(default: 5)
--add_paras ADD_PARAS
Add additional parameters in the step. Format like
"Step number:Parameters.", such as: 4:-g 0.8 (default:
None)
> pgap2 post graph -h
usage: pgap2 post graph [-h] --indir INDIR [--outdir OUTDIR] [--ref REF]
[--distance-threshold DISTANCE_THRESHOLD]
[--compute-layout]
[--layout-algorithm {drl,fr,kk,graphopt}] [--verbose]
[--debug]
options:
-h, --help show this help message and exit
--indir INDIR, -i INDIR
Input directory (output of partition step, containing
GML, detail.tsv, and annot.tsv) (default: None)
--outdir OUTDIR, -o OUTDIR
Output directory (default: same as input directory)
(default: None)
--ref REF, -r REF Reference strain name (default: auto-select strain
with most nodes) (default: None)
--distance-threshold DISTANCE_THRESHOLD
Gene-order distance threshold for long-range edge
detection (default: 100)
--compute-layout Pre-compute 2-D coordinates with igraph and output a
JSON file for D3 Canvas rendering (requires python-
igraph) (default: False)
--layout-algorithm {drl,fr,kk,graphopt}
igraph layout algorithm (only used with --compute-
layout). drl=DrL (best for 10k+ nodes),
fr=Fruchterman-Reingold, kk=Kamada-Kawai,
graphopt=GraphOpt (default: drl)
--verbose, -V Verbose output (default: False)
--debug Debug mode (default: False)
> pgap2 post neigh -h
usage: pgap2 post neigh [-h] --indir INDIR [--outdir OUTDIR]
[--threads THREADS] [--retrieve] [--max_gap MAX_GAP]
[-mg MIN_GENES] [--pval PVAL] [--use_order]
[-mgs MIN_GENOMES] [-re RESOLUTION] [--verbose]
[--debug] [--disable]
options:
-h, --help show this help message and exit
--indir INDIR, -i INDIR
Input directory (output of partition step, containing
graph.pkl, preprocess.pkl, and
total.involved_annot.tsv) (default: None)
--outdir OUTDIR, -o OUTDIR
Output directory (default: same as input directory)
(default: None)
--threads THREADS, -t THREADS
Number of threads (default: 1)
--retrieve, -r Retrieve genes lost during annotation (passed to
reload_annot_file) (default: False)
--max_gap MAX_GAP Maximum gene gap allowed between hits for merging into
a syntenic block. (default: 3)
-mg MIN_GENES, --min_genes MIN_GENES
Minimum number of genes to define a syntenic block.
(default: 2)
--pval PVAL P-value threshold for gene-order filtering. (default:
0.01)
--use_order Enable gene-order conservation filtering. (default:
False)
-mgs MIN_GENOMES, --min_genomes MIN_GENOMES
Minimum number of genomes a neighborhood must span.
(default: 2)
-re RESOLUTION, --resolution RESOLUTION
Louvain resolution parameter. (default: 1.0)
--verbose, -V Verbose output (default: False)
--debug Debug mode (default: False)
--disable Disable progress bar (default: False)
実行方法
PGAP2は複数の入力形式をサポートしている。Prokkaの出力形式と同じGFFファイル、ゲノムFASTAファイルと(別ファイルとしての)GFFファイルの組み合わせ、GenBankフラットファイル(GBFF)、あるいはゲノムFASTAファイルのみ(この場合は`--annot`オプションが必要)。さらに、異なる形式の入力ファイルを同一の入力ディレクトリに混在させてに対応する。PGAP2は、ファイル名のプレフィックス(接頭辞)やサフィックス(接尾辞)に基づいてそれらを識別し、処理を行う。メインのコマンドはpgap2 mainだが、実際には品質管理レポートから順番に走らせることが推奨される。
1、品質チェックと可視化ステップ
GFF (full)やGBFFなどのゲノムアノテーションを含むディレクトリを指定する。
pgap2 prep -i input_dir -o prep_outdir -t 12
- --threads, -t THREADS
- --indir Input file contained, same prefix seems as the same strain. (default: None)
- --outdir Output directory (default: .)
PGAP2は、ユーザーが入力データを把握しやすいインタラクティブなHTMLファイルとそれに対応するベクター形式の図を生成する。入力データとアラインメント前の解析結果はpickleファイルとして保存され、同一の計算ステップを迅速に再開できるようになっている。
出力例
prep_outdir/

10個のGFFで1分ほどかかった。
pgap2.preprocess.pdf

ANIは代表ゲノムとのANI距離を示し、赤い破線は設定したANI閾値を表す (ここでは遠い系統からゲノムを取ってしまったためおかしくなっている)。Number of genesは各ゲノムの遺伝子数、Half cloudとsingle cloudとは半数を超えるゲノムで共有される遺伝子数と各ゲノムに固有の遺伝子数(Single cloud)の関係を示す。下のパネルのDは各ゲノムの遺伝子をHalf、Singleおよびその他の頻度カテゴリーに分類した割合、Eは開始コドンと終止コドンの組み合わせ別の遺伝子数を示す。maxbin2_ERR3494957.021はHalf core遺伝子が少なく、他のゲノムとは遺伝子組成が大きく異なることが示唆される。従って、今回はmaxbin2_ERR3494957.021を除外する。
preprocess_results.html

PGAP2前処理結果の図となる。左上の円グラフの右下付近に10ゲノム中9ゲノムがフィルターをpassと出ている。各パネルには、遺伝子数と完全なCDSの割合、塩基組成とゲノムサイズ、遺伝子長分布、Half coreおよびSingle cloud遺伝子数、開始・終止コドンの分布が示されている。この2つのパネルから、解析から除外したほうがよいゲノムがあるか決定する。
2、メインのパンゲノム解析ステップ
QC結果を確認し、ANI外れ値や遺伝子構成が大きく異なる不要なアノテーションファイルを入力フォルダから除外した後、mainコマンドを実行してパンゲノム解析を行う。
#感度strict設定
pgap2 main -i input/ -o pgap2_out/ -t 20 --sensitivity strict
#パラログを正確に分ける
pgap2 main -i input/ -o pgap2_out/ -t 20 --sensitivity strict --accurate
#パラログを厳密に分ける(--accurateよりさらに厳しめ)
pgap2 main -i input/ -o pgap2_out/ -t 20 --sensitivity strict --exhaust_orth
#ANIが低めの複数の種や複数の属を含む場合、感度を上げる
#--hconf_thre 0.95 =>入力が多様な場合に高信頼クラスターの基準を緩める
pgap2 main -i input/ -o pgap2_out/ -t 20 --sensitivity moderate --hconf_thre 0.95
- --indir Input file contained, same prefix seems as the same strain.
- --outdir Output directory (default: .)
- --orth_id The maximum identity between the most similar panclusters. (default: 0.98)
- --para_id Use this identity as the paralogous identity. (default: 0.7)
- --exhaust_orth Try to split every paralogs gene exhausted (default: False)
- --accurate Apply bidirection check for paralogous gene partition (useless if exhaust_orth asigned). (default: False)
- --retrieve Retrieve gene that may lost with annotations (default: False)
- --annot Discard original annotation, and re-annote the genome privately using prodigal (default: False)
- --sensitivity {soft,moderate,strict} The degree of connectedness between each node of clust. (default: strict)
- --hconf_thre The threshold to define high confidence cluster which is used to evaluate the cluster diversity. Loose this value when your input is too large or too diverse, such as 0.95. (default: 1)
- --aligner {diamond,blastp}
The aligner used to pairwise alignment. (default: diamond) - --clust_method {cdhit,mmseqs2}
The method used to cluster the genes. (default: mmseqs2)
出力例
pgap2_out/

9個のGFFで40秒ほどかかった。 clust_0.99とclust_0.98というフォルダがあるが、これらのフォルダ名は--orth_id ORTH_IDと--dup_id DUP_IDのオプションに由来している。(--orth_idは、最も類似した別の遺伝子クラスターとの境界のidentityとなる。低くすると配列多様性の高いオルソログもまとめられるが、別遺伝子の誤統合が増える可能性がある)。
pgap2.partition.gene_content.csv

Roaryのgene_presence_absence.csvに近いファイル。パラログが存在する場合はgenomeA_03209;genomeA_02765のように、セミコロンで区切って1セルに並列記載される。
pgap2.partition.gene_content.pav

こちらはBinary形式
pgap2.partition.gene_content.detail.tsv

クラスタごとの遺伝子名とアノテーション、coreかcloudかなどの情報。上と照合して使う。
終わったら、mainで作成された遺伝子のpresence/absence情報をもとに、ポスト処理を行なう。pgap2 post statやpgap2 post ptofileなど、目的に応じて複数のサブコマンドが用意されている。
3、 ポストステップ1。パンゲノム統計と可視化を行なう
最初はpgap2 post statを走らせる。これは、遺伝子クラスターの頻度分布、パンゲノム・コアゲノム曲線、パラログの分布などの統計を出力する。”-i”でpgap2 mainの結果のディレクトリ、"-o"で出力ディレクトリを指定する。
pgap2 post stat -i main_out -o post_stat_out -t 8
pgap2 post statの出力例
post_stat_out/

パンゲノムおよびコアゲノムサイズの変化、各ゲノム追加時に新たに見つかる遺伝子クラスター数、core・soft core・shell・cloudなどの遺伝子カテゴリー、各クラスターの保有株数、パラログ遺伝子の分布などを計算し、表形式の結果に加えてインタラクティブHTMLやPDF図を出力する。また、コアゲノムの減少曲線とパンゲノムの増加曲線をモデルに当てはめ、パンゲノムが開いているか閉じているかを検討するための結果も作成される。
pgap2.postprocess_profile.pdf

パンゲノム全体の遺伝子クラスター頻度プロファイルをまとめた図。各遺伝子クラスターが何株に存在するかgが集計され、core、soft core、shell、cloudそれぞれの分布が示されている。
pgap2.postprocess_stat.pdf

各遺伝子クラスターの性質をMEAN、MIN、VAR、UNIの4指標で評価した図。MEANはクラスター内の平均配列同一性、MINは最小配列同一性、VARは配列同一性のばらつきを表す。一方、UNIは最も近縁な別クラスターとの関係を表し、対象クラスターが他の遺伝子ファミリーからどの程度独立しているかを評価する。図では、これらの指標の分布をStrict core、Shell、Cloudの各パンゲノムカテゴリー間で比較している。
pgap2.postprocess_stat_para.pdf

各遺伝子クラスターに含まれるパラログの分布を示した図。(A)Strict core、Shell、Cloudの各パンゲノムカテゴリー間に分けてプロットされている。ほぼすべての点が横軸の1付近(左端)にあるため、パラログの大部分は1株だけにある株特異的なものとなる。(B)Strict core、Shell、Cloudで3つのパネルに分けてパラログクラスターの数をプロットしている。パラログクラスターはパネルAと一致してCloudが大部分となっている。色は同一クラスター内のコピー数を表す。濃い赤ほど同一クラスター内のコピー増加が大きい。
postprocess_stat.html

各解析結果をまとめたインタラクティブな図。
4、 ポストステップ2。系統樹の作成
pgap2 post singletreeを使うと、普遍的にシングルコピーで保存されているコア遺伝子のアラインメントに基づいて系統樹を構築できる。
pgap2 post singletree -i main_out -o post_tree_out -t 8
出力例
post_tree_out/

post_tree_out/postprocess_phylogeny/

post_tree_out/postprocess_phylogeny/06.core_alignment_tree/

5、 ポストステップ3。パンゲノムの頻度分布
pgap2 post profileを使うと、PAV行列を入力として、パンゲノムの頻度分布とrarefactionカーブを含むレポートを出力できる。mainのpgap2.partition.gene_content.pavファイルを指定する。また、PGAP2以外のツールで作成したPAV行列も利用できる。
pgap2 post profile --pav main_out/pgap2.partition.gene_content.pav -o post_profile_out/
ゲノムの増加に伴うパンゲノムサイズとコアゲノムサイズ、新規遺伝子クラスター数、core・shell・cloudの構成などを可視化する。
出力例
post_profile_out/

post_profile_out/pgap2.postprocess_profile.pdf

post_profile_out/pgap2.postprocess_stat_para.pdf

post_profile_out/postprocess_profile.html

他にも以下のポストプロセス向けコマンドが用意されている。パンゲノムグラフを作るコマンド、保存された近傍遺伝子の解析、Tajima's Dによる統計テストなどがある。
Postprocessing · bucongfan/PGAP2 Wiki · GitHub
#tajimas_d
#パンゲノム解析で特定された遺伝子の遺伝的多様性や進化の歴史を評価し、
#解析対象の菌株における遺伝子構成を形成する選択圧に関する知見を提供
pgap2 post tajimas_d -i main_out -o post_stat_out -t 8
#graph (CPU指定optionなし)
pgap2 post graph -i main_out/ -o post_stat_out
#neigh (軽い)
pgap2 post neigh -i main_out -o post_stat_out -t 8
#baps(Bayesian Analysis of Population Structure)ベイズ統計手法を適用し、
#遺伝的変異と階層的な集団構造の両方を考慮した上で、サンプルをクラスターに分類
pgap2 post baps -i main_out -o post_stat_out -t 8
- stat Statistical analysis
- profile To generate the pangenome profile using PAV matrix, it is the subset of [stat] module
- singletree Workflow for bayesian analysis of population structure
- baps Workflow for bayesian analysis of population structure
- tajimas_d Workflow for Tajima's D test
- graph Generate annotated pangenome graph with reference-based layout
- neigh Conserved gene neighborhood (synteny block) analysis on an existing partition output.
論文とWikiより
-
本著者らは2011年、数十株のゲノムを対象に、遺伝子の相同性に基づいて解析を行うワークフローPGAP(Pan-genome analysis pipeline)を公開した。その後、原核生物のゲノムデータが劇的に増加したことに伴い、パンゲノム解析への需要も高まっている。そこで今回、数千ものゲノムに対応可能な、改良型パンゲノム解析手法PGAP2を開発した。PGAP2は、包括的なワークフローと可視化ツールを備えており、ユーザーが入力した株の特性を効果的に解釈できるよう支援する。シミュレーションデータや厳選されたデータセットを用いた検証の結果、PGAP2はゲノムの多様性が高い状況下においても、他の手法と比べて一貫して高い安定性と堅牢性を示す。
- PGAP2は、GFF3、ゲノムFASTA、GBFF、およびアノテーションとゲノム配列を含むGFF3という4種類の入力データを受け入れる。異なる入力形式の混在を受け入れ、ファイル拡張子に基づいて入力形式を識別する。
- 特定の株が指定されていない場合、PGAP2は株間の遺伝子類似性に基づいて代表ゲノムを選択する。
-
(アルゴリズム要約)PGAP2が高速に動作する主な理由は、全遺伝子からオルソログ候補を総当たりで探索するのではなく、配列類似性と遺伝子配置の情報を利用して探索範囲を局所的に限定するためである(論文図1)。まず、Roaryなどと同様に、CD-HITまたはMMseqs2、DIAMOND、MCLを用いて遺伝子を大まかな相同グループへ事前に分割する。続いて、配列類似性を表すidentity networkと、ゲノム上の遺伝子隣接関係を表すsynteny networkを構築する。PGAP2独自のdual-level regional restriction strategyでは、この2種類のネットワークを利用し、配列同一性とシンテニーの一定範囲内に存在する候補のみを詳細に比較する。これにより、巨大なネットワーク全体を繰り返し探索することなく、比較的軽量なグラフ処理によってオルソログとパラログを識別する。ローカル領域内では、クラスター内の配列多様性、ネットワークの接続性、同一株由来の重複遺伝子に対するBBHを用いて、クラスターを統合するかどうかを判定する。このように、高速な事前クラスタリングと局所的な精密判定を組み合わせることで、遺伝子ファミリーごとの系統樹推定を行わずに、オルソログとパラログを比較的高精度かつ高速に分類する。論文では、2,794株のStreptococcus suisパンゲノムを28スレッドで約20分で解析したことが報告されている (32スレッドと28スレッドという記載がある。スペックが記載されていないが一般的なサーバーと思われる)。
-
オルソログ間identityとパラログ間identityを段階的に変えた16種類の模擬データセットを作成し、正解のクラスターと各ツールの出力をRoary, Panaroo, PanTa, PPanGGOLiN, PEPPANと比較して精度を検証している。評価指標には Adjusted Rand Index(ARI) が使われた。ARIは、二つのクラスタリング結果がどの程度一致するかを示す値で、1に近いほど正解に近いことを表す。16条件中14条件でPGAP2が最も高い値を示し、オルソログ間の類似性が低く、パラログとの区別が難しい条件でも安定していた。さらに実データでの評価も行っている。
コメント
安定に動き、パンゲノム解析のネックである計算速度を大幅に改善した非常に実用性の高いツールという印象を持ちました。試しに同属別種34株を用いてpgap2 mainコマンドの完了までに要する時間を測定したところ、Ryzen 9 9900Xの計算機の12コア指定でたった69秒で解析が完了しました。一方、同科に属する系統的多様性が高い110株を使って解析すると、同じ計算環境で約26分半かかりました。間違いなく超高速ではありますが、110株の解析は論文で報告されているほどの極端な速度ではありませんでした(注: piratesなどだと10時間~1日は要する)。
同科のコレクションで計算時間が伸びた原因として、まずデータセットの多様性が影響した可能性があります。論文のベンチマークでは同種のゲノムが使用されており、遺伝子配列と遺伝子配置の類似性が高いため、遺伝子がクラスターへ効率よく集約され、PGAP2の計算量が抑えられた可能性があります。これに対して、自分が使用した同科のゲノムコレクションは、複数属および多様な環境由来の株を含むデータセットです。遺伝子クラスター数やグラフ構造の多様性が高くなり、計算量が増加した可能性があります。もう一つの仮説として、ディスクI/Oの影響が考えられます。PGAP2は解析途中で多くの中間ファイルを読み書きしますが、今回はWSL上でベンチマークを実施したため、Linuxネイティブ環境よりもファイルI/Oが遅くなり、ゲノム数が増えてボトルネックがI/Oに移った可能性があります (検証が必要)。


(C)110株のpangenomic curveとcore gene curve。 (コマンド: pgap2 main -i GFF/ -o out -t 12 --sensitivity moderate)
引用
PGAP2: A comprehensive toolkit for prokaryotic pan-genome analysis based on fine-grained feature networks
Congfan Bu, Hao Zhang, Fengnian Zhang, Wenhao Liang, Hao Gao, Jing Zhao, Fangming Lv, Ruikun Xue, Qian Liu, Zhewen Zhang, Zhong Jin & Jingfa Xiao
Nature Communications volume 16, Article number: 9865 (2025)
関連