Print sequence alignment to file
-
31-05-2021 - |
Question
I do a simple pairwise DNA sequence alignment with pairwiseAlignment from the Biostrings package in Bioconductor:
library('Biostrings')
seq1 = 'ATGCTA'
seq2 = 'ATGTA'
pairwiseAlignment(pattern = seq1, subject = seq2)
The output looks as follows:
Global PairwiseAlignedFixedSubject (1 of 1)
pattern: [1] ATGCTA
subject: [1] ATG-TA
score: -4.091219
For very long sequences, the output is truncated and only one line is shown:
Global PairwiseAlignedFixedSubject (1 of 1)
pattern: [1] AT-------------------------------------------------...----------------TGTCTTCCAKATCTGGCGCGCCTGGGTTGATATC
subject: [1] ATTGGCGGCCGCGCCACCATGCCAGAGCCAGCGAAGTCTGCTCCCGCCCCG...GAAGGCTGTATGCTGTTGTCTTCAAGATCTGGTACCGCTGGGTTGATATC
score: -29418.8
How can I output the complete alignment to a text file?
Solution
Here is a link to the discussion on the bioconductor mailing list. So far there is no easy way to print the alignment formatted, but maybe it's worth implementing.
https://stat.ethz.ch/pipermail/bioconductor/2012-April/044904.html
OTHER TIPS
I think that the R function printPairwiseAlignment()
from Biostrings
package is designed to do this the way I imagine you're looking for.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow