PROCON source listing

NOTE: See granulesdoc.html for instructions
#################################################################################
10 ID$="PROCON 1.0 mod B2A 4/21/89 Copyright (C) 1989 D.K. Hartline and R.W. Newcomb": PRINT ID$
18 'B02 - Retains only needed ages from Process file
19 'B1A - Adds log histo capability
20 PRINT "PROGRAM TO CONVOLVE AGE HISTOGRAM FROM `GRANULES' WITH PRODUCT-"
30 PRINT "DISTRIBUTION OF PEPTIDES PRODUCED BY PULSE-CHASE OPTION OF `PROCESS'"
40 '*******************************************************************
41 '* AGE HISTOGRAM MUST BE IN STANDARD GRANULESQ3N.PRN FORMAT FILE:  *
42 '* AGE-HISTO_xxxx  NT%  Span  Origin                               *
43 '* DAY  {1*BinWidth}  {2*BW} {3*BW} ...... {NT%*BW}  OVERFLOW      *
44 '* 1        n1          n2     n3            nNT%    n-overflow    *
45 '* etc                                                             *
46 '*******************************************************************
50 '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
51 '+ PRODUCT-DISTRIBUTION MUST BE IN STANDARD PROCESSB2A.PRN FORMAT FILE:  +
52 '+ "PROCESSB2A1"  N%  TMAX  DT                                           +
53 '+ "T",  "P(11)" "P(12)" "P(13)" .... "P(1N%+1)" "P(22)" "P(23)" ....    +
54 '+{1*DT}  P(1,1)  P(1,2)  P(1,3) ....  P(1,N%+1)  P(2,2)  P(2,3) ....    +
55 '+{2*DT}  P(1,1) ......                                                  +
56 '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
59 '
60 'PRODUCT-DISTRIBUTION FILE MUST EXTEND TO AGES GREATER THAN MIDDLE OF LAST
70 '  AGE-HISTO BIN.
97 '
98 ' Open files and check formats
99 '
100 FORM$="PROCESSB2A1"
101 INPUT "INPUT DISK (A:, B:, C:, ... etc)";DDSK$
102 INPUT "OUTPUT DISK(A:, B:, ... etc)";ODSK$
103 'INPUT "DEBUG (1=Bin by bin printout; 2=Normalized bin matrix)";DF%
105 CONV%=1: PROC%=2: AGE%=3
107 NMAX%=5: NTMAX%=25                 'Max # peptide segments;Max # histo bins
110 DIM P(NMAX%,NMAX%),P0(NMAX%,NMAX%),PP(NMAX%,NMAX%,NTMAX%),TH%(40)
115 INPUT "PRINT MODE (0= SCREEN; 1= PRINTER; 2=PRINTER with Processed distrib)";PF%: IF PF%>0 THEN LPRINT ID$
120 INPUT "NAME OF PROCESS FILE (No ext.; Format=PROCESSB2A1)";PROC$
125 OPEN "I",#PROC%,DDSK$+PROC$+".PRN"
130 INPUT #PROC%,FMT$                            'Format code
140 IF FMT$<>FORM$ THEN PRINT "BAD PROCESS FILE FORMAT: ";FMT$: CLOSE PROC%: GOTO 110
145 IF PF%>0 THEN LPRINT "PROCESS FILE = ";DDSK$+PROC$+".PRN"
150 INPUT "NAME OF OUTPUT FILE (No ext.)";CONV$
160 OPEN "O",#CONV%,ODSK$+CONV$+".PRN" 
165 IF PF%>0 THEN LPRINT "OUTPUT FILE = ";CONV$+".PRN"
170 INPUT "NAME OF AGE-HISTO FILE (No ext.; Format=GRANULESQ3N)";AGE$
175 IF PF%>0 THEN LPRINT "AGE-HISTO FILE = ";DDSK$+AGE$+".PRN"
180 OPEN "I",#AGE%,DDSK$+AGE$+".PRN"
190 INPUT #AGE%,TITLE$
192 A$=LEFT$(TITLE$,9)
195 IF A$="AGE-HISTO" THEN LG%=0: GOTO 200
196 IF A$="LOG-AGE-H" THEN LG%=1: GOTO 200 ELSE PRINT "WRONG AGE FILE TYPE: ";TITLE$: CLOSE #AGE%: GOTO 120
197 '
198 'Set-up to read PROCESS file into PP(I%,J%,T%) array
199 '
200 INPUT #AGE%,NT%,SPAN,ORIGIN,LBL$          '# bins, span,origin,"DAY"
205 WDTH=SPAN/NT%
210 CLS
220 INPUT #PROC%,N%,TMAX,DT: PRINT N%;" CLEAVAGE SITES"    '(Note: N%1 THEN LPRINT "PROCESS ARRAY": LPRINT "AGE ";
250 FOR I%=1 TO N%+1              'Input and output PROCESS file column titles
260  FOR J%=I% TO N%+1
265   INPUT #PROC%,LBL$: IF LEFT$(LBL$,1)<>"P" THEN PRINT "P-N% DISCREPANCY :";LBL$: GOTO 100
270   PRINT #CONV%,CHR$(34);LBL$;CHR$(34);       'Write titles to output file
275   PRINT LBL$;" ";: IF PF%>1 THEN LPRINT LBL$;" ";
280   NEXT J%,I%: PRINT #CONV%,"": PRINT: IF PF%>1 THEN LPRINT
300 FOR T%=1 TO NT%          'Calc product distrib P(I%,J%,T%) for every bin T%
310  IF LG%=0 THEN TTARG=(T%-0.5)*WDTH ELSE TTARG=EXP((T%-0.5)*WDTH +ORIGIN)               '... for log histo
320  INPUT #PROC%,T          'Input one line of PROCESS product distribution
330  FOR I%=1 TO N%+1
335   FOR J%=I% TO N%+1
340    P0(I%,J%)=P(I%,J%)          'Save old values
345    INPUT #PROC%,P(I%,J%)       'Get new values
350    NEXT J%,I%
355  IF EOF(PROC%) THEN PRINT "PREMATURE END OF PROCESS ARRAY: ABORT": END
360  IF TTTARG
365  FRACT=(TTARG-T)/DT
367  PRINT USING "### ";T;: IF PF%>0 THEN LPRINT USING "### ";T;
370  FOR I%=1 TO N%+1
375   FOR J%=I% TO N%+1
380    PP(I%,J%,T%)=P(I%,J%)-(P(I%,J%)-P0(I%,J%))*FRACT
385    PRINT USING "#.### ";PP(I%,J%,T%);: IF PF%>1 THEN LPRINT USING "#.### ";PP(I%,J%,T%);
390    NEXT J%,I%: PRINT: IF PF%>1 THEN LPRINT
395  NEXT T%
397 '
398 '******  Set up for Age histo input 
399 '
400 INPUT #AGE%,LBL$                   '1-line header
440 INPUT #AGE%,DAY%: PRINT #CONV%,DAY%;: PRINT USING "DAY ### ";DAY%
450 IF PF%>0 THEN LPRINT USING "DAY ### ";DAY%
460 PRINT "P:   ";: FOR I%=1 TO N%+1: PRINT USING "   #   ";I%;: NEXT I%: PRINT
470 NTOT%=0                            'Clear accumulators; reset pointer
480 FOR I%=1 TO N%+1: FOR J%=I% TO N%+1: P(I%,J%)=0: NEXT J%,I%   'Clear P(I,J)
497 '
498 '****** Convolve PROCESS distribution with each day's Age-histo
499 '
500 FOR T%=1 TO NT%                    'Accumulate products of each age bin
510  INPUT #AGE%, TH%(T%)              '# granules in age bin T%
520  FOR I%=1 TO N%+1: FOR J%=I% TO N%+1
525    P(I%,J%)=P(I%,J%)+PP(I%,J%,T%)*TH%(T%)
530    NEXT J%,I%
535  NTOT%=NTOT%+TH%(T%)               'Accum total # granules
540  NEXT T%
580 INPUT #AGE%,TH%(NT%+1)             'Discard overflow bin
597 '
598 'Output product accumulation normalized by # granules
599 '
600 IF PF%>0 THEN LPRINT "P:    ": FOR I%=1 TO N%+1: LPRINT USING "   #   ";I%;: NEXT I%: LPRINT
605 FOR I%=1 TO N%+1
610  PRINT I%;: IF PF%>0 THEN LPRINT I%;
620  FOR J%=1 TO N%+1
630   IF J%0 THEN LPRINT SPACE$(7);: GOTO 650 ELSE GOTO 650
640   PRINT USING "#.###  ";P(I%,J%)/NTOT%;: IF PF%>0 THEN LPRINT USING "#.###  ";P(I%,J%)/NTOT%;: PRINT #CONV%, USING "#.###  ";P(I%,J%)/NTOT%;
650   NEXT J%: PRINT: IF PF%>0 THEN LPRINT
660  NEXT I%: IF PF%>0 THEN LPRINT "OVERFLOW DISCARD=";TH%(NT%+1): print #conv%," "
710 IF NOT EOF(AGE%) THEN GOTO 440
720 CLOSE: PRINT "NORMAL TERMINATION"
730 END
#################################################################################