Scroll to navigation

Bio::PopGen::IO::csv(3pm) User Contributed Perl Documentation Bio::PopGen::IO::csv(3pm)


Bio::PopGen::IO::csv -Extract individual allele data from a CSV parser


#Do not use directly, use through the Bio::PopGen::IO driver

  use Bio::PopGen::IO;
  my $io = Bio::PopGen::IO->new(-format => 'csv',
                               -file   => 'data.csv');
  # Some IO might support reading in a population at a time
  my @population;
  while( my $ind = $io->next_individual ) {
      push @population, $ind;


This object will parse comma delimited format (CSV) or whatever delimiter you specify. It currently doesn't handle the more complex quote escaped CSV format. There are 3 initialization parameters, the delimiter (-field_delimiter) [default ','], (-allele_delimiter) [default ' ']. The third initialization parameter is a boolean -no_header which specifies if there is no header line to read in. All lines starting with '#' will be skipped

When no_header is not specific the data is assumed to be of the following form. Having a header line this SAMPLE,MARKERNAME1,MARKERNAME2,...

and each data line having the form (diploid data) SAMP1,101 102,100 90,a b or for haploid data SAMP1,101,100,a


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 list. Your participation is much appreciated.                  - General discussion  - About the mailing lists


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

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 of the bugs and their resolution. Bug reports can be submitted via the web:

AUTHOR - Jason Stajich



Matthew Hahn,


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


 Title   : new
 Usage   : my $obj = Bio::PopGen::IO::csv->new();
 Function: Builds a new Bio::PopGen::IO::csv object 
 Returns : an instance of Bio::PopGen::IO::csv
 Args    : [optional, these are the current defaults] 
           -field_delimiter => ','
           -allele_delimiter=> '\s+'
           -no_header       => 0,


 Title   : flag
 Usage   : $obj->flag($flagname,$newval)
 Function: Get/Set the flag value
 Returns : value of a flag (a boolean)
 Args    : A flag name, currently we expect 
           'no_header', 'field_delimiter', or 'allele_delimiter' 
           on set, new value (a boolean or undef, optional)


 Title   : next_individual
 Usage   : my $ind = $popgenio->next_individual;
 Function: Retrieve the next individual from a dataset
 Returns : L<Bio::PopGen::IndividualI> object
 Args    : none


 Title   : next_population
 Usage   : my $ind = $popgenio->next_population;
 Function: Retrieve the next population from a dataset
 Returns : L<Bio::PopGen::PopulationI> object
 Args    : none
 Note    : Many implementation will not implement this


 Title   : write_individual
 Usage   : $popgenio->write_individual($ind);
 Function: Write an individual out in the file format
 Returns : none
 Args    : L<Bio::PopGen::PopulationI> object(s)


 Title   : write_population
 Usage   : $popgenio->write_population($pop);
 Function: Write a population out in the file format
 Returns : none
 Args    : L<Bio::PopGen::PopulationI> object(s)
 Note    : Many implementation will not implement this
2018-10-27 perl v5.26.2