Alternatively, I have ran into issues while doing this in R with the package biomaRt, so here's a work around function for ensembl:
getSeq_ensembl =
Vectorize(
function(chromosome, start, end, strand, species = "Homo_sapiens"){
url = paste0("https://useast.ensembl.org/", species, "/Export/Output/Location?db=core;flank3_display=0;flank5_display=0;output=fasta;r=",
chromosome, ":", start, "-", end, ";strand=", strand,
";utr5=yes;cdna=yes;intron=yes;utr3=yes;peptide=yes;coding=yes;genomic=unmasked;exon=yes;_format=Text")
Biostrings::DNAString(read.csv(url)[1,1])
},
vectorize.args = c("chromosome", "start", "end", "strand", "species")
)
Duplicate of this.
now it becomes How To Get The Sequence Of A Genomic Region From Ucsc?.
Thank you - we are in the process of correcting older links now and this comment was helpful.