#!/bin/csh
setenv MOLDIR `pwd`
# accept namelist format directory names, 1 line
if ( $1 != '' ) then
setenv MOLNAME `cut -f1 -d' ' ${1}/names`
# make raster images
balls < ${1}/*.pdb | render -png > ${1}/${MOLNAME}-balls.png
rods < ${1}/*.pdb | render -png > ${1}/${MOLNAME}-rods.png
echo "
"`echo "$*" | \
tr -s ' ' | tr -d ')' | tr -d '(' | tr -d '[' | tr -d ']' | sed s/' -'/' '/ | sed s/' -'/' '/ | sed s/' -'/' '/ | tr -s ' ' | tr -d '*' | tr -d '\"' | tr -d "\'" | tr / ' ' | cut -f1-3 -d ' ' | tr ' ' /`"" \
> ${1}/index.html
echo ""`echo "$*" | \
tr -s ' ' | tr -d ')' | tr -d '(' | tr -d '[' | tr -d ']' | sed s/' -'/' '/ | sed s/' -'/' '/ | sed s/' -'/' '/ | tr -s ' ' | tr -d '*' | tr -d '\"' | tr -d "\'" | tr / ' ' | cut -f2,3 -d ' ' | tr ' ' /`" Index
" \
>> ${1}/index.html
echo "Please note: images may show incorrect connectivity due to improper geometry. We will be working to improve this situation. For now, the left image should be correct, and the other two are correct, if they match the first.
" >> ${1}/index.html
#
# echo -n "${1} " > ${1}/index.html
# echo -n `cat ${1}/names` > ${1}/index.html
# echo "Index" > ${1}/index.html
# echo "${1} index
" > ${1}/index.html
echo "$*" | tr -s ' ' | tr -d ')' | tr -d '(' | tr -d '[' | tr -d ']' | sed s/' -'/' '/ | sed s/' -'/' '/ | sed s/' -'/' '/ | tr -s ' ' | tr -d '*' | tr -d '\"' | tr -d "\'" | tr / ' ' | awk '{print("echo \"
\" && echo -n "$3"\" \" && cat "$1"/"$2"/"$3"/names && echo \"
pdb file: "$3".pdb
sdf file: "$3".sdf\"")}' | csh \
>> ${1}/index.html
cd ${MOLDIR}/$1 && \
echo "$*" | tr / ' ' | cut -f3-104 -d ' ' | tr -s ' ' | tr ' ' '\n' | grep . | \
tr -d ')' | tr -d '(' | tr -d '[' | tr -d ']' | \
sed s/' -'/' '/ | sed s/' -'/' '/ | sed s/' -'/' '/ | tr -s ' ' | tr -d '*' | tr -d '\"' | tr -d "\'" | \
awk '{print("ln -s index.html "$1".html")}' | csh && \
cd ${MOLDIR}
echo "
Image Links
"\
>> ${1}/index.html
\ls $1/ | grep '\.png$' | awk '{print(""$1"
")}'\
>> ${1}/index.html
echo "
Molecule Name Links
"\
>> ${1}/index.html
\ls $1/ | grep '\.html$' | grep -v index.html | sed s/'\.html$'// | awk '{print(""$1"
")}'\
>> ${1}/index.html
echo "
PubChem Fields
"\
>> ${1}/index.html
cat ${1}/*.sdf | tr "\n" "%" | sed s/"%%"/"#"/g | tr "#" "\n" | tr "%" " " | sed s/"> <"// | sed s/">"// | awk '{print(tolower($1)": "$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$80,$81,$82,$83,$84,$85,$86,$87,$88,$89,$90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$100)}' | tr -s ' ' | grep pubchem | txt2html | grep -v "DOCTYPE" | grep -v "http://www.w3.org/TR/html4/strict.dtd" | grep -v "" | grep -v "" | grep -v "" | grep -v "" | grep -v "" | grep -v "" | grep -v "" | sed s/pubchem_/'
pubchem_'/ | sed s/'
'// | sed s/'
pubchem_total_charge'/pubchem_total_charge/\
>> ${1}/index.html
#sed s/pubchem/'pubchem<\/a>'/ \
echo "
Other Related Links
"\
>> ${1}/index.html
\ls $1/ | grep -v '\.html$' | grep -v '\.png$' | grep -v index.html | awk '{print(""$1"
")}'\
>> ${1}/index.html
echo "
More coming soon!"\
>> ${1}/index.html
echo inserting header
~/grabHtmlHeader ${1}/index.html ; ~/insertSidebar2 ${1}/index.html
else
echo argument required
endif