Error with correctGCBias in deepTools
1
0
Entering edit mode
7.3 years ago
clmin ▴ 10

Hello,

I'm trying to correct the GC bias with deepTools. I successfully used computeGCBias

computeGCBias -b file.bam --effectiveGenomeSize 2150570000 -g mm9.2bit -l 200 --GCbiasFrequenciesFile freq.txt -v

But the next step, correctGCBias, return an error I don't understand.

correctGCBias -b file.bam --effectiveGenomeSize 2150570000 -g mm9.2bit --GCbiasFrequenciesFile freq.txt -o gc_file.bam -v

applying correction

genome partition size for multiprocessing: 56882182

using region None

({'chrY': 'chrY', 'chrX': 'chrX', 'chr13': 'chr13', 'chr12': 'chr12', 'chr11': 'chr11', 'chr10': 'chr10', 'chr17': 'chr17', 'chr16': 'chr16', 'chr15': 'chr15', 'chr14': 'chr14', 'chr19': 'chr19', 'chr18': 'chr18', 'chrM': 'chrM', 'chr7': 'chr7', 'chr6': 'chr6', 'chr5': 'chr5', 'chr4': 'chr4', 'chr3': 'chr3', 'chr2': 'chr2', 'chr1': 'chr1', 'chr9': 'chr9', 'chr8': 'chr8'}, {'chrY': 'chrY', 'chrX': 'chrX', 'chr13': 'chr13', 'chr12': 'chr12', 'chr11': 'chr11', 'chr10': 'chr10', 'chr17': 'chr17', 'chr16': 'chr16', 'chr15': 'chr15', 'chr14': 'chr14', 'chr19': 'chr19', 'chr18': 'chr18', 'chrM': 'chrM', 'chr7': 'chr7', 'chr6': 'chr6', 'chr5': 'chr5', 'chr4': 'chr4', 'chr3': 'chr3', 'chr2': 'chr2', 'chr1': 'chr1', 'chr9': 'chr9', 'chr8': 'chr8'})

using 4 processors for 59 number of tasks

Sam for chr10 0 56882182

Sam for chr11 56882182 113764364

Sam for chr12 113764364 121257530

Sam for chr14 0 56882182

Sam for chr15 56882182 103494974

Traceback (most recent call last):

File "/usr/local/bin/correctGCBias", line 11, in <module>

main(args)

File "/usr/local/lib/python2.7/dist-packages/deeptools/correctGCBias.py", line 628, in main

writeCorrectedSam_wrapper, mp_args).get(9999999)

File "/usr/lib/python2.7/multiprocessing/pool.py", line 567, in get

raise self._value

ValueError: invalid value type 'B' (<type 'str'="">)

Could anyone help me?

next-gen deepTools bam • 1.9k views
ADD COMMENT
1
Entering edit mode

I think that's all newest version:

deeptools 2.4.2-4-999ec5d

pysam==0.10.0

ADD REPLY
0
Entering edit mode

OK, please run this with one thread then and post the resulting error message. To properly fix this I might need a copy of the relevant portion of the BAM file (at least the region with the first alignment that's causing this behavior).

ADD REPLY
0
Entering edit mode

My guess is that this is an issue with the version of pysam that you're using. Can you post the following:

  1. The version of deepTools you have installed
  2. The version of pysam you have installed (pip freeze | grep pysam may tell you this).

I know it's a pain, but it might also help to run this single threaded. The error messages are more informative then.

ADD REPLY
0
Entering edit mode

I'm not sure I understand, my first post was one thread and the resulting error message. For the relevant part of the bam, I don't know what that it, sorry.

ADD REPLY
0
Entering edit mode

You were using 4 threads, even though you didn't specify it (it wasn't my idea, but deepTools will use 1/2 of the cores on a server unless you tell it explicitly how many it should use). Just rerun it with -p 1.

ADD REPLY
0
Entering edit mode

It seems the same:

correctGCBias -b ctr1.bam --effectiveGenomeSize 2150570000 -g mm9.2bit --GCbiasFrequenciesFile ct1_j28.txt -o gc_ct1_j28.bam -p 1 -v

applying correction

genome partition size for multiprocessing: 23672257

using region None

({'chrY': 'chrY', 'chrX': 'chrX', 'chr13': 'chr13', 'chr12': 'chr12', 'chr11': 'chr11', 'chr10': 'chr10', 'chr17': 'chr17', 'chr16': 'chr16', 'chr15': 'chr15', 'chr14': 'chr14', 'chr19': 'chr19', 'chr18': 'chr18', 'chrM': 'chrM', 'chr7': 'chr7', 'chr6': 'chr6', 'chr5': 'chr5', 'chr4': 'chr4', 'chr3': 'chr3', 'chr2': 'chr2', 'chr1': 'chr1', 'chr9': 'chr9', 'chr8': 'chr8'}, {'chrY': 'chrY', 'chrX': 'chrX', 'chr13': 'chr13', 'chr12': 'chr12', 'chr11': 'chr11', 'chr10': 'chr10', 'chr17': 'chr17', 'chr16': 'chr16', 'chr15': 'chr15', 'chr14': 'chr14', 'chr19': 'chr19', 'chr18': 'chr18', 'chrM': 'chrM', 'chr7': 'chr7', 'chr6': 'chr6', 'chr5': 'chr5', 'chr4': 'chr4', 'chr3': 'chr3', 'chr2': 'chr2', 'chr1': 'chr1', 'chr9': 'chr9', 'chr8': 'chr8'})

Sam for chr10 0 23672257

Traceback (most recent call last):

File "/usr/local/bin/correctGCBias", line 11, in <module>

main(args)

File "/usr/local/lib/python2.7/dist-packages/deeptools/correctGCBias.py", line 630, in main

res = list(map(writeCorrectedSam_wrapper, mp_args))

File "/usr/local/lib/python2.7/dist-packages/deeptools/correctGCBias.py", line 286, in writeCorrectedSam_wrapper

return writeCorrectedSam_worker(*args)

File "/usr/local/lib/python2.7/dist-packages/deeptools/correctGCBias.py", line 413, in writeCorrectedSam_worker

read.set_tags(readTag)

File "pysam/libcalignedsegment.pyx", line 2113, in pysam.libcalignedsegment.AlignedSegment.set_tags >

(pysam/libcalignedsegment.c:23066)

File "pysam/libcalignedsegment.pyx", line 295, in pysam.libcalignedsegment.packTags >

(pysam/libcalignedsegment.c:6217)

ValueError: invalid value type 'B' (<type 'str'="">)

ADD REPLY
0
Entering edit mode

OK, it's in the set_tags() function, which is the part I needed to know. Can you extract chr10:1-23672257 into a BAM file and post that and your freq.txt file somewhere? Then I can figure out a patch.

ADD REPLY
0
Entering edit mode
ADD REPLY
0
Entering edit mode

Thanks, this turns out to be a bug in pysam. I'm trying to find out now if an earlier version handled this correctly. Whatever aligner you're using producing auxiliary tags that pysam is having problems with.

ADD REPLY
0
Entering edit mode
7.3 years ago

I've posted a bug report to pysam. You can follow the progress of it here.

ADD COMMENT

Login before adding your answer.

Traffic: 1269 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