~ubuntu-branches/ubuntu/natty/python-cogent/natty

« back to all changes in this revision

Viewing changes to tests/test_util/test_table.rst

  • Committer: Bazaar Package Importer
  • Author(s): Steffen Moeller
  • Date: 2010-12-04 22:30:35 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101204223035-j11kinhcrrdgg2p2
Tags: 1.5-1
* Bumped standard to 3.9.1, no changes required.
* New upstream version.
  - major additions to Cookbook
  - added AlleleFreqs attribute to ensembl Variation objects.
  - added getGeneByStableId method to genome objects.
  - added Introns attribute to Transcript objects and an Intron class.
  - added Mann-Whitney test and a Monte-Carlo version
  - exploratory and confirmatory period estimation techniques (suitable for
    symbolic and continuous data)
  - Information theoretic measures (AIC and BIC) added
  - drawing of trees with collapsed nodes
  - progress display indicator support for terminal and GUI apps
  - added parser for illumina HiSeq2000 and GAiix sequence files as 
    cogent.parse.illumina_sequence.MinimalIlluminaSequenceParser.
  - added parser to FASTQ files, one of the output options for illumina's
    workflow, also added cookbook demo.
  - added functionality for parsing of SFF files without the Roche tools in
    cogent.parse.binary_sff
  - thousand fold performance improvement to nmds
  - >10-fold performance improvements to some Table operations

Show diffs side-by-side

added added

removed removed

Lines of Context:
607
607
    ...      sep="\t")
608
608
    >>> t3a = LoadTable(filename="t3.tab", reader=reader, title="new title",
609
609
    ...       space=2)
 
610
    ...         
610
611
    >>> print t3a
611
612
    new title
612
613
    ======================================================
621
622
       edge.1         root  4.0000  1.0000  3.0000  6.0000
622
623
    ------------------------------------------------------
623
624
 
 
625
We can use the ``SeparatorFormatParser`` to ignore reading certain lines by using a callback function. We illustrate this using the above data, skipping any rows with ``edge.name`` starting with ``edge``.
 
626
 
 
627
.. doctest::
 
628
    
 
629
    >>> def ignore_internal_nodes(line):
 
630
    ...     return line[0].startswith('edge')
 
631
    ...     
 
632
    >>> reader = SeparatorFormatParser(with_header=True,converter=converter,
 
633
    ...      sep="\t", ignore=ignore_internal_nodes)
 
634
    ...     
 
635
    >>> tips = LoadTable(filename="t3.tab", reader=reader, digits=1, space=2)
 
636
    >>> print tips
 
637
    =============================================
 
638
    edge.name  edge.parent  length    x    y    z
 
639
    ---------------------------------------------
 
640
        Human       edge.0     4.0  1.0  3.0  6.0
 
641
    HowlerMon       edge.0     4.0  1.0  3.0  6.0
 
642
        Mouse       edge.1     4.0  1.0  3.0  6.0
 
643
    NineBande         root     4.0  1.0  3.0  6.0
 
644
     DogFaced         root     4.0  1.0  3.0  6.0
 
645
    ---------------------------------------------
 
646
 
624
647
In the above example, the data type in a column is static, e.g. all values in ``x`` are floats. Rather than providing a custom reader, you can get the ``Table`` to construct such a reader based on the first data row using the ``static_column_types`` argument.
625
648
 
626
649
.. doctest::