Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ValueError: invalid mode: 'rU' with python3.11 #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions scoary/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,15 @@ def main(**kwargs):
cutoffs.pop(m,None)

# Start analysis
with open(args.genes, "rU") as genes, \
open(args.traits, "rU") as traits:
with open(args.genes, "r") as genes, \
open(args.traits, "r") as traits:

if args.restrict_to is not None:
# Note: Despite being a dictionary, the values of
# allowed_isolates are not currently used, only the keys
allowed_isolates = {isolate : "all"
for line in
open(args.restrict_to,"rU")
open(args.restrict_to,"r")
for isolate in line.rstrip().split(",")}
else:
# Despite the confusing name
Expand Down Expand Up @@ -343,7 +343,7 @@ def Csv_to_dic_Roary(genefile, delimiter, grabcols, startcol=14,

if writereducedset:
file = open(ReduceSet(genefile,delimiter, grabcols, startcol,
allowed_isolates,time,outdir),"rU")
allowed_isolates,time,outdir),"r")
csvfile = csv.reader(file, skipinitialspace=True,
delimiter=delimiter)
else:
Expand Down
2 changes: 1 addition & 1 deletion scoary/vcf2scoary.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def main():
if not os.path.isfile(args.vcf):
sys.exit("Unable to locate input file %s" % args.vcf)

with open(args.vcf,'rU') as vcffile, open(args.out,'w') as outfile:
with open(args.vcf,'r') as vcffile, open(args.out,'w') as outfile:
lines = csv.reader(vcffile, delimiter='\t', quotechar='"')
metainfo = {"##INFO" : {},
"##FILTER" : {},
Expand Down
4 changes: 2 additions & 2 deletions tests/test_scoary_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


for Test in ["1","2","4"]:
with open(os.getcwd() + "/Test" + Test + "/Tetracycline_resistance.results.csv" ,"rU") as resfile:
with open(os.getcwd() + "/Test" + Test + "/Tetracycline_resistance.results.csv" ,"r") as resfile:
tab = csv.reader(resfile, delimiter=",")
for i in range(2):
if i == 0:
Expand Down Expand Up @@ -120,7 +120,7 @@
print("Not equal at Test %s col 17: %s %s" % (Test, data[17], str(reference[17])))
sys.exit(-1)

with open(os.getcwd() + "/mutations_presence_absence.csv" ,"rU") as vcfresfile:
with open(os.getcwd() + "/mutations_presence_absence.csv" ,"r") as vcfresfile:
tab = csv.reader(vcfresfile, delimiter=",")
for i in range(2):
if i == 0:
Expand Down