Imported Upstream version 0.2.0
[tabix.git] / perl / t / 02remote.t
diff --git a/perl/t/02remote.t b/perl/t/02remote.t
new file mode 100644 (file)
index 0000000..0668e8f
--- /dev/null
@@ -0,0 +1,28 @@
+#-*-Perl-*-
+use Test::More tests => 9;
+BEGIN { use_ok('Tabix') };
+
+{ # FTP access
+       my $t = Tabix->new(-data=>"ftp://ftp.ncbi.nih.gov/1000genomes/ftp/pilot_data/release/2010_03/pilot1/CEU.SRP000031.2010_03.genotypes.vcf.gz");
+       ok($t);
+       my $iter = $t->query("1", 1000000, 1100000);
+       ok($iter);
+       $_ = 0;
+       ++$_ while ($t->read($iter));
+       is($_, 306);
+       @_ = $t->getnames;
+       is(scalar(@_), 22);
+}
+
+{ # FTP access plus FTP index
+       my $t = Tabix->new(-data=>"ftp://ftp.ncbi.nih.gov/1000genomes/ftp/pilot_data/release/2010_03/pilot1/CEU.SRP000031.2010_03.genotypes.vcf.gz",
+                                          -index=>"ftp://ftp.ncbi.nih.gov/1000genomes/ftp/pilot_data/release/2010_03/pilot1/CEU.SRP000031.2010_03.genotypes.vcf.gz.tbi");
+       ok($t);
+       my $iter = $t->query("19", 10000000, 10100000);
+       ok($iter);
+       $_ = 0;
+       ++$_ while ($t->read($iter));
+       is($_, 268);
+       @_ = $t->getnames;
+       is(scalar(@_), 22);
+}