visualizing alignment without realignment
1
0
Entering edit mode
@timivanov92-14799
Last seen 2.6 years ago

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?

msa alignment visualization • 703 views
0
Entering edit mode
UBodenhofer ▴ 260
@ubodenhofer-5425
Last seen 3 months ago
University of Applied Sciences Upper Au…

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")

0
Entering edit mode

hm, it still doesn't work:

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


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

0
Entering edit mode

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.

0
Entering edit mode

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",

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

0
Entering edit mode

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.

0
Entering edit mode

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} ?

0
Entering edit mode

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.

0
Entering edit mode

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",


and in my output i got this:

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

0
Entering edit mode

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.