View on
MetaCPAN
Rutger Vos > Bio-Phylo > Bio::Phylo::Parsers::Dwca

Download:
Bio-Phylo-v2.0.1.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Source  

NAME ^

Bio::Phylo::Parsers::Dwca - Parser used by Bio::Phylo::IO, no serviceable parts inside

DESCRIPTION ^

This module parses standard Darwin Core Archive files as produced by GBIF (see: http://www.gbif.org/resource/80639). The end result is a Bio::Phylo::Taxa object that has as many taxon objects in it as there are distinct dwc:scientificNames in the archive. For example, if the archive is for a single species there will thus be only one taxon object in the produced result. Each taxon object is annotated with as many dwc:Occurrence records, instantiated as Bio::Phylo::NeXML::Meta annotations, as there are occurrences for that species in the archive. In turn, nested in each of these annotations are the predicates and objects for that record.

Using this module, the contents of a Darwin Core Archive can be easily accessed and, for example, prepared as input for MAXENT. Here is an example to show how this is done:

        use Bio::Phylo::IO 'parse';
        use Bio::Phylo::Util::CONSTANT ':objecttypes';

        # a set of fossil occurrences of th feral horse, Equus ferus Boddaert, 1785
        # this corresponds with data set doi:10.15468/dl.yyyhyn
        my $url = 'http://api.gbif.org/v1/occurrence/download/request/0074675-160910150852091.zip';

        # like every Bio::Phylo::IO module, we can parse directly from a web location
        my $proj = parse(
                '-format' => 'dwca',
                '-url'    => $url,
                '-as_project' => 1,
        );

        # write a CSV file with MAXENT header
        print "Species,Latitude,Longitude\n";
        for my $t ( @{ $proj->get_items(_TAXON_) } ) {
                my $name = $t->get_name;
                for my $m ( @{ $t->get_meta } ) {
                        my $lat = $m->get_meta_object('dwc:decimalLatitude');
                        my $lon = $m->get_meta_object('dwc:decimalLongitude');
                        print "\"$name\",$lat,$lon\n";
                }
        }

SEE ALSO ^

There is a mailing list at https://groups.google.com/forum/#!forum/bio-phylo for any user or developer questions and discussions.

Bio::Phylo::IO

The dwca parser is called by the Bio::Phylo::IO object. Look there to learn how to parse data in general

Bio::Phylo::Manual

Also see the manual: Bio::Phylo::Manual and http://rutgervos.blogspot.com

CITATION ^

If you use Bio::Phylo in published research, please cite it:

Rutger A Vos, Jason Caravas, Klaas Hartmann, Mark A Jensen and Chase Miller, 2011. Bio::Phylo - phyloinformatic analysis using Perl. BMC Bioinformatics 12:63. http://dx.doi.org/10.1186/1471-2105-12-63

syntax highlighting: