Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
ORFs_scanning
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elabaron
ORFs_scanning
Commits
39472794
Commit
39472794
authored
Nov 5, 2021
by
Labaronne Emmanuel
Browse files
Options
Downloads
Patches
Plain Diff
ORFs_scanning.py : check partial codon in truncated sequence
parent
e3a46aae
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ORFs_scanning.py
+13
-9
13 additions, 9 deletions
src/ORFs_scanning.py
with
13 additions
and
9 deletions
src/ORFs_scanning.py
+
13
−
9
View file @
39472794
...
@@ -16,15 +16,17 @@ def check_files(path):
...
@@ -16,15 +16,17 @@ def check_files(path):
def
read_arguments
(
argv
):
def
read_arguments
(
argv
):
__version__
=
"
0.1
"
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'
-i
'
,
'
--input
'
,
required
=
True
,
parser
.
add_argument
(
'
-i
'
,
'
--input
'
,
required
=
True
,
help
=
'
path to input file in fasta or multifasta format
'
)
help
=
'
path to input file in fasta or multifasta format
'
)
parser
.
add_argument
(
'
-o
'
,
'
--output
'
,
parser
.
add_argument
(
'
-o
'
,
'
--output
'
,
required
=
True
,
help
=
'
path to output file
'
)
help
=
'
path to output file
'
)
parser
.
add_argument
(
'
-s
'
,
'
--startcodon
s
'
,
nargs
=
'
+
'
,
parser
.
add_argument
(
'
-s
'
,
'
--startcodon
'
,
nargs
=
'
+
'
,
default
=
[
'
ATG
'
,
'
CTG
'
],
default
=
[
'
ATG
'
,
'
CTG
'
],
help
=
'
list of start codons allowed
'
)
help
=
'
list of start codons allowed separate with space ex : -s ATG CTG GTG
'
)
parser
.
add_argument
(
'
-v
'
,
'
--version
'
,
action
=
'
version
'
,
version
=
'
%(prog)s
'
+
__version__
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
return
(
args
)
return
(
args
)
...
@@ -47,6 +49,8 @@ def calculateScoreKozak(seq, pos):
...
@@ -47,6 +49,8 @@ def calculateScoreKozak(seq, pos):
def
translate
(
record
,
start
,
stop
):
def
translate
(
record
,
start
,
stop
):
rec
=
record
[
start
:
stop
]
rec
=
record
[
start
:
stop
]
if
len
(
rec
)
%
3
!=
0
:
# if partial codon
rec
=
rec
[:
len
(
rec
)
-
(
len
(
rec
)
%
3
)]
# trim the sequence of partial codon
translation
=
rec
.
translate
()
translation
=
rec
.
translate
()
return
(
translation
.
seq
)
return
(
translation
.
seq
)
...
@@ -81,22 +85,24 @@ def process_seq(record, args, output, writer):
...
@@ -81,22 +85,24 @@ def process_seq(record, args, output, writer):
i
=
0
i
=
0
while
i
<=
len
(
seq
)
-
1
:
while
i
<=
len
(
seq
)
-
1
:
codon
=
seq
[
i
:
i
+
3
]
codon
=
seq
[
i
:
i
+
3
]
if
codon
in
args
.
startcodon
s
:
if
codon
in
args
.
startcodon
:
writer
.
writerow
(
determine_ORF
(
i
,
codon
,
seq
,
record
))
writer
.
writerow
(
determine_ORF
(
i
,
codon
,
seq
,
record
))
i
+=
1
i
+=
1
def
main
(
argv
):
def
main
(
argv
):
args
=
read_arguments
(
argv
)
args
=
read_arguments
(
argv
)
print
(
"
input file :
"
,
args
.
input
,
print
(
"
input file :
"
,
args
.
input
,
"
\n
output file :
"
,
args
.
output
,
"
\n
output file :
"
,
args
.
output
,
"
\n
start codons :
"
,
args
.
startcodon
s
,
"
\n
start codons :
"
,
args
.
startcodon
,
"
\n
"
)
"
\n
"
)
check_files
(
args
.
input
)
check_files
(
args
.
input
)
header
=
[
'
posStart
'
,
'
codonStart
'
,
'
posStop
'
,
'
codonStop
'
,
'
lengthInAA
'
,
'
seqKozak
'
,
'
scoreKozak
'
,
'
seqORF
'
,
'
seqAA
'
]
output
=
open
(
args
.
output
,
'
w
'
)
output
=
open
(
args
.
output
,
'
w
'
)
writer
=
csv
.
writer
(
output
)
writer
=
csv
.
writer
(
output
)
header
=
[
'
posStart
'
,
'
codonStart
'
,
'
posStop
'
,
'
codonStop
'
,
'
lengthInAA
'
,
'
seqKozak
'
,
'
scoreKozak
'
,
'
seqORF
'
,
'
seqAA
'
]
writer
.
writerow
(
header
)
writer
.
writerow
(
header
)
input
=
open
(
args
.
input
,
'
r
'
)
input
=
open
(
args
.
input
,
'
r
'
)
...
@@ -105,7 +111,5 @@ def main(argv):
...
@@ -105,7 +111,5 @@ def main(argv):
print
(
'
Done !
'
)
print
(
'
Done !
'
)
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
main
(
sys
.
argv
[
1
:])
main
(
sys
.
argv
[
1
:])
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