3
|
1 prot_finder
|
|
2 ===========
|
|
3
|
|
4 `prot_finder.pl` is a script to search for query protein homologs in annotated bacterial genomes with **BLASTP**. A companion bash shell script pipeline is available, `prot_finder_pipe.sh`.
|
|
5
|
|
6 Included is also the script `prot_binary_matrix.pl` to create a binary presence/absence matrix (e.g. for [**iTOL**](http://itol.embl.de/)) from the `prot_finder.pl` output. Additionally, two downstream scripts are provided to wrangle these binary presence/absence matrix: `transpose_matrix.pl` to transpose a delimited TEXT matrix and `binary_group_stats.pl` to get overall presence/absence statistics for groups of columns in a delimited binary TEXT matrix (in the style of [`po2group_stats.pl`](/po2group_stats)).
|
|
7
|
|
8 * [Synopsis](#synopsis)
|
|
9 * [prot_finder synopsis](#prot_finder-synopsis)
|
|
10 * [prot_binary_matrix synopsis](#prot_binary_matrix-synopsis)
|
|
11 * [transpose_matrix synopsis](#transpose_matrix-synopsis)
|
|
12 * [binary_group_stats synopsis](#binary_group_stats-synopsis)
|
|
13 * [Description](#description)
|
|
14 * [Usage](#usage)
|
|
15 * [prot_finder usage](#prot_finder-usage)
|
|
16 * [Manual consecutively](#manual-consecutively)
|
|
17 * [cds_extractor for subject proteins](#cds_extractor-for-subject-proteins)
|
|
18 * [Legacy BLASTP](#legacy-blastp)
|
|
19 * [BLASTP plus](#blastp-plus)
|
|
20 * [prot_finder](#prot_finder-1)
|
|
21 * [prot_finder_pipe bash script pipeline](#prot_finder_pipe-bash-script-pipeline)
|
|
22 * [prot_binary_matrix usage](#prot_binary_matrix-usage)
|
|
23 * [transpose_matrix usage](#transpose_matrix-usage)
|
|
24 * [binary_group_stats usage](#binary_group_stats-usage)
|
|
25 * [Options](#options)
|
|
26 * [prot_finder.pl options](#prot_finderpl-options)
|
|
27 * [Mandatory prot_finder.pl options](#mandatory-prot_finderpl-options)
|
|
28 * [Optional prot_finder.pl options](#optional-prot_finderpl-options)
|
|
29 * [prot_finder_pipe.sh options](#prot_finder_pipesh-options)
|
|
30 * [Mandatory prot_finder_pipe.sh options](#mandatory-prot_finder_pipesh-options)
|
|
31 * [Optional prot_finder_pipe.sh options](#optional-prot_finder_pipesh-options)
|
|
32 * [prot_binary_matrix.pl options](#prot_binary_matrixpl-options)
|
|
33 * [transpose_matrix.pl options](#transpose_matrixpl-options)
|
|
34 * [binary_group_stats.pl options](#binary_group_statspl-options)
|
|
35 * [Mandatory binary_group_stats.pl options](#mandatory-binary_group_statspl-options)
|
|
36 * [Optional binary_group_stats.pl options](#optional-binary_group_statspl-options)
|
|
37 * [Output](#output)
|
|
38 * [cds_extractor.pl output](#cds_extractorpl-output)
|
|
39 * [prot_finder.pl output](#prot_finderpl-output)
|
|
40 * [prot_finder_pipe.sh output](#prot_finder_pipesh-output)
|
|
41 * [prot_binary_matrix.pl output](#prot_binary_matrixpl-output)
|
|
42 * [transpose_matrix.pl output](#transpose_matrixpl-output)
|
|
43 * [binary_group_stats.pl output](#binary_group_statspl-output)
|
|
44 * [Dependencies](#dependencies)
|
|
45 * [`prot_finder.pl`/`prot_finder_pipe.sh` dependencies](#prot_finderplprot_finder_pipesh-dependencies)
|
|
46 * [`binary_group_stats.pl` dependencies](#binary_group_statspl-dependencies)
|
|
47 * [Run environment](#run-environment)
|
|
48 * [Author - contact](#author---contact)
|
|
49 * [Citation, installation, and license](#citation-installation-and-license)
|
|
50 * [Acknowledgements](#acknowledgements)
|
|
51 * [Changelog](#changelog)
|
|
52 * [prot_finder changelog](#prot_finder-changelog)
|
|
53 * [prot_binary_matrix changelog](#prot_binary_matrix-changelog)
|
|
54 * [transpose_matrix changelog](#transpose_matrix-changelog)
|
|
55 * [binary_group_stats changelog](#binary_group_stats-changelog)
|
|
56
|
|
57 ## Synopsis
|
|
58
|
|
59 ### prot_finder synopsis
|
|
60
|
|
61 ./prot_finder_pipe.sh -q query.faa (-s subject.faa|-f (embl|gbk)) > blast_hits.tsv
|
|
62
|
|
63 **or**
|
|
64
|
|
65 perl prot_finder.pl -r report.blastp -s subject.faa > blast_hits.tsv
|
|
66
|
|
67 ### prot_binary_matrix synopsis
|
|
68
|
|
69 perl prot_binary_matrix.pl blast_hits.tsv > binary_matrix.tsv
|
|
70
|
|
71 **or**
|
|
72
|
|
73 perl prot_finder.pl -r report.blastp -s subject.faa | perl prot_binary_matrix.pl > binary_matrix.tsv
|
|
74
|
|
75 ### transpose_matrix synopsis
|
|
76
|
|
77 perl transpose_matrix.pl input_matrix.tsv > input_matrix_transposed.tsv
|
|
78
|
|
79 **or**
|
|
80
|
|
81 perl prot_binary_matrix.pl blast_hits.tsv | perl transpose_matrix.pl > binary_matrix_transposed.tsv
|
|
82
|
|
83 ### binary_group_stats synopsis
|
|
84
|
|
85 perl binary_group_stats.pl -i binary_matrix.tsv -g group_file.tsv -p > overall_stats.tsv
|
|
86
|
|
87 ## Description
|
|
88
|
|
89 The script `prot_finder.pl` is intended to search for homologous proteins in annotated bacterial genomes. For this purpose, a previous [**BLASTP**](http://blast.ncbi.nlm.nih.gov/Blast.cgi), either [legacy or plus](https://blast.ncbi.nlm.nih.gov/Blast.cgi?PAGE_TYPE=BlastDocs&DOC_TYPE=Download), needs to be run with query protein sequences against a **BLASTP** database of subject proteins (e.g. all proteins from several *Escherichia coli* genomes).
|
|
90
|
|
91 The script [`cds_extractor.pl`](/cds_extractor) (with options **-p -f**) can be used to create multi-FASTA protein files of all non-pseudo CDS from RichSeq genome files to create the needed subject **BLASTP** database. Present locus tags will be used as FASTA IDs, but see [`cds_extractor.pl`](/cds_extractor) for a description of the format. Query protein sequences for the **BLASTP** need a **unique** FASTA ID.
|
|
92
|
|
93 The **BLASTP** report file (option **-r**), the subject protein multi-FASTA file (option **-s**), and optionally the query protein (multi-)FASTA (option **-q**) file are then given to `prot_finder.pl`. Significant **BLASTP** subject hits are filtered according to the given cutoffs (options **-i**, **-cov_q**, and **-cov_s**) and the result is printed as an informative tab-separated result table to *STDOUT*. To apply global identity/coverage cutoffs to subject hits high-scoring pairs (HSPs) are tiled (see http://www.bioperl.org/wiki/HOWTO:Tiling and http://search.cpan.org/dist/BioPerl/Bio/Search/Hit/GenericHit.pm). Additionally, the subject protein sequences with significant query hits are written to result multi-FASTA files, named according to the respective query FASTA IDs (optionally including the query sequence with option **-q**).
|
|
94
|
|
95 Optionally, [**Clustal Omega**](http://www.clustal.org/omega/) can be called (option **-a** with optional **-p**) to create multiple alignments (FASTA format) for each of the resulting multi-FASTA files. These alignments can be used to calculate phylogenies e.g. with **RAxML** (http://sco.h-its.org/exelixis/software.html) or **MEGA** (http://www.megasoftware.net/).
|
|
96
|
|
97 Run the script [`cds_extractor.pl`](/cds_extractor) (with options **-p -f**) and the **BLASTP** manually or use the bash shell wrapper script `prot_finder_pipe.sh` (see below ['prot_finder_pipe bash script pipeline'](#prot_finder_pipe-bash-script-pipeline)) to execute the whole pipeline including `prot_finder.pl` (with optional option **-q**). For additional options of the pipeline shell script see below ['prot_finder_pipe.sh options'](#prot_finder_pipesh-options). Be aware that some options in `prot_finder_pipe.sh` corresponding to options in `prot_finder.pl` have different names (**-c** instead of **-cov_q**, **-k** instead of **-cov_s**, and **-o** instead of **-p**; also **-f** has a different meaning). If [`cds_extractor.pl`](/cds_extractor) is used in the pipeline (option **-f** of the shell script) the working folder has to contain the annotated bacterial genome subject files (in RichSeq format, e.g. EMBL or GENBANK format). Also, the Perl scripts [`cds_extractor.pl`](/cds_extractor) (only for `prot_finder_pipe.sh` option **-f**) and `prot_finder.pl`have to be either contained in the current working directory or installed in the global *PATH*. **BLASTP** (legacy and/or plus) and **Clustal Omega** binaries have to be installed in global *PATH*, or for **Clustal Omega** you can give the path to the binary with option **-o**. In the pipeline **BLASTP** is run with **disabled** query filtering, locally optimal Smith-Waterman alignments, and increasing the number of database sequences to show alignments to 500 for [**BioPerl**](http://www.bioperl.org) parsing (legacy: **-F F -s T -b 500**, plus: **-seg no -use_sw_tback -num_alignments 500**). The pipeline script ends with the *STDERR* message 'Pipeline finished!', if this is not the case have a look at the log files in the result directory for errors.
|
|
98
|
|
99 The resulting tab-separated table with significant **BLASTP** hits (from `prot_finder.pl` or `prot_finder_pipe.sh`) can be given to the script `prot_binary_matrix.pl`, either as *STDIN* or as a file, to create a presence/absence matrix of the results. See below ['prot_binary_matrix.pl options'](#prot_binary_matrixpl-options) for the `prot_binary_matrix.pl` options. By default a tab-delimited binary presence/absence matrix for query hits per subject organism will be printed to *STDOUT*. Use option **-t** to count all query hits per subject organism, not just the binary presence/absence. This presence/absence matrix can be given to the script `transpose_matrix.pl`, either as *STDIN* or as a file, to transpose the matrix, i.e. rows will become columns and columns rows. Actually, `transpose_matrix.pl` can be used to transpose any delimited TEXT matrix (see below ['transpose_matrix.pl options'](#transpose_matrixpl-options)).
|
|
100
|
|
101 The presence/absence matri(x|ces) can e.g. be loaded into the Interactive Tree Of Life website ([**iTOL**](http://itol.embl.de/)) to associate the data with a phylogenetic tree. [**iTOL**](http://itol.embl.de/) likes individual comma-separated input files, thus use `prot_binary_matrix.pl` options **-s -c** for this purpose. However, the organism names have to have identical names to the leaves of the phylogenetic tree, thus manual adaptation, e.g. in a spreadsheet software (like [**LibreOffice Calc**](https://www.libreoffice.org/discover/calc/)), might be needed. **Careful**, subject organisms without a significant **BLASTP** hit won't be included in the `prot_finder.pl` result table and hence can't be included by `prot_binary_matrix.pl`. If needed add them manually to the result matri(x|ces).
|
|
102
|
|
103 At last, script `binary_group_stats.pl` can be used to categorize columns of the binary presence/absence matrix from `prot_binary_matrix.pl` according to group affiliations. `binary_group_stats.pl` is based upon [`po2group_stats.pl`](/po2group_stats), which does the same thing for genomes in an ortholog/paralog output matrix from a [Proteinortho5](http://www.bioinf.uni-leipzig.de/Software/proteinortho/) calculation. Actually, `binary_group_stats.pl` can work with any delimited TEXT **binary** matrix (option **-i**). But, all fields of the binary matrix need to be filled with either a **0** indicating absence or a **1** indicating presence, i.e. all rows need to have the same number of columns. Use option **-d** to set the delimiter of the input matrix, default is set to tab-delimited/separated matrices.
|
|
104
|
|
105 Also, column headers in the first row and row headers in the first column are **mandatory** for the input binary matrix. Only alphanumeric (a-z, A-Z, 0-9), underscore (_), dash (-), and period (.) characters are allowed for the **column headers** and **group names** in the group file (option **-g**) to avoid downstream problems with the operating/file system. As a consequence, also no whitespaces are allowed in these! Additionally, **column headers**, **row headers**, and **group names** need to be **unique**.
|
|
106
|
|
107 The group affiliations of the columns are intended to get overall presence/absence statistics for groups of columns and not simply single columns of the matrix. Percentage inclusion (option **-cut_i**) and exclusion (option **-cut_e**) cutoffs can be set to define how strict the presence/absence of column groups within a row are defined. Of course groups can also hold only single column headers to get single column statistics. Group affiliations are defined in a mandatory **tab-delimited** group input file (option **-g**), including the column headers from the input binary matrix, with **minimal two** and **maximal four** groups.
|
|
108
|
|
109 See the *README.md* of [`po2group_stats.pl`](/po2group_stats) for an explanation of the logic behind the categorization and the resulting group binary matrix and venn diagram of `binary_group_stats.pl` (and of course its [options](#binary_group_statspl-options) and [output](#binary_group_statspl-output)).
|
|
110
|
|
111 ## Usage
|
|
112
|
|
113 ### prot_finder usage
|
|
114
|
|
115 #### Manual consecutively
|
|
116
|
|
117 ##### cds_extractor for subject proteins
|
|
118
|
|
119 for file in *.(gbk|embl); do perl cds_extractor.pl -i "$file" -p -f; done
|
|
120 cat *.faa > subject.faa
|
|
121 rm !(subject).faa
|
|
122
|
|
123 ##### Legacy **BLASTP**
|
|
124
|
|
125 formatdb -p T -i subject.faa -n prot_finder_db
|
|
126 blastall -p blastp -d prot_finder_db -i query.faa -o prot_finder.blastp -e 1e-10 -F F -s T -b 500
|
|
127
|
|
128 **or**
|
|
129
|
|
130 ##### **BLASTP** plus
|
|
131
|
|
132 makeblastdb -dbtype prot -in subject.faa -out prot_finder_db
|
|
133 blastp -db prot_finder_db -query query.faa -out prot_finder.blastp -evalue 1e-10 -seg no -use_sw_tback -num_alignments 500
|
|
134
|
|
135 ##### prot_finder
|
|
136
|
|
137 perl prot_finder.pl -r prot_finder.blastp -s subject.faa -cov_s 80 > blast_hits.tsv
|
|
138
|
|
139 **or**
|
|
140
|
|
141 perl prot_finder.pl -r prot_finder.blastp -s subject.faa -d result_dir -f -q query.faa -i 50 -cov_q 50 -b -a -p ~/bin/clustalo -t 6 > result_dir/blast_hits.tsv
|
|
142
|
|
143 #### prot_finder_pipe bash script pipeline
|
|
144
|
|
145 ./prot_finder_pipe.sh -q query.faa -s subject.faa > blast_hits.tsv
|
|
146
|
|
147 **or**
|
|
148
|
|
149 ./prot_finder_pipe.sh -q query.faa -f embl -d result_dir -p legacy -e 0 -t 12 -i 50 -c 50 -k 30 -b -a -o ~/bin/clustalo -m > result_dir/blast_hits.tsv
|
|
150
|
|
151 ### prot_binary_matrix usage
|
|
152
|
|
153 perl prot_binary_matrix.pl -s -d result_dir -t blast_hits.tsv
|
|
154
|
|
155 **or**
|
|
156
|
|
157 perl prot_finder.pl -r report.blastp -s subject.faa | perl prot_binary_matrix.pl -l -c > binary_matrix.csv
|
|
158
|
|
159 **or**
|
|
160
|
|
161 mkdir result_dir && ./prot_finder_pipe.sh -q query.faa -s subject.faa -d result_dir -m | tee result_dir/blast_hits.tsv | perl prot_binary_matrix.pl > binary_matrix.tsv
|
|
162
|
|
163 ### transpose_matrix usage
|
|
164
|
|
165 perl transpose_matrix.pl -d ' ' -e NA input_matrix_space-delimit.txt > input_matrix_space-delimit_transposed.txt
|
|
166
|
|
167 **or**
|
|
168
|
|
169 perl prot_finder.pl -r report.blastp -s subject.faa | perl prot_binary_matrix.pl -l -c | perl transpose_matrix.pl -d , > binary_matrix_transposed.csv
|
|
170
|
|
171 **or**
|
|
172
|
|
173 mkdir result_dir && ./prot_finder_pipe.sh -q query.faa -s subject.faa -d result_dir -m | tee result_dir/blast_hits.tsv | perl prot_binary_matrix.pl | tee result_dir/binary_matrix.tsv | perl transpose_matrix.pl > result_dir/binary_matrix_transposed.tsv
|
|
174
|
|
175 Transpose all matrices in a folder:
|
|
176
|
|
177 for matrix in *.tsv; do perl transpose_matrix.pl "$matrix" > "${matrix%.*}_transposed.tsv"; done
|
|
178
|
|
179 ### binary_group_stats usage
|
|
180
|
|
181 perl binary_group_stats.pl -i binary_matrix_transposed.csv -g group_file.tsv -d , -r result_dir -cut_i 0.7 -cut_e 0.2 -b -p -co -s -u -a > overall_stats.tsv
|
|
182
|
|
183 ## Options
|
|
184
|
|
185 ### `prot_finder.pl` options
|
|
186
|
|
187 #### Mandatory `prot_finder.pl` options
|
|
188
|
|
189 - **-r**=_str_, **-report**=_str_
|
|
190
|
|
191 Path to **BLASTP** report/output
|
|
192
|
|
193 - **-s**=_str_, **-subject**=_str_
|
|
194
|
|
195 Path to subject multi-FASTA protein sequence file (\*.faa) created with [`cds_extractor.pl`](/cds_extractor) (and its options **-p -f**), which was used to create the **BLASTP** database
|
|
196
|
|
197 #### Optional `prot_finder.pl` options
|
|
198
|
|
199 - **-h**, **-help**
|
|
200
|
|
201 Help (perldoc POD)
|
|
202
|
|
203 - **-d**=_str_, **-dir_result**=_str_
|
|
204
|
|
205 Path to result folder [default = query identity and coverage cutoffs, './results_i#_cq#']
|
|
206
|
|
207 - **-f**, **-force_dir**
|
|
208
|
|
209 Force output to an existing result folder, otherwise ask user to remove content of existing folder. Careful, files from a previous analysis might not be overwritten if different to current analysis.
|
|
210
|
|
211 - **-q**=_str_, **-query**=_str_
|
|
212
|
|
213 Path to query (multi-)FASTA protein sequence file (\*.faa) with **unique** FASTA IDs, which was used as query in the **BLASTP**. Will include each query protein sequence in the respective multi-FASTA 'query-ID_hits.faa' result file.
|
|
214
|
|
215 - **-b**, **-best_hit**
|
|
216
|
|
217 Give only the best hit (i.e. highest identity) for each subject sequence if a subject has several hits with different queries
|
|
218
|
|
219 - **-i**=_int_, **-ident_cutoff**=_int_
|
|
220
|
|
221 Query identity cutoff for significant hits (not including gaps), has to be an integer number >= 0 and <= 100 [default = 70]
|
|
222
|
|
223 - **-cov_q**=_int_, **-cov_query_cutoff**=_int_
|
|
224
|
|
225 Query coverage cutoff, has to be an integer number >= 0 and <= 100 [default = 70]
|
|
226
|
|
227 - **-cov_s**=_int_, **-cov_subject_cutoff**=_int_
|
|
228
|
|
229 Subject/hit coverage cutoff, has to be an integer >= 0 and <= 100 [default = 0]
|
|
230
|
|
231 - **-a**, **-align_clustalo**
|
|
232
|
|
233 Call [**Clustal Omega**](http://www.clustal.org/omega/) for multiple alignment of each 'query-ID_hits.faa' result file
|
|
234
|
|
235 - **-p**=_str_, **-path_clustalo**=_str_
|
|
236
|
|
237 Path to executable **Clustal Omega** binary if not present in global *PATH* variable; requires option **-a**
|
|
238
|
|
239 - **-t**=_int_, **-threads_clustalo**=_int_
|
|
240
|
|
241 Number of threads for **Clustal Omega** to use; requires option **-a** [default = all processors on system]
|
|
242
|
|
243 - **-v**, **-version**
|
|
244
|
|
245 Print version number to *STDERR*
|
|
246
|
|
247 ### `prot_finder_pipe.sh` options
|
|
248
|
|
249 #### Mandatory `prot_finder_pipe.sh` options
|
|
250
|
|
251 - **-q**=_str_
|
|
252
|
|
253 Path to query protein (multi-)FASTA file (\*.faa) with **unique** FASTA IDs
|
|
254
|
|
255 - **-f**=_str_
|
|
256
|
|
257 File extension for files in the **current** working directory to use for [`cds_extractor.pl`](/cds_extractor) (e.g. 'embl' or 'gbk'); excludes shell script option **-s**
|
|
258
|
|
259 **or**
|
|
260
|
|
261 - **-s**=_str_
|
|
262
|
|
263 Path to subject protein multi-FASTA file (\*.faa) already created with [`cds_extractor.pl`](/cds_extractor) (and its options **-p -f**), will not run [`cds_extractor.pl`](/cds_extractor); excludes shell script option **-f**
|
|
264
|
|
265 #### Optional `prot_finder_pipe.sh` options
|
|
266
|
|
267 - **-h**
|
|
268
|
|
269 Print usage
|
|
270
|
|
271 - **-d**=_str_
|
|
272
|
|
273 Path to result folder [default = query identity and coverage cutoffs,'./results_i#_cq#']
|
|
274
|
|
275 - **-p**=(legacy|plus)
|
|
276
|
|
277 **BLASTP** suite to use [default = plus]
|
|
278
|
|
279 - **-e**=_real_
|
|
280
|
|
281 E-value for **BLASTP** [default = 1e-10]
|
|
282
|
|
283 - **-t**=_int_
|
|
284
|
|
285 Number of threads to be used for **BLASTP** and **Clustal Omega** [default = all processors on system]
|
|
286
|
|
287 - **-i**=_int_
|
|
288
|
|
289 Query identity cutoff for significant hits [default = 70]
|
|
290
|
|
291 - **-c**=_int_
|
|
292
|
|
293 Query coverage cutoff (corresponds to [`prot_finder.pl` option](#optional-prot_finderpl-options) **-cov_q**) [default = 70]
|
|
294
|
|
295 - **-k**=_int_
|
|
296
|
|
297 Subject coverage cutoff (corresponds to [`prot_finder.pl` option](#optional-prot_finderpl-options) **-cov_s**) [default = 0]
|
|
298
|
|
299 - **-b**
|
|
300
|
|
301 Give only the best hit (i.e. highest identity) for each subject sequence
|
|
302
|
|
303 - **-a**
|
|
304
|
|
305 Multiple alignment of each multi-FASTA result file with [**Clustal Omega**](http://www.clustal.org/omega/)
|
|
306
|
|
307 - **-o**=_str_
|
|
308
|
|
309 Path to executable **Clustal Omega** binary if not in global *PATH*; requires shell script option **-a** (corresponds to [`prot_finder.pl` option](#optional-prot_finderpl-options) **-p**)
|
|
310
|
|
311 - **-m**
|
|
312
|
|
313 Clean up all non-essential files, see below ['`prot_finder_pipe.sh` output'](#prot_finder_pipesh-output)
|
|
314
|
|
315 ### `prot_binary_matrix.pl` options
|
|
316
|
|
317 - **-h**, **-help**
|
|
318
|
|
319 Help (perldoc POD)
|
|
320
|
|
321 - **-s**, **-separate**
|
|
322
|
|
323 Separate presence/absence files for each query protein printed to the result directory [default without **-s** = *STDOUT* matrix for all query proteins combined]
|
|
324
|
|
325 - **-d**=_str_, **-dir_result**=_str_
|
|
326
|
|
327 Path to result folder, requires option **-s** [default = './binary_matrix_results']
|
|
328
|
|
329 - **-t**, **-total**
|
|
330
|
|
331 Count total occurrences of query proteins, not just presence/absence binary
|
|
332
|
|
333 - **-c**, **-csv**
|
|
334
|
|
335 Output matri(x|ces) in comma-separated format (\*.csv) instead of tab-delimited format (\*.tsv)
|
|
336
|
|
337 - **-l**, **-locus_tag**
|
|
338
|
|
339 Use the locus_tag **prefixes** in the subject_ID column of the `prot_finder.pl` output (instead of the subject_organism column) as organism IDs to associate query hits to organisms. The subject_ID column will include locus_tags if they're annotated for a genome (see the [`cds_extractor.pl`](/cds_extractor) format description). Useful if the [`cds_extractor.pl`](/cds_extractor) output doesn't include strain names for 'o=' in the FASTA IDs, because the prefix of a locus_tag should be unique for a genome (see http://www.ncbi.nlm.nih.gov/genbank/genomesubmit_annotation).
|
|
340
|
|
341 - **-v**, **-version**
|
|
342
|
|
343 Print version number to *STDERR*
|
|
344
|
|
345 ### `transpose_matrix.pl` options
|
|
346
|
|
347 - **-h**, **-help**
|
|
348
|
|
349 Help (perldoc POD)
|
|
350
|
|
351 - **-d**=_str_, **-delimiter**=_str_
|
|
352
|
|
353 Set delimiter of input and output matrix (e.g. comma ',', single space ' ' etc.) [default = tab-delimited/separated]
|
|
354
|
|
355 - **-e**=_str_, **-empty**=_str_
|
|
356
|
|
357 Fill empty cells of the input matrix with a value in the transposed matrix (e.g. 'NA', '0' etc.)
|
|
358
|
|
359 - **-v**, **-version**
|
|
360
|
|
361 Print version number to *STDERR*
|
|
362
|
|
363 ### `binary_group_stats.pl` options
|
|
364
|
|
365 #### Mandatory `binary_group_stats.pl` options
|
|
366
|
|
367 - **-i**=*str*, **-input**=*str*
|
|
368
|
|
369 Input delimited TEXT binary matrix (e.g. *.tsv, *.csv, or *.txt), see option **-d**
|
|
370
|
|
371 - **-g**=*str*, **-groups_file**=*str*
|
|
372
|
|
373 Tab-delimited file with group affiliation for the columns from the input binary matrix with **minimal two** and **maximal four** groups (easiest to create in a spreadsheet software and save in tab-separated format). **All** column headers from the input binary matrix need to be included. Column headers and group names can only include alphanumeric (a-z, A-Z, 0-9), underscore (_), dash (-), and period (.) characters (no whitespaces allowed either). Example format with two column headers in group A, three in group B and D, and one in group C:
|
|
374
|
|
375 group\_A group\_B group\_C group\_D<br>
|
|
376 column\_header1 column\_header9 column\_header3 column\_header8<br>
|
|
377 column\_header7 column\_header6  column\_header5<br>
|
|
378  column\_header4  column\_header2
|
|
379
|
|
380 #### Optional `binary_group_stats.pl` options
|
|
381
|
|
382 - **-h**, **-help**
|
|
383
|
|
384 Help (perldoc POD)
|
|
385
|
|
386 - **-d**=*str*, **-delimiter**=*str*
|
|
387
|
|
388 Set delimiter of input binary matrix (e.g. comma ',', single space ' ' etc.) [default = tab-delimited/separated]
|
|
389
|
|
390 - **-r**=*str*, **-result\_dir**=*str*
|
|
391
|
|
392 Path to result folder \[default = inclusion and exclusion percentage cutoff, './results\_i#\_e#'\]
|
|
393
|
|
394 - **-cut\_i**=*float*, **-cut\_inclusion**=*float*
|
|
395
|
|
396 Percentage inclusion cutoff for column presence counts in a group per row, has to be > 0 and <= 1. Cutoff will be rounded according to the column header number in each group and has to be > the rounded exclusion cutoff in this group. \[default = 0.9\]
|
|
397
|
|
398 - **-cut\_e**=*float*, **-cut\_exclusion**=*float*
|
|
399
|
|
400 Percentage exclusion cutoff, has to be >= 0 and < 1. Rounded cutoff has to be < rounded inclusion cutoff. \[default = 0.1\]
|
|
401
|
|
402 - **-b**, **-binary\_group\_matrix**
|
|
403
|
|
404 Print a group binary matrix with the presence/absence column group results according to the cutoffs (excluding 'unspecific' category rows)
|
|
405
|
|
406 - **-p**, **-plot\_venn**
|
|
407
|
|
408 Plot venn diagram from the group binary matrix (except 'unspecific' and 'underrepresented' categories) with function `venn` from **R** package **gplots**, requires option **-b**
|
|
409
|
|
410 - **-co**, **-core_strict**
|
|
411
|
|
412 Include 'strict core' category in output for rows where **all** columns have a '1'
|
|
413
|
|
414 - **-s**, **-singletons**
|
|
415
|
|
416 Include singleton/column-specific rows for each column header in the output, activates also overall column header presence ('1') counts in final stats matrix for columns with singletons
|
|
417
|
|
418 - **-u**, **-unspecific**
|
|
419
|
|
420 Include 'unspecific' category in output
|
|
421
|
|
422 - **-a**, **-all\_column\_presence\_overall**
|
|
423
|
|
424 Report overall presence counts for all column headers (appended to the final stats matrix), also those without singletons; will include all overall column header presence counts without option **-s**
|
|
425
|
|
426 - **-v**, **-version**
|
|
427
|
|
428 Print version number to *STDERR*
|
|
429
|
|
430 ## Output
|
|
431
|
|
432 ### `cds_extractor.pl` output
|
|
433
|
|
434 - \*.faa
|
|
435
|
|
436 Multi-FASTA file(s) of subject CDS protein sequences; will be removed with [`prot_finder_pipe.sh` option](#optional-prot_finder_pipesh-options) **-m**
|
|
437
|
|
438 For optional error files from [`cds_extractor.pl`](/cds_extractor) see its documentation.
|
|
439
|
|
440 ### `prot_finder.pl` output
|
|
441
|
|
442 - *STDOUT*
|
|
443
|
|
444 The resulting tab-delimited output table with the significant subject **BLASTP** hits is printed to *STDOUT*. Redirect (e.g. to a file in the result directory, options **-d -f**) or pipe into another tool as needed (e.g. `prot_binary_matrix.pl`).
|
|
445
|
|
446 - ./results_i#_cq#
|
|
447
|
|
448 All output files are stored in a result folder
|
|
449
|
|
450 - ./results_i#_cq#/query-ID_hits.faa
|
|
451
|
|
452 Multi-FASTA protein files of significant subject hits for each query protein (named after the respective query FASTA ID), optionally includes the respective query protein sequence (with option **-q**)
|
|
453
|
|
454 - subject.faa.idx
|
|
455
|
|
456 Index file of the subject protein file for fast sequence retrieval (can be deleted if no further **BLASTPs** are needed with these subject sequences); will be removed with [`prot_finder_pipe.sh` option](#optional-prot_finder_pipesh-options) **-m**
|
|
457
|
|
458 - (./results_i#_cq#/queries_no_blastp-hits.txt)
|
|
459
|
|
460 Lists all query sequence IDs without significant subject hits; with option **-b** includes also queries with significant hits but *without* a best blast hit for a subject
|
|
461
|
|
462 - (./results_i#_cq#/clustal_omega.log)
|
|
463
|
|
464 Optional log file of verbose **Clustal Omega** *STDOUT*/*STDERR* messages; will be removed with [`prot_finder_pipe.sh` option](#optional-prot_finder_pipesh-options) **-m**
|
|
465
|
|
466 - (./results_i#_cq#/query-ID_aln.fasta)
|
|
467
|
|
468 Optional **Clustal Omega** multiple alignment of each 'query-ID_hits.faa' result file in FASTA alignment format
|
|
469
|
|
470 - (./results_i#_cq#/query-ID_tree.nwk)
|
|
471
|
|
472 Optional, **Clustal Omega** NJ-guide tree in Newick format
|
|
473
|
|
474 ### `prot_finder_pipe.sh` output
|
|
475
|
|
476 In addition to the [`cds_extractor.pl` output](#cds_extractorpl-output) and the [`prot_finder.pl` output](#prot_finderpl-output) the pipeline also creates the following non-essential output files, which will be removed with [`prot_finder_pipe.sh` option](#optional-prot_finder_pipesh-options) **-m**:
|
|
477
|
|
478 - ./results_i#_cq#/cds_extractor.log
|
|
479
|
|
480 Log file of [`cds_extractor.pl`](/cds_extractor) *STDOUT*/*STDERR* messages (with `prot_finder_pipe.sh` option **-f**)
|
|
481
|
|
482 - ./results_i#_cq#/prot_finder.faa
|
|
483
|
|
484 Concatenated [`cds_extractor.pl`](/cds_extractor) output files to create the subject **BLASTP** database
|
|
485
|
|
486 - prot_finder_db.phr, prot_finder_db.pin, prot_finder_db.psq
|
|
487
|
|
488 **BLASTP** database files from the concatenated subject sequences ('prot_finder.faa')
|
|
489
|
|
490 - formatdb.log, error.log **or** ./results_i#_cq#/makeblastdb.log
|
|
491
|
|
492 Legacy **BLASTP** or **BLASTP+** log files
|
|
493
|
|
494 - ./results_i#_cq#/prot_finder.blastp
|
|
495
|
|
496 **BLASTP** report/output
|
|
497
|
|
498 - ./results_i#_cq#/prot_finder.log
|
|
499
|
|
500 Log file of `prot_finder.pl` *STDOUT*/*STDERR* messages
|
|
501
|
|
502 ### `prot_binary_matrix.pl` output
|
|
503
|
|
504 - *STDOUT*
|
|
505
|
|
506 The resulting presence/absence matrix is printed to *STDOUT* without option **-s**. Redirect or pipe into another tool as needed.
|
|
507
|
|
508 - (./binary_matrix_results)
|
|
509
|
|
510 Separate query presence/absence files are stored in a result folder with option **-s**
|
|
511
|
|
512 - (./binary_matrix_results/query-ID_binary_matrix.(tsv|csv))
|
|
513
|
|
514 Separate query presence/absence files with option **-s**
|
|
515
|
|
516 ### `transpose_matrix.pl` output
|
|
517
|
|
518 - *STDOUT*
|
|
519
|
|
520 The transposed matrix is printed to *STDOUT*. Redirect or pipe into another tool as needed.
|
|
521
|
|
522 ### `binary_group_stats.pl` output
|
|
523
|
|
524 - *STDOUT*
|
|
525
|
|
526 The tab-delimited final stats matrix is printed to *STDOUT*. Redirect or pipe into another tool as needed.
|
|
527
|
|
528 - ./results_i#_e#
|
|
529
|
|
530 All output files are stored in a results folder
|
|
531
|
|
532 - ./results_i#_e#/[\*_specific|\*_absent|cutoff_core|underrepresented]_rows.txt
|
|
533
|
|
534 Files including the row headers for rows in non-optional categories
|
|
535
|
|
536 - (./results_i#_e#/[\*_singletons|strict_core|unspecific]_rows.txt)
|
|
537
|
|
538 Optional category output files with the respective row headers
|
|
539
|
|
540 - (./results_i#_e#/binary_matrix.tsv)
|
|
541
|
|
542 Tab-delimited binary matrix of group presence/absence results according to cutoffs (excluding 'unspecific' rows)
|
|
543
|
|
544 - (./results_i#_e#/venn_diagram.pdf)
|
|
545
|
|
546 Venn diagram for non-optional categories (except 'unspecific' and 'underrepresented' categories)
|
|
547
|
|
548 ## Dependencies
|
|
549
|
|
550 ### `prot_finder.pl`/`prot_finder_pipe.sh` dependencies
|
|
551
|
|
552 - [**BioPerl**](http://www.bioperl.org) (tested version 1.006923)
|
|
553 - [`cds_extractor`](/cds_extractor) (tested version 0.7.1)
|
|
554 - [**BLASTP**](https://blast.ncbi.nlm.nih.gov/Blast.cgi?PAGE_TYPE=BlastDocs&DOC_TYPE=Download)
|
|
555 - legacy **BLASTP** (tested version 2.2.26)
|
|
556 - **BLASTP+** (tested version 2.2.28+)
|
|
557 - [**Clustal Omega**](http://www.clustal.org/omega/) (tested version 1.2.1)
|
|
558
|
|
559 ### `binary_group_stats.pl` dependencies
|
|
560
|
|
561 - **Statistical computing language [R](http://www.r-project.org/)**
|
|
562
|
|
563 `Rscript` is needed to plot the venn diagram with option **-p**, tested with version 3.2.2
|
|
564
|
|
565 - **gplots (https://cran.r-project.org/web/packages/gplots/index.html)**
|
|
566
|
|
567 Package needed for **R** to plot the venn diagram, includes function `venn`. Tested with **gplots** version 2.17.0.
|
|
568
|
|
569 ## Run environment
|
|
570
|
|
571 The scripts run under UNIX flavors.
|
|
572
|
|
573 ## Author - contact
|
|
574
|
|
575 Andreas Leimbach (aleimba[at]gmx[dot]de; Microbial Genome Plasticity, Institute of Hygiene, University of Muenster)
|
|
576
|
|
577 ## Citation, installation, and license
|
|
578
|
|
579 For [citation](https://github.com/aleimba/bac-genomics-scripts#citation), [installation](https://github.com/aleimba/bac-genomics-scripts#installation-recommendations), and [license](https://github.com/aleimba/bac-genomics-scripts#license) information please see the repository main [*README.md*](https://github.com/aleimba/bac-genomics-scripts/blob/master/README.md).
|
|
580
|
|
581 ## Acknowledgements
|
|
582
|
|
583 The Perl implementation for transposing a matrix on Stack Overflow
|
|
584 was very useful for `transpose_matrix.pl`: https://stackoverflow.com/questions/1729824/transpose-a-file-in-bash
|
|
585
|
|
586 ## Changelog
|
|
587
|
|
588 ### prot_finder changelog
|
|
589
|
|
590 * v0.7.1 (05.04.2016)
|
|
591 * bug fix: significant but non-best blast hits with option **-b** now listed in *queries_no_blastp-hits.txt*
|
|
592 * v0.7 (23.11.2015)
|
|
593 * changed script name from `blast_prot_finder.pl` to `prot_finder.pl`
|
|
594 * fixed bug introduced in v0.6 with a `seek`, because option **-query** didn't pull query sequences anymore
|
|
595 * included version switch
|
|
596 * included 'use autodie;' pragma
|
|
597 * included `pod2usage` with Pod::Usage and `pod2usage`-die for Getopt::Long call
|
|
598 * tab-delimited output table with filtered **BLASTP** hits now printed to *STDOUT* instead of file and can be used as *STDIN* for `prot_binary_matrix.pl`
|
|
599 * result files now created in result directory to unclutter working dir (new options **-dir_result** and **-force_dir**) and replaced subroutine 'file_exist' with 'empty_dir' (also no *STDOUT* message which files were created anymore)
|
|
600 * new output file *queries_no_blastp-hits.txt* to list all queries without **BLASTP** hits
|
|
601 * new output file *clustal_omega.log* to log **Clustal Omega** verbose output
|
|
602 * additional new options, **-path_clustalo** and **-threads_clustalo**
|
|
603 * major code changes/restructuring and additions:
|
|
604 * POD syntax changes and additions for new code
|
|
605 * Perl syntax changes and removing code redundancies
|
|
606 * including script run status messages
|
|
607 * changes to subroutine 'split_fasta_header' to work more robustly with `split` instead of a regex and adapted to `cds_extractor.pl` v0.7+ output format
|
|
608 * included several additional option and input checks
|
|
609 * replaced simple `blast_prot_finder_legacy.sh` with more elaborate bash script pipeline `prot_finder_pipe.sh`
|
|
610 * changed some output column names and moved the subject_ID column before the subject_gene column
|
|
611 * v0.6 (10.06.2013)
|
|
612 * included BioPerls 'frac\*' methods, which include hsp tiling, to correct bug in query coverage and identity calculations for **whole** hits
|
|
613 * corrected bug to use **whole** hit e-value and not just first hsp e-value of a significant hit
|
|
614 * option **-cov_subject** for subject/hit coverage cutoff (not only query coverage cutoff)
|
|
615 * more info in POD
|
|
616 * v0.5 (14.05.2013)
|
|
617 * optionally include query proteins in result subject multi-FASTA files
|
|
618 * new option **-best_hit** to include only best **BLASTP** hit (highest identity) for each subject locus_tag, if a subject protein has hits to several query proteins
|
|
619 * print queries with no subject **BLASTP** hits to *STDOUT*
|
|
620 * v0.4 (24.01.2013)
|
|
621 * corrected bug in hash structure to store **BLASTP** hits, query acc/IDs (keys) and array reference of subject locus_tags (values), as several queries can have the same subject locus_tag as hit
|
|
622 * include 'subject protein_function' in 'blast_hits.txt' output
|
|
623 * v0.3 (12.09.2012)
|
|
624 * **original** script name `blast_prot_finder.pl`
|
|
625 * **BLASTP** hits are stored in a hash with subject locus_tags (keys) and query accessions/IDs (values)
|
|
626
|
|
627 ### prot_binary_matrix changelog
|
|
628
|
|
629 * v0.6 (23.11.2015)
|
|
630 * adapted to `prot_finder.pl` v0.7 output
|
|
631 * included a POD, `pod2usage` with Pod::Usage and `pod2usage`-die for Getopt::Long call
|
|
632 * Perl syntax changes and some simpler loop structures
|
|
633 * Removed option **-input** and instead accept `prot_finder.pl` output as *STDIN* or file as argument
|
|
634 * Removed option **-c|-collective** (actually repurposed, see below), option **-separate** to indicate separate output is enough
|
|
635 * **Without** option **-separate** result matrix is now printed to *STDOUT*
|
|
636 * **With** option **-separate** result matrices now printed to result directory (name optionally given with new option **-dir_result**)
|
|
637 * New option **-locus_tag** to use the locus_tag prefix in column subject_ID of the `prot_finder.pl` output as ID, which is in most cases the locus_tag, instead of the subject_organism; controls if the locus_tags follow NCBI standards
|
|
638 * Output now default tab-separated format (*tsv*), optionally with new option **-csv** comma-separated (*csv*)
|
|
639 * Removed subroutine 'result' and statement which result files have been created
|
|
640 * v0.5 (05.03.2014)
|
|
641 * option **-total** to count all occurences of query proteins within one organism (paralogs), instead of just binary presence/absence
|
|
642 * enforce mandatory options
|
|
643 * changed script name to 'prot_binary_matrix.pl'
|
|
644 * version switch
|
|
645 * included 'use autodie'
|
|
646 * options with Getopt::Long
|
|
647 * changed usage to HERE document
|
|
648 * v0.4 (29.04.2013)
|
|
649 * adapted to new *prot_finders* 'blast_hits.txt' layout, which includes an additional column for 'subject protein_function'
|
|
650 * changed script name to 'blast_binary_matrix.pl'
|
|
651 * v0.3 (15.02.2013)
|
|
652 * status of created result files in *STDOUT* for option **-s**
|
|
653 * v0.2 (21.12.2012)
|
|
654 * prot_finder output file 'blast_hits.txt' doesn't have to be ordered by query protein accessions/IDs anymore
|
|
655 * v0.1 (25.10.2012)
|
|
656 * **original** script name 'blastp_iTOL_binary.pl'
|
|
657
|
|
658 ### transpose_matrix changelog
|
|
659
|
|
660 * v0.1 (12.04.2016)
|
|
661
|
|
662 ### binary_group_stats changelog
|
|
663
|
|
664 * v0.1 (06.06.2016)
|