piscean has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks!
I am using PUBCHEM's PUG REST service to download properties of a specific chemical compound. I want to give STDIN input of the chemical compound in the form of a SMILES string (it's a format to represent a chemical compound, like a molecular formula). The PUG REST URL format looks like this:
http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/smiles/CCC/property/MolecularFormula,MolecularWeight,TPSA/CSV/
http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/smiles/<smiles string>/property/<properties of interest>/<output file format>/Now, how do I STDIN my smiles string in the above format of URL? I've tried some little tricks like this:
and warning was: Use of uninitialized value $finalurl in print at test_lwp.pl line 12. Thanks in advance :)#!/usr/bin/perl use LWP::Simple; my $smiles = <STDIN>; my $url = 'http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/smiles/'; + my $finalurl = get "$url$smiles/property/MolecularFormula,MolecularWei +ght,TPSA/CSV/"; print $finalurl;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to use STDIN in between a URL?
by ikegami (Patriarch) on Apr 24, 2014 at 18:10 UTC | |
by piscean (Acolyte) on Apr 24, 2014 at 18:14 UTC | |
Re: How to use STDIN in between a URL?
by InfiniteSilence (Curate) on Apr 24, 2014 at 18:11 UTC | |
by piscean (Acolyte) on Apr 24, 2014 at 18:16 UTC |
Back to
Seekers of Perl Wisdom