|
4 | 4 |  |
5 | 5 | [](https://github.com/Sam-Sims/kractor/actions/workflows/test.yaml) |
6 | 6 | [](https://github.com/Sam-Sims/kractor/actions/workflows/check.yaml) |
| 7 | +[](https://doi.org/10.5281/zenodo.15761838) |
7 | 8 |
|
8 | 9 | # kractor |
9 | 10 |
|
@@ -89,24 +90,75 @@ All executables will be in the directory Kractor/target/release. |
89 | 90 |
|
90 | 91 | ## Usage |
91 | 92 |
|
92 | | - |
93 | | - |
94 | | -### Basic Usage: |
| 93 | +```bash |
| 94 | +Extract reads from a FASTQ file based on taxonomic classification via Kraken2. |
| 95 | + |
| 96 | +Usage: kractor [OPTIONS] --input [<INPUT>...] --output [<OUTPUT>...] --kraken <KRAKEN> --taxid <TAXID>... |
| 97 | + |
| 98 | +Options: |
| 99 | + -i, --input [<INPUT>...] Input file path(s). Accepts up to 2 files (for paired-end reads) |
| 100 | + -o, --output [<OUTPUT>...] Output file path(s). Accepts up to 2 files (for paired-end reads) |
| 101 | + -k, --kraken <KRAKEN> Kraken2 stdout file path |
| 102 | + -r, --report <REPORT> Kraken2 report file path (Optional). Required when using --parents or --children |
| 103 | + -t, --taxid <TAXID>... Taxonomic IDs to extract reads for. Can specify multiple |
| 104 | + -O, --compression-type <OUTPUT_TYPE> Compression format for output files. Overides the inferred format |
| 105 | + -l, --level <COMPRESSION_LEVEL> Compression level [default: 2] |
| 106 | + --parents Include all parent taxon IDs in the output |
| 107 | + --children Include all child taxon IDs in the output |
| 108 | + --exclude Exclude specified taxon IDs from the output |
| 109 | + --output-fasta Output results in FASTA format |
| 110 | + --json-report Enable a JSON summary output written to stdout |
| 111 | + -v Enable verbose output |
| 112 | + -h, --help Print help |
| 113 | + -V, --version Print version |
| 114 | + ``` |
| 115 | + |
| 116 | +### Examples: |
95 | 117 |
|
96 | 118 | ```bash |
97 | | -kractor -k <kraken_output> -i <fastq_file> -t <taxonomic_id> -o <output_file> --json-report > kractor_report.json |
98 | | -``` |
| 119 | +# Extract reads classified as E. coli from single end reads |
| 120 | +kractor -i sample.fastq -o extracted.fastq -k kraken_output.txt -t 562 |
99 | 121 |
|
100 | | -Or, if you have paired-end illumina reads: |
| 122 | +# Extract from paired end reads |
| 123 | +kractor -i sample_R1.fastq -i sample_R2.fastq -o extracted_R1.fastq -o extracted_R2.fastq -k kraken_output.txt -t 562 |
101 | 124 |
|
102 | | -```bash |
103 | | -kractor -k <kraken_output> -i <R1_fastq_file> -i <R2_fastq_file> -t <taxonomic_id> -o <R1_output_file> -o <R2_output_file> |
104 | | -``` |
| 125 | +# Extract multiple taxids (Bacillaceae and Listeriaceae) |
| 126 | +kractor -i sample.fastq -o extracted.fastq -k kraken_output.txt -t 186817 186820 |
105 | 127 |
|
106 | | -If you want to extract all children of a taxon: |
| 128 | +# Extract all children of Enterobacteriaceae family (requires kraken report) |
| 129 | +kractor -i sample.fastq -o extracted.fastq -k kraken_output.txt -r kraken_report.txt -t 543 --children |
107 | 130 |
|
108 | | -```bash |
109 | | -kractor -k <kraken_output> -r <kraken_report> -i <fastq_file> -t <taxonomic_id> --children -o <output_file> |
| 131 | +# Extract everything EXCEPT viral reads (using --exclude) |
| 132 | +kractor -i sample.fastq -o extracted.fastq -k kraken_output.txt -t 10239 --exclude |
| 133 | + |
| 134 | +# Output FASTA format instead of FASTQ |
| 135 | +kractor -i sample.fastq -o extracted.fasta -k kraken_output.txt -t 562 --output-fasta |
| 136 | +``` |
| 137 | + |
| 138 | +### Summary statistics |
| 139 | +Use `--json-report` to get summary statistics (output to stdout on completion) |
| 140 | +```json |
| 141 | +{ |
| 142 | + "taxon_count": 1, |
| 143 | + "taxon_ids": [ |
| 144 | + 1 |
| 145 | + ], |
| 146 | + "reads_in": { |
| 147 | + "Paired": { |
| 148 | + "total": 107053222, |
| 149 | + "read1": 53526611, |
| 150 | + "read2": 53526611 |
| 151 | + } |
| 152 | + }, |
| 153 | + "reads_out": { |
| 154 | + "Paired": { |
| 155 | + "total": 185410, |
| 156 | + "read1": 92705, |
| 157 | + "read2": 92705 |
| 158 | + } |
| 159 | + }, |
| 160 | + "input_format": "paired" |
| 161 | +} |
110 | 162 | ``` |
111 | 163 |
|
112 | 164 | ### Arguments: |
@@ -216,3 +268,9 @@ This will output a json report that to stdout upon programme completion. |
216 | 268 | ## Version |
217 | 269 |
|
218 | 270 | - 1.0.1 |
| 271 | + |
| 272 | +## Citation |
| 273 | +[](https://doi.org/10.5281/zenodo.15761838) |
| 274 | +``` |
| 275 | +Sam Sims. (2025). Sam-Sims/kractor: kractor-1.0.1 (kractor-1.0.1). Zenodo. https://doi.org/10.5281/zenodo.15761838 |
| 276 | +``` |
0 commit comments