Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
VEBER Philippe
codepi
Commits
5b8de38b
Commit
5b8de38b
authored
Sep 04, 2018
by
LANORE Vincent
Browse files
Added seed option to indel script (was tested; seems to work).
parent
591a053a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
lib/scripts/add_indels.py
lib/scripts/add_indels.py
+6
-4
No files found.
lib/scripts/add_indels.py
View file @
5b8de38b
...
...
@@ -40,7 +40,6 @@ from Bio.Align import MultipleSeqAlignment
#===================================================================================================
# inputs
#===================================================================================================
### Option defining
parser
=
argparse
.
ArgumentParser
(
prog
=
"add_indels.py"
,
description
=
''
)
...
...
@@ -58,6 +57,8 @@ requiredOptions.add_argument('-p', '--indel_p', type=float,
help
=
"indel proportion"
,
required
=
True
)
requiredOptions
.
add_argument
(
'-c'
,
'--codon'
,
action
=
"store_true"
,
help
=
"is codon data"
)
requiredOptions
.
add_argument
(
'-r'
,
'--random_seed'
,
type
=
int
,
help
=
"random seed"
,
required
=
False
)
##############
...
...
@@ -68,6 +69,8 @@ AliFile = args.ali
OutFile
=
args
.
output
IndelP
=
args
.
indel_p
IsCodon
=
args
.
codon
rseed
=
args
.
random_seed
if
args
.
random_seed
else
random
.
randint
(
0
,
sys
.
maxsize
)
random
.
seed
(
rseed
)
#===================================================================================================
# Set up output directory and logger
...
...
@@ -88,6 +91,8 @@ logger.addHandler(ch)
logger
.
debug
(
sys
.
argv
)
logger
.
info
(
"Random seed is %s"
,
rseed
)
#===================================================================================================
# Read input alignment
...
...
@@ -105,7 +110,6 @@ logger.info("Ali (%s) ok after checking", AliFile.name)
#===================================================================================================
# Add indels in the ali
#===================================================================================================
def
add_indels
(
string
,
p
):
if
p
>
0
:
if
not
IsCodon
:
...
...
@@ -138,9 +142,7 @@ for s in ali:
logger
.
info
(
"Indel replacement ok"
)
#===================================================================================================
# Create output files
#===================================================================================================
AlignIO
.
write
(
MultipleSeqAlignment
(
new_ali
),
OutFile
,
"fasta"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment