Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rhinoceros
    Senior Member
    • Apr 2013
    • 372

    #1

    NCBI eutils, perl, a small parsing problem

    Hey guys,

    I'm making a simple script that outputs the lineage of a given organism,

    For example,

    $perl lineage.pl homo sapiens

    should output:

    $cellular organisms; Eukaryota; Opisthokonta; Metazoa; Eumetazoa; Bilateria; Deuterostomia; Chordata; Craniata; Vertebrata; Gnathostomata; Teleostomi; Euteleostomi; Sarcopterygii; Dipnotetrapodomorpha; Tetrapoda; Amniota; Mammalia; Theria; Eutheria; Euarchontoglires; Primates; Haplorrhini; Simiiformes; Catarrhini; Hominoidea; Hominidae; Homininae; Homo

    The script is:

    Code:
    use LWP::Simple;
    
    $query = "$ARGV[0]+$ARGV[1]";
    
    #assemble the esearch URL
    $base = 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/';
    $url = $base . "esearch.fcgi?db=taxonomy&term=$query";
    
    #post the esearch URL
    $output = get($url);
    
    #parse txid
    $txid = "$1" if ($output =~ /<Id>(\S+)<\/Id>/);
    
    #assemble the efetch URL
    $url = $base . "efetch.fcgi?db=taxonomy&id=$txid";
    
    #post the esearch URL
    $output = get($url); 
    #print "$output"; works till here
    
    #parse lineage
    $placement = "$1" if ($output =~ /<Lineage>(\S+)<\/Lineage>/);
    print $placement;
    Everything seem to work fine until the last parse (the commented print output looks fine), but I just can't make it print what's between <Lineage></Lineage>.

    The relevant urls are:





    I'd really appreciate it if somebody could fix the last parse (I have no clue if the first parse is 'right' although it seems to work).

    Thanks

    ..I plan to add espell check after the esearch but I want to get the damn thing working first
    Last edited by rhinoceros; 08-01-2013, 06:18 AM.
    savetherhino.org
  • rhinoceros
    Senior Member
    • Apr 2013
    • 372

    #2
    Nevermind, I figured it out.
    Last edited by rhinoceros; 08-01-2013, 10:48 PM.
    savetherhino.org

    Comment

    • rhinoceros
      Senior Member
      • Apr 2013
      • 372

      #3
      edit. nevermind again
      Last edited by rhinoceros; 08-05-2013, 11:14 PM.
      savetherhino.org

      Comment

      Latest Articles

      Collapse

      • SEQadmin2
        Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
        by SEQadmin2



        Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

        Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
        ...
        10-14-2026, 09:55 AM
      • SEQadmin2
        New Genomics Technologies Take Aim at Long-Standing Limits
        by SEQadmin2


        Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

        We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
        ...
        09-28-2026, 10:25 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by SEQadmin2, 10-22-2026, 11:13 AM
      0 responses
      27 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-22-2026, 10:48 AM
      0 responses
      20 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-15-2026, 10:52 AM
      0 responses
      36 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-14-2026, 05:39 AM
      0 responses
      43 views
      0 reactions
      Last Post SEQadmin2  
      Working...