Commit 5b8de38b authored by LANORE Vincent's avatar LANORE Vincent
Browse files

Added seed option to indel script (was tested; seems to work).

parent 591a053a
......@@ -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")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment