Input and output¶
Input formats¶
Single-region commands accept BED-like files or region text. BED coordinates
default to columns 0, 1, and 2; use --columns to change them.
chr1 100 200 peak_a
Region text defaults to column 0 and accepts delimiters such as :, -,
*, =, /, ^, ;, _, %, $, and ,:
region
chr1:100-200
chr2^300=450
--input-format auto detects BED, VCF, headered text, or headerless text.
Force a format with bed, vcf, txt, or txtnohead; use
--region-column for another text column.
VCF records use standard one-based coordinates and are converted to BED-style
half-open intervals: start = POS - 1, end = start + len(REF). The output
keeps VCF columns after the coordinates, with text output beginning with
Region, followed by ID, REF, ALT, and the remaining VCF columns.
peak2anno peak2gene variants.vcf -s hg38 -f txt -o variants.tsv
Multiple input files are accepted as a comma-separated value or as one path
per line in a file ending in .lst or .list. Blank lines and lines starting
with # in list files are ignored. With -o stdout or -o /dev/stdout,
results are concatenated in the listed order; use --workers to annotate
independent files in parallel. If -o is omitted, each input gets an .anno
result; otherwise -o is treated as a suffix for each input:
peak2anno peak2gene -i sample1.bed,sample2.txt -s hg38 -n 2 -o XXX
# writes sample1.bed.XXX and sample2.txt.XXX
peak2anno peak2gene -i samples.list -s hg38 --workers 4 -o stdout
For merged txt output, only the first input header is written. With
bed/bedpe or txtnohead, no header is added. Headerless BED input assumes
only BED3; extra columns are named field4, field5, field6, and so on when
written as text.
For text input, the region coordinate delimiter can be selected with the
SJCAB_PEAK2ANNO_TXT_DELIMITER environment variable or the same setting in
the RC file. The default is auto, which recognizes the delimiters shown
above. Set it to a literal delimiter such as | when regions use a custom
form:
SJCAB_PEAK2ANNO_TXT_DELIMITER='|' peak2anno peak2gene regions.txt \
--input-format txt --tss-bed tests_data/tss.bed
With that setting, the text region is written as chr1|100|200. The setting
only changes parsing of the chromosome/start/end expression; tabs or spaces
still separate columns in a text table.
Output formats¶
--output-format accepts auto, bed, bedpe, txt, and txtnohead.
autofollows the detected input format.txtis tab-delimited with a header.txtnoheadis tab-delimited without a header.bedwrites chromosome/start/end output without a header.bedpeis the loop equivalent of BED output.
peak2anno peak2gene peaks.bed --tss-bed tests_data/tss.bed \
-o result.tsv --output-format txt
peak2anno peak2gene peaks.bed --tss-bed tests_data/tss.bed \
-o result.bed --output-format bed
Feature and state output modes are controlled by --output-mode and can emit
the maximum assignment, ordered percentages, or both. Feature percentages
allocate each overlapping base to the first feature in order.lst.
Use --order-lst to choose a custom feature priority list; def, default,
and none select the database-root order.lst, while utr selects
order.utr.lst.
Check the selected order list for feature meanings. For two-column order
lists, the second column is used as the output feature name; standard feature
names are used when a mapping is not found.