Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key Error in MACS2 #108

Closed
kannan-kasthuri opened this issue Jan 16, 2016 · 1 comment
Closed

Key Error in MACS2 #108

kannan-kasthuri opened this issue Jan 16, 2016 · 1 comment

Comments

@kannan-kasthuri
Copy link

This is the command I issue,

/Users/home/Tools/MACS-master/bin/macs2 callpeak --format BED --nomodel --broad --verbose 2 --qvalue 0.25 --g mm --name Input.vs.Exp --treatment treatment.bg --control control.bg --outdir .

and I get this error,

INFO @ Fri, 15 Jan 2016 21:12:49:

Command line: callpeak --format BED --nomodel --broad --verbose 2 --qvalue 0.25 --g mm --name Input.vs.Exp --treatment treatment.bg --control control.bg --outdir .

ARGUMENTS LIST:

name = Input.vs.Exp

format = BED

ChIP-seq file = ['treatment.bg']

control file = ['control.bg']

effective genome size = 1.87e+09

band width = 300

model fold = [5, 50]

qvalue cutoff for narrow/strong regions = 2.50e-01

qvalue cutoff for broad/weak regions = 1.00e-01

Larger dataset will be scaled towards smaller dataset.

Range for calculating regional lambda is: 1000 bps and 10000 bps

Broad region calling is on

INFO @ Fri, 15 Jan 2016 21:12:49: #1 read tag files...
INFO @ Fri, 15 Jan 2016 21:12:49: #1 read treatment tags...
INFO @ Fri, 15 Jan 2016 21:12:50: 1000000
INFO @ Fri, 15 Jan 2016 21:12:51: 2000000
INFO @ Fri, 15 Jan 2016 21:12:53: 3000000
INFO @ Fri, 15 Jan 2016 21:12:54: 4000000
INFO @ Fri, 15 Jan 2016 21:12:55: 5000000
INFO @ Fri, 15 Jan 2016 21:12:56: 6000000
INFO @ Fri, 15 Jan 2016 21:12:57: #1.2 read input tags...
INFO @ Fri, 15 Jan 2016 21:12:58: 1000000
INFO @ Fri, 15 Jan 2016 21:13:00: 2000000
INFO @ Fri, 15 Jan 2016 21:13:01: 3000000
INFO @ Fri, 15 Jan 2016 21:13:02: 4000000
INFO @ Fri, 15 Jan 2016 21:13:03: #1 tag size is determined as 41 bps
INFO @ Fri, 15 Jan 2016 21:13:03: #1 tag size = 41
INFO @ Fri, 15 Jan 2016 21:13:03: #1 total tags in treatment: 6600699
INFO @ Fri, 15 Jan 2016 21:13:03: #1 total tags in control: 4295400
INFO @ Fri, 15 Jan 2016 21:13:03: #1 finished!
INFO @ Fri, 15 Jan 2016 21:13:03: #2 Build Peak Model...
INFO @ Fri, 15 Jan 2016 21:13:03: #2 Skipped...
INFO @ Fri, 15 Jan 2016 21:13:03: #2 Use 200 as fragment length
INFO @ Fri, 15 Jan 2016 21:13:03: #3 Call peaks...
INFO @ Fri, 15 Jan 2016 21:13:03: #3 Call broad peaks with given level1 -log10qvalue cutoff and level2: 0.602060, 1.000000...
INFO @ Fri, 15 Jan 2016 21:13:03: #3 Pre-compute pvalue-qvalue table...
INFO @ Fri, 15 Jan 2016 21:13:22: #3 Call peaks for each chromosome...
Traceback (most recent call last):
File "/Users/kasthuri/Tools/MACS-master/bin/macs2", line 617, in
main()
File "/Users/kasthuri/Tools/MACS-master/bin/macs2", line 57, in main
run( args )
File "/Library/Python/2.7/site-packages/MACS2-2.1.0.20151222-py2.7-macosx-10.9-intel.egg/MACS2/callpeak_cmd.py", line 264, in run
peakdetect.call_peaks()
File "PeakDetect.pyx", line 105, in MACS2.PeakDetect.PeakDetect.call_peaks (MACS2/PeakDetect.c:1650)
File "PeakDetect.pyx", line 259, in MACS2.PeakDetect.PeakDetect.__call_peaks_w_control (MACS2/PeakDetect.c:3248)
File "CallPeakUnit.pyx", line 1428, in MACS2.IO.CallPeakUnit.CallerFromAlignments.call_broadpeaks (MACS2/IO/CallPeakUnit.c:18243)
File "CallPeakUnit.pyx", line 1501, in MACS2.IO.CallPeakUnit.CallerFromAlignments.call_broadpeaks (MACS2/IO/CallPeakUnit.c:17770)
File "PeakIO.pyx", line 158, in MACS2.IO.PeakIO.PeakIO.get_data_from_chrom (MACS2/IO/PeakIO.c:3309)
KeyError: 'chr12'

Any help will be much appreciated. Thanks.

@kannan-kasthuri
Copy link
Author

With help from biostars, I was able to fix this error. If there are no peaks in a chromosome, this error will appear. Basically in the file PeakIO.pyx lines 157 and 158 needs to be replaced as shown below and compiled from source:

def get_data_from_chrom (self, str chrom):
if not self.peaks.has_key(chrom):
self.peaks[chrom]=[]
return self.peaks[chrom]

taoliu added a commit that referenced this issue Feb 26, 2016
get_data_from_chrom will throw an error. Thank @kannan-kasthuri!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant