Skip to content

Commit c862540

Browse files
committed
Merge branch 'main' of github.com:Adamtaranto/TIRmite
2 parents 1b69fe7 + 65a3cdd commit c862540

3 files changed

Lines changed: 91 additions & 33 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Test installation.
9494
```bash
9595
# Print version number and exit.
9696
% tirmite --version
97-
tirmite 1.3.0
97+
tirmite 1.4.0
9898

9999
# Get usage information
100100
% tirmite --help

docs/tutorials/tirmite-pair.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,31 @@ tirmite pair \
618618
--outdir MY_TIR_OUTPUT
619619
```
620620

621+
### Disabling sequence extraction
622+
623+
Extracting sequences from a large genome FASTA or BLAST database can be time-consuming. Use `--no-hits` and/or `--no-elements` to skip FASTA output when the sequences are not required.
624+
625+
| Flag | Effect |
626+
|------|--------|
627+
| `--no-hits` | Skip writing individual terminus hit sequences to FASTA |
628+
| `--no-elements` | Skip extraction and writing of full-length paired element sequences to FASTA |
629+
630+
These flags are independent and can be combined. GFF3 output, summary reports, and flank/insertion-site extraction are unaffected.
631+
632+
```bash
633+
tirmite pair \
634+
--genome $GENOME \
635+
--nhmmer-file $NHMMERFILE \
636+
--hmm-file $HMMFILE \
637+
--orientation F,R \
638+
--mincov 0.4 \
639+
--maxdist 20000 \
640+
--no-hits \
641+
--no-elements \
642+
--gff \
643+
--outdir MY_TIR_OUTPUT
644+
```
645+
621646
## Key Options Reference
622647

623648
| Option | Description |
@@ -647,4 +672,6 @@ tirmite pair \
647672
| `--tsd-in-model` | The TSD is encoded at the inner end of the terminus HMM model |
648673
| `--gff-report` | Reporting mode: `all`, `paired`, or `unpaired` |
649674
| `--gff` | Write GFF3 annotation file |
675+
| `--no-hits` | Skip writing individual hit sequences to FASTA |
676+
| `--no-elements` | Skip extraction and writing of paired element sequences to FASTA |
650677
| `--logfile` | Write log to file |

src/tirmite/cli/hmm_pair.py

Lines changed: 63 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,30 @@ def _configure_pair_parser(parser: argparse.ArgumentParser) -> None:
845845
help='Only report individual hits, skip pairing.',
846846
)
847847

848+
parser.add_argument(
849+
'--no-hits',
850+
action='store_true',
851+
default=False,
852+
dest='no_hits',
853+
help=(
854+
'Skip writing individual hit sequences to FASTA. '
855+
'Useful when extracting sequences from a large genome or BLAST database '
856+
'would be time-consuming and hit sequences are not required.'
857+
),
858+
)
859+
860+
parser.add_argument(
861+
'--no-elements',
862+
action='store_true',
863+
default=False,
864+
dest='no_elements',
865+
help=(
866+
'Skip extraction and writing of paired element sequences to FASTA. '
867+
'Useful when extracting full-length elements from a large genome or '
868+
'BLAST database would be time-consuming and element sequences are not required.'
869+
),
870+
)
871+
848872
parser.add_argument(
849873
'--gff',
850874
action='store_true',
@@ -1803,7 +1827,7 @@ def main(args: Optional[argparse.Namespace] = None) -> int:
18031827
# Write individual hits
18041828
# In pairing_map mode individual hits are written per pair (below),
18051829
# so only write to the base outDir when no pairing map is used.
1806-
if not pairing_map:
1830+
if not pairing_map and not args.no_hits:
18071831
logging.info('Writing individual hits to FASTA...')
18081832
tirmite.writeTIRs(
18091833
outDir=outDir,
@@ -1908,17 +1932,18 @@ def main(args: Optional[argparse.Namespace] = None) -> int:
19081932
# Write individual hits for the models in this pair
19091933
pair_hit_models = {left_feature, right_feature}
19101934
pair_hitTable_tirs = hitTable[hitTable['model'].isin(pair_hit_models)]
1911-
logging.info(f'Writing individual hits for pair {pair_label}...')
1912-
tirmite.writeTIRs(
1913-
outDir=pair_outDir,
1914-
hitTable=pair_hitTable_tirs,
1915-
maxeval=args.maxeval,
1916-
genome=genome,
1917-
prefix=args.prefix,
1918-
padlen=args.padlen,
1919-
genome_descriptions=genome_descriptions,
1920-
blastdb=args.blastdb if args.blastdb else None,
1921-
)
1935+
if not args.no_hits:
1936+
logging.info(f'Writing individual hits for pair {pair_label}...')
1937+
tirmite.writeTIRs(
1938+
outDir=pair_outDir,
1939+
hitTable=pair_hitTable_tirs,
1940+
maxeval=args.maxeval,
1941+
genome=genome,
1942+
prefix=args.prefix,
1943+
padlen=args.padlen,
1944+
genome_descriptions=genome_descriptions,
1945+
blastdb=args.blastdb if args.blastdb else None,
1946+
)
19221947

19231948
# Write paired TIRs
19241949
if args.gff_report in ['all', 'paired']:
@@ -1934,16 +1959,19 @@ def main(args: Optional[argparse.Namespace] = None) -> int:
19341959
)
19351960

19361961
# Extract and write elements for this pair
1937-
pair_pairedEles = tirmite.fetchElements(
1938-
paired=pair_paired,
1939-
hitIndex=pair_hitIndex,
1940-
genome=genome,
1941-
genome_descriptions=genome_descriptions,
1942-
blastdb=args.blastdb if args.blastdb else None,
1943-
)
1944-
tirmite.writeElements(
1945-
pair_outDir, eleDict=pair_pairedEles, prefix=args.prefix
1946-
)
1962+
if not args.no_elements:
1963+
pair_pairedEles = tirmite.fetchElements(
1964+
paired=pair_paired,
1965+
hitIndex=pair_hitIndex,
1966+
genome=genome,
1967+
genome_descriptions=genome_descriptions,
1968+
blastdb=args.blastdb if args.blastdb else None,
1969+
)
1970+
tirmite.writeElements(
1971+
pair_outDir, eleDict=pair_pairedEles, prefix=args.prefix
1972+
)
1973+
else:
1974+
pair_pairedEles = {}
19471975

19481976
# Extract and write flanks for this pair
19491977
if args.flanks or args.flanks_paired:
@@ -2125,17 +2153,20 @@ def main(args: Optional[argparse.Namespace] = None) -> int:
21252153
)
21262154

21272155
# Extract and write elements
2128-
logging.info('Extracting paired elements...')
2129-
pairedEles = tirmite.fetchElements(
2130-
paired=paired,
2131-
hitIndex=hitIndex,
2132-
genome=genome,
2133-
genome_descriptions=genome_descriptions,
2134-
blastdb=args.blastdb if args.blastdb else None,
2135-
)
2156+
if not args.no_elements:
2157+
logging.info('Extracting paired elements...')
2158+
pairedEles = tirmite.fetchElements(
2159+
paired=paired,
2160+
hitIndex=hitIndex,
2161+
genome=genome,
2162+
genome_descriptions=genome_descriptions,
2163+
blastdb=args.blastdb if args.blastdb else None,
2164+
)
21362165

2137-
logging.info('Writing paired elements to FASTA...')
2138-
tirmite.writeElements(outDir, eleDict=pairedEles, prefix=args.prefix)
2166+
logging.info('Writing paired elements to FASTA...')
2167+
tirmite.writeElements(outDir, eleDict=pairedEles, prefix=args.prefix)
2168+
else:
2169+
pairedEles = {}
21392170

21402171
# Write summary report for single-pairing mode
21412172
if config is not None:

0 commit comments

Comments
 (0)