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
        16S/ITS Profiling vs. Shotgun Metagenomics: What Changes in Your Workflow?
        by SEQadmin2





        NGS has revolutionized clinical microbiology by offering new ways to identify and surveil pathogens without prior knowledge of the target. One popular approach is 16S rRNA and ITS amplicon sequencing, which targets specific microbial markers. But studies are increasingly incorporating shotgun metagenomics, a technique that sequences all DNA from a sample without targeting specific microbial markers. This approach allows more detailed taxonomic classification,...
        10-30-2026, 06:46 AM
      • 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

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by SEQadmin2, Yesterday, 07:59 AM
      0 responses
      15 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 11-05-2026, 09:25 AM
      0 responses
      32 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 11-03-2026, 11:54 AM
      0 responses
      47 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-28-2026, 09:57 AM
      0 responses
      172 views
      0 reactions
      Last Post SEQadmin2  
      Working...