Cloufield / gwaslab

A Python package for handling and visualizing GWAS summary statistics. https://cloufield.github.io/gwaslab/
GNU General Public License v3.0
118 stars 22 forks source link

Installation problem #57

Closed bsb2014 closed 9 months ago

bsb2014 commented 9 months ago

I tried to install the latest version but got the errors below

  Error compiling Cython file:
      ------------------------------------------------------------
      ...
          p   = pysam_bam_get_seq(src)

          for k from start <= k < end:
              # equivalent to seq_nt16_str[bam1_seqi(s, i)] (see bam.c)
              # note: do not use string literal as it will be a python string
              s[k-start] = seq_nt16_str[p[k/2] >> 4 * (1 - k%2) & 0xf]
                                         ^
      ------------------------------------------------------------

      pysam/libcalignedsegment.pyx:570:35: Invalid index type 'double'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

                  src = self._delegate

                  # as the sequence is stored in half-bytes, the total length (sequence
                  # plus quality scores) is (l+1)/2 + l
                  nbytes_new = (l + 1) / 2 + l
                                           ^
      ------------------------------------------------------------

      pysam/libcalignedsegment.pyx:1426:37: Cannot assign type 'double' to 'Py_ssize_t'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  src = self._delegate

                  # as the sequence is stored in half-bytes, the total length (sequence
                  # plus quality scores) is (l+1)/2 + l
                  nbytes_new = (l + 1) / 2 + l
                  nbytes_old = (src.core.l_qseq + 1) / 2 + src.core.l_qseq
                                                         ^
      ------------------------------------------------------------

      pysam/libcalignedsegment.pyx:1427:51: Cannot assign type 'double' to 'Py_ssize_t'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      for k from 0 <= k < nbytes_new:
                          p[k] = 0
                      # convert to C string
                      s = seq
                      for k from 0 <= k < l:
                          p[k/2] |= seq_nt16_table[<unsigned char>s[k]] << 4 * (1 - k % 2)
                           ^
      ------------------------------------------------------------

      pysam/libcalignedsegment.pyx:1451:21: Invalid index type 'double'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      for k from 0 <= k < nbytes_new:
                          p[k] = 0
                      # convert to C string
                      s = seq
                      for k from 0 <= k < l:
                          p[k/2] |= seq_nt16_table[<unsigned char>s[k]] << 4 * (1 - k % 2)
                           ^
      ------------------------------------------------------------

      pysam/libcalignedsegment.pyx:1451:21: Invalid index type 'double'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      for k from 0 <= k < nbytes_new:
                          p[k] = 0
                      # convert to C string
                      s = seq
                      for k from 0 <= k < l:
                          p[k/2] |= seq_nt16_table[<unsigned char>s[k]] << 4 * (1 - k % 2)

My Cython version is 3.0.2

Cloufield commented 9 months ago

Hi, would you please try installing pysam==0.19? BTW, pySAM doesn't support windows yet. If you are using mac or linux, it should work well.

Cloufield commented 9 months ago

Or use conda to create an environment for gwaslab:

name: gwaslab
channels:
  - conda-forge
  - defaults
dependencies:
  - python=3.8.16=h7a1cb2a_3
  - jupyter==1.0.0
  - pip==23.1.2
  - pip:
      - adjusttext==0.8
      - biopython==1.81
      - gwaslab==3.4.16
      - liftover==1.1.16
      - matplotlib==3.7.1
      - numpy==1.24.2
      - pandas==1.4.4
      - scikit-allel==1.3.5
      - scikit-learn==1.2.2
      - scipy==1.10.1
      - seaborn==0.11.2
      - statsmodels==0.13
      - adjustText==0.8
      - pysam==0.19
      - pyensembl==2.2.3