This is a test version of Biostars. For the public version, visit https://www.biostars.org.
BIOINFORMATICS Problem that i am struggling to solve. Computation of Profile

If anybody can answer this question i shall be grateful

Consider the following profile matrix Profile:

A: 0.4 0.3 0.0 0.1 0.0 0.9
C: 0.2 0.3 0.0 0.4 0.0 0.1
G: 0.1 0.3 1.0 0.1 0.5 0.0
T: 0.3 0.1 0.0 0.4 0.5 0.0

Compute Pr(TCGGTA|Profile). (Express your answer as a decimal and do not round your answer more than 5 decimal places.)

sequence genome homework

Also, this looks like directly copied from an assignment. While you got a good answer now, posting this like it is might be considered against our netiquette. In any case, you should check if you understand why the probabilities are calculated the way it is done. In addition, wouldn't it be more realistic to deal with log probabilities?

1 answer

This is a bit of R code to do this,

   options(digits=5)
probTable<-data.frame("A"=c(0.4, 0.3, 0.0, 0.1, 0.0, 0.9),
                      "C"=c(0.2, 0.3, 0.0, 0.4, 0.0, 0.1), 
                      "G"=c( 0.1, 0.3, 1.0, 0.1, 0.5, 0.0),
                      "T"=c(0.3, 0.1, 0.0, 0.4, 0.5, 0.0))

profileprob<-function(profile,probTable){
  profileVector=unlist(strsplit(profile,""))
  score=1
  for (eachBasePosn in (1:length(profileVector))){
   score=score*(probTable[eachBasePosn,profileVector[eachBasePosn]])
    }
  print(paste0("Probability score of profile",profile," is :",score ))
  }

profileprob(profile="TCGGTA",probTable)

For a new profile run it as profileprob(profile="TCGGTA",probTable)

Log in to answer this question.