Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
1
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
Commits
db7f335e
Commit
db7f335e
authored
14 years ago
by
Ian Longden
Browse files
Options
Downloads
Patches
Plain Diff
IKMC parser
parent
53b81202
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
misc-scripts/xref_mapping/XrefParser/IKMCParser.pm
+100
-0
100 additions, 0 deletions
misc-scripts/xref_mapping/XrefParser/IKMCParser.pm
with
100 additions
and
0 deletions
misc-scripts/xref_mapping/XrefParser/IKMCParser.pm
0 → 100644
+
100
−
0
View file @
db7f335e
package
XrefParser::
IKMCParser
;
use
strict
;
use
base
qw( XrefParser::BaseParser )
;
# This parser will read Direct Xrefs from a simple tab-delimited file.
# The columns of the file should be the following:
#
# 1) Accession ID
# 2) label
# 3) source type
# 4) stable_id
#
sub
new
{
my
$proto
=
shift
;
my
$class
=
ref
$proto
||
$proto
;
my
$self
=
bless
{},
$class
;
return
$self
;
}
sub
run
{
my
$self
=
shift
;
my
$source_id
=
shift
;
my
$species_id
=
shift
;
my
$files_ref
=
shift
;
my
$rel_file
=
shift
;
my
$verbose
=
shift
;
my
$filename
=
@
{
$files_ref
}[
0
];
my
$file_io
=
$self
->
get_filehandle
(
$filename
);
if
(
!
defined
(
$file_io
)
)
{
return
1
;
}
my
$parsed_count
=
0
;
printf
(
STDERR
"
source = %d
\t
species = %d, file is %s
\n
",
$source_id
,
$species_id
,
$filename
);
my
%type2id
;
foreach
my
$t
("
ES cells available
",
"
Vector available
",
"
No products available yet
",
"
Mice available
"){
my
$ikmc
=
"
IKMC_
"
.
$t
;
$ikmc
=~
s/ /_/g
;
$type2id
{
$t
}
=
XrefParser::
BaseParser
->
get_source_id_for_source_name
(
$ikmc
);
print
$ikmc
.
"
\t
"
.
$type2id
{
$t
}
.
"
\n
";
if
(
!
defined
(
$type2id
{
$t
})){
die
"
Could not get source id for
$ikmc
\n
";
}
}
while
(
defined
(
my
$line
=
$file_io
->
getline
()
)
)
{
chomp
$line
;
my
(
$accession
,
$label
,
$source_type
,
$ensembl_id
)
=
split
(
/\t/
,
$line
);
if
(
!
defined
(
$accession
))
{
printf
(
"
Line %d contains has less than one column.
\n
",
1
+
$parsed_count
);
print
("
The parsing failed
\n
");
return
1
;
}
my
$type
=
'
gene
';
$label
||=
$accession
;
my
$source_id
=
$type2id
{
$source_type
};
++
$parsed_count
;
my
$xref_id
=
XrefParser::
BaseParser
->
get_xref
(
$accession
,
$source_id
,
$species_id
);
if
(
!
defined
(
$xref_id
)
||
$xref_id
eq
''
)
{
$xref_id
=
XrefParser::
BaseParser
->
add_xref
(
$accession
,
undef
,
$label
,
'',
$source_id
,
$species_id
,
"
DIRECT
"
);
}
XrefParser::
BaseParser
->
add_direct_xref
(
$xref_id
,
$ensembl_id
,
$type
,
$accession
);
}
## end while ( defined( my $line...
printf
(
"
%d direct xrefs succesfully parsed
\n
",
$parsed_count
);
$file_io
->
close
();
print
"
Done
\n
";
return
0
;
}
## end sub run
1
;
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