[Bioperl-l] Bio::PopGen::IO

Marian Thieme marian.thieme at lycos.de
Tue Jan 9 22:23:22 UTC 2007


If I do so (something like this):
if( my $pop = $io->next_population ) {
	print $pop->get_Individuals;
	print $pop;
}

I get only a reference to the population object:
Bio::PopGen::Population=HASH(...).

On the other hand, if I create the pop object via new constructor and 
afterwards try to access markers via get_Marker() method:

for my $name ( $pop->get_marker_names ) {
	my $marker = $pop->get_Marker();
	print $marker;
}

then an error occurs:
Can't locate object method "get_Marker" via package "marker_name_a" 
(perhaps you forgot to load "marker_name_a"?) at myfile.pl line xx, 
<GEN0> line 95.
To which file does it refer ? (<GEN0> line 95)
How to load "marker_name_a" ?

("marker_name_a" belongs to the marker names I did provide in the csv file)

Regards,
Marian


Jason Stajich schrieb:
> you need to pass in an array ref when you create the population, note 
> the missing '\'.
> The CSV method also provides a method next_population which will go 
> ahead and build a population object for you as well.
> 
>> my $pop = Bio::PopGen::Population->new(
>> -name => 'popname',
>> -description => 'description',
>> -individuals => \@population);
> 
> On Jan 9, 2007, at 11:38 AM, Marian Thieme wrote:
> 
>> Hi,
>>
>> I have a problem/missing knowledge about initialising/providing markers 
>> in a population object
>>
>> Let me illustrating what I did:
>>
>> 1. importing csv file with sample and marker information for some 
>> individuals. (including header info):
>>
>> my $io = new Bio::PopGen::IO ( -format => 'csv',
>> -allele_delimiter => ' ',
>> -field_delimiter => '',
>> -file => 'test.csv')
>>
>>
>> 2.)pushing all individuals to an array
>>
>> my @population;
>> while( my $ind = $io->next_individual ) {
>> push @population, $ind;
>> }
>>
>> 3.) I convinced myself that this has worked, because I was able to ouput
>> alleles, individual_id and marker_name.
>>
>>
>> 4.) Did create a population object with that individuals:
>>
>> my $pop = Bio::PopGen::Population->new(
>> -name => 'popname',
>> -description => 'description',
>> -individuals => @population);
>>
>> 5.) But when I try to access the markers via:
>>
>> for my $name ( $pop->get_marker_names ) {
>> my $marker = $pop->get_Marker();
>> print $marker;
>> }
>>
>> nothing appears on the screen, becuase the function get_marker_names 
>> obviously doesnt fetch some values, in my case.
>>
>> Question: Do I need to provide the marker information seperatly ?
>>
>> Regards,
>> Marian
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at lists.open-bio.org <mailto:Bioperl-l at lists.open-bio.org>
>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
> 
> --
> Jason Stajich 
> Miller Research Fellow
> University of California, Berkeley
> lab: 510.642.8441
> http://pmb.berkeley.edu/~taylor/people/js.html
> 
> 



More information about the Bioperl-l mailing list