-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvcfbits.pl
52 lines (43 loc) · 1.07 KB
/
vcfbits.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
use strict ;
use warnings;
use Bio::DB::HTS::VCF;
#Tests for the sweep functionality
#Open the file
my $sweep = Bio::DB::HTS::VCFSweep->new(filename => "data/test.vcf.gz");
print("File opened\n");
#Display contents
print("Header\n");
print($sweep->header."\n");
my $r = 0 ;
print("Forwards\n");
while( $r < 3 )
{
my $row1=$sweep->next_row();
# $row1->print($sweep->header);
$r++ ;
}
$r = 0 ;
while( $r < 10 )
{
my $row1again=$sweep->previous_row();
#$row1again->print($sweep->header);
my $chr = $row1again->chromosome($sweep->header);
print("Chromsome:$chr\t") ;
print("Position:".$row1again->position()."\t") ;
print("Quality:".$row1again->quality()."\t") ;
print("ID:".$row1again->id()."\t") ;
print("Reference:".$row1again->reference()."\t") ;
print("Filters(".$row1again->num_filters()."):\t") ;
print("Alleles(".$row1again->num_alleles()."):") ;
my $alleles_ref = $row1again->get_alleles() ;
my @alleles = @$alleles_ref ;
for my $a (@alleles)
{
print($a.",") ;
}
print("\n");
$r++ ;
}
#Close
$sweep->close() ;
print("File closed\n");