I amended my answer above with a new solution that will address your questions.
Hello everyone. I have a list of genes after a Differencial expresion analysis and i would like to get a FASTA file to work on OmicsBox (ex Blast2Go). Those genes are ID or Locus tag. By the other hand i have a gff file and a fa genome file.
For example i have the EGR_04594 gen, manually i can go to https://www.ncbi.nlm.nih.gov/gene/?term=EGR_04594 and click on the "Go to nucleotide: FASTA" and go to the site https://www.ncbi.nlm.nih.gov/nuccore/NW_020170409.1?report=fasta&from=687977&to=691293&strand=true to get the sequence, save on a text file and save as *.fa and upload it to OmicsBox, then it works.
The problem is that i have so much genes to do it manually, so the question is:
Is there any way to do this kind of "automatic" with more genes and get only one .fa file?
Thank you all!
2 answers
I refined previous answer (moved to a comment to provide context). There are two entries that get pulled up. One is from genome and other is from RefSeq. See the two queries below. [Sequence truncated for space reasons]
Using Entrezdirect:
$ esearch -db gene -query "EGR_04594 [LOCUS_TAG]" | elink -target protein -name gene_protein_refseq | efetch -format fasta_cds_na
>lcl|XM_024493843.1_cds_XP_024351771.1_1 [locus_tag=EGR_04594] [db_xref=GeneID:36340309] [protein=Glutamate dehydrogenase] [protein_id=XP_024351771.1] [location=1..1527] [gbkey=CDS]
ATGGTTATGTGCGTGCGTAAAATGTCAAAAATAGCCCAAATGGCACCTAATGAGACTATTGAGCCTTCGT
TCCATGAAATGGTTCAAATGTTCGCCAAAGAGGGCGTTCCTCACGTCCAAAAAAAACTACTGGCTGAGTT
OR
$ esearch -db gene -query "EGR_04594 [LOCUS_TAG]" | elink -target protein | efetch -format fasta_cds_na
>lcl|XM_024493843.1_cds_XP_024351771.1_1 [locus_tag=EGR_04594] [db_xref=GeneID:36340309] [protein=Glutamate dehydrogenase] [protein_id=XP_024351771.1] [location=1..1527] [gbkey=CDS]
ATGGTTATGTGCGTGCGTAAAATGTCAAAAATAGCCCAAATGGCACCTAATGAGACTATTGAGCCTTCGT
TCCATGAAATGGTTCAAATGTTCGCCAAAGAGGGCGTTCCTCACGTCCAAAAAAAACTACTGGCTGAGTT
>lcl|APAU02000029.1_cds_EUB60575.1_1 [locus_tag=EGR_04594] [protein=Glutamate dehydrogenase] [protein_id=EUB60575.1] [location=complement(join(687977..688221,688300..688645,688736..688975,689052..689710,691257..691293))] [gbkey=CDS]
ATGGTTATGTGCGTGCGTAAAATGTCAAAAATAGCCCAAATGGCACCTAATGAGACTATTGAGCCTTCGT
TCCATGAAATGGTTCAAATGTTCGCCAAAGAGGGCGTTCCTCACGTCCAAAAAAAACTACTGGCTGAGTT
GCCTTTCAAAGGCTCACTAACCGAGAAAGAACACCACATCAGGGGCATTATGATGTCTATGGAACAATGT
Edited: Based on new request I am amending this answer.
Since your identifiers are not accession numbers you can't use the epost method. Try
$ for i in $(cat your_identifier_file); do esearch -db gene -query "${i} [LOCUS_TAG]" | elink -target protein -name gene_protein_refseq | efetch -format fasta_cds_na >> sequence.fa; done
Updating my previous post, i made my gene list with GeneID (no more with Locus Tag), then i have a list like this
36344776
36346103
36336986
36341279
36339830
36346795
36343976
36345820
36338828
36337519
36344362
36344959
36346561
36342521
36346551
36340258
36341314
36342966
36337111
36336623
Then i performed this command
epost -db gene -input "file2.txt" | elink -target protein -name gene_protein_refseq | efetch -format fasta_cds_na
and i finally get what in need, here is (part of) the output:
>lcl|XM_024500329.1_cds_XP_024345260.1_1 [locus_tag=EGR_11080] [db_xref=GeneID:36346795] [protein=Non-capsid protein NS-1] [protein_id=XP_024345260.1] [location=1..588] [gbkey=CDS]
ATGTTTAACCTACGCGCGGTTCCGACGGCCGGCCGTCGCGCAGGCAATCCGGATTTGCGAACCAATCAGC
GTAGAGCACACGCCCGCACCACGGAGACGCACGCATCCCACCCCCCCGGAAGCGGAAGTGAGTCCATTCA
ATGGCTGGAAGACATGTTTTTAGCCAATGAAATCGCCCTTGTCGATTTTGCAATTACGCTTCGCATTATA
ATGAATTGCGAAGATGAGAAAATCAACACTCTTGTGTTGTACGGCCCGACCAATACGGGCAAATCGCTTA
TTTGTAAGCTGACAACGACCTTCCTTGAGCATGGCAGTGTCATGCGCAGGCAGGGGGCATCAGCCTTCGC
TTACGAGAACCTTCTTAATAGGAAGGTTGCGTTAATGGAGGAGCCTGGGATCTGCGCTGCTAACCAGCAG
GATCTGAAGCAGATCCTAGGAGGCGAGACATTTAAGGGCCCCAAAGACATGCAGACGACCCAACAGGCTC
CACAGCCTGTTCAGAGCACTGCCCAACACCCGCCTGCACCTGCGACTCCTACACCACATACATGGCTTAA
AGGTGACACCACCACCTTGTCGGCTTGA
>lcl|XM_024500095.1_cds_XP_024345491.1_1 [locus_tag=EGR_10846] [db_xref=GeneID:36346561] [protein=hypothetical protein] [protein_id=XP_024345491.1] [location=1..693] [gbkey=CDS]
ATGTCGCGACACTTCATGCACTCCGCCAAGGGTACGGATTCCCTACAGCAATCACTGGAAGTGAGGTCGG
TTCGAAGAAGACTAGATGGTCGCAATGTTGCCGTGGACTTGCGTCGTCGTCGGTGCTCCCCTCGGTCAAC
CTCCTGTATCGGCCATCACAACGTAGTCGGTGTTGTAAGAAAGGCACCCAAGAACCAACCGTGCCAATTA
TGGAAATGGCTTGTAACTGAGAAGATATTTGACCACAACGTCAGTGACGAGTTGCTGCAGATCAATGGTT
TCATGACGGCGGGAATGTCGTATCGTCGTGCGGTGGAGATAATCCGGGCGGGTGGCAACTTGGTCCGCCC
CGCTGCGCTGTCGCCGCTGCCTCTACCTGCGCTCTCCTTCGCACGCTTCCATCCACTGCCGCCTATACCG
TCTTCAGCCCCCGTGGTGCCGCAGCCACCACCGGCGCCTCCACTACCACCGCCATATCTCCGCTCACTGC
AGTTCTTTGCCCCTTCATCCGTGCACAAATCATCCATTGGATCCCATCCCCTACTCTCCTCGGCCTCCGC
CGCAGCCGTTGCCTCCACCGCACTACCAGAATGGGGGAATGAGGATGCCTCTGGGTTTCCCCTTCTCTCC
ACCACATTTCCGCCACCCGTTTCTCTCCTCCTCTCTCCACCTCCCACCATCACTGAAATCTAA
So i think this is the way to do this, please correct me if im wrong.
My last question is, is there any way to print the output to a file? Thank you again and hope for the last time!
Log in to answer this question.
You can use Entrezdirect. An
epostsolution can be applied to many entries in one file to get them all.To get nucleotide sequence
Problem is that
locus_tagreturns 163 entries for this genome so I not sure which of these sequences are you interested in or all of them.OR
Thank you for your answer, that is nearly about what im searching for. As you say, in this example "EGR_04594" the command returns 163 entries, but if you look at every entry, there is only one called "EGR_04594". Here are some examples (only first lines are showed):
The code:
Some examples of the entries:
This one returns the locus tag for EGR_04541
This returns the locus tag for EGR_04543
And this entry is for EGR_04494 (this is the entry that im looking for)
I dont know why it returns many entries, if i only asked for "EGR_04594", i really appreciate your help, i was watching for something like this many time ago, hope you may still help me with this last question, thank you!
See the new answer below.
Thank you for your kind help! Now that i found that, im trying to perform the same command, but with many genes from a list. I Have a file called "file.txt" with my genes, and its like this (only few genes are shown, for space reasons):
Then i tried a command, but did not work...i will show:
INPUT
OUTPUT
Hope you may help me again, im really newbie in this things. Thank you again.
Please use
ADD COMMENT/ADD REPLYwhen responding to existing posts to keep threads logically organized.SUBMIT ANSWERis for new answers to original question.