Seqanswers Leaderboard Ad



No announcement yet.
  • Filter
  • Time
  • Show
Clear All
new posts

  • Samtools installation using Cygwin

    I'm trying to install samtools 1.1 under Cygwin but I got the following error message. Did anyone have the same error?

    $ make
    gcc -g -Wall -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_CURSES_LIB=1 -I. -Ihtslib-1.1 -c -o bam_index.o bam_index.c
    Assembler messages:
    Fatal error: can't create bam_index.o: Permission denied
    Makefile:116: recipe for target 'bam_index.o' failed
    make: *** [bam_index.o] Error 1

    I'm using Windows 8, 64-bit, and Cygwin 1.7.34.

  • #2
    You may want to make a partition and dual boot Linux to save the hassle, unless you only need to perform a small set of specific operations.

    Forgive me if you are more experienced with programming, this may be exactly what you want. For a novice bioinformatician like me it seems as though navigating the data and learning how to use the tools and/or fix bugs is challenging as is. I am not sure if going through Cygwin will help with that.


    • #3
      Some people may just use PuTTY or ssh to do data analysis on a remote machine/computing cluster.


      • #4
        Thank you for your fast answer. I'm definitely not experienced in programming. I wonder how I could solve this error without dual booting my PC.


        • #5
          I was able to compile samtools 0.1.19 a few months ago on windows 8.1 using MinGW to do the compilation (I don't remember what additional work it took to get going, but I seem to remember turning to MinGW when cygwin failed). That was on a work computer I didn't have the option of dual booting.
          That being said, it's a sad, lonely road trying to run any of the standard NGS tools on windows. If samtools is the only program you need, fighting windows might be worth it, but if you're planning on using any additional tools, take the pain of setting up a dual boot. Almost all of the tools are written for Linux first, and are generally easy to install and run, whereas on Windows, you often need to compile them yourself (if they even compile on Windows) and it can be really hard to find support (I've had cases recently where author supplied Windows binaries don't even start. That's about the level of thought and support put into making them Windows compatible).


          • #6
            You can run Picard in Windows, which has most or all of the features of samtools. I prefer samtools, though. Long term, if you plan to do lots of different things with various programs, I would also recommend a dual-boot setup... it will make things a lot simpler.


            • #7
              The specific error you get seems to be saying that you are missing write permissions in the directory you are trying to compile samtools. Anyway, I have the same opinion as the others here - trying to get high-throughput bioinformatics software packages to run under Windows is more trouble than learning to use Linux.

              If you have enough memory (4 GB would be possible, but 8+ GB better), I'd recommend you to install a virtual machine (e.g. VirtualBox) with Ubuntu (or possibly BioLinux) instead of setting up a dual boot system - saves you the reboots and even makes a bit of integration possible: I do it the other way around - Windows VM guest on a Linux host, and have it set up to open certain Microsoft office files with software within my Windows virtual machine. Getting Windows 8 to dual boot is a hassle, as well.


              • #8
                Thank you everyone who replied. I really appreciated knowing I have some options.
                My computer is only 4 GB and unfortunately dual booting is not a option for me.
                I'll try Picard first. And then MinGW.
                As sarvidsson said I'm "missing write permissions in the directory", I moved samtools to another directory and installation went further. But, at the end I had a different error message.

                gcc: error: unrecognized command line option ‘-pthread’
                Makefile:126: recipe for target 'samtools' failed
                make: *** [samtools] Error 1

                It seems to be an endless adventure installing samtools under Cygwin. So, I'm giving up.


                • #9
                  I just downloaded samtools 1.2 source (as bzipped tarball), decompressed and untarred

                  Then .. 2 things ....

                  #1 Change line by adding the exp and log defines ...
                  CPPFLAGS = $(DFLAGS) $(INCLUDES)
                  CPPFLAGS = $(DFLAGS) $(INCLUDES) -Dexpl=exp -Dlogl=log

                  #2 Change all instances of "-pthread" to "-lpthread"

                  Result ; It Works (at least it compiles and produces and EXE) ...

                  finneyr@NCI-01874532 /cygdrive/c/rich/samtools-1.2
                  $ ./samtools.exe

                  Program: samtools (Tools for alignments in the SAM format)
                  Version: 1.2 (using htslib 1.2.1)

                  Usage: samtools <command> [options]

                  -- indexing
                  faidx index/extract FASTA
                  index index alignment
                  -- editing
                  calmd recalculate MD/NM tags and '=' bases
                  fixmate fix mate information
                  reheader replace BAM header
                  rmdup remove PCR duplicates
                  targetcut cut fosmid regions (for fosmid pool only)
                  -- file operations
                  bamshuf shuffle and group alignments by name
                  cat concatenate BAMs
                  merge merge sorted alignments
                  mpileup multi-way pileup
                  sort sort alignment file
                  split splits a file by read group
                  bam2fq converts a BAM to a FASTQ
                  -- stats
                  bedcov read depth per BED region
                  depth compute the depth
                  flagstat simple stats
                  idxstats BAM index stats
                  phase phase heterozygotes
                  stats generate stats (former bamcheck)
                  -- viewing
                  flags explain BAM flags
                  tview text alignment viewer
                  view SAM<->BAM<->CRAM conversion


                  Compiling under Visual C is another story; I've done by hacking the code on earlier samtools.
                  Last edited by Richard Finney; 02-06-2015, 01:58 PM.


                  • #10
                    Hi Richard Finney,
                    Thank you for your help! I downloaded samtools-1.2 as you recommended. It’s written in my original Makefile:
                    CC = gcc
                    CPPFLAGS = $(DFLAGS) $(INCLUDES)
                    CFLAGS = -g -Wall -O2
                    LDFLAGS =
                    LDLIBS =

                    So, I changed CPPFLAGS to:
                    CPPFLAGS = -Dexpl=exp -Dlogl=log
                    But, when I changed "-pthread" to "-lpthread" I had an error message:

                    $ make
                    Makefile:126: *** separator missing. Stop.
                    Last edited by Karina Martins; 02-06-2015, 05:23 PM.


                    • #11
                      I made a mistake; I miscopied and didn't proofread.

                      See edit in previous post ... previous post is now edited.

                      CPPFLAGS = $(DFLAGS) $(INCLUDES)

                      should be

                      CPPFLAGS = $(DFLAGS) $(INCLUDES) -Dexpl=exp -Dlogl=log

                      Note added "-Dexpl=exp -Dlogl=log"
                      Last edited by Richard Finney; 02-06-2015, 02:01 PM.


                      • #12
                        Thank you, Richard
                        I tried, but it's still not working. Now, I'm having a bunch of other errors.
                        The first one is:

                        bedidx.o: In function `bed_read':
                        /cygdrive/c/samtools-1.2/bedidx.c:170: undefined reference to `gzopen'
                        /cygdrive/c/samtools-1.2/bedidx.c:170.text+0xec4): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `gzopen'

                        It's followed by dozens of other 'undefined reference to'
                        I searched similar errors in the web, but couldn't fix those errors.


                        • #13
                          Try the solution here:

                          Edit the makefile.


                          • #14
                            All -lz comes after the lists of objects in my Makefile...


                            Latest Articles


                            • seqadmin
                              Recent Advances in Sequencing Analysis Tools
                              by seqadmin

                              The sequencing world is rapidly changing due to declining costs, enhanced accuracies, and the advent of newer, cutting-edge instruments. Equally important to these developments are improvements in sequencing analysis, a process that converts vast amounts of raw data into a comprehensible and meaningful form. This complex task requires expertise and the right analysis tools. In this article, we highlight the progress and innovation in sequencing analysis by reviewing several of the...
                              05-06-2024, 07:48 AM
                            • seqadmin
                              Essential Discoveries and Tools in Epitranscriptomics
                              by seqadmin

                              The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...
                              04-22-2024, 07:01 AM





                            Topics Statistics Last Post
                            Started by seqadmin, 05-14-2024, 07:03 AM
                            0 responses
                            Last Post seqadmin  
                            Started by seqadmin, 05-10-2024, 06:35 AM
                            0 responses
                            Last Post seqadmin  
                            Started by seqadmin, 05-09-2024, 02:46 PM
                            0 responses
                            Last Post seqadmin  
                            Started by seqadmin, 05-07-2024, 06:57 AM
                            0 responses
                            Last Post seqadmin