#! /bin/bash # Last edited on 2008-06-14 11:17:37 by stolfi # Usage: "extract-all {LISTNAME} {RAWDIR} {OUTDIR}" # Converts Reese human genome files from the Genbank format to the # standard ".bas", ".lab", and ".ama" files. # The input files are "{RAWDIR}/{ITEM}" where # {ITEM} is each of the names listed in the "{LISTNAME}.cands" file. # The output files are "{OUTDIR}/{ITEM}.bas", # "{OUTDIR}/{ITEM}.lab", "{OUTDIR}/{ITEM}.aba", # "{OUTDIR}/{ITEM}.doc" # Diagnostic messages are written to "{LISTNAME}.log". # A list of the {ITEM}s that were not converted, # and the reasons, is written to "{LISTNAME}.bugs". listName="$1"; shift rawDir="$1"; shift outDir="$1"; shift progDir="${STOLFIHOME}/programs/c/DNA/dnabayes" itemList="${listName}.cands" logFile="${listName}.log" bugFile="${listName}.bugs" echo "cleaning ${outDir} ..." /bin/rm -f ${outDir}/*.bas /bin/rm -f ${outDir}/*.lab /bin/rm -f ${outDir}/*.ama /bin/rm -f ${outDir}/*.doc /bin/rm -f ${outDir}/*.trn ls -l ${outDir} /bin/rm -f ${logFile} for item in `cat ${itemList}` ; do echo "=== ${item} ===" ${progDir}/dbd_digest_Reese \ -v outName="${outDir}/${item}" \ ${rawDir}/${item} \ >> ${logFile} \ 2>&1 done cat ${logFile} \ | gawk \ ' /^[*][*]/ { \ gsub(/[:][0-9]+[:]/ , " | ", $0); \ gsub(/^.*[\/]/, "", $0); \ print; \ } \ ' \ > ${bugFile}