#! /bin/bash # Last edited on 2008-06-15 08:22:05 by stolfi # Usage: "ncbi_fetch ${outDir} ${id} # Fetches the NCBI file "${id}" in Genbank format. # Puts it in ${outDir}/${id} # The ${id} may or may not include include a version number, # e.g. "NC_003076.5". # Parse command line args if [[ $# -ne 2 ]]; then echo "wrong nargs" 1>&2 ; fi outDir="$1"; shift id="$1"; shift # Fetch the data ofile="${outDir}/${id}" ncbi="http://www.ncbi.nlm.nih.gov/entrez/viewer.cgi" # Example URL: # 'http://www.ncbi.nlm.nih.gov/entrez/viewer.cgi?db=nucleotide&val=NC_005789.1&save=on&view=gb' echo "=== ${ofile} ===" mkdir -p ${outDir}/${sp} wget -nv "${ncbi}?db=nucleotide&val=${id}&save=on&view=gbwithparts" -O ${ofile} ls -l ${ofile} head -5 ${ofile} echo "..." tail -5 ${ofile}