Skip to content
New issue

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

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

Already on GitHub? # to your account

IndexError: list index out of range #25

Closed
georgeg9 opened this issue Oct 17, 2013 · 4 comments
Closed

IndexError: list index out of range #25

georgeg9 opened this issue Oct 17, 2013 · 4 comments

Comments

@georgeg9
Copy link

INFO @ Wed, 16 Oct 2013 14:27:12: #1 read tag files...
INFO @ Wed, 16 Oct 2013 14:27:12: #1 read treatment tags...
INFO @ Wed, 16 Oct 2013 14:27:17: 1000000
INFO @ Wed, 16 Oct 2013 14:27:22: 2000000
INFO @ Wed, 16 Oct 2013 14:27:27: 3000000
INFO @ Wed, 16 Oct 2013 14:27:32: 4000000
INFO @ Wed, 16 Oct 2013 14:27:37: 5000000
INFO @ Wed, 16 Oct 2013 14:27:42: 6000000
INFO @ Wed, 16 Oct 2013 14:27:47: 7000000
INFO @ Wed, 16 Oct 2013 14:27:52: 8000000
INFO @ Wed, 16 Oct 2013 14:27:57: 9000000
INFO @ Wed, 16 Oct 2013 14:28:03: 10000000
INFO @ Wed, 16 Oct 2013 14:28:08: 11000000
INFO @ Wed, 16 Oct 2013 14:28:13: 12000000
INFO @ Wed, 16 Oct 2013 14:28:18: 13000000
INFO @ Wed, 16 Oct 2013 14:28:23: 14000000
INFO @ Wed, 16 Oct 2013 14:28:28: 15000000
INFO @ Wed, 16 Oct 2013 14:28:33: 16000000
INFO @ Wed, 16 Oct 2013 14:28:37: 17000000
INFO @ Wed, 16 Oct 2013 14:28:42: 18000000
INFO @ Wed, 16 Oct 2013 14:28:47: 19000000
INFO @ Wed, 16 Oct 2013 14:28:52: 20000000
INFO @ Wed, 16 Oct 2013 14:28:57: 21000000
Traceback (most recent call last):
File "/usr/bin/macs2", line 514, in
main()
File "/usr/bin/macs2", line 45, in main
run( args )
File "/usr/lib64/python2.7/site-packages/MACS2/callpeak.py", line 69, in run
else: (treat, control) = load_tag_files_options (options)
File "/usr/lib64/python2.7/site-packages/MACS2/callpeak.py", line 379, in load_tag_files_options
treat = tp.build_fwtrack()
File "cParser.pyx", line 824, in MACS2.IO.cParser.BAMParser.build_fwtrack (MACS2/IO/cParser.c:10311)
File "cParser.pyx", line 828, in MACS2.IO.cParser.BAMParser.build_fwtrack (MACS2/IO/cParser.c:10262)
File "cParser.pyx", line 898, in MACS2.IO.cParser.BAMParser.__build_fwtrack_wo_pysam (MACS2/IO/cParser.c:11404)
IndexError: list index out of range

@taoliu
Copy link
Contributor

taoliu commented Oct 17, 2013

File "cParser.pyx", line 898, in MACS2.IO.cParser.BAMParser.__build_fwtrack_wo_pysam (MACS2/IO/cParser.c:11404)
IndexError: list index out of range

What's the BAM file you used? Did you merge multiple BAM files together using 'cat' command? If so, the 'merged' BAM file actually is invalid, since BAM is a binary format. Please just let MACS2 read all BAM files like this:

macs2 callpeak -t chip1.bam chip2.bam chip3.bam -c control1.bam control2.bam …

-T

@georgeg9
Copy link
Author

No i haven't merged any files. I just created a new one using "samtools view -q 1 -b chip1.bam" that gives you a bam file with only the unique mapped reads

@taoliu
Copy link
Contributor

taoliu commented Oct 17, 2013

Do you mind sending me a sample file? It should be small but can reproduce the error.

I just tested 'samtools view -q 1 -b x.bam > y.bam' then run macs2 on y.bam and haven't seen any error. I haven't specified format actually, since macs2 can detect BAM automatically. See the attached message.

The error you posted happened at this code:

            fwtrack.add_loc( references[ chrid ], fpos, strand )

It means that certain chromosome name is not found in the BAM header. Did you change the header of BAM manually?

Tao

$samtools view -q 1 -b UW_K562_H3K4me3.bam > test.bam
$macs2 callpeak -t test.bam -n test
INFO @ Thu, 17 Oct 2013 10:58:43:

Command line: callpeak -t test.bam -n test

ARGUMENTS LIST:

name = test

format = AUTO

ChIP-seq file = ['test.bam']

control file = None

effective genome size = 2.70e+09

band width = 300

model fold = [5, 50]

qvalue cutoff = 5.00e-02

Larger dataset will be scaled towards smaller dataset.

Range for calculating regional lambda is: 10000 bps

Broad region calling is off

INFO @ Thu, 17 Oct 2013 10:58:43: #1 read tag files...
INFO @ Thu, 17 Oct 2013 10:58:43: #1 read treatment tags...
INFO @ Thu, 17 Oct 2013 10:58:43: Detected format is: BAM
INFO @ Thu, 17 Oct 2013 10:58:43: * Input file is gzipped.
INFO @ Thu, 17 Oct 2013 10:58:48: 1000000
INFO @ Thu, 17 Oct 2013 10:58:53: 2000000
INFO @ Thu, 17 Oct 2013 10:58:59: 3000000
INFO @ Thu, 17 Oct 2013 10:59:04: 4000000
INFO @ Thu, 17 Oct 2013 10:59:09: 5000000
INFO @ Thu, 17 Oct 2013 10:59:14: 6000000
INFO @ Thu, 17 Oct 2013 10:59:19: 7000000
INFO @ Thu, 17 Oct 2013 10:59:24: 8000000
INFO @ Thu, 17 Oct 2013 10:59:29: 9000000
INFO @ Thu, 17 Oct 2013 10:59:34: 10000000
INFO @ Thu, 17 Oct 2013 10:59:39: 11000000
INFO @ Thu, 17 Oct 2013 10:59:44: 12000000
INFO @ Thu, 17 Oct 2013 10:59:49: 13000000
INFO @ Thu, 17 Oct 2013 10:59:54: 14000000
INFO @ Thu, 17 Oct 2013 10:59:59: 15000000
INFO @ Thu, 17 Oct 2013 11:00:02: #1 tag size is determined as 36 bps
INFO @ Thu, 17 Oct 2013 11:00:02: #1 tag size = 36
INFO @ Thu, 17 Oct 2013 11:00:02: #1 total tags in treatment: 15465586
INFO @ Thu, 17 Oct 2013 11:00:02: #1 user defined the maximum tags...
INFO @ Thu, 17 Oct 2013 11:00:02: #1 filter out redundant tags at the same location and the same strand by allowing at most 1 tag(s)
INFO @ Thu, 17 Oct 2013 11:00:07: #1 tags after filtering in treatment: 13913615
INFO @ Thu, 17 Oct 2013 11:00:07: #1 Redundant rate of treatment: 0.10
INFO @ Thu, 17 Oct 2013 11:00:07: #1 finished!
INFO @ Thu, 17 Oct 2013 11:00:07: #2 Build Peak Model...
INFO @ Thu, 17 Oct 2013 11:00:13: #2 number of paired peaks: 32060
INFO @ Thu, 17 Oct 2013 11:00:13: start model_add_line…
INFO @ Thu, 17 Oct 2013 11:00:58: start X-correlation...
INFO @ Thu, 17 Oct 2013 11:00:58: end of X-cor
INFO @ Thu, 17 Oct 2013 11:00:58: #2 finished!
INFO @ Thu, 17 Oct 2013 11:00:58: #2 predicted fragment length is 160 bps
INFO @ Thu, 17 Oct 2013 11:00:58: #2 alternative fragment length(s) may be 160 bps
INFO @ Thu, 17 Oct 2013 11:00:58: #2.2 Generate R script for model : test_model.r
INFO @ Thu, 17 Oct 2013 11:00:58: #3 Call peaks...
INFO @ Thu, 17 Oct 2013 11:00:58: #3 Pre-compute pvalue-qvalue table...
INFO @ Thu, 17 Oct 2013 11:02:33: #3 Call peaks for each chromosome...
INFO @ Thu, 17 Oct 2013 11:04:40: #4 Write output xls file... test_peaks.xls
INFO @ Thu, 17 Oct 2013 11:04:41: #4 Write peak in narrowPeak format file... test_peaks.narrowPeak
INFO @ Thu, 17 Oct 2013 11:04:41: #4 Write summits bed file... test_summits.bed
INFO @ Thu, 17 Oct 2013 11:04:41: Done!

On Oct 17, 2013, at 10:38 AM, George notifications@github.com wrote:

No i haven't merged any files. I just created a new one using "samtools view -q 1 -b chip1.bam" that gives you a bam file with only the unique mapped reads


Reply to this email directly or view it on GitHub.

@taoliu
Copy link
Contributor

taoliu commented Oct 23, 2014

Old issue. Closed for now. If the issue still exists, please reopen.

@taoliu taoliu closed this as completed Oct 23, 2014
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants