2 package CXGN
::GenotypeIO
;
9 use CXGN
::GenotypeIOmain
;
11 has
'format' => ( isa
=> 'Str',
13 default => 'vcf', # or dosage
16 has
'plugin' => ( isa
=> 'Ref',
26 my $plugin = CXGN
::GenotypeIOmain
->new();
28 if ($args->{format
} eq "vcf") {
29 $plugin->load_plugin("VCF");
31 elsif ($args->{format
} eq "dosage") {
32 $plugin->load_plugin("Dosage");
34 elsif ($args->{format
} eq "dosage_transposed") {
35 $plugin->load_plugin("DosageTransposed");
38 print STDERR
"No valid format provided. Using vcf.\n";
39 $plugin->load_plugin("VCF");
41 $plugin->file($args->{file
});
43 my $data = $plugin->init($args);
45 $self->plugin($plugin);
47 #print STDERR "count = $data->{count}\n";
48 #$self->count($data->{count});
49 #$self->header($data->{header});
56 my ($markers, $rawscores, $accession_name) = $self->plugin()->next();
57 if (keys(%$rawscores)==0) { return undef; }
58 my $gt = CXGN
::Genotype
->new();
59 $gt->name($accession_name);
60 $gt->rawscores($rawscores);
61 $gt->markers($self->markers());
63 # print STDERR "NAME: $genotype\n";
64 # print STDERR join ", ", keys %$rawscores;
71 return $self->plugin()->accessions();
76 #print STDERR "Markers now: ".Dumper($self->plugin()->markers())."\n";
77 return $self->plugin()->markers();
82 $self->plugin()->close();
88 my $file = $self->plugin()->file();
89 my $stats = $self->plugin()->summary_stats($file);