R wrapper scripts for genomic tools
gyro provides a set of wrapper scripts for executing popular command-line genomic tools from R. Gyro currently only supports Linux-based systems because of it's use of shell pipes and redirection. It may also require the shell R is run in to be bash.
gyro facilitates the use of genomic programs and pipelines on multiple data sets quickly and easily without the need for shell scripting. In general, the output of gyro functions are the names of the files generated by the output of the program being called. This enables the use of quickly passing the output files of one program as the input files for another program. Below is an example of the execution of a chip-seq pipeline with all fastq files in the current working directory (using magrittr pipes and the converge R package).
# define a vector of file names for all fastq files in the current working directory
f <- files("*.fastq")
# define path to genome chrom sizes file
genome <- "/path/to/genome.chrom.sizes"
# go from fastq to genomewide coverage in a single line
f %>% bowtie("/path/to/bowtieindex") %>% samtoolsView(minQual=10) %>% \
bamToBed %>% bedtoolsGenomeCov(genome) %>% bedGraphToBigWig(genome) -> bigWigs
# without magrittr pipes, one can achieve the same thing as follows
sams <- bowtie(f,"/path/to/bowtieindex")
bams <- samtoolsView(sams,minQual=10)
beds <- bamToBed(bams)
bgs <- bedtoolsGenomeCov(beds,genome)
bws <- bedGraphToBigWig(bgs,genome)
Install devtools if not installed already:
install.packages("devtools")
Then install conifur (convenience functions for R), then gyro:
devtools::install_github("dvera/conifur")
devtools::install_github("dvera/gyro")
The following R packages are recommended:
devtools::install_github("dvera/converge")
devtools::install_github("dvera/travis")
A given program must be installed and available in your $PATH in order to use a gyro script that calls the program. A complete list of programs is tabulated below:
program | gyro function name |
---|---|
bcftools call | bcftoolsCall |
bcftools filter | bcftoolsFilter |
bcftools merge | bcftoolsMerge |
bcftools query | bcftoolsQuery |
bcftools view | bcftoolsView |
bedtools closest | bedtoolsClosest |
bedtools coverage | bedtoolsCoverage |
bedtools genomecov | bedtoolsGenomeCov |
bedtools intersect | bedtoolsIntersect |
bedtools makewindows | bedtoolsMakeWindows |
bedtools map | bedtoolsMap |
bedtools merge | bedtoolsMerge |
bedtools multicov | bedtoolsMultiCov |
bedtools shuffle | bedtoolsShuffle |
bedtools slop | bedtoolsSlop |
bedtools subtract | bedtoolsSubtract |
bfc | bfc |
bgzip | bgzip |
bowtie | bowtie |
bowtie2 | bowtie2 |
bwa aln | bwaAln |
bwa index | bwaIndex |
bwa sampe | bwaSampe |
bwa samse | bwaSamse |
bwa sw | bwaSw |
cuffdiff | cuffdiff |
cufflinks | cufflinks |
cutadapt | cutadapt |
FastQC | fastqc |
fastqp | fastqp |
featureCounts | featureCounts |
hisat | hisat |
kallisto quant | kallistoQuant |
kent utils bedClip | kentBedClip |
kent utils bigWigAverageOverBed | kentBigWigAverageOverBed |
kent utils liftOver | kentLiftOver |
macs callpeak | macsCallPeak |
sambamba rmdup | sambambaRmdup |
samtools cat | samtoolsCat |
samtools index | samtoolsIndex |
samtools merge | samtoolsMerge |
samtools mpileup | samtoolsMpileup |
samtools sort | samtoolsSort |
samtools view | samtoolsView |
seqtk seq | seqtkSeq |
seqtk trimfq | seqtkTrimfq |
stringtie | stringtie |
tophat | tophat |