-
Notifications
You must be signed in to change notification settings - Fork 0
/
like_webcode.pl
32 lines (27 loc) · 1.09 KB
/
like_webcode.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
#!/usr/bin/env perl
#
# Display alignments across SAM/BAM/CRAM file formats.
#
use Bio::DB::HTS ;
use strict ;
my @test_files = (
'http://www.ebi.ac.uk/~rishi/test_files/small_brainz.2.bam',
'http://www.ebi.ac.uk/~rishi/test_files/chicken.chrZ.smallbrainz2.ens.sorted.cram'
) ;
my ($hts, $hts_file, $index);
for my $f (@test_files)
{
print("\nrn6DEBUG:AttachedFormat-BAM-file opening for $f\n") ;
$hts = Bio::DB::HTS->new(-bam => $f);
print("\nrn6DEBUG:AttachedFormat-BAM-file opened ".$hts->hts_path ) ;
$hts_file = $hts->hts_file;
print("\nrn6DEBUG:AttachedFormat-BAM-htsfile set \n") ;
$index = Bio::DB::HTSfile->index($hts) ;
print("\nrn6DEBUG:AttachedFormat-BAM-file indexed \n") ;
my $header = $hts->header;
my $region = $header->target_name->[0];
my $callback = sub {return 1};
print("\nrn6DEBUG:AttachedFormat-BAM-fetch calling for $region \n") ;
$index->fetch($hts_file, $header->parse_region("$region:1-10"), $callback);
print("\nrn6DEBUG:AttachedFormat-BAM-fetch called for $region \n") ;
}