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"]
35 # CFLAG for fermi-lite related codes
40 if os
.environ
['CC'] == "clang":
47 gcc_version_check
= subprocess
.check_output([os
.environ
.get('CC', 'gcc'), "--version"], universal_newlines
=True)
48 if gcc_version_check
.find("clang") != -1:
51 gcc_version_check
= gcc_version_check
.split('\n')[0] # get the first line
52 m
= re
.search(r
"\s+(\d+\.\d+)\.\d+", gcc_version_check
)
54 gcc_version
= float(m
[1])
57 except subprocess
.CalledProcessError
:
61 if os
.environ
['CC'] == "icc":
66 extra_c_args_for_fermi
= ["-std=gnu99", "-DUSE_SIMDE",
67 "-DSIMDE_ENABLE_NATIVE_ALIASES"]
69 if icc
or sysconfig
.get_config_vars()['CC'] == 'icc':
70 extra_c_args_for_fermi
.extend(['-qopenmp-simd',
71 '-DSIMDE_ENABLE_OPENMP'])
72 elif new_gcc
or clang
or sysconfig
.get_config_vars()['CC'] == 'clang':
73 extra_c_args_for_fermi
.extend(['-fopenmp-simd',
74 '-DSIMDE_ENABLE_OPENMP'])
76 # extensions, those have to be processed by Cython
77 ext_modules
= [Extension("MACS3.Signal.HMMR_EM",
78 ["MACS3/Signal/HMMR_EM.pyx"],
80 include_dirs
=numpy_include_dir
,
81 extra_compile_args
=extra_c_args
),
82 Extension("MACS3.Signal.HMMR_Signal_Processing",
83 ["MACS3/Signal/HMMR_Signal_Processing.pyx"],
85 include_dirs
=numpy_include_dir
,
86 extra_compile_args
=extra_c_args
),
87 Extension("MACS3.Signal.HMMR_HMM",
88 ["MACS3/Signal/HMMR_HMM.pyx"],
90 include_dirs
=numpy_include_dir
,
91 extra_compile_args
=extra_c_args
),
92 Extension("MACS3.Signal.Prob",
93 ["MACS3/Signal/Prob.pyx"],
95 include_dirs
=numpy_include_dir
,
96 extra_compile_args
=extra_c_args
),
97 Extension("MACS3.Signal.Region",
98 ["MACS3/Signal/Region.pyx"],
99 include_dirs
=numpy_include_dir
,
100 extra_compile_args
=extra_c_args
),
101 Extension("MACS3.Signal.Pileup",
102 ["MACS3/Signal/Pileup.pyx",
103 "MACS3/Signal/cPosValCalculation.c"],
104 include_dirs
=numpy_include_dir
,
105 extra_compile_args
=extra_c_args
),
106 Extension("MACS3.Signal.PileupV2",
107 ["MACS3/Signal/PileupV2.pyx"],
108 include_dirs
=numpy_include_dir
,
109 extra_compile_args
=extra_c_args
),
110 Extension("MACS3.Signal.PeakModel",
111 ["MACS3/Signal/PeakModel.pyx"],
112 include_dirs
=numpy_include_dir
,
113 extra_compile_args
=extra_c_args
),
114 Extension("MACS3.Signal.PeakDetect",
115 ["MACS3/Signal/PeakDetect.pyx"],
116 extra_compile_args
=extra_c_args
),
117 Extension("MACS3.Signal.SignalProcessing",
118 ["MACS3/Signal/SignalProcessing.pyx"],
119 include_dirs
=numpy_include_dir
,
120 extra_compile_args
=extra_c_args
),
121 Extension("MACS3.Signal.FixWidthTrack",
122 ["MACS3/Signal/FixWidthTrack.pyx"],
123 include_dirs
=numpy_include_dir
,
124 extra_compile_args
=extra_c_args
),
125 Extension("MACS3.Signal.PairedEndTrack",
126 ["MACS3/Signal/PairedEndTrack.pyx"],
127 include_dirs
=numpy_include_dir
,
128 extra_compile_args
=extra_c_args
),
129 Extension("MACS3.Signal.BedGraph",
130 ["MACS3/Signal/BedGraph.pyx"],
132 include_dirs
=numpy_include_dir
,
133 extra_compile_args
=extra_c_args
),
134 Extension("MACS3.Signal.ScoreTrack",
135 ["MACS3/Signal/ScoreTrack.pyx"],
137 include_dirs
=numpy_include_dir
,
138 extra_compile_args
=extra_c_args
),
139 Extension("MACS3.Signal.CallPeakUnit",
140 ["MACS3/Signal/CallPeakUnit.pyx"],
142 include_dirs
=numpy_include_dir
,
143 extra_compile_args
=extra_c_args
),
144 Extension("MACS3.Signal.VariantStat",
145 ["MACS3/Signal/VariantStat.pyx"],
147 include_dirs
=numpy_include_dir
,
148 extra_compile_args
=extra_c_args
),
149 Extension("MACS3.Signal.ReadAlignment",
150 ["MACS3/Signal/ReadAlignment.pyx"],
152 include_dirs
=numpy_include_dir
,
153 extra_compile_args
=extra_c_args
),
154 Extension("MACS3.Signal.RACollection",
155 ["MACS3/Signal/RACollection.pyx",
156 "MACS3/fermi-lite/bfc.c",
157 "MACS3/fermi-lite/bseq.c",
158 "MACS3/fermi-lite/bubble.c",
159 "MACS3/fermi-lite/htab.c",
160 "MACS3/fermi-lite/ksw.c",
161 "MACS3/fermi-lite/kthread.c",
162 "MACS3/fermi-lite/mag.c",
163 "MACS3/fermi-lite/misc.c",
164 "MACS3/fermi-lite/mrope.c",
165 "MACS3/fermi-lite/rld0.c",
166 "MACS3/fermi-lite/rle.c",
167 "MACS3/fermi-lite/rope.c",
168 "MACS3/fermi-lite/unitig.c",
169 "MACS3/Signal/swalign.c"],
170 libraries
=["m", "z"],
171 include_dirs
=numpy_include_dir
+["./",
172 "./MACS3/fermi-lite/",
174 extra_compile_args
=extra_c_args
+extra_c_args_for_fermi
),
175 Extension("MACS3.Signal.UnitigRACollection",
176 ["MACS3/Signal/UnitigRACollection.pyx"],
178 include_dirs
=numpy_include_dir
,
179 extra_compile_args
=extra_c_args
),
180 Extension("MACS3.Signal.PosReadsInfo",
181 ["MACS3/Signal/PosReadsInfo.pyx"],
183 include_dirs
=numpy_include_dir
,
184 extra_compile_args
=extra_c_args
),
185 Extension("MACS3.Signal.PeakVariants",
186 ["MACS3/Signal/PeakVariants.pyx"],
188 include_dirs
=numpy_include_dir
,
189 extra_compile_args
=extra_c_args
),
190 Extension("MACS3.IO.Parser",
191 ["MACS3/IO/Parser.pyx"],
192 include_dirs
=numpy_include_dir
,
193 extra_compile_args
=extra_c_args
),
194 Extension("MACS3.IO.PeakIO",
195 ["MACS3/IO/PeakIO.pyx"],
196 extra_compile_args
=extra_c_args
),
197 Extension("MACS3.IO.BedGraphIO",
198 ["MACS3/IO/BedGraphIO.pyx"],
199 extra_compile_args
=extra_c_args
),
200 Extension("MACS3.IO.BAM",
201 ["MACS3/IO/BAM.pyx",], libraries
=["m"],
202 include_dirs
=numpy_include_dir
,
203 extra_compile_args
=extra_c_args
)]
205 setup(version
=MACS_VERSION
,
206 package_dir
={'MACS3': 'MACS3'},
207 packages
=['MACS3', 'MACS3.IO', 'MACS3.Signal', 'MACS3.Commands', 'MACS3.Utilities'],
208 package_data
={'MACS3': ['*.pxd']},
209 scripts
=['bin/macs3', ],
210 ext_modules
=cythonize(ext_modules
))
213 if __name__
== '__main__':