Docsity

Bioinformatics Problem Set 2: Syntax Errors and Corrections in BioLingua - Prof. Jeffrey E, Assignments of Algorithms and Programming

Toggle sidebar
bg1
Introduction to Bioinformatics
Problem Set 2: BioLingua Syntax
In each case below, fit the statement into the general syntax of BioLingua and the specific syntax
of the relevant function. If the statement produces an error message in BioLingua, explain the
message in terms of the syntax (this is the most important part of the questions), then fix the
error. Note that once the compiler detects one fatal error, it stops looking, so there may be
others Remember to use HELP to find the appropriate syntax of a function.
1a. mole = 6e23
1b. 6e23 = mole
1c. (DEFINE "mole" (AS 6.02 * 10^23))
1d. (DEFINE mole AS 6.02 * 10^23)
1e. (DEFINE mole AS (* 6.02 10^23))
1f. (DEFINE mole AS (* 6.02 ((EXPT 10 23))
1g. (DEFINE-mole AS 6e23)
1h. (ASSIGN mole= 6e23) [Look at the result very carefully]
2a. (SUM OF 1 2 3 4)
2b. (SUM-OF 1 2 3 4)
2c. (SUM-OF (1 2 3 4))
2d. What general syntax does SUM-OF follow -- Lisp or BioLingua-Lite?
3a. FOR-EACH i FROM 1 TO 10
DO (PRINT "HELLO")
3b. (FOR-EACH i FROM 1 TO 10)
DO (PRINT "HELLO"))
3c. (FOR EACH i FROM 1 TO 6
SUM i)
3d. (FOR-EACH IN (LIST-OF NUMBERS 100 TO 1 BY โ€“1)
SUM n)
3e. (FOR-EACH gene IN (GENES-OF ss120)
AS gene size = (LENGTH-OF gene)
DO collect gene size)
3f. (FOR-EACH (GENES-OF ss120)
COLLECT length)
3g. (FOR-EACH gene IN GENES-OF ss120
DO (COLLECT (LENGTH-OF gene)))
3h. (FOR-EACH gene IN (GENES-OF ss120)
COLLECT (LENGTH-OF gene)
SUM (LENGTH-OF gene))
3i. (FOR-EACH n from 1 to 100
WITH sum = 0
DO (+ n sum))
pf2

Partial preview of the text

Download Bioinformatics Problem Set 2: Syntax Errors and Corrections in BioLingua - Prof. Jeffrey E and more Assignments Algorithms and Programming in PDF only on Docsity!

Introduction to Bioinformatics

Problem Set 2: BioLingua Syntax

In each case below, fit the statement into the general syntax of BioLingua and the specific syntax

of the relevant function. If the statement produces an error message in BioLingua, explain the

message in terms of the syntax (this is the most important part of the questions), then fix the

error. Note that once the compiler detects one fatal error, it stops looking, so there may be

others Remember to use HELP to find the appropriate syntax of a function.

1a. mole = 6e

1b. 6e23 = mole

1c. (DEFINE "mole" (AS 6.02 * 10^23))

1d. (DEFINE mole AS 6.02 * 10^23)

1e. (DEFINE mole AS (* 6.02 10^23))

1f. (DEFINE mole AS (* 6.02 ((EXPT 10 23))

1g. (DEFINE-mole AS 6e23)

1h. (ASSIGN mole= 6e23) [Look at the result very carefully]

2a. (SUM OF 1 2 3 4)

2b. (SUM-OF 1 2 3 4)

2c. (SUM-OF (1 2 3 4))

2d. What general syntax does SUM-OF follow -- Lisp or BioLingua-Lite?

3a. FOR-EACH i FROM 1 TO 10

DO (PRINT "HELLO")

3b. (FOR-EACH i FROM 1 TO 10)

DO (PRINT "HELLO"))

3c. (FOR EACH i FROM 1 TO 6

SUM i)

3d. (FOR-EACH IN (LIST-OF NUMBERS 100 TO 1 BY โ€“1)

SUM n)

3e. (FOR-EACH gene IN (GENES-OF ss120)

AS gene size = (LENGTH-OF gene) DO collect gene size)

3f. (FOR-EACH (GENES-OF ss120)

COLLECT length)

3g. (FOR-EACH gene IN GENES-OF ss

DO (COLLECT (LENGTH-OF gene)))

3h. (FOR-EACH gene IN (GENES-OF ss120)

COLLECT (LENGTH-OF gene) SUM (LENGTH-OF gene))

3i. (FOR-EACH n from 1 to 100

WITH sum = 0 DO (+ n sum))

3j. (FOR-EACH n from 1 to 100

WITH sum = 0 DO (INCREMENT sum BY n)

3k. (FOR-EACH gene IN ss

DISPLAY LENGTH-OF gene)

3l. (FOR EACH gene IN (GENES-OF ss120)

DO (LENGTH-OF gene) COLLECT length)

3m. (FOR-EACH gene IN (GENES-OF ss120)

WITH atg-count = 0 WITH non-atg-count = 0 AS start-codon = (SEQUENCE-OF gene FROM 1 TO 3) DO (IF-TRUE (SAME start-codon "atg") THEN (INCREMENT atg-count) ELSE (INCREMENT non-atg-count) FINALLY (COLLECT (LIST atg-count non-atg-count))))

3n. (FOR-EACH gene IN (GENES-OF ss120)

WITH length = (LENGTH-OF gene) COLLECT length)

; This one is very subtle

4a. (LOAD-SHARED-FILE NONCODING-GENES-OF.LISP)

4b. (LOAD-SHARED-FILE "Noncoding-Genes-of .lisp)

5a. (COUNT-OF GENES-OF A7120)

5b. (COUNT-OF (GENES OF A7120)) ; Why do you get the answer you get?

6a. (SEQUENCE-OF all4312 (FROM 1) (TO 20))

6b. (SEQUENCE-OF all4312 FROM-1-TO-20)

6c. (DEFINE tn1 AS

(SEQUENCE-OF a7120 chromosome FROM 6157112 To 6157522))

6d. (DEFINE tn1 AS (SEQUENCE OF a7120 FROM 6157112 TO 6157522))

; Why do you get the answer you get?