man => 0,
color => 1,
org_mode => 0,
+ symbol => 0,
+ organism => 'Homo sapiens',
);
GetOptions(\%options,
'color|c!',
- 'org_mode|org-mode',
+ 'org_mode|org-mode!',
+ 'symbol|s!',
+ 'organism|o=s',
'debug|d+','help|h|?','man|m');
pod2usage() if $options{help};
pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS;
+my $term = join(' ',@ARGV);
+if ($options{symbol}) {
+ $term = join(' OR ',map {'('.$_.'[Preferred Symbol] AND '.$options{organism}.'[Orgn])'} @ARGV);
+}
+
my $search = Bio::DB::EUtilities->new(-eutil => 'esearch',
-email => 'don@donarmstrong.com',
-db => 'gene',
- -term => join(' ',@ARGV),
+ -term => $term,
-retmax => 1000,
);
my @ids = $search->get_ids();
-id => \@ids,
-retmode => 'xml',
);
-#print $esummary->get_Response()->content();
+#print $esummary->get_Response()->content() if $DEBUG;
use XML::LibXML;
my $xml = XML::LibXML->load_xml(string => $esummary->get_Response()->content());
for my $gene ($xml->findnodes('Entrezgene-Set/Entrezgene')) {
- # print $article->toString;
+ print $gene->toString if $DEBUG;
my ($locus) = $gene->findnodes('.//Gene-ref_locus');
my ($desc) = $gene->findnodes('.//Gene-ref_desc');
my ($summary) = $gene->findnodes('.//Entrezgene_summary');
+ my ($idiogram) = $gene->findnodes('.//Gene-ref_maploc');
+ next unless defined $idiogram;
+ my ($start) = $gene->findnodes('.//Gene-commentary_seqs/Seq-loc/Seq-loc_int/Seq-interval/Seq-interval_from');
+ my ($stop) = $gene->findnodes('.//Gene-commentary_seqs/Seq-loc/Seq-loc_int/Seq-interval/Seq-interval_to');
if ($options{org_mode}) {
print "* ";
}
print $locus->textContent();
print ": ";
print RESET if $options{color};
+ print "(".$idiogram->textContent();
+ print " ".$start->textContent().":";
+ print $stop->textContent().") ";
print BOLD CYAN if $options{color};
print encode_utf8($desc->textContent())."\n";
print RESET if $options{color};