write.fasta | R Documentation |
A function to write a vector of strings representing nucleotide sequences into a text file, with optional line breaks
write.fasta(x, file, linebreak = NULL, sep = "\n")
x |
A |
file |
A character string describing the connection (see the description
of argument |
linebreak |
Interval for line breaking to improve file readability
(default: |
sep |
Character used for line breaking (default: |
NULL
(invisibly).
Guillaume Guénard [aut, cre] (<https://orcid.org/0000-0003-0761-3072>), Pierre Legendre [ctb] (<https://orcid.org/0000-0002-3838-3305>)
## Define a raw vector for storing nuceotide values:
c(Sequence_1 = "ATCG-TTTCG--CCCCA--TTA--TTAA-GTAA-GTAATCTTTCA",
Sequence_2 = "TTGGCTTCC--TC--CAT-TTC--TTCA-GT-ACG-ATTCTTTTA",
Sequence_3 = "TTCG-TACC-T-T---A-ATAA--T-AA-GTCTTGTAATCGTTCA") %>%
sapply(charToRaw) %>%
t -> sqn
## Display the raw sequence:
sqn
## Transforming the sequence to character strings
tmp <- concatenate(sqn)
tmp
## Transforming the sequence to character strings without the gaps:
concatenate(sqn, discard="-")
## Write the sequences into a text file:
write.fasta(tmp, file="Sequences.fst", linebreak=15)
## Clean-up:
file.remove("Sequences.fst")
rm(sqn, tmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.