Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mutalyzer
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirrors
mutalyzer
Commits
753bf600
Commit
753bf600
authored
9 years ago
by
Jeroen F.J. Laros
Committed by
Vermaat
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Updated documentation.
parent
57c55d0f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mutalyzer/describe.py
+15
-12
15 additions, 12 deletions
mutalyzer/describe.py
mutalyzer/variant.py
+36
-56
36 additions, 56 deletions
mutalyzer/variant.py
with
51 additions
and
68 deletions
mutalyzer/describe.py
+
15
−
12
View file @
753bf600
...
...
@@ -31,6 +31,15 @@ def printpos(s, start, end, fill=0):
def
var_to_rawvar
(
s1
,
s2
,
var
,
seq_list
=
[],
container
=
DNAVar
,
weight_position
=
1
):
"""
Convert a variant from the extractor module to one of the RawVar
subclasses.
:arg unicode s1: Reference sequence.
:arg unicode s2: Sample sequence.
:arg str var: Variant from the extractor module.
:arg str seq_list: Container for an inserted sequence.
:arg str container: Destination container.
:arg str weight_position: Weight of a position.
"""
# Unknown.
if
s1
==
'
?
'
or
s2
==
'
?
'
:
...
...
@@ -131,13 +140,10 @@ def describe_dna(s1, s2):
"""
Give an allele description of the change from {s1} to {s2}.
:arg s1: Sequence 1.
:type s1: unicode
:arg s2: Sequence 2.
:type s2: unicode
:arg unicode s1: Sequence 1.
:arg unicode s2: Sequence 2.
:returns: A list of RawVar objects, representing the allele.
:rtype: list(RawVar)
:returns list(RawVar): A list of RawVar objects, representing the allele.
"""
description
=
Allele
()
in_transposition
=
0
...
...
@@ -190,13 +196,10 @@ def describe_protein(s1, s2):
"""
Give an allele description of the change from {s1} to {s2}.
:arg s1: Sequence 1.
:type s1: unicode
:arg s2: Sequence 2.
:type s2: unicode
:arg unicode s1: Sequence 1.
:arg unicode s2: Sequence 2.
:returns: A list of RawVar objects, representing the allele.
:rtype: list(RawVar)
:returns list(RawVar): A list of RawVar objects, representing the allele.
"""
description
=
Allele
()
...
...
This diff is collapsed.
Click to expand it.
mutalyzer/variant.py
+
36
−
56
View file @
753bf600
"""
Models for the description extractor.
"""
from
__future__
import
unicode_literals
...
...
@@ -71,14 +72,12 @@ class ISeq(object):
def
__init__
(
self
,
sequence
=
''
,
start
=
0
,
end
=
0
,
reverse
=
False
,
weight_position
=
1
):
"""
:arg sequence: Literal inserted sequence.
:type sequence: unicode
:arg start: Start position for a transposed sequence.
:type start: int
:arg end: End position for a transposed sequence.
:type end: int
:arg reverse: Inverted transposed sequence.
:type reverse: bool
Initialise the class with the appropriate values.
:arg unicode sequence: Literal inserted sequence.
:arg int start: Start position for a transposed sequence.
:arg int end: End position for a transposed sequence.
:arg bool reverse: Inverted transposed sequence.
"""
self
.
sequence
=
sequence
self
.
start
=
start
...
...
@@ -130,30 +129,18 @@ class DNAVar(object):
"""
Initialise the class with the appropriate values.
:arg start: Start position.
:type start: int
:arg start_offset:
:type start_offset: int
:arg end: End position.
:type end: int
:arg end_offset:
:type end_offset: int
:arg sample_start: Start position.
:type sample_start: int
:arg sample_start_offset:
:type sample_start_offset: int
:arg sample_end: End position.
:type sample_end: int
:arg sample_end_offset:
:type sample_end_offset: int
:arg type: Variant type.
:type type: unicode
:arg deleted: Deleted part of the reference sequence.
:type deleted: unicode
:arg inserted: Inserted part.
:type inserted: object
:arg shift: Amount of freedom.
:type shift: int
:arg int start: Start position.
:arg int start_offset:
:arg int end: End position.
:arg int end_offset:
:arg int sample_start: Start position.
:arg int sample_start_offset:
:arg int sample_end: End position.
:arg int sample_end_offset:
:arg unicode type: Variant type.
:arg unicode deleted: Deleted part of the reference sequence.
:arg ISeqList inserted: Inserted part.
:arg int shift: Amount of freedom.
"""
# TODO: Will this container be used for all variants, or only genomic?
# start_offset and end_offset may be never used.
...
...
@@ -176,8 +163,8 @@ class DNAVar(object):
"""
Give the HGVS description of the raw variant stored in this class.
:returns: The HGVS description of the raw variant stored in
this class.
:rtype: unicode
:returns
unicode
: The HGVS description of the raw variant stored in
this class.
"""
if
self
.
type
==
'
unknown
'
:
return
'
?
'
...
...
@@ -215,31 +202,24 @@ class DNAVar(object):
class
ProteinVar
(
object
):
"""
Container for a protein variant.
"""
#NOTE: This is experimental code. It is not used at the moment.
def
__init__
(
self
,
start
=
0
,
end
=
0
,
sample_start
=
0
,
sample_end
=
0
,
type
=
'
none
'
,
deleted
=
ISeqList
([
ISeq
()]),
inserted
=
ISeqList
([
ISeq
()]),
shift
=
0
,
term
=
0
):
"""
Initialise the class with the appropriate values.
:arg start: Start position.
:type start: int
:arg end: End position.
:type end: int
:arg sample_start: Start position.
:type sample_start: int
:arg sample_end: End position.
:type sample_end: int
:arg type: Variant type.
:type type: unicode
:arg deleted: Deleted part of the reference sequence.
:type deleted: unicode
:arg inserted: Inserted part.
:type inserted: object
:arg shift: Amount of freedom.
:type shift: int
:arg term:
:type term:
:arg int start: Start position.
:arg int end: End position.
:arg int sample_start: Start position.
:arg int sample_end: End position.
:arg unicode type: Variant type.
:arg unicode deleted: Deleted part of the reference sequence.
:arg ISeqList inserted: Inserted part.
:arg int shift: Amount of freedom.
:arg int term: Number of positions until stop codon.
"""
self
.
start
=
start
self
.
end
=
end
...
...
@@ -257,10 +237,10 @@ class ProteinVar(object):
Give the HGVS description of the raw variant stored in this class.
Note that this function relies on the absence of values to make the
correct description.
Also see the comment in the class definition
.
correct description.
The method used in the DNAVar is better
.
:returns: The HGVS description of the raw variant stored in
this class.
:rtype: unicode
:returns
unicode
: The HGVS description of the raw variant stored in
this class.
"""
if
self
.
type
==
'
unknown
'
:
return
'
?
'
...
...
@@ -278,7 +258,7 @@ class ProteinVar(object):
description
+=
'
{}
'
.
format
(
self
.
start
)
if
self
.
end
:
description
+=
'
_{}{}
'
.
format
(
seq3
(
self
.
end_aa
),
self
.
end
)
if
self
.
type
not
in
[
'
subst
'
,
'
stop
'
,
'
ext
'
,
'
fs
'
]
:
# fs is not a type
if
self
.
type
not
in
(
'
subst
'
,
'
stop
'
,
'
ext
'
,
'
fs
'
)
:
# fs is not a type
description
+=
self
.
type
if
self
.
inserted
:
description
+=
'
{}
'
.
format
(
seq3
(
self
.
inserted
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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