4 Setup script for MACS -- Model Based Analysis for ChIP-Seq data
6 This code is free software; you can redistribute it and/or modify it
7 under the terms of the BSD License (see the file LICENSE included with
14 from setuptools
import setup
, Extension
15 from Cython
.Build
import cythonize
21 exec(open("MACS3/Utilities/Constants.py").read())
25 if sys
.version_info
< (3, 9):
26 sys
.stderr
.write("CRITICAL: Python version must >= 3.9!\n")
30 numpy_include_dir
= [numpy
.get_include()]
33 extra_c_args
= ["-w", "-O3", "-g0"]
34 # CFLAG for fermi-lite related codes
39 if os
.environ
['CC'] == "clang":
46 gcc_version_check
= subprocess
.check_output([os
.environ
.get('CC', 'gcc'), "--version"], universal_newlines
=True)
47 if gcc_version_check
.find("clang") != -1:
50 gcc_version_check
= gcc_version_check
.split('\n')[0] # get the first line
51 m
= re
.search(r
"\s+(\d+\.\d+)\.\d+", gcc_version_check
)
53 gcc_version
= float(m
[1])
56 except subprocess
.CalledProcessError
:
60 if os
.environ
['CC'] == "icc":
65 extra_c_args_for_fermi
= ["-std=gnu99", "-DUSE_SIMDE",
66 "-DSIMDE_ENABLE_NATIVE_ALIASES"]
68 if icc
or sysconfig
.get_config_vars()['CC'] == 'icc':
69 extra_c_args_for_fermi
.extend(['-qopenmp-simd',
70 '-DSIMDE_ENABLE_OPENMP'])
71 elif new_gcc
or clang
or sysconfig
.get_config_vars()['CC'] == 'clang':
72 extra_c_args_for_fermi
.extend(['-fopenmp-simd',
73 '-DSIMDE_ENABLE_OPENMP'])
75 # extensions, those have to be processed by Cython
76 ext_modules
= [Extension("MACS3.Signal.HMMR_EM",
77 ["MACS3/Signal/HMMR_EM.py"],
79 include_dirs
=numpy_include_dir
,
80 extra_compile_args
=extra_c_args
),
81 Extension("MACS3.Signal.HMMR_Signal_Processing",
82 ["MACS3/Signal/HMMR_Signal_Processing.py"],
84 extra_compile_args
=extra_c_args
),
85 Extension("MACS3.Signal.HMMR_HMM",
86 ["MACS3/Signal/HMMR_HMM.py"],
88 include_dirs
=numpy_include_dir
,
89 extra_compile_args
=extra_c_args
),
90 Extension("MACS3.Signal.Prob",
91 ["MACS3/Signal/Prob.py"],
93 include_dirs
=numpy_include_dir
,
94 extra_compile_args
=extra_c_args
),
95 Extension("MACS3.Signal.Region",
96 ["MACS3/Signal/Region.py"],
97 extra_compile_args
=extra_c_args
),
98 Extension("MACS3.Signal.Pileup",
99 ["MACS3/Signal/Pileup.py",
100 "MACS3/Signal/cPosValCalculation.c"],
101 include_dirs
=numpy_include_dir
,
102 extra_compile_args
=extra_c_args
),
103 Extension("MACS3.Signal.PileupV2",
104 ["MACS3/Signal/PileupV2.py"],
105 include_dirs
=numpy_include_dir
,
106 extra_compile_args
=extra_c_args
),
107 Extension("MACS3.Signal.PeakModel",
108 ["MACS3/Signal/PeakModel.py"],
109 include_dirs
=numpy_include_dir
,
110 extra_compile_args
=extra_c_args
),
111 Extension("MACS3.Signal.PeakDetect",
112 ["MACS3/Signal/PeakDetect.py"],
113 extra_compile_args
=extra_c_args
),
114 Extension("MACS3.Signal.SignalProcessing",
115 ["MACS3/Signal/SignalProcessing.py"],
116 include_dirs
=numpy_include_dir
,
117 extra_compile_args
=extra_c_args
),
118 Extension("MACS3.Signal.FixWidthTrack",
119 ["MACS3/Signal/FixWidthTrack.py"],
120 include_dirs
=numpy_include_dir
,
121 extra_compile_args
=extra_c_args
),
122 Extension("MACS3.Signal.PairedEndTrack",
123 ["MACS3/Signal/PairedEndTrack.py"],
124 include_dirs
=numpy_include_dir
,
125 extra_compile_args
=extra_c_args
),
126 Extension("MACS3.Signal.BedGraph",
127 ["MACS3/Signal/BedGraph.py"],
129 include_dirs
=numpy_include_dir
,
130 extra_compile_args
=extra_c_args
),
131 Extension("MACS3.Signal.ScoreTrack",
132 ["MACS3/Signal/ScoreTrack.py"],
134 include_dirs
=numpy_include_dir
,
135 extra_compile_args
=extra_c_args
),
136 Extension("MACS3.Signal.CallPeakUnit",
137 ["MACS3/Signal/CallPeakUnit.py"],
139 include_dirs
=numpy_include_dir
,
140 extra_compile_args
=extra_c_args
),
141 Extension("MACS3.Signal.VariantStat",
142 ["MACS3/Signal/VariantStat.pyx"],
144 include_dirs
=numpy_include_dir
,
145 extra_compile_args
=extra_c_args
),
146 Extension("MACS3.Signal.ReadAlignment",
147 ["MACS3/Signal/ReadAlignment.pyx"],
149 include_dirs
=numpy_include_dir
,
150 extra_compile_args
=extra_c_args
),
151 Extension("MACS3.Signal.RACollection",
152 ["MACS3/Signal/RACollection.pyx",
153 "MACS3/fermi-lite/bfc.c",
154 "MACS3/fermi-lite/bseq.c",
155 "MACS3/fermi-lite/bubble.c",
156 "MACS3/fermi-lite/htab.c",
157 "MACS3/fermi-lite/ksw.c",
158 "MACS3/fermi-lite/kthread.c",
159 "MACS3/fermi-lite/mag.c",
160 "MACS3/fermi-lite/misc.c",
161 "MACS3/fermi-lite/mrope.c",
162 "MACS3/fermi-lite/rld0.c",
163 "MACS3/fermi-lite/rle.c",
164 "MACS3/fermi-lite/rope.c",
165 "MACS3/fermi-lite/unitig.c",
166 "MACS3/Signal/swalign.c"],
167 libraries
=["m", "z"],
168 include_dirs
=numpy_include_dir
+["./",
169 "./MACS3/fermi-lite/",
171 extra_compile_args
=extra_c_args
+extra_c_args_for_fermi
),
172 Extension("MACS3.Signal.UnitigRACollection",
173 ["MACS3/Signal/UnitigRACollection.pyx"],
175 include_dirs
=numpy_include_dir
,
176 extra_compile_args
=extra_c_args
),
177 Extension("MACS3.Signal.PosReadsInfo",
178 ["MACS3/Signal/PosReadsInfo.pyx"],
180 include_dirs
=numpy_include_dir
,
181 extra_compile_args
=extra_c_args
),
182 Extension("MACS3.Signal.PeakVariants",
183 ["MACS3/Signal/PeakVariants.pyx"],
185 include_dirs
=numpy_include_dir
,
186 extra_compile_args
=extra_c_args
),
187 Extension("MACS3.IO.Parser",
188 ["MACS3/IO/Parser.py"],
189 extra_compile_args
=extra_c_args
),
190 Extension("MACS3.IO.PeakIO",
191 ["MACS3/IO/PeakIO.py"],
192 extra_compile_args
=extra_c_args
),
193 Extension("MACS3.IO.BedGraphIO",
194 ["MACS3/IO/BedGraphIO.py"],
195 extra_compile_args
=extra_c_args
),
196 Extension("MACS3.IO.BAM",
197 ["MACS3/IO/BAM.py",], libraries
=["m"],
198 extra_compile_args
=extra_c_args
)]
200 setup(version
=MACS_VERSION
,
201 package_dir
={'MACS3': 'MACS3'},
202 packages
=['MACS3', 'MACS3.IO', 'MACS3.Signal', 'MACS3.Commands', 'MACS3.Utilities'],
203 package_data
={'MACS3': ['*.pxd']},
204 scripts
=['bin/macs3', ],
205 ext_modules
=cythonize(ext_modules
))
208 if __name__
== '__main__':