Note: nmed2ris is doomed to disappear from the refdb distribution as most of the functionality (and then some) is available through the med2ris.pl script these days. Don't rely on the existence of this program in future releases.
This input filter accepts a variety of Medline tagged file formats and converts them to RIS format. To import the Pubmed XML format, please see med2ris.pl in the next section. The input is accepted in DOS (with CR/LF line endings) and Unix (LF) formats. nmed2ris is also used as a CGI application to provide its data conversion service in the refdb web interface.
Start nmed2ris with the command:
nmed2ris [-e log-destination] [-h] [-i t|f] [-l log-level] [-L log-file] [-o output-file | -O output-file] [-q] [-s data-source] [-v] [-y confdir] [-f input-file | file]
Remember that you don't have to specify all these options each time if you define the values in nmed2risrc.
The -e option defines the destination of log output. In order for log output to appear at all, the log level has to be specified correctly with the -l option. A log-destination argument of 0 directs log output to stderr, 1 uses the syslog facility, 2 uses a custom log file. For the latter to work you have to specify a log filename with the -L option.
With the -h option nmed2ris displays a brief help screen and exits.
Use the -i option to determine what to do with unknown tags in the source files. An unknown tag may lead to unwanted loss of information. Use the value t to simply ignore unknown tags. If you use f instead, any unknown tag will generate an error.
The -l option determines the maximum log level that a log message may have to be logged. If you specify a high level (<=7), all sorts of messages including debug messages are logged. If you specify a low level (>=0), only critical errors are logged. Specify -1 to disable logging.
The -L option specifies a filename which is used as a custom log file if the -e option is set appropriately.
The -o and -O options specify a filename where the output gets written to or appended, respectively. If neither of these options is used, the output is written to stdout.
Use the -q option to temporarily switch off the settings in the init files. nmed2ris will then use the compile-time defaults unless you specify things with the command line switches (useful for debugging configuration file settings).
Specify the data source with the -s option. Valid arguments are BM (BioMedNet), CC (Current Contents on disk), GM (Grateful Med), HG (HealthGate), KF (Knowledge Finder), PM (PubMed).
-v prints the version information and brief licensing information, then exits.
Use the -y to specify the directory where the global configuration files are.
Note: By default, all refdb applications look for their configuration files in a directory that is specified during the configure step when building the package. That is, you don't need the -y option unless you use precompiled binaries in unusual locations, e.g. by relocating a rpm package.
All other command line parameters will be interpreted as input filenames. nmed2ris can read the incoming data either from these files or from stdin. If data are available at stdin, the filename arguments will be ignored. The output is sent to stdout unless you use one of the -o and -O options, so you can either view the result by piping into a pager or redirect the data into a file. Of course it is also possible to directly pipe the result into refdbc but it may be prudent to manually check the output before sending something to refdbc that you may later regret.
All other command line parameters will be interpreted as input filenames.
The following examples show the usage of nmed2ris for file-based and stream-based in/output, respectively.
~# nmed2ris -o out.ris pm* |
This will convert all files in the current directory starting with pm and write the output into out.ris, overwriting any existing file with the same name.
~# nmed2ris -s PM < pm001.txt >> out.ris |
This will direct the contents of pm001.txt to stdin of nmed2ris and convert the contents. The result will be appended to the file out.ris.
Depending on how nmed2ris is run, it will consult two different configuration files. If it runs as a regular application, the file nmed2risrc will be used. If it runs as a CGI application, nmed2riscgirc will be used instead. This way you can use different configurions even if the user program and the CGI program run on the same computer.
Table 16-3. nmed2risrc
Variable | Default | Comment |
---|---|---|
medsource | PUBMED | The default source of input data. |
outfile | (none) | The default output file name. |
outappend | t | Determines whether output is appended (t) to an existing file or overwrites (f) an existing file. |
ignoretag | t | If set to t, unknown tags in the input data will be silently ignored. If set to f, each unknown tag will generate an error message. |
logfile | /var/log/nmed2ris.log | The full path of a custom log file. This is used only if logdest is set appropriately. |
logdest | 1 | The destination of the log information. 0 = print to stderr; 1 = use the syslog facility; 2 = use a custom logfile. The latter needs a proper setting of logfile. |
loglevel | 6 | The log level up to which messages will be sent. A low setting (0) allows only the most important messages, a high setting (7) allows all messages including debug messages. -1 means nothing will be logged. |
Table 16-4. nmed2riscgirc
Variable | Default | Comment |
---|---|---|
refdblib | (none) | The path of the directory containing shareable refdb files like DTDs, HTML templates etc. |
medsource | PUBMED | The default source of input data. |
outfile | (none) | The default output file name. |
outappend | t | Determines whether output is appended (t) to an existing file or overwrites (f) an existing file. |
ignoretag | t | If set to t, unknown tags in the input data will be silently ignored. If set to f, each unknown tag will generate an error message. |
logfile | /var/log/nmed2ris.log | The full path of a custom log file. This is used only if logdest is set appropriately. |
logdest | 1 | The destination of the log information. 0 = print to stderr; 1 = use the syslog facility; 2 = use a custom logfile. The latter needs a proper setting of logfile. |
loglevel | 6 | The log level up to which messages will be sent. A low setting (0) allows only the most important messages, a high setting (7) allows all messages including debug messages. -1 means nothing will be logged. |
While the primary purpose of nmed2ris is the conversion of various Medline tagged formats to the RIS format digestable for refdb, it does some useful things on the fly:
Regardless of the number of original input files, you'll have to deal with only one output file or output stream at stdout.
Different Medline providers use different formats for the MeSH subheadings. All supported formats are consolidated into a single format to get a consistent database.
Keywords with multiple MeSH subheadings are split into multiple keywords with one MeSH subheading each. This simplifies searching for MeSH subheadings greatly.
nmed2ris is no parser and does not validate the input files, though. That is, the input files must stick to the rules of the data sources, otherwise the conversion results are not predictable. nmed2ris will act according to "garbage in, garbage out" in most cases.
nmed2ris currently supports data from the following source:
nmed2ris also contains code to import data from other sources. This code may be out of date as it is currently not maintained.
Current Contents (no MEDLINE data)
The data source can be explicitly specified with an medsource entry in the init file or with the -s command line option. Either of these should be specified if you read the data from stdin, otherwise nmed2ris defaults to PubMed. Alternatively, you can use a semi-automatic datasource recognition by filename prefixes (this clearly doesn't work for input on stdin). When downloading the files from any of the online sources, simply prefix the filenames with a case-insensitive two-letter code denoting the datasorce:
BioMedNet
Current Contents
Grateful Med
HealthGate
KnowledgeFinder
PubMed
Thus pm001.txt would be recognized as a PubMed input file. A PubMed file not starting with pm would need either the command line switch -s PM or the init file setting medsource PM.