You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
getncbiseq("accession_num")
# store as variable; vector object, nucleotides will be lowercase.
seqvector <- getncbiseq("accession_num")
# print out subsequence of the sequence by indexing.
seqvector[1:50]
Writing sequence data out as a FASTA file (SeqinR)
write.fasta()
# write to fasta file that contains the sequence and the assigned sequence label.
write.fasta(names="seqlabel", sequences=seqvector, file.out="file-name.fasta")
Reading sequence data into R (SeqinR)
# read fasta file into R and store (list object).
seqlist <- read.fasta(file = "file-name.fasta")
# store sequence in vector variable.
seqvector <- seqlist[[1]]
Length of a DNA sequence
# returns sequence length since each vector element contains one nucleotide.
length(seqvector)
Base composition of a DNA sequence (with & without SeqinR)
# count number of occurences of the four nucleotides A, C, G, and T.
table(seqvector)
# SeqinR count() function: table of number of occurences at specified length.
count(seqvector, 1)
# example output:
a c g t
3426 2240 2770 2299
GC Content of DNA (SeqinR)
# returns fraction of bases in sequence that are Gs or Cs.
GC(seqvector)
write.csv(seqtable, "seqtable.csv")
# do not include row names.
write.csv(seqtable, "seq-table.csv", row.names=FALSE)
# store such that special attributes of data structures are preserved.
dump("seqtable", "seq-table.Rdmpd")
Find the Complement String
# returns complement DNA string; non-ACTG returned NA.
comp()