make test pass for multicat parsing with two xlsx files for testing.
[sgn.git] / t / unit / CXGN / GenotypeIO.t
blobe1a6aee774451a9c9f03f8cdcd5d9901790217c3
2 use strict;
3 use Test::More;
4 use Data::Dumper;
5 use CXGN::GenotypeIO;
7 my $gtio = CXGN::GenotypeIO->new( { file => "t/data/cassava_test.vcf", format => 'vcf'});
9 is(scalar(@{$gtio->markers}), 15, "vcf marker count 1");
10 is($gtio->markers->[0], "S1_14740", "vcf first marker name");
11 is($gtio->markers->[-1], "S1_14911", "vcf last marker name");
12 is($gtio->accessions->[0], "1002:250060174", "vcf first accession name");
13 is($gtio->accessions->[-1], "Ug120191:250144197", "vcf last accession name");
14 is(scalar(@{$gtio->accessions}), 9990, "vcf accession count");
15 if (my $gt = $gtio->next()) { 
16     #print STDERR Dumper($gt->markers());
17     is(scalar(@{$gt->markers()}), 15, "marker count in genotype");
20 my $gtio2 = CXGN::GenotypeIO->new( { file => "t/data/dosage_transposed.csv", format=>'dosage_transposed' } );
22 #print STDERR "Markers: ".(Dumper($gtio->markers()))."\n";
23 is(scalar(@{$gtio2->accessions()}), 9, "dosage_transposed accession count");
24 is(scalar(@{$gtio2->markers()}), 3839, "dosage_transposed marker count");
26 is($gtio2->markers()->[0], "S10_14045", "dosage_transposed first marker");
27 is($gtio2->markers()->[-1], "S10_23448593", "dosage_transposed last marker");
28 is($gtio2->accessions()->[0], "1002.250060174", "dosage_transposed first accession");
29 is($gtio2->accessions()->[-1], "1024.250060172", "dosage_transposed last accession");
31 my @gts;
32 while(my $gt = $gtio2->next()) { 
33     print STDERR $gt->name()."\n";
34     push @gts, $gt;
37 is($gts[0]->name(), "1002.250060174", "genotype object accession name");
38 is($gts[1]->rawscores()->{S10_131712}, 0.06, "genotype object markerscore 1");
39 is($gts[7]->rawscores()->{S10_14045}, 0.2, "genotype object markerscore 2");
41 my $gtio3 = CXGN::GenotypeIO->new( { file => "t/data/dosage_transposed.csv", format=>'blablabla' });
43 done_testing();