This is a test version of Biostars. For the public version, visit https://www.biostars.org.
extract fasta sequences using gene names

Hello. I want to get from the fasta file only those sequences matching the name of gene from a name.txt file

Ex. Input.fasta

>lcl|CP001829.1_gene_1 [gene=dnaA] [locus_tag=CpC231_0001] [location=1..1812] [gbkey=Gene]
TTGTCGGAGGCTCCATCGACATGGAACGAGCGGTGGCAAGAAGTTACTAATGAGCTGCTGTCACAGTCTC
>lcl|CP001829.1_gene_2 [locus_tag=CpC231_0001a] [location=complement(1821..1967)] [gbkey=Gene]
GTGTCGAGTATCACTGAATTACAAGTTTGTAATTACACAGCGTGTATAACTCTGTGGACTACTTTTAAAA
>lcl|CP001829.1_gene_3 [gene=dnaN] [locus_tag=CpC231_0002] [location=2396..3583] [gbkey=Gene]
CCACGTGAATCTTGAACCGGCCACGTGAATCTTGAACCGGCCACGTGAATCTTGAACCGG
>lcl|CP001829.1_gene_4 [gene=recF] [locus_tag=CpC231_0003] [location=3650..4864] [gbkey=Gene]
GTGTACATTCGCGAGCTATCGCTCCGAGATTTTCGTTCGTGGGCAGACTGCCACGTGAATCTTGAACCGG
>lcl|CP001829.1_gene_5 [locus_tag=CpC231_0004] [location=4854..5426] [gbkey=Gene]
ATGAGCAATAAACCTGCTGATGCTGGATCAGAAGATCCCGTAGCAGAGGCATTTGCTGCTATTCGTGCGG
AAGCCCAGCGGCGCACAGGGCGCATCCCCGATCTCTCCGTCCAAGCTCCGCGTTCTGGTTTAAAGCTTAA
>lcl|CP001829.1_gene_6 [gene=gyrB] [locus_tag=CpC231_0005] [location=5566..7611] [gbkey=Gene]
GTGGCAACCGCTGAACATGAATATGGCGCCTCATCCATTACGATCCTTGAGGGTCTAGAGGCTGTACGTA

name.txt

recF
gyrB

output:

>lcl|CP001829.1_gene_6 [gene=gyrB] [locus_tag=CpC231_0005] [location=5566..7611] [gbkey=Gene]
GTGGCAACCGCTGAACATGAATATGGCGCCTCATCCATTACGATCCTTGAGGGTCTAGAGGCTGTACGTA
>lcl|CP001829.1_gene_4 [gene=recF] [locus_tag=CpC231_0003] [location=3650..4864] [gbkey=Gene]
GTGTACATTCGCGAGCTATCGCTCCGAGATTTTCGTTCGTGGGCAGACTGCCACGTGAATCTTGAACCGG

thanks for your help!

genome

Hello savscosta!

We believe that this post does not fit the main topic of this site.

There are plenty of FASTA filtering posts on the site. Have you looked through them?

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

0 answers

No answers yet.

Log in to answer this question.