Closed tele-med closed 8 months ago
Hi @tele-med,
This may be a problem for Windows, where the new line character is \r\n
instead of \n
. What you can do is to replace all the \n
of your data.json
file with \r\n
. Here is an example script of how you can do it:
original_json=open('data.json','r')
new_json=open('new_data.json','w')
for ln in original_json:
new_json.write(ln.strip()+'\r\n')
new_json.close()
Then you would want to rename your new_data.json
to data.json
to run xpore diffmod
.
Thanks!
Best wishes, Yuk Kei
Good day, i'm encountering same error. PS C:\Users\DELL\Desktop\python\RNAmodifications\demo\data\HEK293T-METTL3-KO-rep1\dataprep> original_json=open('data.json','r')
new_json=open('new_data.json','w') for ln in original_json: new_json.write(ln.strip()+'\r\n') new_json.close() At line:3 char:4
- for ln in original_json:
- ~ Missing opening '(' after keyword 'for'. At line:4 char:29
- new_json.write(ln.strip()+'\r\n')
- ~ An expression was expected after '('. At line:5 char:16
- new_json.close()
- ~ An expression was expected after '('.
- CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
- FullyQualifiedErrorId : MissingOpenParenthesisAfterKeyword
Hi @Ibisanmi1,
Please save the following as a python script change_dataprep_json.py
:
original_json=open('data.json','r')
new_json=open('new_data.json','w')
for ln in original_json:
new_json.write(ln.strip()+'\r\n')
new_json.close()
Then you call the script from command line:
python change_dataprep_json.py
Thanks!
Best wishes, Yuk Kei
Hi all, I'm trying to run the demo code found here: https://xpore.readthedocs.io/en/latest/quickstart.html I'm able to create the dataprep folders correctly for both WT and KO datasets (I have the "--- SUCCESSFULLY FINISHED ---" string in data.log). Anyway, when I run the next command of the tutorial xpore diffmod --config Hek293T_config.yml I get this error:
C:\Users\Sasha\demo>xpore diffmod --config Hek293T_config.yml Using the signal of unmodified RNA from C:\Users\Sasha\AppData\Local\Programs\Python\Python310\lib\site-packages\xpore-2.1-py3.10.egg\xpore\diffmod\model_kmer.csv 2 ids to be testing ... Traceback (most recent call last): File "C:\Users\Sasha\AppData\Local\Programs\Python\Python310\Scripts\xpore-script.py", line 33, in
sys.exit(load_entry_point('xpore==2.1', 'console_scripts', 'xpore')())
File "C:\Users\Sasha\AppData\Local\Programs\Python\Python310\lib\site-packages\xpore-2.1-py3.10.egg\xpore\scripts\xpore.py", line 67, in main
options.func(options)
File "C:\Users\Sasha\AppData\Local\Programs\Python\Python310\lib\site-packages\xpore-2.1-py3.10.egg\xpore\scripts\diffmod.py", line 169, in diffmod
data_dict[(condition_name,run_name)] = ujson.loads(json_str) # A data dict for each gene.
ujson.JSONDecodeError: Trailing data
How can I solve this problem? Thanks a lot in advance SF