if (check.binary("bedtools")) {
# 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(a, 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
)
mutation.triplet <- get.fasta(clinvar.bed, check.chr = FALSE);
}Run the code above in your browser using DataLab