What is the cellular homology of a CW complex $X$ from long exact sequence of relative homology? Consider the handle decomposition of the manifold $Y:=Y_N$ where we let $Y_k=Y_{k-1}\cup_{\chi} H^{\gamma_k}$ be a $\dim Y_{k-1}$-manifold with a $\gamma_k$-handle attached $H^{\gamma_k}=D^{\gamma_k}\times D^{\dim Y_{k-1}-\gamma_k}$ along the embedding map $\chi:S^{\gamma_k-1}\times D^{\dim Y_{k-1}-\gamma_k}\to\partial Y_{k-1}$ with $Y_0:=D^m$ for $1\le k\le N$. 
Then we collapse each handle $D^k\times D^{n−k}$ to $D^k$ to get a homotopy equivalent CW complex $X$ with the same number of $k$-cells as the manifold has $k$-handles. Thus, the CW can be given via its $(N-1)$-skeleton $X_N$ by attaching $\gamma_N$-cells, i.e. $X_N=X_{N-1}\cup_{} (e_{\gamma_i}^N)_i$. Cellular homology of this complex, $H_*^{CW}(X)$, is the homology of the cellular chain complex $(C_*(X),d_*)$ indexed by the cells of $X$ with differentials $d_n:C_n(X)\to C_{n-1}(X)$. Let $X$ have $n_{\gamma_i}$-many $\gamma_i$-cells (for $0\le i\le N$) with $\gamma_N$ the highest-dimensional cells. Note, the inclusion $i:X_N\hookrightarrow X$ induces an isomorphism $H_k(X_N)\cong H_k(X)$ if $k<N=dim(X)$.

Then can we conclude from the long exact sequence of relative homology that the cellular homology of the CW complex is $$H_k(X_N)=H_k^{CW}(X_N)=\begin{cases} 
      \mathbb{Z}^{n_{\gamma_1}}, & \text{if }k=\gamma_1 \\
      &\vdots\\
      \mathbb{Z}^{n_{\gamma_N}}, & \text{if }k=\gamma_N \\
      \mathbb{Z}_2, & \text{if }k=0 \\
       0,       & \text{otherwise} \\   
   \end{cases}$$?

Attempted Proof: Let $X_k=X_{k-1}\cup_{\chi} H^{\gamma_k}$. Suppose one has a retraction $r_N:X_N\to X_{N-1}$, so $r_N\circ i_N=id_{X_{N-1}}$ where $i_N: X_{N-1}\to X_N$ is the inclusion. We similarly define $r_k:X_k\to X_{k-1}$, $i_k:X_{k-1}\to X_k$ for $1\le k\le N$. The induced map $(i_N)_*:H_n(X_{N-1})\to H_n(X_N)$ is then injective for $(r_N)_*(i_N)_*=id$. It follows that the boundary maps in the long exact sequences for $(X_N,X_{N-1})$ are zero, so the long exact sequences breaks up into short exact sequences $0\to H_n(X_{N-1})\overset{(i_N)_*}\longrightarrow H_n(X_N)\overset{(j_N)_*}\longrightarrow H_n(X_N,X_{N-1})\to 0$ and, in general, $0\to H_n(X_{k-1})\overset{(i_k)_*}\longrightarrow H_n(X_k)\overset{(j_k)_*}\longrightarrow H_n(X_k,X_{k-1})\to 0$, so $H_n(X_k)=H_n(X_{k-1})\oplus H_n(X_k,X_{k-1})$ for $1\le k \le N$. Thus, $$H_n(X_N)=H_n(X_{N-1})\oplus H_n(X_N,X_{N-1})=H_n(X_{N-2})\oplus H_n(X_{N-1},X_{N-2})\oplus H_n(X_N,X_{N-1})=\cdots=H_n(D^m)\oplus H_n(X_1,X_0)\oplus\cdots\oplus H_n(X_N,X_{N-1})=\begin{cases} 
      \mathbb{Z}^{n_{\gamma_1}}, & \text{if }n=\gamma_1 \\
      &\vdots\\
      \mathbb{Z}^{n_{\gamma_N}}, & \text{if }n=\gamma_N \\
      \mathbb{Z}_2, & \text{if }n=0 \\   
   0,       & \text{otherwise.} \\
   \end{cases}$$
Motivation: The canonical computation by Hatcher AT, P 141 for $M_g$ a closed oriented surface of genus $g$ with the CW structure of one $0$-cell, $2g$ $1$-cells, and one $2$-cells admits such a result. The cells are attached by the product of commutators $[a_1,b_1]\dots[a_g,b_g]$. The cellular chain complex of $M_g$ is $0\overset{d_3}\longrightarrow\mathbb{Z}\overset{d_2}\longrightarrow\mathbb{Z}^{2g}\overset{d_1}\longrightarrow\mathbb{Z}\overset{d_0}\longrightarrow 0$ with zero maps $d_1$ and $d_2$. Then the homology groups are $$H_k(M_g)=\begin{cases} 
      \mathbb{Z}, & k=0,2 \\
      \mathbb{Z}^{2g}, & k=1\\
      0, & \text{otherwise}.  
   \end{cases}$$ 
I thought that a similar argument with cellular homology applies.
Any help would be much appreciated. Thanks in advance!
 A: Here is an example. Let's consider the surfaces you could build from a single $0$-handle, $1$-handle and $2$-handle. There are essentially two ways to attach a $1$-handle to a $0$-handle, depending on whether you have a twist or not. 


*

*If there is no twist, you can visualize it like a basket with a handle. You can then add your $2$-handle to cap off one of the two boundary components, and the result will be homeomorphic to a disk.

*If there is a twist, then you have a Möbius strip, and this has one boundary component to which we can attach a $2$-handle, giving a projective plane.
The chain complex in both cases is of the form $$0\to \mathbb Z\to\mathbb Z\to\mathbb Z\to 0,$$ but the boundary maps induced by the attaching maps are different.


*

*The first chain complex is $0\to\mathbb Z\overset{\mathrm{id}}{\to}\mathbb Z\overset{0}{\to}\mathbb Z\to 0$, which yields homology only in degree $0$.

*The second chain complex is $0\to\mathbb Z\overset{\cdot 2}{\to}\mathbb Z\overset{0}{\to}\mathbb Z\to 0$, which has $H_1\cong\mathbb Z/2\mathbb Z$.

A: This is not a detailed answer, but a suggestion of a possible area to look for  developments. 
The book by V.V. Sharko, "Functions on Manifolds. Algebraic and Topological Aspects",  (Transl. Math. Monogr. 131. Amer. Math. Soc., 1993), remarks in Chapter VII on: "The need to make use of homotopy systems in order to study Morse functions on non-simply connected closed  manifolds or on manifolds with one boundary component ...".  Homotopy systems  were developed by J.H.C. Whitehead in his 1949 paper "Combinatorial Homotopy II", and are now called crossed complexes. Their homotopically defined  example involves operations of  fundamental groupoids on relative homotopy groups, rather than chain complexes and homology as in the current standard approach to CW-filtrations. 
The book  partially titled Nonabelian Algebraic Topology  EMS Tract (2011), (which we call NAT)  gives computational methods for crossed complexes of  filtered spaces, with applications  mainly to cellular filtrations, i.e. to  CW-complexes. 
The usual tensor product of chain complexes generalises to crossed complexes, as detailed in NAT, so that there are potential applications to such handlebody decompositions. 
Obtaining such applications is  the essential  content of Problem $16.1.17$ of NAT. 
