I have a list of sequence names (A1, A2, A3, A1, A1, A2 etc) and a fasta file with the names and sequences, and I am trying to find a way to replace each item on the list with the corresponding sequence from the fasta file.
test <- sequences[names(sequences) %in% list]
which just extracts A1, A2, A3 and doesn't give me the remaining ones. What am I missing?
list of sequence names:
A1 A2 A3 A1 A1 A2
>A1 ATCATC >A2 CCCGGG >A3 GTGTGT >A4 TCTATC >A5 ATCTAC
>A1 ATCATC >A2 CCCGGG >A3 GTGTGT
ATCATC CCCGGG GTGTGT ATCATC ATCATC CCCGGG