**40**wrote:

Hi everyone,

i have been working with PWMenrich package to investigate the motifs in promoter sequences. I have a few questions,

first one is about the position of the motifs in the promoter sequences, i am not sure what i am doing is correct or not, here is the code:

```
for( i in 1:length (sum1tar_top10)){
gg<-scanWithPWM(sum1$pwms[[i]],dna = pat[[1]])
maxposit<-which.max(gg)
motifpositionsforpatterntopten<-append(motifpositionsforpatterntopten,maxposit)
}
```

so sum1tar is basically summary 1 of the target motifs, those are the motifs i got from the motifenrichment analysis on my sequences using the motifenrich function inside the PWMenrich package. So i use scanWithPWM to get the highest score and i am not sure if the highest one represents the optimal position?

So after i have got the position , i hope to plot the sequence with the motif on top of the sequence somehow, i have tried using substring from the biostring package but only able to plot the sequences. So second question is about plotting the motif or highlighting the motif detected with the sequence. after we have detected the motifs, would there be any ways that i could highlight the motifs ? because so far i am only able to make a ranking table in the in the window and highlight the rough position just like the one in the manual. However i would like to see every single base pair with highlighted motifs in the sequence.

The third quesiton is about pairwise alignment and motif anlysis, it is not possible to do motif enrichment with gaps in sequence , so i had to do the enrichment before i do a pairwise alignment for two sequences, however, the positions of the motifs is different after the alignemnt because of the introduction of the gaps after the pairwise alignment. So my third question is how to solve this? can i somehow do the motif enrichment with the gapped consensus sequence from the pairwise alignemnt?I have been working on this for months, any help would be much appreciated.

thank you