Skip to content

Suggested update to python code in RPRegress.py file #11

@rppunr

Description

@rppunr

Hi Bart2 team,
I installed the command-line version of Bart2 in my Windows 11 laptop in an Anaconda environment yesterday.
Specifics about my environment:

  1. Microsoft Windows 11 Home-Version 10.0.22631 Build 22631

  2. Anaconda - conda 25.5.1

  3. Python 3.13.5

    When I tried to run the first Genelist simulation, the code stopped running and provided this error message:
    Traceback (most recent call last):
    File "C:\Users\xxx\bart2\bart2-master\bart2-master\bin\bart2", line 183, in
    main()

File "C:\Users\xxx\bart2\bart2-master\bart2-master\bin\bart2", line 179, in main
bart(args)
~~~~^^^^^^
File "c:\users\xxx\bart2\bart2-master\bart2-master\bart2\main.py", line 69, in bart
model_df, model_summary = RPRegress.main(rp_args)
~~~~~~~~~~~~~~^^^^^^^^^
File "c:\users\xxx\bart2\bart2-master\bart2-master\bart2\RPRegress.py", line 397, in main
ann = dataset_annotation(annotation)
File "c:\users\xxx\bart2\bart2-master\bart2-master\bart2\RPRegress.py", line 209, in dataset_annotation
inf = open(annotationf, 'rU')
ValueError: invalid mode: 'rU'

I implemented the following solution, and then the simulation ran entirely and provided me with all the expected output files:
 Step-by-step fix

Open the file:
Edit
C:\Users\xxx\bart2\bart2-master\bart2-master\bart2\RPRegress.py
Go to line 209 — it looks like:

inf = open(annotationf, 'rU')
Replace it with:

inf = open(annotationf, 'r', newline=None)
This is the modern equivalent that handles universal newlines correctly.

Save the file.

Please consider implementing this change, and let me know if the tool is expected to work properly with it.
Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions