| 1 |
# Application sub module documentation |
| 2 |
|
| 3 |
Submodule dedicated to run applications/executables used in the software of the CGE tools. |
| 4 |
|
| 5 |
## KMA |
| 6 |
|
| 7 |
The python file *KMA.py* contains the classes: |
| 8 |
|
| 9 |
* KMACommandline |
| 10 |
* KMAIndexCommandline |
| 11 |
* KMAShmCommandline |
| 12 |
* KMASeq2FastaCommandline |
| 13 |
* KMADistCommandline |
| 14 |
* KMADBCommandline |
| 15 |
|
| 16 |
For running KMA with cgelib, installing KMA is required. Follow the instructions at: |
| 17 |
https://bitbucket.org/genomicepidemiology/kma.git |
| 18 |
|
| 19 |
If you are using KMA for your research, please cite: |
| 20 |
|
| 21 |
1. Philip T.L.C. Clausen, Frank M. Aarestrup & Ole Lund, "Rapid and precise alignment of raw reads against redundant databases with KMA", BMC Bioinformatics, 2018;19:307. |
| 22 |
|
| 23 |
### KMACommandline |
| 24 |
|
| 25 |
```python |
| 26 |
>>>from cgelib.applications.KMA import KMACommandline |
| 27 |
|
| 28 |
>>> kma_application = KMACommandline(input="test.fq", output="path/to/folder", template_db='path/to/template_db/', min_len=0.5) |
| 29 |
|
| 30 |
>>> stdout, stderr=kma_application() |
| 31 |
``` |
| 32 |
The class KMACommandline calls KMA from python. The different options for KMACommandline are: |
| 33 |
|
| 34 |
``` |
| 35 |
| KMACommandline | KMA | Description | |
| 36 |
|----------------|---------------|-------------------------------------------------------------------------------------| |
| 37 |
| input | -i | Input file name(s) | |
| 38 |
| input_ipe | -ip | Input paired end file name(s) | |
| 39 |
| input_int | -int | Input interleaved file name(s) | |
| 40 |
| output | -o | Output file | |
| 41 |
| template_db | -t_db | Template db | |
| 42 |
| k_size | -k | Kmersize | |
| 43 |
| min_len | -ml | Minimum alignment length | |
| 44 |
| p_value | -p | p-value | |
| 45 |
| con_clave | -ConClave | Conclave version | |
| 46 |
| mem_mode | -mem_mode | Use kmers to choose best template and save memory | |
| 47 |
| proxi | -proxi | Use proximity scoring under template mapping | |
| 48 |
| ex_mode | -ex_mode | Search kmers exhaustively | |
| 49 |
| extra_files | -ef | Output extra files (mapstat) | |
| 50 |
| vcf | -vcf | Make vcf file, 2 to appy FT | |
| 51 |
| sam | -sam | Output sam to stdout, 4 to output mapped reads | |
| 52 |
| non_consensus | -nc | No consensus file | |
| 53 |
| no_aln | -na | No aln file | |
| 54 |
| no_frag | -mf | No frag file | |
| 55 |
| deCon | -deCon | Remove contamination | |
| 56 |
| dense | -dense | Do not allow insertions in assembly | |
| 57 |
| sasm | -sasm | Skip alignment and assembly | |
| 58 |
| ref_sa | -ref_sa | Consensus sequence will have 'n' instead of gaps | |
| 59 |
| matrix | -matrix | Outputs assembly matrix | |
| 60 |
| best_maps | -a | Print all best mappings | |
| 61 |
| min_phred | -mp | Minimum phred score | |
| 62 |
| cut_5p | -5p | Cut a constant number of nucleotides from the 5 primers | |
| 63 |
| cut_3p | -3p | Cut a constant number of nucloetides from the 3 primers | |
| 64 |
| sparse | -Sparse | Only count Kmers | |
| 65 |
| Mt1 | -Mt1 | Map only to 'num' template | |
| 66 |
| ID | -ID | Minimum ID | |
| 67 |
| ss | -ss | Sparse sorting (q,c,d) | |
| 68 |
| pm | -pm | Pairing method (p,u,f) | |
| 69 |
| fpm | -fpm | Fine pairing method (p,u,f) | |
| 70 |
| apm | -apm | Sets both pm and fpm | |
| 71 |
| shm | -shm | Use shared DB made by kma_shm | |
| 72 |
| mmap | -mmap | Memory map *.comp.by | |
| 73 |
| tmp | -tmp | Set directory for temporary files | |
| 74 |
| 1t1 | -1t1 | Force end to end mapping | |
| 75 |
| hmm | -hmm | Use HMM to assign template to query sequence | |
| 76 |
| count_k | ck | Count kmers instead of pseudo alignment | |
| 77 |
| circular_aln | -ca | Make circular alignments | |
| 78 |
| bootstrap | -boot | Bootstrap sequence | |
| 79 |
| bc | -bc | Base calls should be significantly overrerpresented | |
| 80 |
| bc90 | -bc90 | Base calls should be both significantly overrerpresented and have 90% agreement | |
| 81 |
| bcNano | -bcNano | Call bases at suspicious deletio0ns, made for nanopore | |
| 82 |
| bcd | -bcd | Minimum depth at base | |
| 83 |
| bcg | -bcg | Maintain isnignificant gaps | |
| 84 |
| and | -and | Both mrs and p_value thresholds has to reached to in order to report a template hit | |
| 85 |
| MinMapQ | -mq | Minimum mapping quality | |
| 86 |
| MinAlnQ | -mrs | Minimum alignment score, normalized to alignment length | |
| 87 |
| mct | -mct | Max overlap between templates | |
| 88 |
| reward | -reward | Score for match | |
| 89 |
| penalty | -penalty | Penalty for mismatch | |
| 90 |
| gap_open | -gapopen | Penalty for gap opening | |
| 91 |
| gap_extend | -gapextend | Penalty for gap extension | |
| 92 |
| reward_pairing | -per | Reward for pairing end | |
| 93 |
| local_open | -localopen | Penalty for opening a local chain | |
| 94 |
| n_penalty | -Npenalty | Penalty matching N | |
| 95 |
| transition | -transition | Penalty for transition | |
| 96 |
| transversion | -transversion | Penalty for transversion | |
| 97 |
| cge | -cge | Set cge penalties and reward | |
| 98 |
| threads | -t | Number of threads | |
| 99 |
| status | -status | extra status | |
| 100 |
| verbose | -verbose | extra verbose | |
| 101 |
| citation | -c | citations | |
| 102 |
``` |
| 103 |
|
| 104 |
### KMAIndexCommandline |
| 105 |
|
| 106 |
``` |
| 107 |
| KMAIndexCommandline | KMA Index | Description | |
| 108 |
|---------------------|-----------|-------------------------------------------| |
| 109 |
| input | -i | Input/query file name | |
| 110 |
| output | -o | Output file | |
| 111 |
| batch | -batch | Batch input file | |
| 112 |
| deCon | -deCon | File with contamination | |
| 113 |
| batchD | -batchD | Batch decon file | |
| 114 |
| template_db | -t_db | Add to existing DB | |
| 115 |
| k_size | -k | Kmersize | |
| 116 |
| k_temp | -k_t | Kmersize for template identification | |
| 117 |
| k_index | -k_i | Kmersize for indexing | |
| 118 |
| min_len | -ML | Minimum length for templates | |
| 119 |
| cs | -CS | Start Chain size | |
| 120 |
| mega_db | -ME | Mega DB | |
| 121 |
| no_index | -NI | Do not dump *.index.b | |
| 122 |
| sparse | -Sparse | Make Sparse DB | |
| 123 |
| homology_temp | -ht | Homology template | |
| 124 |
| homology_query | -hq | Homology query | |
| 125 |
| and | -and | Both homology threshold has to be reached | |
| 126 |
| no_bias | -nbp | No bias print | |
| 127 |
``` |
| 128 |
|
| 129 |
### KMAShmCommandline |
| 130 |
|
| 131 |
``` |
| 132 |
| KMAShmCommandline | KMA Shm | Description | |
| 133 |
|-------------------|----------|--------------------------| |
| 134 |
| template_db | -t_db | Template DB | |
| 135 |
| destroy | -destroy | Destroy shared memory | |
| 136 |
| shmLvl | -shmLvl | Level of shared memory | |
| 137 |
| shm_h | -shm-h | Explain of shared memory | |
| 138 |
``` |
| 139 |
|
| 140 |
### KMASeq2FastaCommandline |
| 141 |
|
| 142 |
``` |
| 143 |
| KMASeq2FastaCommandline | KMA seq2fasta | Description | |
| 144 |
|-------------------------|---------------|-----------------------------------| |
| 145 |
| template_db | -t_db | Template DB | |
| 146 |
| seqs | -seqs | Comma separated list of templates | |
| 147 |
``` |
| 148 |
|
| 149 |
### KMADistCommandline |
| 150 |
|
| 151 |
``` |
| 152 |
| KMADistCommandline | KMA dist | Description | |
| 153 |
|--------------------|----------|----------------------------------------------------------------------------------| |
| 154 |
| template_db | -t_db | Template DB | |
| 155 |
| output | -o | Output file | |
| 156 |
| output_f | -f | Output flags | |
| 157 |
| help_flags | -fh | Help on option '-f' | |
| 158 |
| distance_method | -d | Distance method. Options:1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096 | |
| 159 |
| help_distance | -dh | Help on option '-d' | |
| 160 |
| matrix | -m | Allocate matrix on the disk | |
| 161 |
| tmp | -tmp | Set directory for temporary file | |
| 162 |
| threads | -t | Number of threads | |
| 163 |
``` |
| 164 |
|
| 165 |
### KMADBCommandline |
| 166 |
|
| 167 |
``` |
| 168 |
| KMADBCommandline | KMA db | Description | |
| 169 |
|------------------|--------|-------------| |
| 170 |
| template_db | -t_db | Template DB | |
| 171 |
|
| 172 |
``` |
| 173 |
|
| 174 |
## Blast |
| 175 |
|
| 176 |
The python file *Blast.py* contains: |
| 177 |
|
| 178 |
* BlastNCommandline |
| 179 |
|
| 180 |
For running BlastN with cgelib, installing Blast is required. Follow the instructions at: |
| 181 |
https://www.ncbi.nlm.nih.gov/books/NBK569861/ |
| 182 |
|
| 183 |
If you are using Blast for your research, please cite: |
| 184 |
|
| 185 |
1. Camacho C, Coulouris G, Avagyan V, Ma N, Papadopoulos J, Bealer K, Madden TL. (2009). BLAST+: architecture and applications. BMC Bioinformatics 10(1):421. |
| 186 |
|
| 187 |
### BlastNCommandline |
| 188 |
|
| 189 |
```python |
| 190 |
>>>from cgelib.applications.Blast import BlastNCommandline |
| 191 |
|
| 192 |
>>> blastnline = BlastNCommandline(subject="path/to/template.fsa", query="path/to/output.fsa", output="path/to/output", outfmt="6 std qlen", perc_identity=0.9, max_target_seqs=50000, dust="no") |
| 193 |
|
| 194 |
>>> std_output, err_output = blastnline() |
| 195 |
``` |
| 196 |
The class BlastNCommandline calls BlastN from python. The different options for BlastNCommandline are: |
| 197 |
|
| 198 |
``` |
| 199 |
| BlastNCommandline | blastn | Description | |
| 200 |
|------------------------|-------------------------|-----------------------------------------------------------------------------------------------| |
| 201 |
| db | -db | BLAST database name | |
| 202 |
| query | -query | Query file name | |
| 203 |
| query_location | -query_loc | Location on the query sequence | |
| 204 |
| output | -out | Output file name | |
| 205 |
| evalue | -evalue | Expect value (E) for saving hits | |
| 206 |
| subject | -subject | File with subject sequence(s) to search | |
| 207 |
| subject_location | -subject_loc | Locaiton on the subject sequence | |
| 208 |
| show_GIs | -show_gis | Show NCBI GIs in report | |
| 209 |
| num_descriptions | -num_descriptions | Show one-line descriptions for this number of database sequences | |
| 210 |
| num_alignments | -num_alignments | Show alignments for this number of database sequences | |
| 211 |
| max_target_seqs | -max_target_seqs | Number of aligned sequences to keep | |
| 212 |
| max_hsps | -max_hsps | Maximum number of HSPs (alignments) to keep for any single query-subject pair. | |
| 213 |
| html | -html | Porduce HTML output | |
| 214 |
| seqidlist | -seqidlist | Restrict search of database to list of SeqIDs | |
| 215 |
| gilist | -gilist | Restrict search of database to GI's listed in this file | |
| 216 |
| negative_gilist | -negative_gilist | Restrict search of database to everything except the GI's listed in this file | |
| 217 |
| entrez_query | -entrez_query | Restrict search with the given Entrez query. | |
| 218 |
| culling_limit | -culling_limit | Delete a hit that is enveloped by at least this many higher-scoring hits | |
| 219 |
| best_hit_overhang | -best_hit_overhang | Best hit algorithm overhang value | |
| 220 |
| best_hit_score_edge | -best_hit_score_edge | Best hit algorithm score edge value | |
| 221 |
| dbsize | -dbsize | Effective size of the database | |
| 222 |
| searchsp | -searchsp | Effective length of the search space | |
| 223 |
| import_search_strategy | -import_search_strategy | Search strategy file to read | |
| 224 |
| export_search_strategy | -export_search_strategy | Eecord search strategy to this file | |
| 225 |
| parse_deflines | -parse_deflines | Parse query and subject bar delimited sequence identifiers | |
| 226 |
| num_threads | -num_threads | Numberof threads CPUs to use in blast search | |
| 227 |
| remote | -remote | Execute search on NCBI servers | |
| 228 |
| outfmt | -outfmt | Number of threads (CPUs) to use in blast serach | |
| 229 |
| task | -task | Task to execute | |
| 230 |
| word_size | -word_size | Word size for wordfinder algorithm (lenght of best perfect match) | |
| 231 |
| gapopen | -gapopen | Cost to open a gap | |
| 232 |
| gapextend | -gapextend | Word size for wordfinder algorithm (length of best perfect match) | |
| 233 |
| reward | -reward | Reward for a nucleotide match | |
| 234 |
| penalty | -penalty | Penalty for a nucleotide mismatch | |
| 235 |
| strand | -strand | Query strand to search against database/subject | |
| 236 |
| dust | -dust | Filter query sequence with dust | |
| 237 |
| filtering_db | -filtering_db | Mask query using the sequences in this database | |
| 238 |
| window_masker_taxid | -window_masker_taxid | Enable windowmasker filtering using a taxonomic DB | |
| 239 |
| sum_stats | -sum_stats | Use sum statistics | |
| 240 |
| window_masker_db | -window_masker_db | Enable windowmasker filtering using this file | |
| 241 |
| soft_masking | -soft_masking | Apply filtering locations as soft masks | |
| 242 |
| lcase_masking | -lcase_masking | Use lower case filtering in query and subject sequence | |
| 243 |
| db_soft_mask | -db_soft_mask | Filtering algorithm ID to apply to the BLAST database as soft mask | |
| 244 |
| db_hard_mask | -db_hard_mask | Filtering algorithm ID to apply to the BLAST databaseas hard mask | |
| 245 |
| perc_identity | -perc_identity | Percent query identity cutoff | |
| 246 |
| qcov_hsp_perc | -qcov_hsp_perc | Percent query coverage per hsp | |
| 247 |
| template_type | -template_type | Discontiguous MegaBLAST template type | |
| 248 |
| template_length | -template_length | Discontiguous BegaBlast template length | |
| 249 |
| use_index | -use_index | Use MegaBlast Database index | |
| 250 |
| index_name | -index_name | MegaBLAST database index name | |
| 251 |
| xdrop_ungap | -xdrop_ungap | Heuristic value for ungapped extensions | |
| 252 |
| xdrop_gap | -xdrop_gap | Heuristic value for preliminary gapped extensions | |
| 253 |
| xdrop_gap_final | -xdrop_gap_final | Heuristic value for final gapped alignment | |
| 254 |
| no_greedy | -no_greedy | Use non_greedy dynamic programming extension | |
| 255 |
| min_raw_gapped_score | -min_raw_gapped_score | Minimum raw gapped score to keep an alignment in the preliminary gapped and trace-back stages | |
| 256 |
| ungapped | -ungapped | Perform ungapped alignment | |
| 257 |
| window_size | -window_size | Multiple hits window size, use 0 to specify 1-hit algorithm | |
| 258 |
| off_diagonal_range | -off_diagonal_range | Number off-diagonals to search for the 2nd hit use 0 to turn off | |
| 259 |
| line_length | -line_length | Line length for formatting alignments | |
| 260 |
``` |