prepare_tabular

prepare_tabular prepares a tabular file for parallel annotation. It reads a TSV or CSV file with a header, plain or gzip/bgzip-compressed. It sorts the rows by chromosome and position, and writes a tab-separated, bgzip-compressed file and its tabix index. Use it before you annotate a large tabular file, so that annotate_tabular can split the job by genomic region and run the parts in parallel.

Examples

prepare_tabular SSC_WES_variants_select.tsv.gz

Writes SSC_WES_variants_select.sorted.tsv.bgz and its tabix index SSC_WES_variants_select.sorted.tsv.bgz.tbi next to the input.

prepare_tabular variants.csv -R hg38/genomes/GRCh38-hg38 -o variants.sorted.tsv.bgz

Sorts the chromosomes in the order of the hg38/genomes/GRCh38-hg38 reference genome, not in lexicographic order.

prepare_tabular variants.tsv.gz --sort-threads 8 --sort-buffer 4G -w /scratch/sort_tmp

Runs the sort with 8 threads and a 4 GB memory buffer, and keeps the temporary files in /scratch/sort_tmp.

See also

Option reference

Sort and tabix-index a tabular file so that annotate_tabular can parallelize annotation.

usage: prepare_tabular [-h] [-o OUTPUT] [--input-separator INPUT_SEPARATOR]
                       [--skip-sort] [-w WORK_DIR]
                       [--sort-threads SORT_THREADS]
                       [--sort-buffer SORT_BUFFER] [--version]
                       [--col-pos COL_POS] [--col-variant COL_VARIANT]
                       [--col-pos-end COL_POS_END] [--col-alt COL_ALT]
                       [--col-pos-beg COL_POS_BEG] [--col-ref COL_REF]
                       [--col-location COL_LOCATION]
                       [--col-vcf-like COL_VCF_LIKE]
                       [--col-cnv-type COL_CNV_TYPE] [--col-chrom COL_CHROM]
                       [-g GRR_FILENAME] [--grr-directory GRR_DIRECTORY]
                       [-R REFERENCE_GENOME_RESOURCE_ID] [--verbose]
                       [--logfile LOGFILE]
                       input

Positional Arguments

input

Input tabular file (plain text or gzip/bgzip compressed).

Named Arguments

-o, --output

The output bgzip-compressed file path. The path must end with .bgz or .gz. Without this option, the tool writes <input-stem>.sorted.tsv.bgz next to the input.

--input-separator, --in-sep

The column separator in the input. If not specified, defaults to ‘,’ for .csv/.csv.gz inputs and to a tab otherwise. The output is always tab-separated.

--skip-sort

Assume the input is already sorted; only bgzip and tabix index it (still injecting derived chrom/pos columns when needed).

Default: False

-w, --work-dir

Directory for temporary files used by the native sort. Defaults to a fresh temporary directory next to the output.

--sort-threads

Threads for native sort (maps to sort’s –parallel).

--sort-buffer

Memory buffer for native sort, e.g. 1G (maps to sort’s -S).

--version

Show the GAIn version and exit.

Default: False

--col-pos

The column name that stores pos. Use “-” to exclude this column requirement, causing annotatable patterns that require pos to be skipped.

Default: 'pos'

--col-variant

The column name that stores variant. Use “-” to exclude this column requirement, causing annotatable patterns that require variant to be skipped.

Default: 'variant'

--col-pos-end

The column name that stores pos_end. Use “-” to exclude this column requirement, causing annotatable patterns that require pos_end to be skipped.

Default: 'pos_end'

--col-alt

The column name that stores alt. Use “-” to exclude this column requirement, causing annotatable patterns that require alt to be skipped.

Default: 'alt'

--col-pos-beg

The column name that stores pos_beg. Use “-” to exclude this column requirement, causing annotatable patterns that require pos_beg to be skipped.

Default: 'pos_beg'

--col-ref

The column name that stores ref. Use “-” to exclude this column requirement, causing annotatable patterns that require ref to be skipped.

Default: 'ref'

--col-location

The column name that stores location. Use “-” to exclude this column requirement, causing annotatable patterns that require location to be skipped.

Default: 'location'

--col-vcf-like

The column name that stores vcf_like. Use “-” to exclude this column requirement, causing annotatable patterns that require vcf_like to be skipped.

Default: 'vcf_like'

--col-cnv-type

The column name that stores cnv_type. Use “-” to exclude this column requirement, causing annotatable patterns that require cnv_type to be skipped.

Default: 'cnv_type'

--col-chrom

The column name that stores chrom. Use “-” to exclude this column requirement, causing annotatable patterns that require chrom to be skipped.

Default: 'chrom'

-g, --grr-filename, --grr

The GRR configuration file. If absent, the default GRR repository is used.

--grr-directory

Local GRR directory to use as the repository.

-R, --reference-genome-resource-id, --ref

The resource id for the reference genome whose chromosome order will be used. If absent, chromosomes are sorted lexicographically.

--verbose, -v, -V

Default: 0

--logfile

File to log output to. If not set, logs to console.