| Type: | Package | 
| Title: | Render an ASCII Ruler | 
| Version: | 0.2 | 
| Date: | 2018-01-29 | 
| Author: | Jeremy Leipzig <leipzig@gmail.com> | 
| Maintainer: | Jeremy Leipzig <leipzig@gmail.com> | 
| Description: | An ASCII ruler is for measuring text and is especially useful for sequence analysis. Included in this package are methods to create ASCII rulers and associated GenBank sequence blocks, multi-column text displays that make it easy for viewers to locate nucleotides by position. | 
| License: | GPL-3 | file LICENSE | 
| Depends: | R (≥ 2.14) | 
| Imports: | stringr | 
| Collate: | 'asciiruler.R' | 
| RoxygenNote: | 6.0.1 | 
| Suggests: | testthat | 
| NeedsCompilation: | no | 
| Packaged: | 2018-01-30 15:15:42 UTC; leipzig | 
| Repository: | CRAN | 
| Date/Publication: | 2018-01-30 16:53:24 UTC | 
Generate an ascii ruler
Description
'
' v borders ' +-----------------------------------------------------------------+<-borders ' |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||<-dense_ticks ' | | | | | | | | | | | | | | |<-sparse_ticks ' |-30 -20 -10 0 10 20 30 | ' +-----------------------------------------------------------------+<-borders '
Usage
asciiruler(low = 0L, high = 50L, sparse_ticks = 5L, dense_ticks = TRUE,
  block_space = 0L, borders = FALSE, numbers_down = TRUE,
  line_break = "\n", strict_width = FALSE)
default.asciiruler(x)
Arguments
| low | the range start, can be negative | 
| high | the range end, can be negative | 
| sparse_ticks | intermittent ticks appear every sparse_ticks, set to 0 to hide row | 
| dense_ticks | display a row of ticks at every position | 
| block_space | break up the ruler with a space every block_space blocks encountered, a multiple of sparse_ticks, set to 0 to disable | 
| borders | display borders | 
| numbers_down | display the ruler so the numbers are below the ticks | 
| line_break | the line break character(s) | 
| strict_width | hide numbers whose display would force the ruler to be wider than width(high-low) | 
| x | the asciiruler | 
Value
asciiruler object with the following slots:
- output
- delimited ruler string ready to cat 
- content
- vector of lines comprising the ruler 
- width
- width of ruler 
- leftmargin
- position of the first tick relative to the left edge of the ruler 
References
Inspired by http://codegolf.stackexchange.com/questions/4910/ascii-ruler-generation
Examples
asciiruler(low=-30,high=30,borders=TRUE)
Generate a GenBank sequence block
Description
'
' 1 6 11 16 21 26 31 36 41 46 51 56 ' | | | | | | | | | | | | ' |||||||||| |||||||||| |||||||||| |||||||||| |||||||||| |||||||||| ' 1 GATCACAGGT CTATCACCCT ATTAACCACT CACGGGAGCT CTCCATGCAT TTGGTATTTT ' 61 CGTCTGGGGG GTGTGCACGC GATAGCATTG CGAGACGCTG GAGCCGGAGC ACCCTATGTC ' 121 GCAGTATCTG TCTTTGATTC CTGCCCCATC CTATTATTTA TCGCACCTAC GTTCAATATT ' 181 ACAGGCGAAC ATACTTACTA AAGTGTGTTA ATTAATTAAT GCTTGTAGGA CATAATAATA ' 241 ACAATTGAAT GTCTGCACAG CCGCTTTCCA CACAGACATC ATAACAAAAA ATTTCCACCA ' 301 AACCCCCCCT CCCCCGCTTC TGGCCACAGC ACTTAAACAC ATCTCTGC '
Usage
genbank_seqblock(string, start = 1L, end = 0L, blocksize = 10L,
  width = 60L, sep = " ", line_break = "\n", ruler = TRUE, ...)
Arguments
| string | the sequence string to display | 
| start | the substring start, should be 1 or greater | 
| end | substring end, should be >start, negative to trim | 
| blocksize | number of characters in each block | 
| width | width of the sequence block | 
| sep | space character between blocks | 
| line_break | the line break character(s) | 
| ruler | display an ascii ruler | 
| ... | additional arguments passed to asciiruler | 
Value
delimited GenBank block string ready to cat
Examples
my_sequence<-'GATCACAGGTCTATCACCCTATTAACCACTCACGGGAGCTCTCCATGCATTTGGTATTTTCGTCTGGGGG
GTATGCACGCGATAGCATTGCGAGACGCTGGAGCCGGAGCACCCTATGTCGCAGTATCTGTCTTTGATTC
CTGCCTCATCCTATTATTTATCGCACCTACGTTCAATATTACAGGCGAACATACTTACTAAAGTGTGTTA
ATTAATTAATGCTTGTAGGACATAATAATAACAATTGAATGTCTGCACAGCCACTTTCCACACAGACATC'
my_seqblock<-genbank_seqblock(my_sequence)
cat(my_seqblock)
Print an asciiruler
Description
Print an asciiruler
Usage
## S3 method for class 'asciiruler'
print(x, ...)
Arguments
| x | the asciiruler | 
| ... | additional arguments | 
Get the total width of an ascii ruler
Description
Get the total width of an ascii ruler
Usage
width(x, ...)
Arguments
| x | the asciiruler | 
| ... | additional arguments |