This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Writing a fasta file in R

I am trying to write a fasta file in R using this code:

write.fasta(sequences=df$seq, names=df$location, file.out="fasta", open = "w", nbchar = 33, as.string = FALSE)

df$seq contains my sequences and df$locations contains locations

However, my file produced looks like this

> +111
> +4675
> -837
> -2793
> +283
> +398
AGGGGGGCCCCA....

Can anyone understand why my sequences are not linking to their specific location?

My dataframe looks like this:

location  seq
+111      AGGGGC...
+4675     ATTTGGGC...
-837      AGGGTTGC...
-2793     AGGGGC...
+283      AGTGGGC...
+398      AGGGTTGC...
fasta sequencing r

1 answer

I have managed to solve my problems with the details in this link: https://bootstrappers.umassmed.edu/guides/main/r_writeFasta.html

Log in to answer this question.