Skip to content

Commit c014c0c

Browse files
Added doc for simplot
1 parent f1393aa commit c014c0c

6 files changed

Lines changed: 162 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ You may go to the [doc](docs/index.md) for a more detailed documentation of the
106106
* distances: compute evolutionary distances for nucleotide alignment
107107
* entropy: compute entropy of alignment sites
108108
* pssm: compute position-specific scoring matrix
109+
* simplot: compute similarity plot data + image
109110
* concat: Concatenates several alignments by concatenating each sequences having the same name
110111
* consensus: Compute a basic majority consensus of an input alignment
111112
* dedup: Remove sequences that have the same sequence

docs/commands/compute.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ This command implements different computations:
3030
- `-n 3` : By column frequency compared to uniform frequency: same as -n 1, but divides by uniform frequency of the nt/aa (1/4 for nt, 1/20 for aa)
3131
- `-n 4` : Normalization "Logo".
3232
Option `-c` allows to add pseudo counts before normalization, and option `-l` log2 transforms the values.
33+
4. `goalign compute simplot`: See the [dedicated page](simplot.md). Compute a similarity plot between a query sequence and other sequences, using a sliding window.
3334

3435
#### Usage
3536

@@ -42,6 +43,7 @@ Available Commands:
4243
distance Compute distance matrix from an input alignment
4344
entropy Computes entropy of a given alignment
4445
pssm Computes and prints a Position specific scoring matrix
46+
[simplot](simplot.md)) Computes simplot data and image
4547
4648
Flags:
4749
-h, --help help for compute

docs/commands/compute_simplot.md

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# Goalign: toolkit and api for alignment manipulation
2+
3+
## Commands
4+
5+
### compute simplot
6+
This command takes as input:
7+
8+
1. A sequence alignment,
9+
2. A query sequences that we want to compare to others
10+
11+
It then computes evolutionary distances between the query sequence and all other sequences,
12+
for each region defined by sliding windows of size and step parameterizable.
13+
14+
Query sequence name is defined by the following parameter:
15+
16+
```
17+
-r, --refseq string Reference sequence to compare all others (default "-")
18+
```
19+
20+
Sliding windows are defined by the following parameters:
21+
22+
```
23+
-w, --window-size int Window size (default 100)
24+
-s, --window-step int Window step (default 100)
25+
```
26+
27+
By default, `goalign compute simplot` only outputs distance data in the stdout or output file, in a tabluted format, with the columns:
28+
29+
1. start (window start)
30+
2. end (window end)
31+
3. comp (compared sequence name)
32+
4. dist (computed distance between the query and the compared sequence on the current window)
33+
34+
But `goalign compute simplot` can also generate a figure, if the following parameters are given:
35+
36+
```
37+
--image string simplot image image output file (default "none")
38+
--image-height int simplot image output heigh (default 4)
39+
--image-width int simplot image image output width (default 4)
40+
```
41+
42+
The output image format will depend on the name of the file (its extension).
43+
44+
The evolutionary model to compute distances is specified using the following paramter:
45+
46+
```
47+
-m, --model string Model for distance computation (default "k2p")
48+
```
49+
50+
The model can take the following values:
51+
52+
- pdist : number of mutations divided by length
53+
- rawdist : raw distance (like pdist, without normalization by length)
54+
- jc : Juke-Cantor
55+
- k2p : Kimura 2 Parameters
56+
- f81 : Felsenstein 81
57+
- f84 : Felsenstein 84
58+
- tn93 : Tamura and Nei 1993
59+
60+
Finally, `goalign compute simplot` can group compared sequences into defined groups (e.g. clades, lineages, etc.). In this case, for each window, the distance is computed between the query sequences and each group of compared sequences, as the average distance between the query sequence and all members of each group. Groups are defined using sequence names (the information must be encoded into the sequence name). To do so, the following parameters must be given:
61+
62+
```
63+
--group If sequences must be grouped
64+
--sep string Separator for extracting group (if group is true) (default "_")
65+
--field int Field number for extracting group (if group is true)
66+
```
67+
68+
#### Usage
69+
```
70+
Usage:
71+
goalign compute simplot [flags]
72+
73+
Flags:
74+
--field int Field number for extracting group (if group is true)
75+
--group If sequences must be grouped
76+
--image string LTT plot image image output file (default "none")
77+
--image-height int LTT plot image output heigh (default 4)
78+
--image-width int LTT plot image image output width (default 4)
79+
-m, --model string Model for distance computation (default "k2p")
80+
-o, --output string Distance matrix output file (default "stdout")
81+
-r, --refseq string Reference sequence to compare all others (default "-")
82+
--sep string Separator for extracting group (if group is true) (default "_")
83+
-w, --window-size int Window size (default 100)
84+
-s, --window-step int Window step (default 100)
85+
86+
Global Flags:
87+
-i, --align string Alignment input file (default "stdin")
88+
--alphabet string Alignment/Sequences alphabet: auto (default), aa, or nt (default "auto")
89+
--auto-detect Auto detects input format (overrides -p, -x and -u)
90+
-u, --clustal Alignment is in clustal? default fasta
91+
--ignore-identical int Ignore duplicated sequences that have the same name and potentially have same sequences,
92+
0 : Does not ignore anything, 1: Ignore sequences having the same name (keep the first
93+
one whatever their sequence), 2: Ignore sequences having the same name and the same
94+
sequence
95+
--input-strict Strict phylip input format (only used with -p)
96+
-x, --nexus Alignment is in nexus? default fasta
97+
--no-block Write Phylip sequences without space separated blocks (only used with -p)
98+
--one-line Write Phylip sequences on 1 line (only used with -p)
99+
--output-strict Strict phylip output format (only used with -p)
100+
-p, --phylip Alignment is in phylip? default fasta
101+
-k, --stockholm Alignment is in stockholm? default fasta
102+
```
103+
104+
#### Examples
105+
106+
* Generating simplot for sars-cov-2 data from [Samson et. al](https://doi.org/10.1093/bioinformatics/btac287)
107+
108+
```
109+
wget https://raw.githubusercontent.com/Stephane-S/Simplot_PlusPlus/refs/heads/master/example_data/sars_cov_2_gene_s.fas
110+
cat > rename.txt << EOF
111+
BetaCoV/Wuhan/IVDC-HB-04/2020 BetaCoV/Wuhan/IVDC-HB-04/2020_SARS-CoV-2
112+
BetaCoV/Wuhan/WIV04/2019 BetaCoV/Wuhan/WIV04/2019_SARS-CoV-2
113+
BetaCoV/Wuhan-Hu-1/2019 BetaCoV/Wuhan-Hu-1/2019_SARS-CoV-2
114+
GX/P1E GX/P1E_Guangxi-Pangolin-CoV
115+
GX/P2V GX/P2V_Guangxi-Pangolin-CoV
116+
GX/P3B GX/P3B_Guangxi-Pangolin-CoV
117+
GX/P4L GX/P4L_Guangxi-Pangolin-CoV
118+
GX/P5E GX/P5E_Guangxi-Pangolin-CoV
119+
GX/P5L GX/P5L_Guangxi-Pangolin-CoV
120+
bat-SL-CoVZC45 bat-SL-CoVZC45_BatCoVZ
121+
bat-SL-CoVZXC21 bat-SL-CoVZXC21_BatCoVZ
122+
BtCoV/BM48-31/BGR/2008 BtCoV/BM48-31/BGR/2008_BatCoV-Kenya
123+
BtKY72 BtKY72_BatCoV-Kenya
124+
Rs3367 Rs3367_BatSLCoVBTRS
125+
BtCoV/273/2005 BatCoV/273/2005_BatSLCoVBTRS
126+
BtCoV/279/2005 BatCoV/279/2005_BatSLCoVBTRS
127+
HKU3-13 HKU3-13_BatSLCoVHKU
128+
HKU3-6 HKU3-6_BatSLCoVHKU
129+
Rf1 Rf1_BatSLCoVHKU
130+
GD/P1L GD/P1L_GuangdongPangolinCoV
131+
GD/P2S GD/P2S_GuangdongPangolinCoV
132+
PC4_13 PC4-13_SARSCoV
133+
Tor2 Tor2_SARSCoV
134+
BetaCoV/bat/Yunnan/RaTG13/2013 BetaCoV/bat/Yunnan/RaTG13/2013_BatCoVRatG13
135+
EOF
136+
```
137+
138+
**Simplot with individual sequences**:
139+
140+
```
141+
goalign compute simplot -i sars_cov_2_gene_s.fas \
142+
--refseq BetaCoV/Wuhan-Hu-1/2019 \
143+
-w 200 -s 20 --image simplot_sars_cov_2_gene_s.png --image-height 10 --image-width 30
144+
```
145+
146+
![Simplot individual sequences](simplot_sars_cov_2_gene_s.png)
147+
148+
149+
**Simplot with groups**:
150+
151+
```
152+
goalign compute simplot -i sars_cov_2_gene_s_rename.fas \
153+
--refseq BetaCoV/Wuhan-Hu-1/2019_SARS-CoV-2 \
154+
-w 200 -s 20 --image simplot_sars_cov_2_gene_s_group.png --image-height 10 --image-width 30 \
155+
--group --field 1 --sep '_'
156+
```
157+
158+
![Simplot by groups](simplot_sars_cov_2_gene_s_group.png)
671 KB
Loading
452 KB
Loading

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Command | Subcommand |
7070
-- | distance | Computes distance matrix from inpu alignment
7171
-- | entropy | Computes entropy of sites of a given alignment
7272
-- | pssm | Computes and prints a Position specific scoring matrix
73+
-- | [simplot](commands/compute_simplot.md) | Computes similarity plot data + image
7374
[concat](commands/concat.md) ([api](api/concat.md)) | | Concatenates a set of alignment
7475
[consensus](commands/consensus.md) ([api](api/consensus.md))| | Computes a basic majority consensus sequence
7576
[extract](commands/extract.md) | | Extracts sub-sequences from an input alignment

0 commit comments

Comments
 (0)