Commit 7ce07f86 authored by Tiago Grego's avatar Tiago Grego
Browse files

perlcritic open file plus some housecleaning

parent c16e9a21
......@@ -213,17 +213,8 @@ $feature_writer->write(
)
);
foreach my $slice (@slices) {
$feature_writer->write($slice, $slice_trans);
}
foreach my $feature (@features) {
$feature_writer->write($feature, $feature_trans);
}
# map { $feature_writer->write($_, $slice_trans) } @slices;
# map { $feature_writer->write($_, $feature_trans) } @features;
map { $feature_writer->write($_, $slice_trans) } @slices;
map { $feature_writer->write($_, $feature_trans) } @features;
# finally write connecting triple to master RDF file
$feature_writer->write(
......
......@@ -58,16 +58,16 @@ push @{$gene->{transcripts}[0]{xrefs}},
'primary_id' => 'GO:0032259',
'associated_xrefs' => [],
'linkage_types' => [
{
'source' => {
'display_id' => 'Q8N6Q8',
'primary_id' => 'Q8N6Q8',
'description' => 'Methyltransferase-like protein 25 ',
'dbname' => 'Uniprot/SWISSPROT'
},
'evidence' => 'IEA'
}
],
{
'source' => {
'display_id' => 'Q8N6Q8',
'primary_id' => 'Q8N6Q8',
'description' => 'Methyltransferase-like protein 25 ',
'dbname' => 'Uniprot/SWISSPROT'
},
'evidence' => 'IEA'
}
],
'description' => 'methylation',
'dbname' => 'GO'
};
......@@ -113,11 +113,12 @@ my $rdf_string = <<"RDF";
RDF
my $feature_trans =
Bio::EnsEMBL::IO::Translator::BulkFetcherFeature->new(version => $version,
xref_mapping_file => "$Bin/xref_LOD_mapping.json",
biotype_mapper => Bio::EnsEMBL::Utils::SequenceOntologyMapper->new($omulti->get_DBAdaptor('ontology')->get_OntologyTermAdaptor()),
adaptor => $adaptor);
my $feature_trans = Bio::EnsEMBL::IO::Translator::BulkFetcherFeature->new(
version => $version,
xref_mapping_file => "$Bin/xref_LOD_mapping.json",
biotype_mapper => Bio::EnsEMBL::Utils::SequenceOntologyMapper->new($omulti->get_DBAdaptor('ontology')->get_OntologyTermAdaptor()),
adaptor => $adaptor
);
my $xrefs_writer = Bio::EnsEMBL::IO::Writer::RDF::XRefs->new($feature_trans);
......@@ -126,9 +127,14 @@ my $fh = IO::String->new();
$xrefs_writer->open($fh);
# write namespaces, pass minimal prefix set to reduce clutter
$xrefs_writer->write(Bio::EnsEMBL::IO::Object::RDF->namespaces(blastprodom => "http://purl.uniprot.org/prodom/",
dataset => 'http://rdf.ebi.ac.uk/dataset/ensembl/',
dc => 'http://purl.org/dc/elements/1.1/'));
$xrefs_writer->write(
Bio::EnsEMBL::IO::Object::RDF->namespaces(
blastprodom => "http://purl.uniprot.org/prodom/",
dataset => 'http://rdf.ebi.ac.uk/dataset/ensembl/',
dc => 'http://purl.org/dc/elements/1.1/'
)
);
map { $xrefs_writer->write($_) } @features;
eq_or_diff(${$fh->string_ref()}, $rdf_string, "serializer output matches expected RDF");
......@@ -140,14 +146,14 @@ done_testing();
sub slurp_file {
my $file = shift;
defined $file or die "Undefined file";
my $string;
{
local $/=undef;
open FILE, "<$file" or die "Couldn't open file: $!";
$string = <FILE>;
close FILE;
open my $FILE, '<', $file or die "Couldn't open file: $!";
$string = <$FILE>;
close $FILE;
}
return $string;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment