Check CPAN for modules that might already do this. A search on CPAN provides quite a few interesting options.
Ex. Boulder::Blast::NCBI
Take a look at perldoc for basics like perldata and Getopt Long
Take a shot at those and when you run into issues, show your work and ask questions.
#!/usr/bin/perl
use strict;
use warnings;
use Boulder::Blast::NCBI; #or whatever might work best for you
...
Hope that is helpful...
...the majority is always wrong, and always the last to know about it...
Insanity: Doing the same thing over and over again and expecting different results...
A solution is nothing more than a clearly stated problem...otherwise, the problem is not a problem, it is simply an inconvenient fact
| [reply] [d/l] |
| [reply] |
This seems fairly simple and the assignment (well, it really looks like a homework assignment, and the monks here usually prefer when the poster says it upfront)) tells you how to do.
Basically, you first need to read the genes source (NCNI) and load the gene IDs and sequences into a hash. Once this is done, you ask your user to enter a gene ID. Chomp the user input and lookup in the hash if you find it. If the value is defined for the ID, just print the value (sequence); if not, print an error message.
Turning that into Perl is not complicated, and you should really try to do it yourself. If you encouter somme difficulties, feel free to post your code and explain in which respect it does not work as you would expect/want.
| [reply] |
use strict;
use warnings;
...
That's a good start. | [reply] [d/l] |
If i were in in your shoes, i would have asked like this:
Dear monks,
I've got an assignment (and got no plan).
The task is:
- Write a Perl program that asks a user for a gene ID or accession number and returns the sequence that corresponds to that gene.
- Use a hash to accomplish this.
- Get the genes and their sequences from NCBI and create the hash so that the key = gene ID and value = sequence.
- Handle the case where the gene ID is not found in the hash.
Here is what i tried already: # some code.
I need help on how to start because (...).
Thank you very much for any hint.
Regards, jgood4
See PerlMonks FAQ for details.
If you browse through PM, you may notice that interesting, good asked, polite and well formatted questions get high upvotes.
This is not an end in itself.
My best regards, Karl
«The Crux of the Biscuit is the Apostrophe»
| [reply] [d/l] |