<commit_before>\documentclass{book}
\usepackage{listings}

\begin{document}
\chapter{Introduction}



\section{Motivation for CLCB}

Lisp is fun. And it was felt that for a particular problem at hand, 
there was little gained over using Bio* libraries for Java, Python or Perl.
Hence, the decision was made to implement in Lisp and from day one kept in
mind to offer the fun to others, too.

But exactly {\em why} is it so much fun? There are probably many answers
to this questions.  For one, the language is very clean, even for concepts
that came into fashion twenty years after Lisp's conception. Take
for instance the overloading of methods when introducing a subclass.
When interating over a set of zoo animals, there is no need for the
typical switch statement to learn about the object's real type and then a
cast to call the real method. If in C or Java you would do something alike

\lstset{language=C}
\begin{lstlisting}
	for(animal *a= alist->first(); a->next();) {
		if ("dog"==typeof(a)) {
			dog *d = (dog *)a;
			d->speak();
		}
		else if ("cat"==typeof(a)) {
		...
		}
	}
\end{lstlisting}

to hear the miows and barks.  In Lisp, you'd get the sound directly for
any animal, also for the ones not originally anticipated in that zoo loop.
For bioinformatics, with its zoo of sequence types and their subtypes,
the genes and what was formerly known as "junk", such cleanliness is essential.

There are other reasons....

\section{How to learn Lisp}

The Net is full of tutorials that introduce to the language
Lisp. We found the instructions at the GMU very good to follow
(http://www.cs.gmu.edu/~sean/lisp/LispTutorial.html). A much recommended
text book is

	<NAME>\\
	Practical Common Lisp\\
	ISBN 1-59059-239-5\\
	Apress

A more biologically inclined reader of this document may decide
to leave the syntax of the language aside while first passing through
this document and instead concentrate more on the understanding
of the classes that represent biological entities in CLCB.

\section{Instant access to CLCB without reading this documentation}

CLCB is developed with SBCL but should be compatible with other implementations with Lisp.

Start the interpreter and type "...." to import all of CLCB libraries.


\end{document}<commit_msg>Some simple examples.<commit_after>\documentclass{book}
\usepackage{listings}

\begin{document}
\chapter{Introduction}



\section{Motivation for CLCB}

Lisp is fun. And it was felt that for a particular problem at hand, 
there was little gained over using Bio* libraries for Java, Python or Perl.
Hence, the decision was made to implement in Lisp and from day one kept in
mind to offer the fun to others, too.

But exactly {\em why} is it so much fun? There are probably many answers
to this questions.  For one, the language is very clean, even for concepts
that came into fashion twenty years after Lisp's conception. Take
for instance the overloading of methods when introducing a subclass.
When interating over a set of zoo animals, there is no need for the
typical switch statement to learn about the object's real type and then a
cast to call the real method. If in C or Java you would do something alike

\lstset{language=C}
\begin{lstlisting}
	for(animal *a= alist->first(); a->next();) {
		if ("dog"==typeof(a)) {
			dog *d = (dog *)a;
			d->speak();
		}
		else if ("cat"==typeof(a)) {
		...
		}
	}
\end{lstlisting}

to hear the miows and barks.  In Lisp, you'd get the sound directly for
any animal, also for the ones not originally anticipated in that zoo loop.
For bioinformatics, with its zoo of sequence types and their subtypes,
the genes and what was formerly known as "junk", such cleanliness is essential.

There are other reasons....

\section{How to learn Lisp}

The Net is full of tutorials that introduce to the language
Lisp. We found the instructions at the GMU very good to follow
(http://www.cs.gmu.edu/~sean/lisp/LispTutorial.html). A much recommended
text book is

	<NAME>\\
	Practical Common Lisp\\
	ISBN 1-59059-239-5\\
	Apress

A more biologically inclined reader of this document may decide
to leave the syntax of the language aside while first passing through
this document and instead concentrate more on the understanding
of the classes that represent biological entities in CLCB.

\section{Instant access to CLCB without reading this documentation}

CLCB is developed with SBCL but should be compatible with other
implementations with Lisp.

Start the interpreter and type "...." to import all of CLCB libraries.

\lstset{language=lisp}
\begin{lstlisting}
(pushnew <path/to/CLCB> asdf:*central-registry*)
(pushnew <path/to/CLCB/ensembl> asdf:*central-registry*)
(asdf:oos 'asdf:load-op :clcb) or
(asdf:oos 'asdf:load-op :clcb-ensembl)
(in-package :ensembl)
ENSEMBL> (fetch-by-stable-id ``ENSG00000000005'')
=> #<GENE {C974EC1}>

(defparameter *gene* (fetch-by-stable-id ``ENSG00000000005''))

ENSEMBL> (transcripts *gene*)
=> (#<TRANSCRIPT {CAB4751}>)

ENSEMBL> (translation (car *))
=> #<TRANSLATION {CAF4C49}>

ENSEMBL> (exons (first (transcripts *gene*)))
=> 
(#<EXON {CB4F9E9}> #<EXON {CB5C809}> #<EXON {CB69539}> #<EXON {CB76249}>
 #<EXON {CB831E9}> #<EXON {CB8FF09}> #<EXON {CB9CC09}> #<EXON {CBA98E9}>
 #<EXON {CBB6619}> #<EXON {CBC3329}> #<EXON {CBD0011}> #<EXON {CBDCD09}>
 #<EXON {CBE9A09}> #<EXON {CBF6729}> #<EXON {CC03421}> #<EXON {CC10149}>
 #<EXON {CC1CE61}> #<EXON {CC2BB61}> #<EXON {CC3A8A9}> #<EXON {CC47AD1}>
 #<EXON {CC56809}>)


ENSEMBL> (protein-features (translation (car (transcripts *gene*))))
(#<PROTEIN-FEATURE {CD15729}> #<PROTEIN-FEATURE {CD178C9}>
 #<PROTEIN-FEATURE {CD18591}> #<PROTEIN-FEATURE {CD19269}>
 #<PROTEIN-FEATURE {CD19F31}> #<PROTEIN-FEATURE {CD1ABF9}>
 #<PROTEIN-FEATURE {CD1B8C9}> #<PROTEIN-FEATURE {CD1C591}>)
ENSEMBL> (mapcar #'protein-feature-type
                 (protein-features (translation (car (transcripts *gene*)))))
("Pfam" "Superfamily" "Superfamily" "Smart" "low_complexity" "low_complexity"
 "low_complexity" "Prosite_profiles")
(mapcar #'dna-sequence-interval
                 (protein-features (translation (car (transcripts *gene*)))))
(#<DNA-SEQUENCE {D1DF909}>
 #<MULTI-INTERVAL (#<DNA-SEQUENCE {D1FD389}> #<DNA-SEQUENCE {D1FE011}>)>
 #<MULTI-INTERVAL (#<DNA-SEQUENCE {D21BEF1}> #<DNA-SEQUENCE {D21CB71}> #<DNA-SEQUENCE {D21D7F1}>)>
 #<DNA-SEQUENCE {D2D2A01}> #<DNA-SEQUENCE {D2EA241}> #<DNA-SEQUENCE {D3019E1}>
 #<MULTI-INTERVAL (#<DNA-SEQUENCE {D320179}> #<DNA-SEQUENCE {D320DF9}>)>
 #<DNA-SEQUENCE {D342429}>)
ENSEMBL> (mapcar #'(lambda (x) (genomic-coordinates (dna-sequence-interval x)))
                 (protein-features (translation (car (transcripts *gene*)))))
((204639 . 204885) (204630 . 205434) (250229 . 255355) (204639 . 204918)
 (242551 . 242602) (216822 . 216855) (204921 . 205473) (204639 . 204888))
\end{lstlisting}


\end{document}
{'fraction_non_alphanumeric': 0.1177334116265414, 'fraction_numerical': 0.04565472695243688, 'mean_word_length': 4.561632653061224, 'pattern_counts': {'":': 0, '<': 54, '<?xml version=': 0, '>': 71, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1726627', 'n_tokens_mistral': 2534, 'n_tokens_neox': 2239, 'n_words': 853}