This is a test version of Biostars. For the public version, visit https://www.biostars.org.
[MACS] IndexError: list index out of range

histone modify data mapping to reference genome

.sra-->fastq

fastq-dump -I --split-3 SRR948816.sra

fastq--bowtie2--sam

bowtie2 -p 8 -x genome SRR948816.fastq > SRR948816.sam
bowtie2 -p 8 -x genome SRR948825_input.fastq > SRR948825.sam

sam--MACS--peak

macs14 -t SRR948816.sam -c SRR948825.sam -g mm -m 5,30 -n SRR16 -B --call-subpeaks

warning:WARNING @ Sat, 17 Jan 2015 12:35:45: Treatment tags and Control tags are uneven! FDR may be wrong!

macs14 -t SRR948817.sam -c SRR948825.sam -g mm -m 5,30 -n SRR17 -B --call-subpeaks

error:
Traceback (most recent call last):
  File "/usr/bin/macs14", line 366, in <module>
    main()
  File "/usr/bin/macs14", line 60, in main
    (treat, control) = load_tag_files_options (options)
  File "/usr/bin/macs14", line 338, in load_tag_files_options
    treat = tp.build_fwtrack()
  File "/usr/local/python-2.7.8/lib/python2.7/site-packages/MACS14/IO/Parser.py", line 666, in build_fwtrack
    (chromosome,fpos,strand) = self.__fw_parse_line(thisline)
  File "/usr/local/python-2.7.8/lib/python2.7/site-packages/MACS14/IO/Parser.py", line 683, in __fw_parse_line
    thisref = thisfields[2]
IndexError: list index out of range

I want to know what dose the error mean~

macs software error

1 answer

line 683 of Parser.pyis about parsing a sam file (SAMParser class).

Here is the code from MACS:

if thisline[0]=="@": return ("comment line",None,None) # header line started with '@' is skipped
        thisfields = thisline.split('\t')
        thistagname = thisfields[0]         # name of tag
        thisref = thisfields[2]
        bwflag = int(thisfields[1])

its pretty straight forward that it will skip the header lines. Then split the sam records by tab and then stores the read name, chromosome name and flag information.

Can you check the sam file once using samtools whether it is complete and in proper format?

May be you can do sam --> bam --> sort --> any preprocessing --> index and run macs14 on final bam file.

Now I can not connect to the server. But I also do not know how to check the sam file, can you teach me ? I am a beginner.

I tried to translate sam to bam with samtool before, but there is also a error when I use samtool

Try to re-run bowtie2

bowtie2 -p 8 -x genome -U SRR948816.fastq -S SRR948816.sam
bowtie2 -p 8 -x genome -U SRR948825_input.fastq -S SRR948825.sam

Thank you so much.

I try re-run bowtie2 as you said,there is no error now. Can you tell me why?

The command that you were using is not correct.

Log in to answer this question.