The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Bio::OntologyIO::simplehierarchy - a base class parser for simple hierarchy-by-indentation type formats

SYNOPSIS

use Bio::OntologyIO;

# do not use directly -- use via Bio::OntologyIO
my $parser = Bio::OntologyIO->new
      ( -format        => "simplehierarchy",
        -file          => "pathology_terms.csv",
        -indent_string => ",",
        -ontology_name => "eVOC",
        -term_factory  => $fact,
      );

my $ontology = $parser->next_ontology();

DESCRIPTION

Needs Graph.pm from CPAN. This class is nearly identical to OntologyIO::dagflat, see Bio::OntologyIO::dagflat for details.

FEEDBACK

Mailing Lists

User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing lists Your participation is much appreciated.

bioperl-l@bioperl.org                  - General discussion
http://bioperl.org/wiki/Mailing_lists  - About the mailing lists

Support

Please direct usage questions or support issues to the mailing list:

bioperl-l@bioperl.org

rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.

Reporting Bugs

Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via the web:

https://github.com/bioperl/bioperl-live/issues

AUTHOR

Allen Day

Email: allenday@ucla.edu

CONTRIBUTOR

Christian Zmasek

APPENDIX

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _

new

Title   : new
Usage   : see SYNOPSIS
Function: Creates a new simplehierarchy parser.
Returns : A new simplehierarchy parser object, implementing Bio::OntologyIO.
Args    : -files         => a single ontology flat file holding the
                            term relationships, or an array ref holding
                            the file names
          -file          => if there is only a single flat file, it may
                            also be specified via the -file parameter
          -ontology_name => the name of the ontology, defaults to
                            "Gene Ontology"
          -file_is_root  => Boolean indicating whether a virtual root
                            term is to be added, the name of which will
                            be derived from the file name. Default is false.
                            Enabling this allows one to parse multiple input
                            files into the same ontology and still have
                            separately rooted.
          -engine        => the L<Bio::Ontology::OntologyEngineI> object
                            to be reused (will be created otherwise); note
                            that every L<Bio::Ontology::OntologyI> will
                            qualify as well since that one inherits from the
                            former.
          -indent_string => the string used to indent hierarchical
                            levels in the file.

                            For a file like this:

                            term0
                              subterm1A
                                subterm2A
                              subterm1B
                              subterm1C

                            indent_string would be "  ".  Defaults to
                            one space (" ").
          -comment_char  => Allows specification of a regular
                            expression string to indicate a comment line.
                            Currently defaults to "[\|\-]".
                            Note: this is not yet implemented.

See Bio::OntologyIO.

ontology_name

Title   : ontology_name
Usage   : $obj->ontology_name($newval)
Function: Get/set the name of the ontology parsed by this module.
Example :
Returns : value of ontology_name (a scalar)
Args    : on set, new value (a scalar or undef, optional)

parse

Title   : parse()
Usage   : $parser->parse();
Function: Parses the files set with "new" or with methods
          defs_file and _flat_files.

          Normally you should not need to call this method as it will
          be called automatically upon the first call to
          next_ontology().

Returns : [Bio::Ontology::OntologyEngineI]
Args    :

next_ontology

Title   : next_ontology
Usage   :
Function: Get the next available ontology from the parser. This is the
          method prescribed by Bio::OntologyIO.
Example :
Returns : An object implementing Bio::Ontology::OntologyI, and undef if
          there is no more ontology in the input.
Args    :

_flat_files

Title   : _flat_files
Usage   : $files_to_parse = $parser->_flat_files();
Function: Get the array of ontology flat files that need to be parsed.

          Note that this array will decrease in elements over the
          parsing process. Therefore, it\'s value outside of this
          module will be limited. Also, be careful not to alter the
          array unless you know what you are doing.

Returns : a reference to an array of zero or more strings
Args    : none

_defs_io

Title   : _defs_io
Usage   : $obj->_defs_io($newval)
Function: Get/set the Bio::Root::IO instance representing the
          definition file, if provided (see defs_file()).
Example :
Returns : value of _defs_io (a Bio::Root::IO object)
Args    : on set, new value (a Bio::Root::IO object or undef, optional)

indent_string

Title   : indent_string
Usage   : $obj->indent_string($newval)
Function:
Example :
Returns : value of indent_string (a scalar)
Args    : on set, new value (a scalar or undef, optional)

file_is_root

Title   : file_is_root
Usage   : $obj->file_is_root($newval)
Function: Boolean indicating whether a virtual root term is to be
          added, the name of which will be derived from the file
          name.

          Enabling this allows one to parse multiple input files into the
          same ontology and still have separately rooted.

Example :
Returns : value of file_is_root (a scalar)
Args    : on set, new value (a scalar or undef, optional)

_virtual_root

Title   : _virtual_root
Usage   : $obj->_virtual_root($newval)
Function:
Example :
Returns : value of _virtual_root (a scalar)
Args    : on set, new value (a scalar or undef, optional)