Routine sequence analysis with R
Adapted from
- https://cran.r-project.org/web/packages/seqinr/seqinr.pdf
- https://cran.r-project.org/web/packages/rentrez/vignettes/rentrez_tutorial.html
library(seqinr)
library(rentrez)
# From NCBI database
# Increase time out from 1 to 10 seconds
httr::timeout(10)
# Example, NM_001530
m.hif1a <- rentrez::entrez_fetch(db = "nucleotide", id = "NM_001530.4", rettype = "fasta")
m.hif1a.fasta <- as.SeqFastadna(m.hif1a)
# Save the file
write(m.hif1a, file="myHIF1Am.fasta")
# From local file
# mySequence <- read.fasta(file.choose())
hif1a <- read.fasta("myHIF1Am.fasta")
getLength(hif1a)
[1] 3946
# view first 10 positions
hif1A$HIF1A[1:10]
[1] "a" "g" "t" "g" "c" "a" "c" "a" "g" "t"
# Translate, reading frame = 2
getTrans(My.hif1a$HIF1A,frame=1)
/MD