what should i do to calculate percentage of occurrence of characters in an argument if the data are
t<-c(UUU,UUC,UUA,UUG,CUU,CUC,CUA,CUG,AUU,AUC,AUA,AUG,GUU,GUC,GUA,GUG,UCU,UCC,UCA,UCG,CCU,CCC,CCA,CCG,ACU,ACC,ACA,ACG,GCU,GCC,GCA,GCG,UAU,UAC,UAA,UAG,CAU,CAC,CAA,CAG,AAU,AAC,AAA,AAG,GAU,GAC,GAA,GAG,UGU,UGC,UGA,UGG,CGU,CGC,CGA,CGG,AGU,AGC,AGA,AGG,GGU,GGC,GGA,GGG)
i want to make a function regarding this which may help me in future to calculate more problems in future.
suppose our argument would be-
(UUUUUCUUAUUGCUUCUCCUACUGAUUAUCAUAAUGGUUGUCGUAGUGUCUUCCUCAUCGCCUCCCCCACCGACUACCACAACGGCUGCCGCAGCGUAUUACUAAUAGCAUCACCAACAGAAUAACAAAAAGGAUGACGAAGAGUGUUGCUGAUGGCGUCGCCGACGGAGUAGCAGAAGAGGUGGCGGAGGG)
also, the reading frame would start right in the starting which separate in the number of 3(e.g-AUG,GUG) I got this code which is following but i want my answer in the form of list with two columns named count and percentage, please help me in modify this code to give percentage in required manner.
seqn <- c("UUA","AUC","GUA", "UUA", "GAU", "UUA") #your sequence
l_seq <- length(seqn)
u_seq <- unique(seqn)
seq_long <- "UUUAUGGGCG"
seqn <- unlist(str_extract_all(seq_long, pattern = "[AUGC]{3}"))
colSums(sapply(u_seq, function(s) str_count(string = seqn,pattern = s)))/l_seq
help me in correcting this code i want my argument continuous like UGCUGCUAUGAAUGAUG