Gap.code | R Documentation |
Gap coding of DNA nucleotide alignments
Gap.code(seqs)
seqs |
Character vector of aligned (and preferably flank trimmed) DNA sequences. |
FastGap-like gap code nucleotide alignments ('ATGCN-' are allowed).
Encodes gap presence as 'A' and absence as 'C'.
Likely too straightforward, and only weakly optimized (really slow).
Outputs character matrix where each column is a gapcoded position.
Alexey Shipunov
Borchsenius F. 2009. FastGap 1.2. Department of Biosciences, Aarhus University, Denmark. See "http://www.aubot.dk/FastGap_home.htm".
write(file=file.path(tempdir(), "tmp.fasta"), c( ">1\nGAAC------ATGC", ">2\nGAAC------TTGC", ">3\nGAAC---CCTTTGC", ">4\nGAA---------GC")) write(file=file.path(tempdir(), "tmp_expected.fasta"), c( ">1\nGAAC------ATGCCA-", ">2\nGAAC------TTGCCA-", ">3\nGAAC---CCTTTGCCCA", ">4\nGAA---------GCA--")) tmp <- Read.fasta(file=file.path(tempdir(), "tmp.fasta")) expected <- Read.fasta(file=file.path(tempdir(), "tmp_expected.fasta")) seqs <- tmp$sequence gc <- Gap.code(seqs) tmp$sequence <- apply(cbind(seqs, gc), 1, paste, collapse="") identical(tmp, expected) # TRUE, isn't it?
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.