Bio::PopGen::PopStats

View: New views
2 Messages — Rating Filter:   Alert me  

Bio::PopGen::PopStats

by Robin Runyowa :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, I am a newbie in bioperl and I am trying to use to
Bio::PopGen::PopStats.
Unfortunately, I am not sure how to create arrays of objects so I keep
getting an error message.
My input files  are below:
testpop3.cvs:
SAMPLE,rs0001
Person1,A T
Person2,T T
Person3,A A
Person4,T A
Person5,A A


testpop4.cvs
SAMPLE,rs0001
Per1,A T
Per2,T T
Per3,A A
Per4,T A
Per5,A A


My script:
use Bio::PopGen::PopStats;
use Bio::PopGen::Individual;
use Bio::PopGen::Genotype;
use Bio::PopGen::Population;
use Bio::PopGen::IO;

my $handle = new Bio::PopGen::IO (-format => 'csv',
                                -file => 'testpop3.cvs');
my $handle2 = new Bio::PopGen::IO (-format => 'csv',
                                -file => 'testpop4.cvs');

my $YRI = $handle ->next_population;
my $CEU = $handle2 ->next_population;
my @pop = ();
push @pop, $YRI;
push @pop, $CEU;
@markers = $YRI->get_marker_names;
my $fst = $stats->Fst(\@pop,\@marker);

Thanks, Rob
_______________________________________________
Bioperl-l mailing list
Bioperl-l@...
http://lists.open-bio.org/mailman/listinfo/bioperl-l

Re: Bio::PopGen::PopStats

by Mark A. Jensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Rob,

Don't forget to

 use strict;
 use warnings;

There's an omission and a typo in your script that these would have caught.
You need

 my $stat = Bio::PopGen::PopStats->new()

and

> my $fst = $stats->Fst(\@pop,\@marker);
should be

my $fst = $stats->Fst(\@pop,\@markers);

cheers MAJ
----- Original Message -----
From: "Robin Runyowa" <robrunyowa@...>
To: <bioperl-l@...>
Cc: <robrunyowa@...>
Sent: Tuesday, October 20, 2009 1:20 PM
Subject: [Bioperl-l] Bio::PopGen::PopStats


> Hi, I am a newbie in bioperl and I am trying to use to
> Bio::PopGen::PopStats.
> Unfortunately, I am not sure how to create arrays of objects so I keep
> getting an error message.
> My input files  are below:
> testpop3.cvs:
> SAMPLE,rs0001
> Person1,A T
> Person2,T T
> Person3,A A
> Person4,T A
> Person5,A A
>
>
> testpop4.cvs
> SAMPLE,rs0001
> Per1,A T
> Per2,T T
> Per3,A A
> Per4,T A
> Per5,A A
>
>
> My script:
> use Bio::PopGen::PopStats;
> use Bio::PopGen::Individual;
> use Bio::PopGen::Genotype;
> use Bio::PopGen::Population;
> use Bio::PopGen::IO;
>
> my $handle = new Bio::PopGen::IO (-format => 'csv',
>                                -file => 'testpop3.cvs');
> my $handle2 = new Bio::PopGen::IO (-format => 'csv',
>                                -file => 'testpop4.cvs');
>
> my $YRI = $handle ->next_population;
> my $CEU = $handle2 ->next_population;
> my @pop = ();
> push @pop, $YRI;
> push @pop, $CEU;
> @markers = $YRI->get_marker_names;
> my $fst = $stats->Fst(\@pop,\@marker);
>
> Thanks, Rob
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@...
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>
>
_______________________________________________
Bioperl-l mailing list
Bioperl-l@...
http://lists.open-bio.org/mailman/listinfo/bioperl-l