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

rgt-hint differential Error #285

Open
nihenniuwa opened this issue Oct 8, 2024 · 4 comments
Open

rgt-hint differential Error #285

nihenniuwa opened this issue Oct 8, 2024 · 4 comments

Comments

@nihenniuwa
Copy link

When I run the rgt-hintdifferential, there are the following errors, how to solve them?

signal generation is done!

generating line plot for each motif...

multiprocessing.pool.RemoteTraceback:

"""

Traceback (most recent call last):

File "/home/rui/miniconda3/lib/python3.9/multiprocessing/pool.py", line 125, in worker

result = (True, func(*args, **kwds))

File "/home/rui/miniconda3/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar

return list(map(*args))

File "/home/rui/miniconda3/lib/python3.9/site-packages/rgt/HINT/DifferentialAnalysis.py", line 506, in output_line_plot

with open(output_filename, "w") as f:

OSError: [Errno 22] Invalid argument: './DiffFootprinting/Lineplots/MA1128.1.FOSL1::JUN.txt'

"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "/home/rui/miniconda3/bin/rgt-hint", line 8, in

sys.exit(main())

File "/home/rui/miniconda3/lib/python3.9/site-packages/rgt/HINT/Main.py", line 95, in main

args.func(args)

File "/home/rui/miniconda3/lib/python3.9/site-packages/rgt/HINT/DifferentialAnalysis.py", line 258, in diff_analysis_run

pool.map(output_line_plot, arguments_list)

File "/home/rui/miniconda3/lib/python3.9/multiprocessing/pool.py", line 364, in map

return self._map_async(func, iterable, mapstar, chunksize).get()

File "/home/rui/miniconda3/lib/python3.9/multiprocessing/pool.py", line 771, in get

raise self._value

OSError: [Errno 22] Invalid argument: './DiffFootprinting/Lineplots/MA1128.1.FOSL1::JUN.txt'
I returned the same error when I ran the sample file.

@songw01
Copy link

songw01 commented Nov 28, 2024

I get the same error. Is there a solution to this?

@nihenniuwa
Copy link
Author

I get the same error. Is there a solution to this?

This problem is because ":" is a special character and cannot be used for file names. I tried to handle file names in DifferentialAnalysis.py script by replacing "::" with other legal characters, such as "_". Find the part of the script responsible for generating the file name (the output_line_plot function) and replace the illegal characters before creating the file.
def output_line_plot(arguments):
(mpbs_name, mpbs_num, signals, conditions, pwm, output_location, window_size, colors) = arguments

# replace characters that might make the file name invalid
safe_mpbs_name = mpbs_name.replace("::", "_").replace("(", "_").replace(")", "")

# output signal
output_filename = os.path.join(output_location, "{}.txt".format(safe_mpbs_name))
with open(output_filename, "w") as f:
    f.write("\t".join(conditions) + "\n")
    for i in range(window_size):
        res = []
        for j, condition in enumerate(conditions):
            res.append(signals[j][i])

        f.write("\t".join(map(str, res)) + "\n")

This is the modified part of the code, may need to be modified, for reference only.

@songw01
Copy link

songw01 commented Dec 1, 2024

I am new to python, and wonder if this is simply matter of changing the code in the file? Or do you have the patched source file?

@nihenniuwa
Copy link
Author

我是 Python 新手,不知道这是否只是更改文件中的代码的问题?或者您有修补过的源文件吗?

DifferentialAnalysis.zip
This is the file I changed. The change to the script only involves generating the file name, and the modification does not involve any calculation logic, nor does it change the semantics of mpbs_name, so I think it will not affect the operation of the code and the accuracy of the result. There was no anomaly when I used it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants