cole-trapnell-lab / cufflinks

Boost Software License 1.0
310 stars 116 forks source link

Cuffmerge:ValueError: can't have unbuffered text I/O #130

Open shainijoseph opened 3 years ago

shainijoseph commented 3 years ago

Hi I was using cuffmerge for merging my transcripts..gtd file. I get the following error Thu May 13 23:19:38 2021] Preparing output location ./merged_asm/ Traceback (most recent call last): File "/usr/bin/cuffmerge", line 580, in sys.exit(main()) File "/usr/bin/cuffmerge", line 526, in main run_log = open(logging_dir + "run.log", "w", 0) ValueError: can't have unbuffered text I/O

Ive tried switching my python version from 3.8 to 2.7... Any suggestions to solve this error would be much appreciated

Thanks in advance

actapia commented 3 years ago

I encountered the same error. I believe this is a problem with the cufflinks package from Debian—not the upstream cufflinks. The package maintainers apply a patch to make cuffmerge work with Python 3, but it seems they neglected to change the calls to open. Here's a short patch that should fix it.

--- a/src/cuffmerge
+++ b/src/cuffmerge
@@ -56,6 +56,21 @@
     def __init__(self, msg):
         self.msg = msg

+# Unbuffered class from Magnus Lycka
+# Wraps a stream so that writes are always flushed.
+# https://mail.python.org/pipermail/tutor/2003-November/026645.html
+class Unbuffered(object):
+   def __init__(self, stream):
+       self.stream = stream
+   def write(self, data):
+       self.stream.write(data)
+       self.stream.flush()
+   def writelines(self, datas):
+       self.stream.writelines(datas)
+       self.stream.flush()
+   def __getattr__(self, attr):
+       return getattr(self.stream, attr)
+
 class TestParams:

     class SystemParams:
@@ -523,7 +538,7 @@
         start_time = datetime.now()
         prepare_output_dir()

-        run_log = open(logging_dir + "run.log", "w", 0)
+        run_log = Unbuffered(open(logging_dir + "run.log", "w"))
         run_cmd = " ".join(argv)
         print(run_cmd, file=run_log)
Vermarashi commented 1 year ago

I am also facing the same issue. Could anyone suggest me solution. I am new to this field.

Thanks in advance.

Regards Rashi

actapia commented 1 year ago

I am also facing the same issue. Could anyone suggest me solution. I am new to this field.

Thanks in advance.

Regards Rashi

If you're encountering this issue on Ubuntu 20.04, you can download a version of the cufflinks package with the patch I suggested applied from my repository here.

The steps are

wget http://cs485repo-archives.s3-website.us-east-2.amazonaws.com/repo/dists/focal/non-free/binary-amd64/science/cufflinks_2.2.1+dfsg.1-9~ngs+1_amd64.deb
sudo dpkg -i cufflinks_2.2.1+dfsg.1-9~ngs+1_amd64.deb
RahmatAderemi commented 10 months ago

I am also facing the same issue. Could anyone suggest me solution. I am new to this field. Thanks in advance. Regards Rashi

If you're encountering this issue on Ubuntu 20.04, you can download a version of the cufflinks package with the patch I suggested applied from my repository here.

The steps are

wget https://www.cs.uky.edu/~acta225/CS485/repo/dists/focal/non-free/binary-amd64/science/cufflinks_2.2.1+dfsg.1-9~ngs+1_amd64.deb
sudo dpkg -i cufflinks_2.2.1+dfsg.1-9~ngs+1_amd64.deb

will this work for Ubuntu 22.04?

actapia commented 7 months ago

I am also facing the same issue. Could anyone suggest me solution. I am new to this field. Thanks in advance. Regards Rashi

If you're encountering this issue on Ubuntu 20.04, you can download a version of the cufflinks package with the patch I suggested applied from my repository here. The steps are

wget https://www.cs.uky.edu/~acta225/CS485/repo/dists/focal/non-free/binary-amd64/science/cufflinks_2.2.1+dfsg.1-9~ngs+1_amd64.deb
sudo dpkg -i cufflinks_2.2.1+dfsg.1-9~ngs+1_amd64.deb

will this work for Ubuntu 22.04?

I have a version for 22.04 now here.

wget https://www.cs.uky.edu/~acta225/CS485/repo/dists/jammy/non-free/binary-amd64/science/cufflinks_2.2.1+dfsg.1-10~ngs+1_amd64.deb
sudo dpkg -i cufflinks_2.2.1+dfsg.1-10~ngs+1_amd64.deb