Question: visualizing alignment without realignment
0
gravatar for tim.ivanov.92
5 months ago by
tim.ivanov.920 wrote:

I'm using msa package to visualize alignments which i already have. But it seems that to create an msa object i can't use 'none' method

myFirstAlignment <- msa(mySequences,method = 'none')

'arg' should be one of “ClustalW”, “ClustalOmega”, “Muscle”

Is there a way to create an msa object without realigning?

alignment visualization msa • 212 views
ADD COMMENTlink modified 5 months ago by Martin Morgan ♦♦ 23k • written 5 months ago by tim.ivanov.920
Answer: visualizing alignment without realignment
0
gravatar for UBodenhofer
5 months ago by
UBodenhofer250
Johannes Kepler University, Linz, Austria
UBodenhofer250 wrote:

Yes, it is true that msa() performs a multiple alignment on a set of unaligned sequences. If the sequences are indeed unaligned, there is no way to create a multiple alignment object without alignment. If the sequences are aligned (at least weakly in the sense that they all have the same lengths, possibly with gaps), then it is possible to directly convert them using AAMultipleAlignment(mySequences) or, if you want the data structures as used by the msa package: as(AAMultipleAlignment(mySequences), "MsaAAMultipleAlignment")

ADD COMMENTlink written 5 months ago by UBodenhofer250

hm, it still doesn't work:

new_aln=as(AAMultipleAlignment("full_path_to_my_alignment.clw"), "MsaAAMultipleAlignment")
msaPrettyPrint(new_aln, output="pdf", showNames="none",
               showLogo="none", askForOverwrite=FALSE, verbose=FALSE)

which result in error

Error in texi2dvi(texfile, quiet = !verbose, pdf = identical(output,"pdf"), : unable to run 'pdflatex' on 'new_aln.tex'

...and it does work as expected on toy examples from package manual, so latex is set up properly

ADD REPLYlink written 5 months ago by tim.ivanov.920

I am not 100% sure, but, as far as I know, LaTeX might have issues with underscores in file names on Windows. Please try a different name of the object without an underscore character and let me know if that fixes the problem.

ADD REPLYlink written 5 months ago by UBodenhofer250

no, sry - still this problem (also, i'm on mac, not windows)

newaln=as(AAMultipleAlignment("/Users/timofei.ivanov/projects/2bit_to_maf/clusters_with_deletions/74hephrevcompl.fasta"), "MsaAAMultipleAlignment")
> msaPrettyPrint(newaln, output="pdf", showNames="none",
+                showLogo="none", askForOverwrite=FALSE, verbose=FALSE)
Error in texi2dvi(texfile, quiet = !verbose, pdf = identical(output, "pdf"),  : 
  unable to run 'pdflatex' on 'newaln.tex'
  
ADD REPLYlink written 5 months ago by tim.ivanov.920

I suggest you change output="pdf" to output="tex" and run pdflatex on the resulting file newaln.tex, and look what error message is thrown. Unfortunately, the texi2dvi() function does not convey enough information about what the problem is.

ADD REPLYlink written 5 months ago by UBodenhofer250

ok, here is what i got from

dflatex newaln.tex

Admins-iMac:clusterswithdeletions timofei.ivanov$ pdflatex newaln.tex This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=pdflatex) restricted \write18 enabled. entering extended mode (./newaln.tex LaTeX2e <2018-04-01> patch level 2 Babel <3.18> and hyphenation patterns for 84 language(s) loaded. (/usr/local/texlive/2018/texmf-dist/tex/latex/base/article.cls Document Class: article 2014/09/29 v1.4h Standard LaTeX document class (/usr/local/texlive/2018/texmf-dist/tex/latex/base/size10.clo)) (/usr/local/texlive/2018/texmf-dist/tex/latex/texshade/texshade.sty Package `texshade', Version 1.25 of 2018/01/17. (/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/color.sty (/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-cfg/color.cfg) (/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-def/dvips.def) (/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/dvipsnam.def)) (/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/graphics.sty (/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/trig.sty) (/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-cfg/graphics.cfg) (/usr/local/texlive/2018/texmf-dist/tex/latex/graphics-def/pdftex.def)) (/usr/local/texlive/2018/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/local/texlive/2018/texmf-dist/tex/latex/amsfonts/amsfonts.sty))) (./newaln.aux) (/usr/local/texlive/2018/texmf-dist/tex/context/base/mkii/supp-pdf.mkii [Loading MPS to PDF converter (version 2006.09.02).] ) (/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty (/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/infwarerr.sty) (/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/grfext.sty (/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty (/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/ltxcmds.sty))) (/usr/local/texlive/2018/texmf-dist/tex/latex/oberdiek/kvoptions.sty (/usr/local/texlive/2018/texmf-dist/tex/latex/graphics/keyval.sty) (/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty (/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/etexcmds.sty (/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/ifluatex.sty)))) (/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty (/usr/local/texlive/2018/texmf-dist/tex/generic/oberdiek/ifpdf.sty)) (/usr/local/texlive/2018/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg)) (/var/folders/c5/vw343qls2wg037rbtyhhz8vm0000gp/T//RtmpoveBWF/seq82a57890887.fa sta: . ! Missing number, treated as zero. <to be="" read="" again=""> \consU& l.35 \end{texshade} ?

ADD REPLYlink written 5 months ago by tim.ivanov.920

Sorry, I cannot determine the source of the problem. Do your sequences contain a character that LaTeX cannot handle? (this is only a wild guess) I suggest you send me the input file and the TeX file via a private message (bodenhoferatbioinf.jku.at) and I will try to go deeper into the problem.

ADD REPLYlink written 5 months ago by UBodenhofer250

also can you help me with dna alignments? If i'm willing to realign with, for example muscle, i do it this way:

mySequences <- readDNAStringSet("100_slo_chr3R_24691930_24694960_1_exon2.fasta")
myFirstAlignment <- msa(mySequences,method = 'Muscle',type='dna')
msaPrettyPrint(myFirstAlignment, output="pdf", 
               shadingMode="identical",
               shadingColors="reds", showLogo="none",
               showLegend=FALSE, askForOverwrite=FALSE)

and in my output i got this: my_alignment

Can i color only matching letters on a DNA, or is this package for AA only? link for image doesn't work, so here is it https://imgur.com/JG2NjUF

ADD REPLYlink modified 5 months ago • written 5 months ago by tim.ivanov.920

I am not 100% sure what you are asking for. My interpretation of "matching letters" is that shadingMode="identical" should do the job. If the issue is rather that N is treated like a regular character, my suggestion is simple: replace all N's with dashes. If you need more custom functionality, you need to study the features of TeXshade and use the furtherCode argument of the msaPrettyPrint() function. An example is shown in Section 7.4 of the package vignette.

ADD REPLYlink written 5 months ago by UBodenhofer250
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 289 users visited in the last hour