From e701fa49e7fc5f8aaef4ba680e012a14bce00c4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rolf=20Schr=C3=B6der?= Date: Sat, 12 Jun 2021 16:12:07 +0200 Subject: [PATCH] feat(plugins): New plugins for samtools and bedtools (#3574) * Add first impl of samtools autocompletion * Just autocomplete with files all the time * Add init impl of bedtools completion * Add readme.md for bedtools plugin * Add readme for samtools Co-authored-by: Rolf Schroeder --- plugins/bedtools/README.md | 5 +++ plugins/bedtools/_bedtools | 64 ++++++++++++++++++++++++++++++++++++++ plugins/samtools/README.md | 5 +++ plugins/samtools/_samtools | 40 ++++++++++++++++++++++++ 4 files changed, 114 insertions(+) create mode 100644 plugins/bedtools/README.md create mode 100644 plugins/bedtools/_bedtools create mode 100644 plugins/samtools/README.md create mode 100644 plugins/samtools/_samtools diff --git a/plugins/bedtools/README.md b/plugins/bedtools/README.md new file mode 100644 index 000000000..c4de4e3a9 --- /dev/null +++ b/plugins/bedtools/README.md @@ -0,0 +1,5 @@ +# Bedtools plugin + +This plugin adds support for the [bedtools suite](http://bedtools.readthedocs.org/en/latest/): + +* Adds autocomplete options for all bedtools sub commands. diff --git a/plugins/bedtools/_bedtools b/plugins/bedtools/_bedtools new file mode 100644 index 000000000..ef6c4179a --- /dev/null +++ b/plugins/bedtools/_bedtools @@ -0,0 +1,64 @@ +#compdef bedtools +#autoload + +local curcontext="$curcontext" state line ret=1 +local -a _files + +_arguments -C \ + '1: :->cmds' \ + '2:: :->args' && ret=0 + +case $state in + cmds) + _values "bedtools command" \ + "--contact[Feature requests, bugs, mailing lists, etc.]" \ + "--help[Print this help menu.]" \ + "--version[What version of bedtools are you using?.]" \ + "annotate[Annotate coverage of features from multiple files.]" \ + "bamtobed[Convert BAM alignments to BED (& other) formats.]" \ + "bamtofastq[Convert BAM records to FASTQ records.]" \ + "bed12tobed6[Breaks BED12 intervals into discrete BED6 intervals.]" \ + "bedpetobam[Convert BEDPE intervals to BAM records.]" \ + "bedtobam[Convert intervals to BAM records.]" \ + "closest[Find the closest, potentially non-overlapping interval.]" \ + "cluster[Cluster (but don't merge) overlapping/nearby intervals.]" \ + "complement[Extract intervals _not_ represented by an interval file.]" \ + "coverage[Compute the coverage over defined intervals.]" \ + "expand[Replicate lines based on lists of values in columns.]" \ + "fisher[Calculate Fisher statistic b/w two feature files.]" \ + "flank[Create new intervals from the flanks of existing intervals.]" \ + "genomecov[Compute the coverage over an entire genome.]" \ + "getfasta[Use intervals to extract sequences from a FASTA file.]" \ + "groupby[Group by common cols. & summarize oth. cols. (~ SQL "groupBy")]" \ + "igv[Create an IGV snapshot batch script.]" \ + "intersect[Find overlapping intervals in various ways.]" \ + "jaccard[Calculate the Jaccard statistic b/w two sets of intervals.]" \ + "links[Create a HTML page of links to UCSC locations.]" \ + "makewindows[Make interval "windows" across a genome.]" \ + "map[Apply a function to a column for each overlapping interval.]" \ + "maskfasta[Use intervals to mask sequences from a FASTA file.]" \ + "merge[Combine overlapping/nearby intervals into a single interval.]" \ + "multicov[Counts coverage from multiple BAMs at specific intervals.]" \ + "multiinter[Identifies common intervals among multiple interval files.]" \ + "nuc[Profile the nucleotide content of intervals in a FASTA file.]" \ + "overlap[Computes the amount of overlap from two intervals.]" \ + "pairtobed[Find pairs that overlap intervals in various ways.]" \ + "pairtopair[Find pairs that overlap other pairs in various ways.]" \ + "random[Generate random intervals in a genome.]" \ + "reldist[Calculate the distribution of relative distances b/w two files.]" \ + "sample[Sample random records from file using reservoir sampling.]" \ + "shuffle[Randomly redistrubute intervals in a genome.]" \ + "slop[Adjust the size of intervals.]" \ + "sort[Order the intervals in a file.]" \ + "subtract[Remove intervals based on overlaps b/w two files.]" \ + "tag[Tag BAM alignments based on overlaps with interval files.]" \ + "unionbedg[Combines coverage intervals from multiple BEDGRAPH files.]" \ + "window[Find overlapping intervals within a window around an interval.]" \ + ret=0 + ;; + *) + _files + ;; +esac + +return ret diff --git a/plugins/samtools/README.md b/plugins/samtools/README.md new file mode 100644 index 000000000..f4baf41f7 --- /dev/null +++ b/plugins/samtools/README.md @@ -0,0 +1,5 @@ +# Samtools plugin + +This plugin adds support for [samtools](http://www.htslib.org/): + +* Adds autocomplete options for all samtools sub commands. diff --git a/plugins/samtools/_samtools b/plugins/samtools/_samtools new file mode 100644 index 000000000..ddb002ae2 --- /dev/null +++ b/plugins/samtools/_samtools @@ -0,0 +1,40 @@ +#compdef samtools +#autoload + +local curcontext="$curcontext" state line ret=1 +local -a _files + +_arguments -C \ + '1: :->cmds' \ + '2:: :->args' && ret=0 + +case $state in + cmds) + _values "samtools command" \ + "view[SAM<->BAM conversion]" \ + "sort[sort alignment file]" \ + "mpileup[multi-way pileup]" \ + "depth[compute the depth]" \ + "faidx[index/extract FASTA]" \ + "tview[text alignment viewer]" \ + "index[index alignment]" \ + "idxstats[BAM index stats (r595 or later)]" \ + "fixmate[fix mate information]" \ + "flagstat[simple stats]" \ + "calmd[recalculate MD/NM tags and '=' bases]" \ + "merge[merge sorted alignments]" \ + "rmdup[remove PCR duplicates]" \ + "reheader[replace BAM header]" \ + "cat[concatenate BAMs]" \ + "bedcov[read depth per BED region]" \ + "targetcut[cut fosmid regions (for fosmid pool only)]" \ + "phase[phase heterozygotes]" \ + "bamshuf[shuffle and group alignments by name]" + ret=0 + ;; + *) + _files + ;; +esac + +return ret