Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl-io
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl-io
Commits
0a81f2c9
Unverified
Commit
0a81f2c9
authored
4 years ago
by
Mira
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #119 from Ensembl/Feature/BCFLocation
Feature/bcf location
parents
a3be6527
26b4c61f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/Bio/EnsEMBL/IO/Parser/BCF.pm
+16
-1
16 additions, 1 deletion
modules/Bio/EnsEMBL/IO/Parser/BCF.pm
modules/t/bcf.t
+9
-0
9 additions, 0 deletions
modules/t/bcf.t
with
25 additions
and
1 deletion
modules/Bio/EnsEMBL/IO/Parser/BCF.pm
+
16
−
1
View file @
0a81f2c9
...
@@ -34,7 +34,7 @@ use warnings;
...
@@ -34,7 +34,7 @@ use warnings;
use
Carp
;
use
Carp
;
use
Bio::DB::HTS::
VCF
;
use
Bio::DB::HTS::
VCF
;
use
Bio::DB::HTS::VCF::
Iterator
;
use
Bio::DB::HTS::VCF::
Iterator
;
use
Cwd
qw(getcwd)
;
use
parent
qw/Bio::EnsEMBL::IO::Parser/
;
use
parent
qw/Bio::EnsEMBL::IO::Parser/
;
sub
open
{
sub
open
{
...
@@ -51,6 +51,21 @@ sub open {
...
@@ -51,6 +51,21 @@ sub open {
return
$self
;
return
$self
;
}
}
sub
open_with_location
{
my
(
$caller
,
$filename
,
$location
,
@other_args
)
=
@_
;
my
$class
=
ref
(
$caller
)
||
$caller
;
# initialize generic parser
my
$self
=
$class
->
SUPER::
new
(
@other_args
);
my
$currentDir
=
getcwd
();
chdir
(
$location
);
$self
->
{
record
}
=
undef
;
$self
->
{
bcf_file
}
=
Bio::DB::HTS::
VCF
->
new
(
filename
=>
$filename
);
$self
->
{
iterator
}
=
undef
;
chdir
(
$currentDir
);
return
$self
;
}
sub
seek
{
sub
seek
{
my
(
$self
,
$chrom
,
$start
,
$end
)
=
@_
;
my
(
$self
,
$chrom
,
$start
,
$end
)
=
@_
;
...
...
This diff is collapsed.
Click to expand it.
modules/t/bcf.t
+
9
−
0
View file @
0a81f2c9
...
@@ -17,6 +17,7 @@ use warnings;
...
@@ -17,6 +17,7 @@ use warnings;
use
Test::
More
;
use
Test::
More
;
use
Bio::EnsEMBL::IO::Parser::
BCF
;
use
Bio::EnsEMBL::IO::Parser::
BCF
;
use
Cwd
qw(getcwd)
;
use
FindBin
qw( $Bin )
;
use
FindBin
qw( $Bin )
;
...
@@ -26,6 +27,14 @@ my $test_file = $Bin . '/input/test.bcf';
...
@@ -26,6 +27,14 @@ my $test_file = $Bin . '/input/test.bcf';
ok
(
my
$parser
=
Bio::EnsEMBL::IO::Parser::
BCF
->
open
(
$test_file
),
"
BCF file open
");
ok
(
my
$parser
=
Bio::EnsEMBL::IO::Parser::
BCF
->
open
(
$test_file
),
"
BCF file open
");
is
(
$parser
->
num_variants
(),
9
,
'
correct number of variants identified in file
');
is
(
$parser
->
num_variants
(),
9
,
'
correct number of variants identified in file
');
#test open with $location
my
$currentDir
=
getcwd
();
chdir
('
/
');
ok
(
$parser
=
Bio::EnsEMBL::IO::Parser::
BCF
->
open
(
$test_file
,
$currentDir
),
"
BCF file open with location
");
is
(
$parser
->
num_variants
(),
9
,
'
correct number of variants identified in file
');
chdir
(
$currentDir
);
ok
(
my
$h
=
$parser
->
header
(),
"
Got header
");
ok
(
my
$h
=
$parser
->
header
(),
"
Got header
");
my
$header_str
=
<<HEADER;
my
$header_str
=
<<HEADER;
##fileformat=VCFv4.0
##fileformat=VCFv4.0
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment