
The perl scripts used in the data analysis are run from a command line.
I have used the MKS Toolkit to provide both the perl language, and also a
command line environment (Korn Shell).  However, perl could also be run
from the Windows "Command Prompt" environment.  The MKS Toolkit emulates
a Unix environment in Windows.  My perl scripts are files with a .tex
extension, which is file extension used by the Vi editor of the MKS Toolkit.
Vi is a classic Unix text editor.

================================================================================

The data used in this analysis came from three sources:

1) NIMH-PDSP data for twenty-five drugs provided exclusively to this author

2) NIMH-PDSP data for four azetidines provided to me by Dave Nichols

3) Affinity data collected from the literature for six drugs (some originating
   from NIMH-PDSP)

The data from NIMH-PDSP comes in the form of Excell spreadsheets, and Nichols
provided copies of his Excell sheets.  The first step of the analytical process
is "Data Preparation", in which the data from the three sources are combined,
and cleaned up (see "Data Preparation" below) for automated analysis.  
Eventually the data is written out as a single text file, YYMMDD.txt, which can 
be directly operated on by the perl scripts.

I have provided the perl scripts, as well as the text file, 061001.txt,
containing the affinity data for all thirty-five drugs.

================================================================================

Data Preparation

1) Download the secondaries data from NIMH-PDSP into a file named
   SecondariesYYMMDD.xls

2) Remove the unneeded rows and columns

3) Rearrange the column order until it matches the
   Azetidines.xls NIMH-PDSP file from Nichols

4) Cut and paste the azetidine data into the
   SecondariesYYMMDD.xls file

5) Replace all green cells with 10000

6) Replace all missing data with 10001

7) Save the data from SecondariesYYMMDD.xls into a text file
   and edit the text file with Vi to:

   a) Remove the characters: , " >

   b) Remove other junk like: (AVE)

   c) Remove spaces from receptor names: 
      Imidazoline 1, Sigma 1, Sigma 2

8) Read back into a file named YYMMDD.xls

9) Add data from literature for Morphine, Salvinorin_A, Ibogaine, 2-Me-5-MeO-DMT, 
   2-Et-5-MeO-DMT, THC to file

10) Save as a file named YYMMDD.txt

11) Copy this edited file into the perl scripts directory

================================================================================

Table of All Ki Values:

1) Read 061001.txt into MSExcell, save as AllKiData061001.xls

2) Cut and paste the no-hit data from Azetidines.xls into AllKiData061001.xls
   This will be the receptors from NMDA to A4B4.  Fill in 10001 for the
   non-ergoline compounds at these receptors.

3) There are numerous receptors listed in Secondaries061001.xls
   that are not in AllKiData061001.xls (those where all data were >10,000,
   these columns need to be added, and filled with data

4) Examine the original data files, Secondaries061001.xls,
   "LSD/extraction 179-182.xls" and "LSD/nichols 99-0179 thru 99-0182.xls"
   look for yellow fields (primary hit, but secondary not done)
   Change these entries to "PH" in AllKiData061001.xls

5) Replace all 10001 with ND, and replace all 10000 with > 10,000

================================================================================

Normalization for npKi Bar Graphs

9) Run: perl PlNormalizeData.tex 061001.txt > NormalizedData.txt

10) Convert NormalizedData.txt into NormalizedData.xls to produce a 
    bar diagram in SPSS, ordered by drug and receptor

================================================================================

Row Order npKi

1) Run: perl PlRowOrder.tex 061001.txt > RowOrder061001.txt

2) Read into MSWord
   a) convert to landscape
   b) make drug names bold
   c) hilight 5ht2a and 5ht2c in red
   d) group all zero data, group all missing data
   e) arrange rows in order by best hit

================================================================================

Col Order npKi

1) Run: perl PlColOrder.tex 061001.txt > ColOrder061001.txt

2) Read into MSWord
   a) convert to landscape
   b) make receptor names bold
   c) group all zero data, group all missing data
   d) arrange rows in order by best hit

================================================================================

Cluster Analysis

11) Run: perl PlVectorAngleMatrix.tex 061001.txt > AngleBetweenDrugs.txt

12) Convert AngleBetweenDrgs.txt into AngleBetweenDrgs.xls to produce a tree
    in SPSS

================================================================================

Regression Analysis

1) Run: perl PlRegressionPrep.tex 061001.txt > RegressionPrep.txt
2) convert RegressionPrep.txt to RegressionPrep.xls
3) Remove the rows for drugs lacking dose data 
4) Add column for "Dose Glennon" from Doses.xls

Use the file for regression analysis.  We want to regress the
Ki values at each receptor, the "Min Ki", and the "Bu" against the "Dose".
We will use log(1/Dose) as the dependent variable.  When the independent
variable is Ki, we will use log(1/Ki).

This is to be compared to the results of:

Glennon RA, Titeler M, McKenney JD.
Evidence for 5-HT2 involvement in the mechanism of action of hallucinogenic agents.
Life Sci. 1984 Dec 17;35(25):2505-11.

So I want to repeat the 5-HT2 regressions for this subset of drugs, which were
also used in their paper: LSD, DOI, DOB, DOM, DOET, TMA-2, MEM, TMA.

================================================================================

Breadth/Selectivity Analysis (Breadth.xls also used for Plot)

1) Run: perl PlBreadthPrep.tex 061001.txt > Breadth.txt
2) read into Excell
3) set cells as number with 4 decimal places, auto-fit column width, 
   center align columns
4) save as Breadth.xls

1) Run: perl PlBreadthProPrep.tex 061001.txt > BreadthPro.txt
2) read into Excell
3) set cells as number with 4 decimal places, auto-fit column width, 
   center align columns
4) save as BreadthPro.xls

1) Run: perl PlBreadthRece.tex 061001.txt > BreadthRece.txt
2) read into Excell
3) set cells as number with 4 decimal places, auto-fit column width, 
   center align columns
4) save as BreadthRece.xls
5) Make a copy of BreadthRece.xls as BreadthReceT.xls, then transpose the 
   data in the copy

These then need to be reordered, by converting into .tex files and
rearranging the lines.  Generally we only want to work with the
normalized values

================================================================================

Plot Analysis

1) Use Breadth.xls produced above from: 
   perl PlBreadthPrep.tex 061001.txt > Breadth.txt
2) Copy Breadth.xls to Plot.xls and make plots in SPSS

================================================================================
