if (check.binary("bedtools")) {
if (FALSE) {
# get the sequence for a set of regions as a data.frame
index <- get.example.regions();
a <- index[[1]];
b <- get.fasta(bedr.sort.region(a));
# this time output a fasta
d <- get.fasta(b, output.fasta = TRUE);
writeLines(d[[1]], con = "test.fasta");
# get the region adjacent to a set of mutations in a vcf
clinvar.vcf.example <- system.file(
"extdata/clinvar_dbSNP138_example.vcf.gz",
package = "bedr"
);
clinvar <- read.vcf(clinvar.vcf.example);
# note that clinvar uses ncbi fasta which does not use "chr" and codes chrM as MT
clinvar.bed <- data.frame(
chr = paste0("chr", gsub("MT", "M", clinvar$vcf$CHROM)),
start = clinvar$vcf$POS - 2,
end = clinvar$vcf$POS + 1,
stringsAsFactors = FALSE
);
# get trinucleotide sequences of variants on chr M only
mutation.triplet <- get.fasta(
clinvar.bed[which(clinvar.bed$chr == "chrM"), ],
fasta = system.file("extdata/ucsc.hg19.chrM.fasta", package = "bedr"),
check.chr = FALSE
);
}
}
Run the code above in your browser using DataLab