{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "##Collating for real with CollateX\n", "\n", "Okay, let's do some serious hands-on collation.\n", "\n", "First of all we want to make sure that you have the latest version of CollateX. That's why we do…" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "!pip install --pre --upgrade collatex" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You don't need to do this every time, but make sure you do it regularly.\n", "\n", "Next we need to tell Python that we will be needing the Python library that holds the code for CollateX…" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from collatex import *" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we're ready to make a collation object. We do this with the slightly hermetic line of code: \n", "\n", " collation = Collation()\n", " \n", "Here the small caps `collation` is the arbitrary named variable that refers to a copy (officially it is called an *instance*) of the CollateX collation engine. We simply tell the collation library to create a new instance by saying `Collation()`." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "collation = Collation()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we add some witnesses. Each witness gets a letter or name that will identify them, and for each we add the literal text of the witness to the collation object, like so…" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "collation.add_plain_witness( \"A\", \"The quick brown fox jumped over the lazy dog.\")\n", "collation.add_plain_witness( \"B\", \"The brown fox jumped over the dog.\" )\n", "collation.add_plain_witness( \"C\", \"The bad fox jumped over the lazy dog.\" )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And now we can let CollateX do its work of collating these witnesses and sit back for about 0.001 seconds. The result will be an alignment table, so we'll refer to the result with a variable named `alignment_table`." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": true }, "outputs": [], "source": [ "alignment_table = collate(collation, layout='vertical', segmentation=False )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Well, that worked nicely it seems. But there's no printout, no visualization. That's okay, we can come up with a printout of the alignment table too:" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "+--------+--------+--------+\n", "| A | B | C |\n", "+--------+--------+--------+\n", "| The | The | The |\n", "+--------+--------+--------+\n", "| quick | - | bad |\n", "+--------+--------+--------+\n", "| brown | brown | - |\n", "+--------+--------+--------+\n", "| fox | fox | fox |\n", "+--------+--------+--------+\n", "| jumped | jumped | jumped |\n", "+--------+--------+--------+\n", "| over | over | over |\n", "+--------+--------+--------+\n", "| the | the | the |\n", "+--------+--------+--------+\n", "| lazy | - | lazy |\n", "+--------+--------+--------+\n", "| dog | dog | dog |\n", "+--------+--------+--------+\n", "| . | . | . |\n", "+--------+--------+--------+\n" ] } ], "source": [ "print( alignment_table )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Usually you will want those segments that run parallel to be collected and displayed together. Since this is what most people seem to want, CollateX does that by default. We switched this option off in the example above for a moment because the result then shows you more clearly what the underlying primary structure is that CollateX returns. But for all practicle purposes you will probabably lose that `segmentation=False` option. So, let's get rid of that, and collate again…" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": true }, "outputs": [], "source": [ "alignment_table = collate(collation, layout='vertical' )" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "+---------------------+---------------------+---------------------+\n", "| A | B | C |\n", "+---------------------+---------------------+---------------------+\n", "| The | The | The |\n", "+---------------------+---------------------+---------------------+\n", "| quick | - | bad |\n", "+---------------------+---------------------+---------------------+\n", "| brown | brown | - |\n", "+---------------------+---------------------+---------------------+\n", "| fox jumped over the | fox jumped over the | fox jumped over the |\n", "+---------------------+---------------------+---------------------+\n", "| lazy | - | lazy |\n", "+---------------------+---------------------+---------------------+\n", "| dog. | dog. | dog. |\n", "+---------------------+---------------------+---------------------+\n" ] } ], "source": [ "print( alignment_table )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The aligment table visualization is CollateX's default way of rendering a collation result. There are various ways in which one can depict collated results of course. The output in alignment table form can be a good basis for further visualizations. CollateX can also format your collation as a variant graph. This is a visualization that lets you trace from left to right through a directed network, to follow which witness carries what readings." ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "%3\n", "\n", "\n", "0\n", "\n", "\n", "\n", "2\n", "\n", "The\n", "\n", "\n", "0->2\n", "\n", "\n", "A, B, C\n", "\n", "\n", "1\n", "\n", "\n", "\n", "3\n", "\n", "quick\n", "\n", "\n", "2->3\n", "\n", "\n", "A\n", "\n", "\n", "4\n", "\n", "brown\n", "\n", "\n", "2->4\n", "\n", "\n", "B\n", "\n", "\n", "12\n", "\n", "bad\n", "\n", "\n", "2->12\n", "\n", "\n", "C\n", "\n", "\n", "3->4\n", "\n", "\n", "A\n", "\n", "\n", "5\n", "\n", "fox jumped over the\n", "\n", "\n", "4->5\n", "\n", "\n", "A, B\n", "\n", "\n", "9\n", "\n", "lazy\n", "\n", "\n", "5->9\n", "\n", "\n", "A, C\n", "\n", "\n", "10\n", "\n", "dog.\n", "\n", "\n", "5->10\n", "\n", "\n", "B\n", "\n", "\n", "9->10\n", "\n", "\n", "A, C\n", "\n", "\n", "10->1\n", "\n", "\n", "A, B, C\n", "\n", "\n", "12->5\n", "\n", "\n", "C\n", "\n", "\n", "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "graph = collate( collation, output=\"svg\" )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Okay, that's all good and nice, but that's just tiny fragments—we want decent chunks of text to collate! Well, we can do that too, although is requires a little more work. Specifically for reading in text files from the file system. If we didn't do it that way, we would have to key in all characters of each witness, and that's just a lot of unnecessary work if we have done those texts already in a file. The below code uses the `open` command to open each text file and appoint the contents to a variable with an appropriately chosen name.\n", "\n", "The `encoding=\"utf-8\"` bit is needed because you should always tell Python which encoding your data uses. This is probably the only place and time where you will use that encoding directive: when you open a (text) file." ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [], "source": [ "collation = Collation()\n", "witness_1859 = open( \"./fixtures/Darwin/txt/darwin1859_par1.txt\", encoding='utf-8' ).read()\n", "witness_1860 = open( \"./fixtures/Darwin/txt/darwin1860_par1.txt\", encoding='utf-8' ).read()\n", "witness_1861 = open( \"./fixtures/Darwin/txt/darwin1861_par1.txt\", encoding='utf-8' ).read()\n", "witness_1866 = open( \"./fixtures/Darwin/txt/darwin1866_par1.txt\", encoding='utf-8' ).read()\n", "witness_1869 = open( \"./fixtures/Darwin/txt/darwin1869_par1.txt\", encoding='utf-8' ).read()\n", "witness_1872 = open( \"./fixtures/Darwin/txt/darwin1872_par1.txt\", encoding='utf-8' ).read()\n", "collation.add_plain_witness( \"1859\", witness_1859 )\n", "collation.add_plain_witness( \"1860\", witness_1860 )\n", "collation.add_plain_witness( \"1861\", witness_1861 )\n", "collation.add_plain_witness( \"1866\", witness_1866 )\n", "collation.add_plain_witness( \"1869\", witness_1869 )\n", "collation.add_plain_witness( \"1872\", witness_1872 )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now let's check if these witnesses actually contain some text." ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "WHEN we look to the individuals of the same variety or sub-variety of our older cultivated plants and animals, one of the first points which strikes us, is, that they generally differ much more from each other, than do the individuals of any one species or variety in a state of nature. When we reflect on the vast diversity of the plants and animals which have been cultivated, and which have varied during all ages under the most different climates and treatment, I think we are driven to conclude that this greater variability is simply due to our domestic productions having been raised under conditions of life not so uniform as, and somewhat different from, those to which the parent-species have been exposed under nature. There is, also, I think, some probability in the view propounded by Andrew Knight, that this variability may be partly connected with excess of food. It seems pretty clear that organic beings must be exposed during several generations to the new conditions of life to cause any appreciable amount of variation; and that when the organisation has once begun to vary, it generally continues to vary for many generations. No case is on record of a variable being ceasing to be variable under cultivation. Our oldest cultivated plants, such as wheat, still often yield new varieties: our oldest domesticated animals are still capable of rapid improvement or modification.\n", "\n" ] } ], "source": [ "print( witness_1859 )" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "WHEN we look to the individuals of the same variety or sub-variety of our older cultivated plants and animals, one of the first points which strikes us, is, that they generally differ more from each other than do the individuals of any one species or variety in a state of nature. When we reflect on the vast diversity of the plants and animals which have been cultivated, and which have varied during all ages under the most different climates and treatment, I think we are driven to conclude that this great variability is simply due to our domestic productions having been raised under conditions of life not so uniform as, and somewhat different from, those to which the parent-species have been exposed under nature. There is also, I think, some probability in the view propounded by Andrew Knight, that this variability may be partly connected with excess of food. It seems pretty clear that organic beings must be exposed during several generations to the new conditions of life to cause any appreciable amount of variation; and that when the organisation has once begun to vary, it generally continues to vary for many generations. No case is on record of a variable being ceasing to be variable under cultivation. Our oldest cultivated plants, such as wheat, still often yield new varieties: our oldest domesticated animals are still capable of rapid improvement or modification.\n", "\n" ] } ], "source": [ "print( witness_1860 )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And now let's collate those witnesses and let's put the result up as an HTML-formatted alignment table…" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
185918601861186618691872
---Causes of
Variability.
Causes of
Variability.
Causes of
Variability.
WHEN weWHEN weWHEN weWHEN weWHEN weWHEN we
look tolook tolook tolook tocomparecompare
the individuals of
the same variety or
sub- variety of our
older cultivated
plants and animals,
one of the first
points which strikes
us
the individuals of
the same variety or
sub- variety of our
older cultivated
plants and animals,
one of the first
points which strikes
us
the individuals of
the same variety or
sub- variety of our
older cultivated
plants and animals,
one of the first
points which strikes
us
the individuals of
the same variety or
sub- variety of our
older cultivated
plants and animals,
one of the first
points which strikes
us
the individuals of
the same variety or
sub- variety of our
older cultivated
plants and animals,
one of the first
points which strikes
us
the individuals of
the same variety or
sub- variety of our
older cultivated
plants and animals,
one of the first
points which strikes
us
,,,,--
is, that they
generally differ
is, that they
generally differ
is, that they
generally differ
is, that they
generally differ
is, that they
generally differ
is, that they
generally differ
much-----
moremoremoremore-more
from each otherfrom each otherfrom each otherfrom each otherfrom each otherfrom each other
,---more-
than do the
individuals of any
one species or
variety in a state
of nature.
than do the
individuals of any
one species or
variety in a state
of nature.
than do the
individuals of any
one species or
variety in a state
of nature.
than do the
individuals of any
one species or
variety in a state
of nature.
than do the
individuals of any
one species or
variety in a state
of nature.
than do the
individuals of any
one species or
variety in a state
of nature.
WhenWhenWhenWhenAnd ifAnd if
we reflect on the
vast diversity of
the plants and
animals which have
been cultivated, and
which have varied
during all ages
under the most
different climates
and treatment,
we reflect on the
vast diversity of
the plants and
animals which have
been cultivated, and
which have varied
during all ages
under the most
different climates
and treatment,
we reflect on the
vast diversity of
the plants and
animals which have
been cultivated, and
which have varied
during all ages
under the most
different climates
and treatment,
we reflect on the
vast diversity of
the plants and
animals which have
been cultivated, and
which have varied
during all ages
under the most
different climates
and treatment,
we reflect on the
vast diversity of
the plants and
animals which have
been cultivated, and
which have varied
during all ages
under the most
different climates
and treatment,
we reflect on the
vast diversity of
the plants and
animals which have
been cultivated, and
which have varied
during all ages
under the most
different climates
and treatment,
I thinkI thinkI thinkI think--
we are driven to
conclude that this
we are driven to
conclude that this
we are driven to
conclude that this
we are driven to
conclude that this
we are driven to
conclude that this
we are driven to
conclude that this
greatergreatgreatgreatgreatgreat
variability isvariability isvariability isvariability isvariability isvariability is
simplysimplysimplysimply--
due to our domestic
productions having
been raised under
conditions of life
not so uniform as,
and somewhat
different from,
those to which the
parent- species
due to our domestic
productions having
been raised under
conditions of life
not so uniform as,
and somewhat
different from,
those to which the
parent- species
due to our domestic
productions having
been raised under
conditions of life
not so uniform as,
and somewhat
different from,
those to which the
parent- species
due to our domestic
productions having
been raised under
conditions of life
not so uniform as,
and somewhat
different from,
those to which the
parent- species
due to our domestic
productions having
been raised under
conditions of life
not so uniform as,
and somewhat
different from,
those to which the
parent- species
due to our domestic
productions having
been raised under
conditions of life
not so uniform as,
and somewhat
different from,
those to which the
parent- species
havehavehavehavehadhad
been exposed under
nature. There is
been exposed under
nature. There is
been exposed under
nature. There is
been exposed under
nature. There is
been exposed under
nature. There is
been exposed under
nature. There is
,----,
alsoalsoalsoalsoalsoalso
, I think, I think, I think, I think, I think-
, some probability
in the view
propounded by Andrew
Knight, that this
variability may be
partly connected
with excess of food.
It seems
, some probability
in the view
propounded by Andrew
Knight, that this
variability may be
partly connected
with excess of food.
It seems
, some probability
in the view
propounded by Andrew
Knight, that this
variability may be
partly connected
with excess of food.
It seems
, some probability
in the view
propounded by Andrew
Knight, that this
variability may be
partly connected
with excess of food.
It seems
, some probability
in the view
propounded by Andrew
Knight, that this
variability may be
partly connected
with excess of food.
It seems
, some probability
in the view
propounded by Andrew
Knight, that this
variability may be
partly connected
with excess of food.
It seems
prettyprettyprettypretty--
clear that organic
beings must be
exposed during
several generations
to
clear that organic
beings must be
exposed during
several generations
to
clear that organic
beings must be
exposed during
several generations
to
clear that organic
beings must be
exposed during
several generations
to
clear that organic
beings must be
exposed during
several generations
to
clear that organic
beings must be
exposed during
several generations
to
thethethethe--
newnewnewnewnewnew
conditions of lifeconditions of lifeconditions of lifeconditions of lifeconditionsconditions
to cause anyto cause anyto cause anyto cause anyto cause anyto cause any
appreciableappreciableappreciableappreciableappreciablegreat
amount of variation;
and that
amount of variation;
and that
amount of variation;
and that
amount of variation;
and that
amount of variation;
and that
amount of variation;
and that
---,,,
when the
organisation has
once begun to vary,
it generally
when the
organisation has
once begun to vary,
it generally
when the
organisation has
once begun to vary,
it generally
when the
organisation has
once begun to vary,
it generally
when the
organisation has
once begun to vary,
it generally
when the
organisation has
once begun to vary,
it generally
continuescontinuescontinuescontinuescon- tinuescontinues
to varyto varyto varyto varyvaryingvarying
for many
generations. No case
is on record of a
variable
for many
generations. No case
is on record of a
variable
for many
generations. No case
is on record of a
variable
for many
generations. No case
is on record of a
variable
for many
generations. No case
is on record of a
variable
for many
generations. No case
is on record of a
variable
beingbeingbeingbeingorganismorganism
ceasingceasingceasingceasingceasingceasing
to be variableto be variableto be variableto be variableto varyto vary
under cultivation.
Our oldest
cultivated plants,
such as wheat, still
under cultivation.
Our oldest
cultivated plants,
such as wheat, still
under cultivation.
Our oldest
cultivated plants,
such as wheat, still
under cultivation.
Our oldest
cultivated plants,
such as wheat, still
under cultivation.
Our oldest
cultivated plants,
such as wheat, still
under cultivation.
Our oldest
cultivated plants,
such as wheat, still
oftenoftenoftenoften--
yield new varieties:
our oldest
domesticated animals
are still capable of
rapid improvement or
modification.
yield new varieties:
our oldest
domesticated animals
are still capable of
rapid improvement or
modification.
yield new varieties:
our oldest
domesticated animals
are still capable of
rapid improvement or
modification.
yield new varieties:
our oldest
domesticated animals
are still capable of
rapid improvement or
modification.
yield new varieties:
our oldest
domesticated animals
are still capable of
rapid improvement or
modification.
yield new varieties:
our oldest
domesticated animals
are still capable of
rapid improvement or
modification.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "alignment_table = collate(collation, layout='vertical', output='html')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Hmm… but that's still a little hard to read. Wouldn't it be nice if we got a hint where the actual differences are? Sure, try…" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
185918601861186618691872
---Causes of\n", "Variability.Causes of\n", "Variability.Causes of\n", "Variability.
WHEN weWHEN weWHEN weWHEN weWHEN weWHEN we
look tolook tolook tolook tocomparecompare
the individuals of\n", "the same variety or\n", "sub- variety of our\n", "older cultivated\n", "plants and animals,\n", "one of the first\n", "points which strikes\n", "usthe individuals of\n", "the same variety or\n", "sub- variety of our\n", "older cultivated\n", "plants and animals,\n", "one of the first\n", "points which strikes\n", "usthe individuals of\n", "the same variety or\n", "sub- variety of our\n", "older cultivated\n", "plants and animals,\n", "one of the first\n", "points which strikes\n", "usthe individuals of\n", "the same variety or\n", "sub- variety of our\n", "older cultivated\n", "plants and animals,\n", "one of the first\n", "points which strikes\n", "usthe individuals of\n", "the same variety or\n", "sub- variety of our\n", "older cultivated\n", "plants and animals,\n", "one of the first\n", "points which strikes\n", "usthe individuals of\n", "the same variety or\n", "sub- variety of our\n", "older cultivated\n", "plants and animals,\n", "one of the first\n", "points which strikes\n", "us
,,,,--
is, that they\n", "generally differis, that they\n", "generally differis, that they\n", "generally differis, that they\n", "generally differis, that they\n", "generally differis, that they\n", "generally differ
much-----
moremoremoremore-more
from each otherfrom each otherfrom each otherfrom each otherfrom each otherfrom each other
,---more-
than do the\n", "individuals of any\n", "one species or\n", "variety in a state\n", "of nature.than do the\n", "individuals of any\n", "one species or\n", "variety in a state\n", "of nature.than do the\n", "individuals of any\n", "one species or\n", "variety in a state\n", "of nature.than do the\n", "individuals of any\n", "one species or\n", "variety in a state\n", "of nature.than do the\n", "individuals of any\n", "one species or\n", "variety in a state\n", "of nature.than do the\n", "individuals of any\n", "one species or\n", "variety in a state\n", "of nature.
WhenWhenWhenWhenAnd ifAnd if
we reflect on the\n", "vast diversity of\n", "the plants and\n", "animals which have\n", "been cultivated, and\n", "which have varied\n", "during all ages\n", "under the most\n", "different climates\n", "and treatment,we reflect on the\n", "vast diversity of\n", "the plants and\n", "animals which have\n", "been cultivated, and\n", "which have varied\n", "during all ages\n", "under the most\n", "different climates\n", "and treatment,we reflect on the\n", "vast diversity of\n", "the plants and\n", "animals which have\n", "been cultivated, and\n", "which have varied\n", "during all ages\n", "under the most\n", "different climates\n", "and treatment,we reflect on the\n", "vast diversity of\n", "the plants and\n", "animals which have\n", "been cultivated, and\n", "which have varied\n", "during all ages\n", "under the most\n", "different climates\n", "and treatment,we reflect on the\n", "vast diversity of\n", "the plants and\n", "animals which have\n", "been cultivated, and\n", "which have varied\n", "during all ages\n", "under the most\n", "different climates\n", "and treatment,we reflect on the\n", "vast diversity of\n", "the plants and\n", "animals which have\n", "been cultivated, and\n", "which have varied\n", "during all ages\n", "under the most\n", "different climates\n", "and treatment,
I thinkI thinkI thinkI think--
we are driven to\n", "conclude that thiswe are driven to\n", "conclude that thiswe are driven to\n", "conclude that thiswe are driven to\n", "conclude that thiswe are driven to\n", "conclude that thiswe are driven to\n", "conclude that this
greatergreatgreatgreatgreatgreat
variability isvariability isvariability isvariability isvariability isvariability is
simplysimplysimplysimply--
due to our domestic\n", "productions having\n", "been raised under\n", "conditions of life\n", "not so uniform as,\n", "and somewhat\n", "different from,\n", "those to which the\n", "parent- speciesdue to our domestic\n", "productions having\n", "been raised under\n", "conditions of life\n", "not so uniform as,\n", "and somewhat\n", "different from,\n", "those to which the\n", "parent- speciesdue to our domestic\n", "productions having\n", "been raised under\n", "conditions of life\n", "not so uniform as,\n", "and somewhat\n", "different from,\n", "those to which the\n", "parent- speciesdue to our domestic\n", "productions having\n", "been raised under\n", "conditions of life\n", "not so uniform as,\n", "and somewhat\n", "different from,\n", "those to which the\n", "parent- speciesdue to our domestic\n", "productions having\n", "been raised under\n", "conditions of life\n", "not so uniform as,\n", "and somewhat\n", "different from,\n", "those to which the\n", "parent- speciesdue to our domestic\n", "productions having\n", "been raised under\n", "conditions of life\n", "not so uniform as,\n", "and somewhat\n", "different from,\n", "those to which the\n", "parent- species
havehavehavehavehadhad
been exposed under\n", "nature. There isbeen exposed under\n", "nature. There isbeen exposed under\n", "nature. There isbeen exposed under\n", "nature. There isbeen exposed under\n", "nature. There isbeen exposed under\n", "nature. There is
,----,
alsoalsoalsoalsoalsoalso
, I think, I think, I think, I think, I think-
, some probability\n", "in the view\n", "propounded by Andrew\n", "Knight, that this\n", "variability may be\n", "partly connected\n", "with excess of food.\n", "It seems, some probability\n", "in the view\n", "propounded by Andrew\n", "Knight, that this\n", "variability may be\n", "partly connected\n", "with excess of food.\n", "It seems, some probability\n", "in the view\n", "propounded by Andrew\n", "Knight, that this\n", "variability may be\n", "partly connected\n", "with excess of food.\n", "It seems, some probability\n", "in the view\n", "propounded by Andrew\n", "Knight, that this\n", "variability may be\n", "partly connected\n", "with excess of food.\n", "It seems, some probability\n", "in the view\n", "propounded by Andrew\n", "Knight, that this\n", "variability may be\n", "partly connected\n", "with excess of food.\n", "It seems, some probability\n", "in the view\n", "propounded by Andrew\n", "Knight, that this\n", "variability may be\n", "partly connected\n", "with excess of food.\n", "It seems
prettyprettyprettypretty--
clear that organic\n", "beings must be\n", "exposed during\n", "several generations\n", "toclear that organic\n", "beings must be\n", "exposed during\n", "several generations\n", "toclear that organic\n", "beings must be\n", "exposed during\n", "several generations\n", "toclear that organic\n", "beings must be\n", "exposed during\n", "several generations\n", "toclear that organic\n", "beings must be\n", "exposed during\n", "several generations\n", "toclear that organic\n", "beings must be\n", "exposed during\n", "several generations\n", "to
thethethethe--
newnewnewnewnewnew
conditions of lifeconditions of lifeconditions of lifeconditions of lifeconditionsconditions
to cause anyto cause anyto cause anyto cause anyto cause anyto cause any
appreciableappreciableappreciableappreciableappreciablegreat
amount of variation;\n", "and thatamount of variation;\n", "and thatamount of variation;\n", "and thatamount of variation;\n", "and thatamount of variation;\n", "and thatamount of variation;\n", "and that
---,,,
when the\n", "organisation has\n", "once begun to vary,\n", "it generallywhen the\n", "organisation has\n", "once begun to vary,\n", "it generallywhen the\n", "organisation has\n", "once begun to vary,\n", "it generallywhen the\n", "organisation has\n", "once begun to vary,\n", "it generallywhen the\n", "organisation has\n", "once begun to vary,\n", "it generallywhen the\n", "organisation has\n", "once begun to vary,\n", "it generally
continuescontinuescontinuescontinuescon- tinuescontinues
to varyto varyto varyto varyvaryingvarying
for many\n", "generations. No case\n", "is on record of a\n", "variablefor many\n", "generations. No case\n", "is on record of a\n", "variablefor many\n", "generations. No case\n", "is on record of a\n", "variablefor many\n", "generations. No case\n", "is on record of a\n", "variablefor many\n", "generations. No case\n", "is on record of a\n", "variablefor many\n", "generations. No case\n", "is on record of a\n", "variable
beingbeingbeingbeingorganismorganism
ceasingceasingceasingceasingceasingceasing
to be variableto be variableto be variableto be variableto varyto vary
under cultivation.\n", "Our oldest\n", "cultivated plants,\n", "such as wheat, stillunder cultivation.\n", "Our oldest\n", "cultivated plants,\n", "such as wheat, stillunder cultivation.\n", "Our oldest\n", "cultivated plants,\n", "such as wheat, stillunder cultivation.\n", "Our oldest\n", "cultivated plants,\n", "such as wheat, stillunder cultivation.\n", "Our oldest\n", "cultivated plants,\n", "such as wheat, stillunder cultivation.\n", "Our oldest\n", "cultivated plants,\n", "such as wheat, still
oftenoftenoftenoften--
yield new varieties:\n", "our oldest\n", "domesticated animals\n", "are still capable of\n", "rapid improvement or\n", "modification.yield new varieties:\n", "our oldest\n", "domesticated animals\n", "are still capable of\n", "rapid improvement or\n", "modification.yield new varieties:\n", "our oldest\n", "domesticated animals\n", "are still capable of\n", "rapid improvement or\n", "modification.yield new varieties:\n", "our oldest\n", "domesticated animals\n", "are still capable of\n", "rapid improvement or\n", "modification.yield new varieties:\n", "our oldest\n", "domesticated animals\n", "are still capable of\n", "rapid improvement or\n", "modification.yield new varieties:\n", "our oldest\n", "domesticated animals\n", "are still capable of\n", "rapid improvement or\n", "modification.
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "alignment_table = collate(collation, layout='vertical', output='html2')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And finally, we can also generate the variant graph for this collation…" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "%3\n", "\n", "\n", "0\n", "\n", "\n", "\n", "2\n", "\n", "WHEN we\n", "\n", "\n", "0->2\n", "\n", "\n", "1859, 1860, 1861\n", "\n", "\n", "263\n", "\n", "Causes of Variability.\n", "\n", "\n", "0->263\n", "\n", "\n", "1866, 1869, 1872\n", "\n", "\n", "1\n", "\n", "\n", "\n", "4\n", "\n", "look to\n", "\n", "\n", "2->4\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "268\n", "\n", "compare\n", "\n", "\n", "2->268\n", "\n", "\n", "1869, 1872\n", "\n", "\n", "6\n", "\n", "the individuals of the same variety or sub- variety of our older cultivated plants and animals, one of the first points which strikes us\n", "\n", "\n", "4->6\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "32\n", "\n", ",\n", "\n", "\n", "6->32\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "33\n", "\n", "is, that they generally differ\n", "\n", "\n", "6->33\n", "\n", "\n", "1869, 1872\n", "\n", "\n", "32->33\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "39\n", "\n", "much\n", "\n", "\n", "33->39\n", "\n", "\n", "1859\n", "\n", "\n", "40\n", "\n", "more\n", "\n", "\n", "33->40\n", "\n", "\n", "1860, 1861, 1866, 1872\n", "\n", "\n", "41\n", "\n", "from each other\n", "\n", "\n", "33->41\n", "\n", "\n", "1869\n", "\n", "\n", "39->40\n", "\n", "\n", "1859\n", "\n", "\n", "40->41\n", "\n", "\n", "1859, 1860, 1861, 1866, 1872\n", "\n", "\n", "44\n", "\n", ",\n", "\n", "\n", "41->44\n", "\n", "\n", "1859\n", "\n", "\n", "45\n", "\n", "than do the individuals of any one species or variety in a state of nature.\n", "\n", "\n", "41->45\n", "\n", "\n", "1860, 1861, 1866, 1872\n", "\n", "\n", "269\n", "\n", "more\n", "\n", "\n", "41->269\n", "\n", "\n", "1869\n", "\n", "\n", "44->45\n", "\n", "\n", "1859\n", "\n", "\n", "61\n", "\n", "When\n", "\n", "\n", "45->61\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "270\n", "\n", "And if\n", "\n", "\n", "45->270\n", "\n", "\n", "1869, 1872\n", "\n", "\n", "62\n", "\n", "we reflect on the vast diversity of the plants and animals which have been cultivated, and which have varied during all ages under the most different climates and treatment,\n", "\n", "\n", "61->62\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "93\n", "\n", "I think\n", "\n", "\n", "62->93\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "95\n", "\n", "we are driven to conclude that this\n", "\n", "\n", "62->95\n", "\n", "\n", "1869, 1872\n", "\n", "\n", "93->95\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "102\n", "\n", "greater\n", "\n", "\n", "95->102\n", "\n", "\n", "1859\n", "\n", "\n", "262\n", "\n", "great\n", "\n", "\n", "95->262\n", "\n", "\n", "1860, 1861, 1866, 1869, 1872\n", "\n", "\n", "103\n", "\n", "variability is\n", "\n", "\n", "102->103\n", "\n", "\n", "1859\n", "\n", "\n", "105\n", "\n", "simply\n", "\n", "\n", "103->105\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "106\n", "\n", "due to our domestic productions having been raised under conditions of life not so uniform as, and somewhat different from, those to which the parent- species\n", "\n", "\n", "103->106\n", "\n", "\n", "1869, 1872\n", "\n", "\n", "105->106\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "135\n", "\n", "have\n", "\n", "\n", "106->135\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "272\n", "\n", "had\n", "\n", "\n", "106->272\n", "\n", "\n", "1869, 1872\n", "\n", "\n", "136\n", "\n", "been exposed under nature. There is\n", "\n", "\n", "135->136\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "143\n", "\n", ",\n", "\n", "\n", "136->143\n", "\n", "\n", "1859, 1872\n", "\n", "\n", "144\n", "\n", "also\n", "\n", "\n", "136->144\n", "\n", "\n", "1860, 1861, 1866, 1869\n", "\n", "\n", "143->144\n", "\n", "\n", "1859, 1872\n", "\n", "\n", "145\n", "\n", ", I think\n", "\n", "\n", "144->145\n", "\n", "\n", "1859, 1860, 1861, 1866, 1869\n", "\n", "\n", "148\n", "\n", ", some probability in the view propounded by Andrew Knight, that this variability may be partly connected with excess of food. It seems\n", "\n", "\n", "144->148\n", "\n", "\n", "1872\n", "\n", "\n", "145->148\n", "\n", "\n", "1859, 1860, 1861, 1866, 1869\n", "\n", "\n", "173\n", "\n", "pretty\n", "\n", "\n", "148->173\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "174\n", "\n", "clear that organic beings must be exposed during several generations to\n", "\n", "\n", "148->174\n", "\n", "\n", "1869, 1872\n", "\n", "\n", "173->174\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "185\n", "\n", "the\n", "\n", "\n", "174->185\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "186\n", "\n", "new\n", "\n", "\n", "174->186\n", "\n", "\n", "1869, 1872\n", "\n", "\n", "185->186\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "187\n", "\n", "conditions of life\n", "\n", "\n", "186->187\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "273\n", "\n", "conditions\n", "\n", "\n", "186->273\n", "\n", "\n", "1869, 1872\n", "\n", "\n", "190\n", "\n", "to cause any\n", "\n", "\n", "187->190\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "193\n", "\n", "appreciable\n", "\n", "\n", "190->193\n", "\n", "\n", "1859, 1860, 1861, 1866, 1869\n", "\n", "\n", "281\n", "\n", "great\n", "\n", "\n", "190->281\n", "\n", "\n", "1872\n", "\n", "\n", "194\n", "\n", "amount of variation; and that\n", "\n", "\n", "193->194\n", "\n", "\n", "1859, 1860, 1861, 1866, 1869\n", "\n", "\n", "200\n", "\n", "when the organisation has once begun to vary, it generally\n", "\n", "\n", "194->200\n", "\n", "\n", "1859, 1860, 1861\n", "\n", "\n", "267\n", "\n", ",\n", "\n", "\n", "194->267\n", "\n", "\n", "1866, 1869, 1872\n", "\n", "\n", "211\n", "\n", "continues\n", "\n", "\n", "200->211\n", "\n", "\n", "1859, 1860, 1861, 1866, 1872\n", "\n", "\n", "274\n", "\n", "con- tinues\n", "\n", "\n", "200->274\n", "\n", "\n", "1869\n", "\n", "\n", "212\n", "\n", "to vary\n", "\n", "\n", "211->212\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "277\n", "\n", "varying\n", "\n", "\n", "211->277\n", "\n", "\n", "1872\n", "\n", "\n", "214\n", "\n", "for many generations. No case is on record of a variable\n", "\n", "\n", "212->214\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "226\n", "\n", "being\n", "\n", "\n", "214->226\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "278\n", "\n", "organism\n", "\n", "\n", "214->278\n", "\n", "\n", "1869, 1872\n", "\n", "\n", "227\n", "\n", "ceasing\n", "\n", "\n", "226->227\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "228\n", "\n", "to be variable\n", "\n", "\n", "227->228\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "279\n", "\n", "to vary\n", "\n", "\n", "227->279\n", "\n", "\n", "1869, 1872\n", "\n", "\n", "231\n", "\n", "under cultivation. Our oldest cultivated plants, such as wheat, still\n", "\n", "\n", "228->231\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "244\n", "\n", "often\n", "\n", "\n", "231->244\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "245\n", "\n", "yield new varieties: our oldest domesticated animals are still capable of rapid improvement or modification.\n", "\n", "\n", "231->245\n", "\n", "\n", "1869, 1872\n", "\n", "\n", "244->245\n", "\n", "\n", "1859, 1860, 1861, 1866\n", "\n", "\n", "245->1\n", "\n", "\n", "1859, 1860, 1861, 1866, 1869, 1872\n", "\n", "\n", "262->103\n", "\n", "\n", "1860, 1861, 1866, 1869, 1872\n", "\n", "\n", "263->2\n", "\n", "\n", "1866, 1869, 1872\n", "\n", "\n", "267->200\n", "\n", "\n", "1866, 1869, 1872\n", "\n", "\n", "268->6\n", "\n", "\n", "1869, 1872\n", "\n", "\n", "269->45\n", "\n", "\n", "1869\n", "\n", "\n", "270->62\n", "\n", "\n", "1869, 1872\n", "\n", "\n", "272->136\n", "\n", "\n", "1869, 1872\n", "\n", "\n", "273->190\n", "\n", "\n", "1869, 1872\n", "\n", "\n", "274->277\n", "\n", "\n", "1869\n", "\n", "\n", "277->214\n", "\n", "\n", "1869, 1872\n", "\n", "\n", "278->227\n", "\n", "\n", "1869, 1872\n", "\n", "\n", "279->231\n", "\n", "\n", "1869, 1872\n", "\n", "\n", "281->194\n", "\n", "\n", "1872\n", "\n", "\n", "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "graph = collate( collation, output=\"svg\" )" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.4.3" } }, "nbformat": 4, "nbformat_minor": 0 }