This is a test version of Biostars. For the public version, visit https://www.biostars.org.
infer_experiment.py issue

Hi. When I try to run rseqc to detect the strandness of a bam file (obtained from alignment of reads in paire-end on a genomic reference format gtf using STAR) I get this error:


This is PairEnd Data
Fraction of reads failed to determine: %.4f
Traceback (most recent call last):
  File "/home/omar/Dropbox/TCF19_project/SCRIPTS/infer_experiment.py", line 118, in <module>
    main()
  File "/home/omar/Dropbox/TCF19_project/SCRIPTS/infer_experiment.py", line 103, in main
    print ("Fraction of reads failed to determine: %.4f") % other
TypeError: unsupported operand type(s) for %: 'NoneType' and 'float'

Anyone have a tip?

My bam file composition: enter image description here

My bed file composition: enter image description here

infer_experiment.py

Please copy and paste a small amount of relevant data. Use 10101 button to format that part as code (with a monospace font). Pasting screen shots that show a wall of text are hard to read and not very useful.

1 answer

The line in the script that throws an error:

print ("Fraction of reads failed to determine: %.4f") % other

should be:

print("Fraction of reads failed to determine: %.4f" % other)

That's assuming that other variable is a float-point number, and the parentheses from print should have this variable inside rather than out.

Log in to answer this question.