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

Jason Stajich jason at bioperl.org
Tue Jan 9 17:30:55 EST 2007


this doesn't make sense to me - you want to request a particular  
marker with the vals you requested in the loop.

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

See the code in t/PopGen.t for working code that tests these modules.
Here is some code from there cut+pasted:

# build a population from an alignment

for my $name ( $population->get_marker_names ) {
     my $marker = $population->get_Marker($name);
     warn("$name ",join(" ",$marker->get_Alleles()),"\n");
}

-jason
On Jan 9, 2007, at 2:23 PM, Marian Thieme wrote:

> 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
>>
>>
> _______________________________________________
> Bioperl-l mailing list
> 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