Hello As part of a college project, I have to write a program that finds similar FASTA sequences to a one the user chooses. In my program, say the user enters "cat", I have to display to him all the relevant entries present in the DB, and let him choose one. I have a script that outputs the FASTA data of a certain entry in the NCBI database given its accession number.
I have found the following perl script that converts GI to accession number:
use LWP::Simple;
$gi_list = '24475906,224465210,50978625,9507198';
#assemble the URL
$base = 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/';
$url = $base . "efetch.fcgi?db=nucleotide&id=$gi_list&rettype=acc";
#post the URL
$output = get($url);
print "$output";
However, I haven't found a way to retrieve the GI from the database through code. Thank you for taking the time to read this, I hope you will be able to help me!
I normally don't post replies to homework or project-based questions, but I'll simply point to this post (and indicate you should point this out to your course instructor, it's been two years since the original announcement):
https://www.ncbi.nlm.nih.gov/books/NBK431010/#news_03-02-2016-phase-out-of-GI-numbers
Okay thanks for the update. Let me rephrase my question: how can I retrieve the accession number of a certain entry through code?
See my answer below.