Question: Building sequence logo from uneven sequences
0
5 weeks ago
rioualen • 360
France

Hi,

I'm looking for methods to build logo from fasta sequences. I'm not sure what strategy to adopt. My input is a fasta file containing various sequences of various sizes (precisely binding sites, so they're rather short). Looks like this:

>Chromosome:180614-180629
GTAAATTACCGTCAG
>Chromosome:200346-200361
GTAAAACCTGGTAAG
>Chromosome:461646-461661
GTAAAGAGATCACCA
>Chromosome:461694-461709
GTAAAGCACTGAAAG
>Chromosome:461714-461731
GTAAACTAAGCGTTGTC

What I have done is to first align the sequences, using an R package named DECIPHER.

>Chromosome:180614-180629
-CATTTAATGGCAGTC-------
>Chromosome:200346-200361
---GTAAAACCTGGTAAG-----
>Chromosome:461646-461661
---GTAAAGAGATCACCA-----
>Chromosome:461694-461709
----GAAAGTCACGAAATG----
>Chromosome:461714-461731
---GTAAACTAAGCGTTGTC---

I then generated logos using the aligned fasta file, using the R library ggseqlogo, and the online version of weblogo. However I'm not satisfied with the result in both cases.

ggseqlogo

ggseqlogo

weblogo

weblogo

It doesn't seem to take into account the "N" characters from my sequences. For example the initial "C" looks big, but in reality it only appears twice among 50 sequences, otherwise this position is unknown.

How can I correct this? Either by changing some parameter, or maybe "trimming" the extremities somehow beforehand?

Thanks!

ADD COMMENTlink 5 weeks ago rioualen • 360 • updated 5 weeks ago SMK ♦ 1.3k
0

The second one I posted is from weblogo, but maybe I'm missing some parameter here? I just posted 5 sequences here but they're 52 in this particular case.

ADD REPLYlink 5 weeks ago
rioualen
• 360
0

I see. Have considered limiting the logo to just the part where there is something in each position?

ADD REPLYlink 5 weeks ago
genomax
68k
0

Yeah but I'm afraid of losing information, and there has to be a cleaner way to do it, it seems like quite a basic problem to me...

ADD REPLYlink 5 weeks ago
rioualen
• 360
1
5 weeks ago
SMK ♦ 1.3k
Ghent, Belgium

Hi rioualen,

What you can do is:

ggseqlogo

seqs <- chartr('ATCG-', 'ATCGN', aln)
ggseqlogo(seqs, method = 'p', namespace = 'ATCGN')

Where aln is your alignment characters. (note that here I switched to the "probability" method, you can turn it back to "bits" by removing method = 'p')

ADD COMMENTlink 5 weeks ago SMK ♦ 1.3k
0

Yeah that's the idea, only I don't want the "N" to appear, for it kinda disturbs the visualization!

ADD REPLYlink 5 weeks ago
rioualen
• 360
0

Indeed. A workaround is to make "N" in light grey:

example_cs

by:

cs_gaps <-
  make_col_scheme(
    chars = c("A", "T", "C", "G", "N"),
    cols = c("#178739", "#CA112C", "#1D4887", "#F3A522", "grey97")
  )
ggseqlogo(seqs, method = 'p', namespace = 'ATCGN', col_scheme = cs_gaps)

But also, base 1, 21, 22, and 23 contain not much info and might be trimmed.

ADD REPLYlink 5 weeks ago
SMK
♦ 1.3k

Login before adding your answer.

Powered by the version 1.4