Question: (Closed) extract fasta sequences using gene names
0
gravatar for savscosta
19 months ago by
savscosta0
savscosta0 wrote:

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 • 411 views
ADD COMMENTlink modified 19 months ago by Pierre Lindenbaum130k • written 19 months ago by savscosta0

look at grep with options: -w -A -f

ADD REPLYlink written 19 months ago by Pierre Lindenbaum130k

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!

ADD REPLYlink written 19 months ago by RamRS30k
Please log in to add an answer.
The thread is closed. No new answers may be added.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1265 users visited in the last hour