_TITLE "sequence show mod #2" ' b+ 2020=09-07 OPEN "seque analysis.txt" FOR INPUT AS #1 ' < load all the lines from analysis into d() string array 'PRINT d(2029) ' good
page = 0 ' < I am showing pages of 40 lines at a time starting at page 0
nextPage:
' !!! carlos redim seqPage(1 to 15) 'to save running total of seq length counts
FOR p
= 1 TO 40 ' << each line is p added to page (a multiple of 40)
'!!! carlos redim seqLength( 1 to 15)
n$
= _TRIM$(STR$(page
+ p
)) ' this is the line number in the data file ready to display MID$(blank$
, 2, LEN(n$
)) = n$
'< i insert the line number into a blank of 6 spaces PRINT blank$;
' < OK there is the line number on screen
' now the data line has 3 parts
fl$
= MID$(d
(page
+ p
), 1, 45) ' <<< this is the 15 2 digit numbers cs$
= MID$(d
(page
+ p
), 46, 15) ' <<< this is the 15 color codes for those numbers sc$
= MID$(d
(page
+ p
), 62) ' <<< this is the running total of each sequence lenth count
'get the previous running total of each sequence lenth count
IF page
= 0 AND p
= 1 THEN ' no previous line sc2$ = ""
sc2$
= MID$(d
(page
+ p
- 1), 62) ' this section of the previous line contains the running totals
' now we will show the 15 numbers color coded with QB4.5 numbers
PRINT MID$(fl$
, i
* 3 - 2, 3);
' print the number
'Now to figure the sequence length counts for the line.
' We will be using Split a powerful parsing tool!
REDIM dat$
(1 TO 1), dat2$
(1 TO 1) ' this sets up 2 dynamic arrays to contain numbers of running totals
Split sc$, " ", dat$() ' this splits sc$ section into and array of numbers the currnet line running totals here
IF sc2$
<> "" THEN Split sc2$
, " ", dat2$
() ' this splits the previous line running totals into an array of numbers
PRINT SPACE$(3);
' just separate the line with some space
'PRINT LBOUND(dat$), UBOUND(dat$)
'END
COLOR i
' set color code for sequence
' now subtract from current line running totals the previous line if there was one
'blank$ = SPACE$(2) ' load our arithmatic into a 2 space blank
'IF sc2$ <> "" THEN
' diff$ = _TRIM$(STR$(VAL(dat$(i)) - VAL(dat2$(i)))) ' do subraction and convert number to string
' MID$(blank$, 1, LEN(diff$)) = diff$ ' < the diffence of the running total for a given seq length
'ELSE
' MID$(blank$, 1, LEN(dat$(i))) = dat$(i)
'END IF
'PRINT blank$; ' and here is goes onto our line
'Carlos here is where you want to do something different
' i = 1 and i = 2 you dont want
' You need to setup:
'different diff calcs
diff
= VAL(dat$
(i
)) - VAL(dat2$
(i
))
' an array (cleared for each line) to hold the maybe: seqLength(i) = seqLength(i) + diff
' and array for the page to hold the running totals for the page: seqPage(i) = seqPage(i) + diff
seqLength(i) = seqLength(i) + diff
seqPage(i) = seqPage(i) + diff
' !!! Carlos from seqLength build a line that list the seq length and counts for seqLength() array
' !!! and print it to finish your lines
IF seqLength
(i
) THEN PRINT " seq"; i;
"="; seqLength
(i
);
'!!! and print it to finish your lines
PRINT ' my line is finished finally !
' !!!!!!!!!! Carlos locate and print the data from the seqPage() totals now
' remember the QB color is same as i
IF seqPage
(i
) THEN LOCATE i
, 100:
PRINT "Total"; i;
"lengths this page ="; seqPage
(i
)
FOR i
= 1 TO 15 'this is color code legend I write at bottom of screen
'ast bit of instruction for page
PRINT SPACE$(25) + "press u for page Up, d for page Down ";
' now wait for keypress to page up or page down and handle it
getpage:
pageDir$ = ""
' a very powerful parsing tool!!!
curpos
= 1: arrpos
= LBOUND(loadMeArray
): LD
= LEN(delim
) dpos
= INSTR(curpos
, SplitMeString
, delim
) loadMeArray
(arrpos
) = MID$(SplitMeString
, curpos
, dpos
- curpos
) arrpos = arrpos + 1
curpos = dpos + LD
dpos
= INSTR(curpos
, SplitMeString
, delim
) loadMeArray
(arrpos
) = MID$(SplitMeString
, curpos
)
'hint to color code writing
'FOR i = 0 TO 15
' PRINT HEX$(i), VAL("&H" + HEX$(i))
'NEXT