Using MACS2 with BAM input

1,160 views
Skip to first unread message

Becca

unread,
May 8, 2013, 1:31:36 PM5/8/13
to macs-ann...@googlegroups.com
Hi,

I am having trouble running MACS2 with BAM format files. Using BED input seems to work fine but when using BAM I get the following error:

/home/Programs/MACS2-2.0.10.09132012/bin/macs2 callpeak -t test.bam -f BAM -g mm -n test_peaks -B -q 0.01
INFO  @ Wed, 08 May 2013 18:00:10:
# ARGUMENTS LIST:
# name = test_peaks
# format = BAM
# ChIP-seq file = ['test.bam']
# control file = None
# effective genome size = 1.87e+09
# band width = 300
# model fold = [5, 50]
# qvalue cutoff = 1.00e-02
# Larger dataset will be scaled towards smaller dataset.
# Range for calculating regional lambda is: 10000 bps
# Broad region calling is off
 
INFO  @ Wed, 08 May 2013 18:00:10: #1 read tag files...
INFO  @ Wed, 08 May 2013 18:00:10: #1 read treatment tags...
Traceback (most recent call last):
  File "/home/Programs/MACS2-2.0.10.09132012/bin/macs2", line 362, in <module>
    main()
  File "/home/Programs/MACS2-2.0.10.09132012/bin/macs2", line 45, in main
    run( args )
  File "/usr/local/lib/python2.7/site-packages/MACS2/callpeak.py", line 70, in run
    else:       (treat, control) = load_tag_files_options  (options)
  File "/usr/local/lib/python2.7/site-packages/MACS2/callpeak.py", line 350, in load_tag_files_options
    tp = options.parser(options.tfile[0])
  File "cParser.pyx", line 659, in MACS2.IO.cParser.BAMParser.__init__ (MACS2/IO/cParser.c:7647)
  File "/usr/local/lib/python2.7/gzip.py", line 258, in read
    if not self._read(readsize):
  File "/usr/local/lib/python2.7/gzip.py", line 293, in _read
    self._read_gzip_header()
  File "/usr/local/lib/python2.7/gzip.py", line 205, in _read_gzip_header
    self._read_exact(struct.unpack("<H", self._read_exact(2)))
  File "/usr/local/lib/python2.7/gzip.py", line 185, in _read_exact
    data = self.fileobj.read(n)
TypeError: an integer is required

We extract a bed file from our sam file (with format: <chr> <start> <end> <id> <score> <strand>) making each read 200bp long, and then use bedToBam. (I have also tried converting the sam directly to bam using samtools just to test if the problem was with my bedToBam conversion, but I get the same error in MACS2). We want to be able to use bam for reasons of storage and as such, we need to be able to run analysis directly on the bam files!

Many thanks,
Rebecca

Tao Liu

unread,
May 8, 2013, 3:03:48 PM5/8/13
to macs-ann...@googlegroups.com
Hi Rebecca,

I have seen such bug reports for a lot of times :) First, you need to make sure your BAM file is valid. Check it with samtools. The bam file converted by bedToBam may not work since many fields have lost when you convert BAM to BED. Make sure you convert SAM to BAM successfully ( $samtools view -bS -o test.bam test.sam).

Also, keep you MACS2 code updated. What you have to do is to clean the old MACS2 installation and update your MACS2 codes. The best way is through PyPI system. A simple instruction on how to install MACS2 through pypi is here: https://github.com/taoliu/MACS/wiki/Build-Signal-Track#wiki-Install

Best,
Tao Liu

--
Assistant Professor
Department of Biochemistry
University at Buffalo
NY State Center of Excellence in Bioinformatics & Life Sciences

B2-163 COEBLS
(O) 716-829-2749
tl...@buffalo.edu

Mailing address:
University at Buffalo-COEBLS
701 Ellicott St, B2-163
Buffalo, NY 14203-1221

--
You received this message because you are subscribed to the Google Groups "MACS announcement" group.
To unsubscribe from this group and stop receiving emails from it, send an email to macs-announcem...@googlegroups.com.
To post to this group, send email to macs-ann...@googlegroups.com.
Visit this group at http://groups.google.com/group/macs-announcement?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Tao Liu

unread,
May 15, 2013, 10:23:22 AM5/15/13
to macs-ann...@googlegroups.com
Compilation is successful. Warnings while compiling C codes are normal.  It may be related to new version of Python 2.7.4. I found this bug report on bugs.python.org:


This bug is closed on 5/12/2013.

Does anyone see such error in Python2.7.3? I think either you have to wait for a update on Python from Ubuntu repository, or you need to download reinstall Python from source code which is updated later than 5/12/2013.

Best,

Tao Liu

--
Assistant Professor
Department of Biochemistry
University at Buffalo
NY State Center of Excellence in Bioinformatics & Life Sciences

B2-163 COEBLS
(O) 716-829-2749
tl...@buffalo.edu

Mailing address:
University at Buffalo-COEBLS
701 Ellicott St, B2-163
Buffalo, NY 14203-1221

On May 15, 2013, at 1:55 AM, zhangz...@gmail.com wrote:

Hi, this is the upgrade output:

> sudo easy_install --upgrade MACS2
Searching for MACS2
Best match: MACS2 2.0.10.20130501
Processing MACS2-2.0.10.20130501.tar.gz
Running MACS2-2.0.10.20130501/setup.py -q bdist_egg --dist-dir /tmp/easy_install-5AyeIo/MACS2-2.0.10.20130501/egg-dist-tmp-_JDhhM
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1728:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from MACS2/cProb.c:259:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: 警告: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:26:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from MACS2/cProb.c:259:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__multiarray_api.h:1594:1: 警告: ‘_import_array’定义后未使用 [-Wunused-function]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ufuncobject.h:311:0,
                 from MACS2/cProb.c:260:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__ufunc_api.h:236:1: 警告: ‘_import_umath’定义后未使用 [-Wunused-function]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1728:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from MACS2/IO/cParser.c:258:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: 警告: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:26:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from MACS2/IO/cParser.c:258:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__multiarray_api.h:1594:1: 警告: ‘_import_array’定义后未使用 [-Wunused-function]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ufuncobject.h:311:0,
                 from MACS2/IO/cParser.c:259:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__ufunc_api.h:236:1: 警告: ‘_import_umath’定义后未使用 [-Wunused-function]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1728:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from MACS2/cPileup.c:257:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: 警告: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:26:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from MACS2/cPileup.c:257:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__multiarray_api.h:1594:1: 警告: ‘_import_array’定义后未使用 [-Wunused-function]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ufuncobject.h:311:0,
                 from MACS2/cPileup.c:258:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__ufunc_api.h:236:1: 警告: ‘_import_umath’定义后未使用 [-Wunused-function]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1728:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from MACS2/cPeakModel.c:257:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: 警告: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:26:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from MACS2/cPeakModel.c:257:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__multiarray_api.h:1594:1: 警告: ‘_import_array’定义后未使用 [-Wunused-function]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ufuncobject.h:311:0,
                 from MACS2/cPeakModel.c:258:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__ufunc_api.h:236:1: 警告: ‘_import_umath’定义后未使用 [-Wunused-function]
MACS2/cPeakModel.c: 在函数‘__pyx_pw_5MACS2_10cPeakModel_9PeakModel_17__naive_peak_pos’中:
MACS2/cPeakModel.c:6726:17: 警告: 此函数中的‘__pyx_v_pos’在使用前可能未初始化 [-Wuninitialized]
MACS2/cPeakModel.c:6564:7: 附注: ‘__pyx_v_pos’在此声明
MACS2/cPeakDetect.c:787:18: 警告: ‘__pyx_f_5MACS2_11cPeakDetect_subpeak_letters’定义后未使用 [-Wunused-function]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1728:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from MACS2/cSignal.c:257:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: 警告: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:26:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from MACS2/cSignal.c:257:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__multiarray_api.h:1594:1: 警告: ‘_import_array’定义后未使用 [-Wunused-function]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ufuncobject.h:311:0,
                 from MACS2/cSignal.c:258:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__ufunc_api.h:236:1: 警告: ‘_import_umath’定义后未使用 [-Wunused-function]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1728:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from MACS2/IO/cFixWidthTrack.c:259:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: 警告: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:26:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from MACS2/IO/cFixWidthTrack.c:259:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__multiarray_api.h:1594:1: 警告: ‘_import_array’定义后未使用 [-Wunused-function]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ufuncobject.h:311:0,
                 from MACS2/IO/cFixWidthTrack.c:260:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__ufunc_api.h:236:1: 警告: ‘_import_umath’定义后未使用 [-Wunused-function]
MACS2/IO/cFixWidthTrack.c: 在函数‘__pyx_f_5MACS2_2IO_14cFixWidthTrack_10FWTrackIII_compute_region_tags_from_peaks’中:
MACS2/IO/cFixWidthTrack.c:9857:11: 警告: 此函数中的‘__pyx_v_j’在使用前可能未初始化 [-Wmaybe-uninitialized]
MACS2/IO/cFixWidthTrack.c:9856:11: 警告: 此函数中的‘__pyx_v_i’在使用前可能未初始化 [-Wmaybe-uninitialized]
MACS2/IO/cFixWidthTrack.c: 在函数‘__pyx_f_5MACS2_2IO_14cFixWidthTrack_10FWTrackIII_refine_peak_from_tags_distribution’中:
MACS2/IO/cFixWidthTrack.c:10842:11: 警告: 此函数中的‘__pyx_v_j’在使用前可能未初始化 [-Wmaybe-uninitialized]
MACS2/IO/cFixWidthTrack.c:10841:11: 警告: 此函数中的‘__pyx_v_i’在使用前可能未初始化 [-Wmaybe-uninitialized]
MACS2/IO/cFixWidthTrack.c: 在函数‘__pyx_f_5MACS2_2IO_14cFixWidthTrack_10FWTrackIII_separate_dups’中:
MACS2/IO/cFixWidthTrack.c:5143:21: 警告: 此函数中的‘__pyx_v_n’在使用前可能未初始化 [-Wmaybe-uninitialized]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1728:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from MACS2/IO/cPairedEndTrack.c:257:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: 警告: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:26:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from MACS2/IO/cPairedEndTrack.c:257:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__multiarray_api.h:1594:1: 警告: ‘_import_array’定义后未使用 [-Wunused-function]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ufuncobject.h:311:0,
                 from MACS2/IO/cPairedEndTrack.c:258:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__ufunc_api.h:236:1: 警告: ‘_import_umath’定义后未使用 [-Wunused-function]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1728:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from MACS2/IO/cScoreTrack.c:257:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: 警告: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:26:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from MACS2/IO/cScoreTrack.c:257:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__multiarray_api.h:1594:1: 警告: ‘_import_array’定义后未使用 [-Wunused-function]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ufuncobject.h:311:0,
                 from MACS2/IO/cScoreTrack.c:258:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__ufunc_api.h:236:1: 警告: ‘_import_umath’定义后未使用 [-Wunused-function]
MACS2/IO/cScoreTrack.c: 在函数‘__pyx_f_5MACS2_2IO_11cScoreTrack_12scoreTrackII_compute_SPMR’中:
MACS2/IO/cScoreTrack.c:14480:37: 警告: 此函数中的‘__pyx_v_scale’在使用前可能未初始化 [-Wmaybe-uninitialized]
MACS2/IO/cScoreTrack.c: 在函数‘__pyx_pw_5MACS2_2IO_11cScoreTrack_16CombinedTwoTrack_19extract_average’中:
MACS2/IO/cScoreTrack.c:8073:33: 警告: 此函数中的‘__pyx_v_l’在使用前可能未初始化 [-Wmaybe-uninitialized]
MACS2/IO/cScoreTrack.c:7371:7: 附注: ‘__pyx_v_l’在此声明
MACS2/IO/cScoreTrack.c: 在函数‘__pyx_f_5MACS2_2IO_11cScoreTrack_15DiffScoreTrackI_annotate_peaks’中:
MACS2/IO/cScoreTrack.c:39293:13: 警告: 此函数中的‘__pyx_v_ii’在使用前可能未初始化 [-Wmaybe-uninitialized]
MACS2/IO/cScoreTrack.c: 在函数‘__pyx_f_5MACS2_2IO_11cScoreTrack_15DiffScoreTrackI_call_diff_peaks’中:
MACS2/IO/cScoreTrack.c:43749:37: 警告: 此函数中的‘__pyx_v_i’在使用前可能未初始化 [-Wmaybe-uninitialized]
MACS2/IO/cScoreTrack.c: 在函数‘__pyx_pf_5MACS2_2IO_11cScoreTrack_15DiffScoreTrackI_38write_peaks2’中:
MACS2/IO/cScoreTrack.c:49034:17: 警告: 此函数中的‘__pyx_pybuffernd_above_cutoff.diminfo[0].shape’在使用前可能未初始化 [-Wmaybe-uninitialized]
MACS2/IO/cScoreTrack.c:49039:25: 警告: 此函数中的‘__pyx_pybuffernd_above_cutoff.diminfo[0].strides’在使用前可能未初始化 [-Wmaybe-uninitialized]
MACS2/IO/cScoreTrack.c: 在函数‘__pyx_f_5MACS2_2IO_11cScoreTrack_15DiffScoreTrackI__write_peaks_by_summit’中:
MACS2/IO/cScoreTrack.c:54010:14: 警告: 此函数中的‘__pyx_v_score_value’在使用前可能未初始化 [-Wmaybe-uninitialized]
MACS2/IO/cScoreTrack.c: 在函数‘__pyx_f_5MACS2_2IO_11cScoreTrack_12scoreTrackII_reassign_peaks’中:
MACS2/IO/cScoreTrack.c:15534:37: 警告: 此函数中的‘__pyx_v_cutoff’在使用前可能未初始化 [-Wuninitialized]
MACS2/IO/cScoreTrack.c: 在函数‘__pyx_f_5MACS2_2IO_11cScoreTrack_15DiffScoreTrackI_call_peaks’中:
MACS2/IO/cScoreTrack.c:37737:23: 警告: 此函数中的‘__pyx_v_i’在使用前可能未初始化 [-Wmaybe-uninitialized]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1728:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from MACS2/IO/cCallPeakUnit.c:257:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: 警告: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:26:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from MACS2/IO/cCallPeakUnit.c:257:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__multiarray_api.h:1594:1: 警告: ‘_import_array’定义后未使用 [-Wunused-function]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ufuncobject.h:311:0,
                 from MACS2/IO/cCallPeakUnit.c:258:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__ufunc_api.h:236:1: 警告: ‘_import_umath’定义后未使用 [-Wunused-function]
MACS2/IO/cCallPeakUnit.c:2475:15: 警告: ‘__pyx_f_5MACS2_2IO_13cCallPeakUnit_get_interpolated_pscore’定义后未使用 [-Wunused-function]
MACS2/IO/cCallPeakUnit.c: 在函数‘__pyx_f_5MACS2_2IO_13cCallPeakUnit_20CallerFromAlignments_refine_peak_from_tags_distribution’中:
MACS2/IO/cCallPeakUnit.c:15431:11: 警告: 此函数中的‘__pyx_v_j’在使用前可能未初始化 [-Wmaybe-uninitialized]
MACS2/IO/cCallPeakUnit.c:15430:11: 警告: 此函数中的‘__pyx_v_i’在使用前可能未初始化 [-Wmaybe-uninitialized]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1728:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from MACS2/hashtable.c:258:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: 警告: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:26:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:15,
                 from MACS2/hashtable.c:258:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__multiarray_api.h:1594:1: 警告: ‘_import_array’定义后未使用 [-Wunused-function]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ufuncobject.h:311:0,
                 from MACS2/hashtable.c:259:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__ufunc_api.h:236:1: 警告: ‘_import_umath’定义后未使用 [-Wunused-function]
zip_safe flag not set; analyzing archive contents...
MACS2.cStat: module MAY be using inspect.trace
Removing MACS2 2.0.10.20130501 from easy-install.pth file
Adding MACS2 2.0.10.20130501 to easy-install.pth file
Installing macs2 script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/MACS2-2.0.10.20130501-py2.7-linux-x86_64.egg
Processing dependencies for MACS2
Finished processing dependencies for MACS2

And then I run macs2, the "TypeError..." appears.
Thank you!

Zhuqiang, Zhang

unread,
May 16, 2013, 1:39:22 AM5/16/13
to macs-ann...@googlegroups.com

Hi, Liu. Thanks for your reply. This is the very cause. I simply modified the gzip.py manually as Peter suggested at http://bugs.python.org/issue17666:

 

=====quote=====

The bug is very simple, an error in line 205 of gzip.py:

 

203     if flag & FEXTRA:

204         # Read & discard the extra field, if present

205         self._read_exact(struct.unpack("<H", self._read_exact(2)))

 

The struct.unpack method returns a single element tuple, thus a fix is:

 

203     if flag & FEXTRA:

204         # Read & discard the extra field, if present

205         extra_len, = struct.unpack("<H", self._read_exact(2))

206         self._read_exact(extra_len)

=====end of quote=====

 

MACS now works smoothly with BAM input again.

Thank you!

 

---Zhuqiang

 

发件人: macs-ann...@googlegroups.com [mailto:macs-ann...@googlegroups.com] 代表 Tao Liu
发送时间: 2013515 22:23
收件人: macs-ann...@googlegroups.com
主题: Re: [macs-announscement] Using MACS2 with BAM input

--
You received this message because you are subscribed to a topic in the Google Groups "MACS announcement" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/macs-announcement/ZUPtwaP1xVU/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to macs-announcem...@googlegroups.com.

Matteo Cesaroni

unread,
May 15, 2013, 6:45:54 PM5/15/13
to macs-ann...@googlegroups.com
Same problem. Solved.
Change the gzip.py file in this way (with a default installation it should be here /usr/local/lib/python2.7/gzip.py)

The bug is very simple, an error in line 205 of gzip.py:

203     if flag & FEXTRA:
204         # Read & discard the extra field, if present
205         self._read_exact(struct.unpack("<H", self._read_exact(2)))

The struct.unpack method returns a single element tuple, thus a fix is:

203     if flag & FEXTRA:
204         # Read & discard the extra field, if present
205         extra_len, = struct.unpack("<H", self._read_exact(2))
206         self._read_exact(extra_len)

After that macs2 worked just fine for me.
Thanks Tao for the link!
Mat

Samuel collombet

unread,
Jul 11, 2013, 7:28:32 AM7/11/13
to macs-ann...@googlegroups.com
HI! I have the same problem :

INFO  @ Thu, 11 Jul 2013 13:18:18: #1 read tag files... 
INFO  @ Thu, 11 Jul 2013 13:18:18: #1 read treatment tags... 
Traceback (most recent call last):
  File "/usr/local/bin/macs2", line 512, in <module>
    main()
  File "/usr/local/bin/macs2", line 45, in main
    run( args )
  File "/usr/local/lib/python2.7/dist-packages/MACS2/callpeak.py", line 69, in run
    else:       (treat, control) = load_tag_files_options  (options)
  File "/usr/local/lib/python2.7/dist-packages/MACS2/callpeak.py", line 375, in load_tag_files_options
    tp = options.parser(options.tfile[0])
  File "cParser.pyx", line 664, in MACS2.IO.cParser.BAMParser.__init__ (MACS2/IO/cParser.c:8050)
  File "/usr/lib/python2.7/gzip.py", line 258, in read
    if not self._read(readsize):
  File "/usr/lib/python2.7/gzip.py", line 293, in _read
    self._read_gzip_header()
  File "/usr/lib/python2.7/gzip.py", line 205, in _read_gzip_header
    self._read_exact(struct.unpack("<H", self._read_exact(2)))
  File "/usr/lib/python2.7/gzip.py", line 185, in _read_exact
    data = self.fileobj.read(n)
TypeError: an integer is required

However my version of gzip.py is already corrected... I am using the last version of MACS2 (downloaded yesterday) and python 2.7.4 on ubuntu 13.04. 
Did anyone had this problem after correction of gzip.py?

Tao Liu

unread,
Jul 16, 2013, 12:17:31 PM7/16/13
to macs-ann...@googlegroups.com
I believe this python bug hasn't been fixed in your Ubuntu box. 

Check this:


python-defaults (2.7.4-0ubuntu1) raring; urgency=low

  * Bump version to 2.7.4.
 -- Matthias Klose <email address hidden>   Sun, 07 Apr 2013 20:40:20 +0200

See that timestamp? This bug was fixed by python developers in May and included in python 2.7.5. I think there is an unfortunate lag or mis-communication between Ubuntu and upstream Python developers. By the way, I am not sure how many problems does this bug bring to Ubuntu 13.04…  If you are a Ubuntu user ( I am not), why not submit a bug report to Ubuntu?

Best,
Tao Liu

--
Assistant Professor
Department of Biochemistry
University at Buffalo
NY State Center of Excellence in Bioinformatics & Life Sciences

B2-163 COEBLS
(O) 716-829-2749
tl...@buffalo.edu

Mailing address:
University at Buffalo-COEBLS
701 Ellicott St, B2-163
Buffalo, NY 14203-1221

Reply all
Reply to author
Forward
0 new messages