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
8521c3be
Commit
8521c3be
authored
14 years ago
by
William McLaren
Browse files
Options
Downloads
Patches
Plain Diff
Added get_all_differences method
parent
cb5a62c7
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
modules/Bio/EnsEMBL/LRGSlice.pm
+134
-0
134 additions, 0 deletions
modules/Bio/EnsEMBL/LRGSlice.pm
with
134 additions
and
0 deletions
modules/Bio/EnsEMBL/LRGSlice.pm
+
134
−
0
View file @
8521c3be
...
...
@@ -135,5 +135,139 @@ sub feature_Slice {
sub
DESTROY
{
}
sub
get_all_differences
{
my
$self
=
shift
;
my
@results
;
# get seq_region_attrib diffs (always same-length substitutions)
################################################################
my
$sth
=
$self
->
adaptor
->
prepare
(
qq{
SELECT sra.value
FROM seq_region_attrib sra, attrib_type at
WHERE at.code = '_rna_edit'
AND at.attrib_type_id = sra.attrib_type_id
AND sra.seq_region_id = ?
}
);
$sth
->
execute
(
$self
->
get_seq_region_id
);
my
$edit_string
;
$sth
->
bind_columns
(
\
$edit_string
);
while
(
$sth
->
fetch
())
{
my
(
$start
,
$end
,
$edit
)
=
split
"
",
$edit_string
;
my
$slice
=
$self
->
sub_Slice
(
$start
,
$end
);
my
$chr_proj
=
$slice
->
project
("
chromosome
");
my
$ref_seq
=
'
-
';
if
(
scalar
@$chr_proj
==
1
)
{
$ref_seq
=
$chr_proj
->
[
0
]
->
[
2
]
->
seq
;
}
my
$diff
=
{
'
start
'
=>
$start
,
'
end
'
=>
$end
,
'
type
'
=>
'
substitution
',
'
seq
'
=>
$edit
,
'
ref
'
=>
$ref_seq
,
};
push
@results
,
$diff
;
}
# get more complex differences via projections
##############################################
# project the LRG slice to contig coordinates
my
@segs
=
@
{
$self
->
project
("
contig
")};
# if the LRG projects into more than one segment
if
(
scalar
@segs
>
1
)
{
my
(
$prev_end
,
$prev_chr_start
,
$prev_chr_end
,
$prev_was_chr
);
foreach
my
$seg
(
@segs
)
{
# is this a novel LRG contig, or does it project to a chromosome?
my
@chr_proj
=
@
{
$seg
->
[
2
]
->
project
("
chromosome
")};
# if it is a normal contig
if
(
scalar
@chr_proj
)
{
# check if there has been a deletion in LRG
if
(
$prev_was_chr
&&
$prev_end
==
$seg
->
[
0
]
-
1
)
{
# check it's not just a break in contigs
unless
(
(
$chr_proj
[
0
]
->
[
2
]
->
strand
!=
$self
->
strand
&&
$prev_chr_start
==
$chr_proj
[
0
]
->
[
2
]
->
end
+
1
)
||
(
$chr_proj
[
0
]
->
[
2
]
->
strand
!=
$self
->
strand
&&
$prev_chr_end
==
$chr_proj
[
0
]
->
[
2
]
->
start
-
1
)
)
{
# now get deleted slice coords, depends on the strand rel to LRG
my
(
$s
,
$e
);
# opposite strand
if
(
$chr_proj
[
0
]
->
[
2
]
->
strand
!=
$self
->
strand
)
{
(
$s
,
$e
)
=
(
$prev_chr_start
-
1
,
$chr_proj
[
0
]
->
[
2
]
->
end
+
1
);
}
# same strand
else
{
(
$s
,
$e
)
=
(
$prev_chr_end
+
1
,
$chr_proj
[
0
]
->
[
2
]
->
start
-
1
);
}
if
(
$s
>
$e
)
{
warn
"
Oops, trying to create a slice from
$s
to
$e
(could have been
",
$prev_chr_start
-
1
,
"
-
",
$chr_proj
[
0
]
->
[
2
]
->
end
+
1
,
"
or
",
$prev_chr_end
+
1
,
"
-
",
$chr_proj
[
0
]
->
[
2
]
->
start
-
1
,
"
)
";
}
else
{
# get a slice representing the sequence that was deleted
my
$deleted_slice
=
$self
->
adaptor
->
fetch_by_region
("
chromosome
",
$chr_proj
[
0
]
->
[
2
]
->
seq_region_name
,
$s
,
$e
);
my
$diff
=
{
'
start
'
=>
$seg
->
[
0
],
'
end
'
=>
$prev_end
,
'
type
'
=>
'
deletion
',
'
seq
'
=>
'
-
',
'
ref
'
=>
$deleted_slice
->
seq
.
"
"
.
$deleted_slice
->
start
.
'
-
'
.
$deleted_slice
->
end
,
};
push
@results
,
$diff
;
}
}
}
$prev_was_chr
=
1
;
$prev_chr_start
=
$chr_proj
[
0
]
->
[
2
]
->
start
;
$prev_chr_end
=
$chr_proj
[
0
]
->
[
2
]
->
end
;
}
# if it is an LRG made-up contig for an insertion
else
{
$prev_was_chr
=
0
;
my
$diff
=
{
'
start
'
=>
$seg
->
[
0
],
'
end
'
=>
$seg
->
[
1
],
'
type
'
=>
'
insertion
',
'
seq
'
=>
substr
(
$self
->
seq
,
$seg
->
[
0
]
-
1
,
$seg
->
[
1
]
-
$seg
->
[
0
]
+
1
),
'
ref
'
=>
'
-
',
};
push
@results
,
$diff
;
}
$prev_end
=
$seg
->
[
1
];
}
}
# return results sorted by start, then end position
return
[
sort
{
$a
->
{
start
}
<=>
$b
->
{
start
}
||
$a
->
{
end
}
<=>
$b
->
{
end
}}
@results
];
}
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