Skip to content

Commit

Permalink
Fix name clash btw. input() and input
Browse files Browse the repository at this point in the history
Update to Python3 changed the raw_input() function to the input()
function, which clashed with the variable `input` used in this code.

That caused odd behavior.
  • Loading branch information
brantfaircloth committed Oct 4, 2023
1 parent 594c47a commit 55a15ad
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions bin/assembly/phyluce_assembly_explode_get_fastas_file
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def get_args():
help="""Split file by taxon and not by locus""",
)
parser.add_argument(
"--split-char", type=str, default="_", help="""The character to split on"""
"--split-char",
type=str,
default="_",
help="""The character to split on""",
)
return parser.parse_args()

Expand All @@ -66,13 +69,13 @@ def main():
os.makedirs(args.output)
print("Reading fasta...")
if not args.by_taxon:
with open(args.input, "rU") as input:
for seq in SeqIO.parse(input, "fasta"):
with open(args.input, "rU") as input_file:
for seq in SeqIO.parse(input_file, "fasta"):
uce = seq.id.split(args.split_char)[0]
seqdict[uce].append(seq)
elif args.by_taxon:
with open(args.input, "rU") as input:
for seq in SeqIO.parse(input, "fasta"):
with open(args.input, "rU") as input_file:
for seq in SeqIO.parse(input_file, "fasta"):
taxon = "-".join(seq.id.split(args.split_char)[1:])
seqdict[taxon].append(seq)
print("Writing fasta...")
Expand Down

0 comments on commit 55a15ad

Please sign in to comment.