Log2 Scale Deeptools
1
1
Entering edit mode
6 weeks ago
Mohammed ▴ 10

Greetings,

I hope everyone is doing well.

So I used computeMatrix from deeptools to calculate the coverage of certain samples. The bigwig signal is in BPM (generated by bamCoverage). I want to transform the values in the matrix to a log2 scale to get the enrichment profile or heatmap in a log2 scale rather than the original BPM.

I've tried importing the matrix generated by compute matrix into Rstudio, converted the values into log2 scale, and then rezipped the file and tried using plotHeatmap with no success.

 Traceback (most recent call last):
  File "/home/bol7asan/anaconda3/envs/pyngs/bin/plotHeatmap", line 12, in <module>
    main(args)
  File "/home/bol7asan/anaconda3/envs/pyngs/lib/python3.7/site-packages/deeptools/plotHeatmap.py", line 815, in main
    hm.read_matrix_file(matrix_file)
  File "/home/bol7asan/anaconda3/envs/pyngs/lib/python3.7/site-packages/deeptools/heatmapper.py", line 779, in read_matrix_file
    chrom, start, end, name, score, strand = region[0:6]
ValueError: not enough values to unpack (expected 6, got 1)

I've also attached a picture of the matrix after modification, I just changed the values after the strand column.

enter image description here

I would appreciate it if someone can help with this.

deeptools • 353 views
ADD COMMENT
0
Entering edit mode

your first line in the data appears to be some sort of comment starting with @ how did you make that file?

ADD REPLY
0
Entering edit mode

That's supposed to be there, it's json starting with a @, which I presume made loading easy early on (the rest is parsed as a dictionary).

ADD REPLY
0
Entering edit mode
6 weeks ago

My only guess regarding what happened is that you wrote is comma-separated rather than tab-separated. In short, after the header json line, each line is chopped into columns at tabs:

region = line.split('\t')

So your file must have it's first data line with no tab in it. You can confirm this with head -n 2 modified_file.txt | tail -n 1 | cat -A.

BTW, it probably would have been simpler to use wiggletools to log2-transform the bigWig file.

ADD COMMENT
0
Entering edit mode

Thank you Devon!,

wiggletools was the simpler alternative.

ADD REPLY

Login before adding your answer.

Traffic: 1636 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6