SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics

Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile samtools on Windows so it doesn't need Cygwin imilne Bioinformatics 3 04-05-2016 06:31 AM
SAMtools installation kaushal25 Bioinformatics 27 03-12-2016 02:37 PM
Nice installation guide of cygwin to emulate linux on windows steven Bioinformatics 1 06-07-2012 06:36 AM
Cygwin Samtools junfeng Bioinformatics 6 04-06-2011 10:27 PM
samtools installation rdu Bioinformatics 4 08-27-2010 12:18 PM

Reply
 
Thread Tools
Old 08-03-2014, 03:15 AM   #21
Cytosine
Member
 
Location: Belgium

Join Date: Mar 2014
Posts: 22
Default

Seems you're still missing the ncurses library.

On ubuntu-based system you'd just do:
Code:
sudo apt-get install libncurses5-dev libncursesw5-dev
But Cygwin is a little different...

Googling it up did turn up a few posts on this matter:
http://sourceforge.net/p/samtools/ma...ail.gmail.com/

http://www.cygwin.com/ml/cygwin-anno.../msg00124.html

You can go for either one... The first one shows you how to compile without the ncurses library, and the other one gives you steps on how to install the library on Cygwin.
Cytosine is offline   Reply With Quote
Old 08-03-2014, 06:09 AM   #22
Scorpion43
Junior Member
 
Location: Melbourne, Australia

Join Date: Aug 2014
Posts: 8
Default

Quote:
Originally Posted by Cytosine View Post
Seems you're still missing the ncurses library.

On ubuntu-based system you'd just do:
Code:
sudo apt-get install libncurses5-dev libncursesw5-dev
But Cygwin is a little different...

Googling it up did turn up a few posts on this matter:
http://sourceforge.net/p/samtools/ma...ail.gmail.com/

http://www.cygwin.com/ml/cygwin-anno.../msg00124.html

You can go for either one... The first one shows you how to compile without the ncurses library, and the other one gives you steps on how to install the library on Cygwin.
I have had a look at both the links, thank you Cytosine ...

The second link is quite old, 2001, and while I can find the ncurses package and have installed it, the second part, terminfo package is there but there appears to be no libncurses5 or libncurses6 packages available. I see libncurses10 is already installed, and 7, 8 and 9 available. I did not install these.

I still got errors on 'make'

Then I tried changing the parameters in the 'makefile' file as suggested by the first link but it still would not install with 'make'

My current errors are:-
$ make
make[1]: Entering directory '/cygdrive/c/sam/samtools-0.1.19'
make[2]: Entering directory '/cygdrive/c/sam/samtools-0.1.19'
make[2]: Nothing to be done for 'lib'.
make[2]: Leaving directory '/cygdrive/c/sam/samtools-0.1.19'
make[2]: Entering directory '/cygdrive/c/sam/samtools-0.1.19/bcftools'
make[2]: Nothing to be done for 'lib'.
make[2]: Leaving directory '/cygdrive/c/sam/samtools-0.1.19/bcftools'
make[2]: Entering directory '/cygdrive/c/sam/samtools-0.1.19/misc'
make[2]: Nothing to be done for 'lib'.
make[2]: Leaving directory '/cygdrive/c/sam/samtools-0.1.19/misc'
gcc -I/usr/include/ncurses -o samtools bam_tview.o bam_plcmd.o sam_view.o bam_rmdup.o bam_rmdupse.o bam_mate.o bam_stat.o bam_color.o bamtk.o kaln.o bam2bcf.o bam2bcf_indel.o errmod.o sample.o cut_target.o phase.o bam2depth.o padding.o bedcov.o bamshuf.o bam_tview_curses.o bam_tview_html.o libbam.a -Lbcftools -lbcf -lcurses -lm -lz -lpthread
/usr/lib/gcc/i686-pc-cygwin/4.8.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lcurses
collect2: error: ld returned 1 exit status
Makefile:48: recipe for target 'samtools' failed
make[1]: *** [samtools] Error 1
make[1]: Leaving directory '/cygdrive/c/sam/samtools-0.1.19'
Makefile:28: recipe for target 'all-recur' failed
make: *** [all-recur] Error 1

Any other thoughts?
Can Samtools be installed in a Windows 32 bit environment?
Scorpion43 is offline   Reply With Quote
Old 08-03-2014, 07:06 AM   #23
Cytosine
Member
 
Location: Belgium

Join Date: Mar 2014
Posts: 22
Default

From what I see in the error report you did not make the proper adjustments in the Makefile.

Did you set -D_CURSES_LIB=1 to -D_CURSES_LIB=0 ?

and added the "#" in the following line?
LIBCURSES= -lcurses # -lXCurses --> LIBCURSES="" #-lcurses # -lXCurses

You need to disable both searching for and linking the library if you want to remove it from the final executable.


Give this another try and show me the report then.
Cytosine is offline   Reply With Quote
Old 08-03-2014, 03:10 PM   #24
Scorpion43
Junior Member
 
Location: Melbourne, Australia

Join Date: Aug 2014
Posts: 8
Default

I tend to return files to their original format when something does not work, otherwise we don't know what is going on.

However, with the first part of my makefile :-

CC= gcc
CFLAGS= -g -Wall -O2 #-m64 #-arch ppc
CFLAGS= -I/usr/include/ncurses
#LDFLAGS= -Wl,-rpath,\$$ORIGIN/../lib
DFLAGS= -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=0
KNETFILE_O= knetfile.o
LOBJS= bgzf.o kstring.o bam_aux.o bam.o bam_import.o sam.o bam_index.o \
bam_pileup.o bam_lpileup.o bam_md.o razf.o faidx.o bedidx.o \
$(KNETFILE_O) bam_sort.o sam_header.o bam_reheader.o kprobaln.o bam_cat.o
AOBJS= bam_tview.o bam_plcmd.o sam_view.o \
bam_rmdup.o bam_rmdupse.o bam_mate.o bam_stat.o bam_color.o \
bamtk.o kaln.o bam2bcf.o bam2bcf_indel.o errmod.o sample.o \
cut_target.o phase.o bam2depth.o padding.o bedcov.o bamshuf.o \
bam_tview_curses.o bam_tview_html.o
PROG= samtools
INCLUDES= -I.
SUBDIRS= . bcftools misc
LIBPATH=
LIBCURSES= # -lcurses # -lXCurses
etc etc

When I run 'make', the error report is:-

$ make
make[1]: Entering directory '/cygdrive/c/sam/samtools-0.1.19'
make[2]: Entering directory '/cygdrive/c/sam/samtools-0.1.19'
make[2]: Nothing to be done for 'lib'.
make[2]: Leaving directory '/cygdrive/c/sam/samtools-0.1.19'
make[2]: Entering directory '/cygdrive/c/sam/samtools-0.1.19/bcftools'
make[2]: Nothing to be done for 'lib'.
make[2]: Leaving directory '/cygdrive/c/sam/samtools-0.1.19/bcftools'
make[2]: Entering directory '/cygdrive/c/sam/samtools-0.1.19/misc'
make[2]: Nothing to be done for 'lib'.
make[2]: Leaving directory '/cygdrive/c/sam/samtools-0.1.19/misc'
gcc -I/usr/include/ncurses -o samtools bam_tview.o bam_plcmd.o sam_view.o bam_rmdup.o bam_rmdupse.o bam_mate.o bam_stat.o bam_color.o bamtk.o kaln.o bam2bcf.o bam2bcf_indel.o errmod.o sample.o cut_target.o phase.o bam2depth.o padding.o bedcov.o bamshuf.o bam_tview_curses.o bam_tview_html.o libbam.a -Lbcftools -lbcf -lm -lz -lpthread
errmod.o:errmod.c: (.text+0xd96): undefined reference to `expl'
errmod.o:errmod.c: (.text+0xdbe): undefined reference to `logl'
collect2: error: ld returned 1 exit status
Makefile:48: recipe for target 'samtools' failed
make[1]: *** [samtools] Error 1
make[1]: Leaving directory '/cygdrive/c/sam/samtools-0.1.19'
Makefile:28: recipe for target 'all-recur' failed
make: *** [all-recur] Error 1

Looks like the lcurses problem is fixed but now we have undefined references to expl and logl.

Do you thoughts on these?
Scorpion43 is offline   Reply With Quote
Old 08-03-2014, 03:27 PM   #25
Scorpion43
Junior Member
 
Location: Melbourne, Australia

Join Date: Aug 2014
Posts: 8
Default

A little further info;
If I do a 'make clean', then a 'make', I get the more explanatory errors:-

prob1.c: In function ‘mc_cal_y’:
prob1.c:774:7: warning: incompatible implicit declaration of built-in function ‘ expl’ [enabled by default]
x = expl(ma->t - (ma->t1 + ma->t2));

errmod.c: In function ‘cal_coef’:
errmod.c:44:18: warning: incompatible implicit declaration of built-in function ‘expl’ [enabled by default]
sum = sum1 + expl(lC[n<<8|k] + k*le + (n-k)*le1);
^
errmod.c:45:31: warning: incompatible implicit declaration of built-in function ‘logl’ [enabled by default]
beta[k] = -10. / M_LN10 * logl(sum1 / sum);

errmod.o:errmod.c: (.text+0xd96): undefined reference to `expl'
errmod.o:errmod.c: (.text+0xdbe): undefined reference to `logl'
collect2: error: ld returned 1 exit status


Does this help?
Scorpion43 is offline   Reply With Quote
Old 08-03-2014, 11:52 PM   #26
Cytosine
Member
 
Location: Belgium

Join Date: Mar 2014
Posts: 22
Default

Undefined reference would probably mean you unlinked a library too much.
I suggest you try to modify the makefile like this now: (keep the 2 changes you made before)

- Put a "#" before CFLAGS
- Delete the # before LDFLAGS

CC= gcc
CFLAGS= -g -Wall -O2 #-m64 #-arch ppc
#CFLAGS= -I/usr/include/ncurses
LDFLAGS= -Wl,-rpath,\$$ORIGIN/../lib
DFLAGS= -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=0
KNETFILE_O= knetfile.o

That will basically remove any reference to ncurses and will link back the libraries that possibly contain the 'expl' and 'logl' functions.

What does make tell you after this?
Cytosine is offline   Reply With Quote
Old 08-04-2014, 12:11 AM   #27
Scorpion43
Junior Member
 
Location: Melbourne, Australia

Join Date: Aug 2014
Posts: 8
Default

Thank you Cytosine for taking the time to help me with this, I much appreciate it.

I added the # before the second CFLAGS, (I am guessing the first CFLAGS parameters are needed), and deleted it from the LDFLAGS, so the first couple of lines of 'Makefile' now read:-

CC= gcc
CFLAGS= -g -Wall -O2 #-m64 #-arch ppc
# CFLAGS= -I/usr/include/ncurses
LDFLAGS= -Wl,-rpath,\$$ORIGIN/../lib
DFLAGS= -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=0

However when I run 'make' I am still getting the same errors:-

$ make
make[1]: Entering directory '/cygdrive/c/sam/samtools-0.1.19'
make[2]: Entering directory '/cygdrive/c/sam/samtools-0.1.19'
make[2]: Nothing to be done for 'lib'.
make[2]: Leaving directory '/cygdrive/c/sam/samtools-0.1.19'
make[2]: Entering directory '/cygdrive/c/sam/samtools-0.1.19/bcftools'
make[2]: Nothing to be done for 'lib'.
make[2]: Leaving directory '/cygdrive/c/sam/samtools-0.1.19/bcftools'
make[2]: Entering directory '/cygdrive/c/sam/samtools-0.1.19/misc'
make[2]: Nothing to be done for 'lib'.
make[2]: Leaving directory '/cygdrive/c/sam/samtools-0.1.19/misc'
gcc -g -Wall -O2 -o samtools bam_tview.o bam_plcmd.o sam_view.o bam_rmdup.o bam_rmdupse.o bam_mate.o bam_stat.o bam_color.o bamtk.o kaln.o bam2bcf.o bam2bcf_indel.o errmod.o sample.o cut_target.o phase.o bam2depth.o padding.o bedcov.o bamshuf.o bam_tview_curses.o bam_tview_html.o -Wl,-rpath,\$ORIGIN/../lib libbam.a -Lbcftools -lbcf -lm -lz -lpthread
errmod.o: In function `cal_coef':
/cygdrive/c/sam/samtools-0.1.19/errmod.c:44: undefined reference to `expl'
/cygdrive/c/sam/samtools-0.1.19/errmod.c:45: undefined reference to `logl'
collect2: error: ld returned 1 exit status
Makefile:48: recipe for target 'samtools' failed
make[1]: *** [samtools] Error 1
make[1]: Leaving directory '/cygdrive/c/sam/samtools-0.1.19'
Makefile:28: recipe for target 'all-recur' failed
make: *** [all-recur] Error 1

Hmmmmm.... not any better!
Scorpion43 is offline   Reply With Quote
Old 08-04-2014, 12:29 AM   #28
Cytosine
Member
 
Location: Belgium

Join Date: Mar 2014
Posts: 22
Default

That's odd... The expl and logl function declarations are in math.h, which you are including in your makefile.

Did you do make clean after each try? Could be some code got compiled without it and make does not register it.
Cytosine is offline   Reply With Quote
Old 08-04-2014, 12:29 AM   #29
Scorpion43
Junior Member
 
Location: Melbourne, Australia

Join Date: Aug 2014
Posts: 8
Default

I was thinking I needed some maths library so installed gmp, libgmp and libgmp3 but identical error to above.

Edit, yes I did a make clean then make each time.

I don't see math.h in my 'makefile' Can you give me a line to add please?

Last edited by Scorpion43; 08-04-2014 at 12:35 AM. Reason: messages crossed
Scorpion43 is offline   Reply With Quote
Old 08-04-2014, 01:31 AM   #30
Cytosine
Member
 
Location: Belgium

Join Date: Mar 2014
Posts: 22
Default

There is an old post about this same problem on this forum: link

There it is proposed to rename the functions in the DFLAGS line in the makefile:

DFLAGS= -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_USE_KNETFILE -D_CURSES_LIB=0 -Dexpl=exp -Dlogl=log


Try this and if it still doesn't work go consult the forum thread in the link.
Cytosine is offline   Reply With Quote
Old 08-04-2014, 02:02 AM   #31
Scorpion43
Junior Member
 
Location: Melbourne, Australia

Join Date: Aug 2014
Posts: 8
Default

Thank you Cytosine, that did it !!!

I had tried adding those two parameters from another thread I had seen before I registered with SEQanswers, (but not the same thread that you have directed me to).

As I said before, when something does not work I tend to remove it again rather that clog up a file with apparently non-working parts.

This is what I now get:-

$ ./samtools.exe

Program: samtools (Tools for alignments in the SAM format)
Version: 0.1.19-44428cd

Usage: samtools <command> [options]

Command: view SAM<->BAM conversion
sort sort alignment file
mpileup multi-way pileup
depth compute the depth
faidx index/extract FASTA
index index alignment
idxstats BAM index stats (r595 or later)
fixmate fix mate information
flagstat simple stats
calmd recalculate MD/NM tags and '=' bases
merge merge sorted alignments
rmdup remove PCR duplicates
reheader replace BAM header
cat concatenate BAMs
bedcov read depth per BED region
targetcut cut fosmid regions (for fosmid pool only)
phase phase heterozygotes
bamshuf shuffle and group alignments by name

Thank you so much for leading me by the hand ... now I might be able to get on with my DNA analysis of my BAM files.

Cheers
Dennis Wright
www.irishtype3dna.org/
Scorpion43 is offline   Reply With Quote
Old 08-04-2014, 11:03 AM   #32
BurlEarl
Member
 
Location: Salt lake city, UT, US

Join Date: Jun 2012
Posts: 19
Default

Hi all,

From my experience Cygwin will be a continuous pain in the rear when trying to get new programs to compile. Unless this is really the only thing you can imagine having to compile, I would recommend buying another HD and installing a linux distribution. Because Cygwin is light weight, it is missing a ton of standard libraries. Since a lot of programs have dependencies that are met with standard Linux distros they are just not listed. What ended up happening for me was i tried $ make, found the compiler complaint, then installed Cygwin library and rinse and repeat for many iterations.

One pretty good newbie solution/stepping stone is Bio-Linux, which is based on Ubuntu (the window user friendly Linux distro). It comes with a ton of useful software preinstalled along with all their dependencies (obviously). These same packages are used for a ton of programs, so in the end much less time sifting through $ make outputs all day
It has been well worth the investment in the linux learning curve.

Bio-linux site:
http://environmentalomics.org/bio-linux/
BurlEarl is offline   Reply With Quote
Old 08-04-2014, 05:36 PM   #33
Scorpion43
Junior Member
 
Location: Melbourne, Australia

Join Date: Aug 2014
Posts: 8
Default

Thank you BurlEarl for your suggestion but I have no need, or desire to dive in deeper into Unix/Linux.

I taught myself Microsoft Basic in 1980 and have had a computer at home since then. At that time I taught myself and wrote programs in Z80 machine language. But I have not had a need to learn C+, C++, Perl, Ruby or any of the other languages. In recent times I have confined myself to HTML and CSS to build and maintain my website and at 70 can't be bothered in learning more that I have to!

While I haven't bothered to work out the intricacies of PATHs, SOURCEs and ENVIRONMENTs I am now able to drop a .bam file into the Samtools-0.1.19 folder, open the Cygwin Terminal window, cd to /samtools-0.1.19 directory and on issuing the command:-
./samtools.exe index xxxx.bam
after a short delay, the xxxx.bam.bai index file appears in the samtools-0.1.19 directory.

I can then use IGV 2.3.34 (Intergrative Genomics Viewer) to analyse the DNA results emanating from Next Generation Sequencing of the Y Chromosome.

That was all I needed Samtools to do for me so thanks to SEQanswers for assisting me to that end.

Last edited by Scorpion43; 08-04-2014 at 06:04 PM. Reason: Spelling
Scorpion43 is offline   Reply With Quote
Old 08-05-2014, 10:31 AM   #34
BurlEarl
Member
 
Location: Salt lake city, UT, US

Join Date: Jun 2012
Posts: 19
Default

Well you are certainly more qualified than me! I just started this bioinformatics journey (hence all the newbie info). Glad it's working for you. Good luck with analysis and whatnot.

Earl
__________________
--Please take everything thing I say with a grain of salt, because, if grad school has taught me anything, it's that I'm an idiot--
BurlEarl is offline   Reply With Quote
Old 08-05-2014, 08:26 PM   #35
Jeremy
Senior Member
 
Location: Pathum Thani, Thailand

Join Date: Nov 2009
Posts: 190
Default

A more functional alternative to cygwin would be bio-linux (ubuntu with many programs such as samtools pre installed) in a virtual box.
Jeremy is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 10:14 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO