e701fa49e7fc5f8aaef4ba680e012a14bce00c4b

Author
Rolf Schröder <rolf.schr@gmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

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 <rolf.schroeder@centogene.com>

Diff

  1diff --git a/plugins/bedtools/README.md b/plugins/bedtools/README.md
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..c4de4e3a90f2bfa689fedec28ba182f8a8691a4c
  4--- /dev/null
  5+++ b/plugins/bedtools/README.md
  6@@ -0,0 +1,5 @@
  7+# Bedtools plugin
  8+
  9+This plugin adds support for the [bedtools suite](http://bedtools.readthedocs.org/en/latest/):
 10+
 11+* Adds autocomplete options for all bedtools sub commands.
 12diff --git a/plugins/bedtools/_bedtools b/plugins/bedtools/_bedtools
 13new file mode 100644
 14index 0000000000000000000000000000000000000000..ef6c4179afc7125390fb1a0ae96c03f0fb4acb3c
 15--- /dev/null
 16+++ b/plugins/bedtools/_bedtools
 17@@ -0,0 +1,64 @@
 18+#compdef bedtools
 19+#autoload
 20+
 21+local curcontext="$curcontext" state line ret=1
 22+local -a _files
 23+
 24+_arguments -C \
 25+  '1: :->cmds' \
 26+  '2:: :->args' && ret=0
 27+
 28+case $state in
 29+  cmds)
 30+    _values "bedtools command" \
 31+        "--contact[Feature requests, bugs, mailing lists, etc.]" \
 32+        "--help[Print this help menu.]" \
 33+        "--version[What version of bedtools are you using?.]" \
 34+        "annotate[Annotate coverage of features from multiple files.]" \
 35+        "bamtobed[Convert BAM alignments to BED (& other) formats.]" \
 36+        "bamtofastq[Convert BAM records to FASTQ records.]" \
 37+        "bed12tobed6[Breaks BED12 intervals into discrete BED6 intervals.]" \
 38+        "bedpetobam[Convert BEDPE intervals to BAM records.]" \
 39+        "bedtobam[Convert intervals to BAM records.]" \
 40+        "closest[Find the closest, potentially non-overlapping interval.]" \
 41+        "cluster[Cluster (but don't merge) overlapping/nearby intervals.]" \
 42+        "complement[Extract intervals _not_ represented by an interval file.]" \
 43+        "coverage[Compute the coverage over defined intervals.]" \
 44+        "expand[Replicate lines based on lists of values in columns.]" \
 45+        "fisher[Calculate Fisher statistic b/w two feature files.]" \
 46+        "flank[Create new intervals from the flanks of existing intervals.]" \
 47+        "genomecov[Compute the coverage over an entire genome.]" \
 48+        "getfasta[Use intervals to extract sequences from a FASTA file.]" \
 49+        "groupby[Group by common cols. & summarize oth. cols. (~ SQL "groupBy")]" \
 50+        "igv[Create an IGV snapshot batch script.]" \
 51+        "intersect[Find overlapping intervals in various ways.]" \
 52+        "jaccard[Calculate the Jaccard statistic b/w two sets of intervals.]" \
 53+        "links[Create a HTML page of links to UCSC locations.]" \
 54+        "makewindows[Make interval "windows" across a genome.]" \
 55+        "map[Apply a function to a column for each overlapping interval.]" \
 56+        "maskfasta[Use intervals to mask sequences from a FASTA file.]" \
 57+        "merge[Combine overlapping/nearby intervals into a single interval.]" \
 58+        "multicov[Counts coverage from multiple BAMs at specific intervals.]" \
 59+        "multiinter[Identifies common intervals among multiple interval files.]" \
 60+        "nuc[Profile the nucleotide content of intervals in a FASTA file.]" \
 61+        "overlap[Computes the amount of overlap from two intervals.]" \
 62+        "pairtobed[Find pairs that overlap intervals in various ways.]" \
 63+        "pairtopair[Find pairs that overlap other pairs in various ways.]" \
 64+        "random[Generate random intervals in a genome.]" \
 65+        "reldist[Calculate the distribution of relative distances b/w two files.]" \
 66+        "sample[Sample random records from file using reservoir sampling.]" \
 67+        "shuffle[Randomly redistrubute intervals in a genome.]" \
 68+        "slop[Adjust the size of intervals.]" \
 69+        "sort[Order the intervals in a file.]" \
 70+        "subtract[Remove intervals based on overlaps b/w two files.]" \
 71+        "tag[Tag BAM alignments based on overlaps with interval files.]" \
 72+        "unionbedg[Combines coverage intervals from multiple BEDGRAPH files.]" \
 73+        "window[Find overlapping intervals within a window around an interval.]" \
 74+    ret=0
 75+    ;;
 76+  *)
 77+    _files
 78+    ;;
 79+esac
 80+
 81+return ret
 82diff --git a/plugins/samtools/README.md b/plugins/samtools/README.md
 83new file mode 100644
 84index 0000000000000000000000000000000000000000..f4baf41f78f0dd96a095bd8ebba086c25e062c49
 85--- /dev/null
 86+++ b/plugins/samtools/README.md
 87@@ -0,0 +1,5 @@
 88+# Samtools plugin
 89+
 90+This plugin adds support for [samtools](http://www.htslib.org/):
 91+
 92+* Adds autocomplete options for all samtools sub commands.
 93diff --git a/plugins/samtools/_samtools b/plugins/samtools/_samtools
 94new file mode 100644
 95index 0000000000000000000000000000000000000000..ddb002ae273277a99a261e01650d745e249f2b8b
 96--- /dev/null
 97+++ b/plugins/samtools/_samtools
 98@@ -0,0 +1,40 @@
 99+#compdef samtools
100+#autoload
101+
102+local curcontext="$curcontext" state line ret=1
103+local -a _files
104+
105+_arguments -C \
106+  '1: :->cmds' \
107+  '2:: :->args' && ret=0
108+
109+case $state in
110+  cmds)
111+    _values "samtools command" \
112+        "view[SAM<->BAM conversion]" \
113+        "sort[sort alignment file]" \
114+        "mpileup[multi-way pileup]" \
115+        "depth[compute the depth]" \
116+        "faidx[index/extract FASTA]" \
117+        "tview[text alignment viewer]" \
118+        "index[index alignment]" \
119+        "idxstats[BAM index stats (r595 or later)]" \
120+        "fixmate[fix mate information]" \
121+        "flagstat[simple stats]" \
122+        "calmd[recalculate MD/NM tags and '=' bases]" \
123+        "merge[merge sorted alignments]" \
124+        "rmdup[remove PCR duplicates]" \
125+        "reheader[replace BAM header]" \
126+        "cat[concatenate BAMs]" \
127+        "bedcov[read depth per BED region]" \
128+        "targetcut[cut fosmid regions (for fosmid pool only)]" \
129+        "phase[phase heterozygotes]" \
130+        "bamshuf[shuffle and group alignments by name]"
131+    ret=0
132+    ;;
133+  *)
134+    _files
135+    ;;
136+esac
137+
138+return ret