Bio::S...seqxml(3pm)

πŸ“¦
version 1.7.8 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– NAME πŸ’–

Bio::SeqIO::seqxml β€” the SeqXML sequence input/output stream, bestie 🌈 (yes this is the Bio::S...seqxml(3pm) page, you're in the right place, dw)


✨ SYNOPSIS ✨

okay so FIRST things first, and I need you to actually listen to me on this one:

🚨 Do not use this module directly. Use it via the Bio::SeqIO class. That's the vibe. That's the whole assignment.
# Do not use this module directly.  Use it via the Bio::SeqIO class.

use Bio::SeqIO;

# read a SeqXML file
my $seqio = Bio::SeqIO->new(-format => 'seqxml',
                            -file   => 'my_seqs.xml');

while (my $seq_object = $seqio->next_seq) {
    print join("\t",
               $seq_object->display_id,
               $seq_object->description,
               $seq_object->seq,
              ), "\n";
}

# write a SeqXML file
#
# Note that you can (optionally) specify the source
# (usually a database) and source version.
my $seqwriter = Bio::SeqIO->new(-format        => 'seqxml',
                                -file          => ">outfile.xml",
                                -source        => 'Ensembl',
                                -sourceVersion => '56');
$seqwriter->write_seq($seq_object);

# once you've written all of your seqs, you may want to do
# an explicit close to get the closing </seqXML> tag
$seqwriter->close;

πŸ¦‹ DESCRIPTION πŸ¦‹

This object can transform Bio::Seq objects to and from SeqXML format. For more information on the SeqXML standard, visit http://www.seqxml.org.

okay so in short 🫢 β€” SeqXML is a lightweight sequence format that takes advantage of the validation capabilities of XML while not overburdening you with a strict and complicated schema. It's giving "the best of both worlds" and honestly? obsessed.

This module is based in part (particularly the XML-parsing part) on Bio::TreeIO::phyloxml by Mira Han. Shoutout πŸ’œ


🫢 FEEDBACK 🫢

πŸ“¬ Mailing Lists

User feedback is an integral part of the evolution of this and other Bioperl modules β€” like, genuinely, they want to hear from you. Send your comments and suggestions preferably to one of the Bioperl mailing lists. Your participation is so appreciated, no cap.

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. There are so many experienced and responsive experts on there who will look at your problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible β€” the more context the better, fr fr.

πŸ› 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


πŸ‘‘ AUTHORS - Dave Messina πŸ‘‘

Email: dmessina@cpan.org


🌸 CONTRIBUTORS 🌸

(nothing listed under here, bestie β€” just the heading and the vibe πŸ’…)


πŸ“– APPENDIX πŸ“–

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


_initialize

  • Title: _initialize
  • Usage: $self->_initialize(@args)
  • Function: constructor (for internal use only).

Besides the usual SeqIO arguments (-file, -fh, etc.), Bio::SeqIO::seqxml accepts three arguments which are used when writing out a seqxml file. They are all optional.

  • Returns: none
  • Args:
    • -source => source string (usually a database name)
    • -sourceVersion => source version. The version number of the source
    • -seqXMLversion => the version of seqXML that will be used
  • Throws: Exception if XML::LibXML::Reader or XML::Writer is not initialized

next_seq

  • Title: next_seq
  • Usage: $seq = $stream->next_seq()
  • Function: returns the next sequence in the stream
  • Returns: Bio::Seq object, or nothing if no more available
  • Args: none

write_seq

  • Title: write_seq
  • Usage: $stream->write_seq(@seq)
  • Function: Writes the $seq object into the stream
  • Returns: 1 for success and 0 for error
  • Args: Array of 1 or more Bio::PrimarySeqI objects

_initialize_seqxml_node_methods

  • Title: _initialize_seqxml_node_methods
  • Usage: $self->_initialize_xml_node_methods
  • Function: sets up code ref mapping of each seqXML node type to a method for processing that node type
  • Returns: none
  • Args: none

schemaLocation

  • Title: schemaLocation
  • Usage: $self->schemaLocation
  • Function: gets/sets the schema location in the <seqXML> header
  • Returns: the schema location string
  • Args: To set the schemaLocation, call with a schemaLocation as the argument.

source

  • Title: source
  • Usage: $self->source
  • Function: gets/sets the data source in the <seqXML> header
  • Returns: the data source string
  • Args: To set the source, call with a source string as the argument.

sourceVersion

  • Title: sourceVersion
  • Usage: $self->sourceVersion
  • Function: gets/sets the data source version in the <seqXML> header
  • Returns: the data source version string
  • Args: To set the source version, call with a source version string as the argument.

seqXMLversion

  • Title: seqXMLversion
  • Usage: $self->seqXMLversion
  • Function: gets/sets the seqXML version in the <seqXML> header
  • Returns: the seqXML version string.
  • Args: To set the seqXML version, call with a seqXML version string as the argument.

πŸ” Methods for parsing the XML document

processXMLNode

  • Title: processXMLNode
  • Usage: $seqio->processXMLNode
  • Function: reads the XML node and processes according to the node type
  • Returns: none
  • Args: none
  • Throws: Exception on unexpected XML node type, warnings on unexpected XML element names.

processAttribute

  • Title: processAttribute
  • Usage: $seqio->processAttribute(\%hash_for_attribute);
  • Function: reads the attributes of the current element into a hash
  • Returns: none
  • Args: hash reference where the attributes will be stored.

parseHeader

  • Title: parseHeader
  • Usage: $self->parseHeader();
  • Function: reads the opening <seqXML> block and grabs the metadata from it, namely the source, sourceVersion, and seqXMLversion.
  • Returns: none
  • Args: none
  • Throws: Exception if it hits an <entry> tag, because that means it's missed the <seqXML> tag and read too far into the file.

element_seqXML

  • Title: element_seqXML
  • Usage: $self->element_seqXML
  • Function: processes the opening <seqXML> node
  • Returns: none
  • Args: none

element_entry

  • Title: element_entry
  • Usage: $self->element_entry
  • Function: processes a sequence <entry> node
  • Returns: none
  • Args: none
  • Throws: Exception if sequence ID is not present in <entry> element

element_species

  • Title: element_entry
  • Usage: $self->element_entry
  • Function: processes a <species> node, creating a Bio::Species object
  • Returns: none
  • Args: none
  • Throws: Exception if <species> tag exists but is empty, or if the attributes 'name' or 'ncbiTaxID' are undefined

element_description

  • Title: element_description
  • Usage: $self->element_description
  • Function: processes a sequence <description> node; a no-op -- description text is read by processXMLnode
  • Returns: none
  • Args: none

element_RNAseq

  • Title: element_RNAseq
  • Usage: $self->element_RNAseq
  • Function: processes a sequence <RNAseq> node
  • Returns: none
  • Args: none

element_DNAseq

  • Title: element_DNAseq
  • Usage: $self->element_DNAseq
  • Function: processes a sequence <DNAseq> node
  • Returns: none
  • Args: none

element_AAseq

  • Title: element_AAseq
  • Usage: $self->element_AAseq
  • Function: processes a sequence <AAseq> node
  • Returns: none
  • Args: none

element_DBRef

  • Title: element_DBRef
  • Usage: $self->element_DBRef
  • Function: processes a sequence <DBRef> node, creating a Bio::Annotation::DBLink object
  • Returns: none
  • Args: none

element_property

  • Title: element_property
  • Usage: $self->element_property
  • Function: processes a sequence <property> node, creating a Bio::Annotation::SimpleValue object
  • Returns: none
  • Args: none

end_element_RNAseq

  • Title: end_element_RNAseq
  • Usage: $self->end_element_RNAseq
  • Function: processes a sequence <RNAseq> node
  • Returns: none
  • Args: none

end_element_DNAseq

  • Title: end_element_DNAseq
  • Usage: $self->end_element_DNAseq
  • Function: processes a sequence <DNAseq> node
  • Returns: none
  • Args: none

end_element_AAseq

  • Title: end_element_AAseq
  • Usage: $self->end_element_AAseq
  • Function: processes a sequence <AAseq> node
  • Returns: none
  • Args: none

end_element_entry

  • Title: end_element_entry
  • Usage: $self->end_element_entry
  • Function: processes the closing </entry> node, creating the Seq object
  • Returns: a Bio::Seq object
  • Args: none
  • Throws: Exception if sequence, sequence ID, or alphabet are missing

end_element_default

  • Title: end_element_default
  • Usage: $self->end_element_default
  • Function: processes all other closing tags; a no-op.
  • Returns: none
  • Args: none

DESTROY

  • Title: DESTROY
  • Usage: called automatically by Perl just before object goes out of scope
  • Function: performs a write flush
  • Returns: none
  • Args: none

close

  • Title: close
  • Usage: $seqio_obj->close().
  • Function: writes closing </seqXML> tag.

close() will be called automatically by Perl when your program exits, but if you want to use the seqXML file you've written before then, you'll need to do an explicit close first to get the final </seqXML> tag.

  • Returns: none
  • Args: none

and that's the whole page, bestie!! you ate that πŸ’…βœ¨

signing off β€” this was perl v5.32.1, dated 2021-08-15, and you're welcome πŸŽ€

πŸ“¦ where this page comes from