Installing the Bio :: DB :: Sam perl module

I am trying to install the Bio::DB::Sam perl module in my home directory on a remote server.

I downloaded the module, extracted the files and executed:

 perl Build.pl prefix=~/local 

here's what will happen next:

 This module requires samtools 0.1.10 or higher (samtools.sourceforge.net). Please enter the location of the bam.h and compiled libbam.a files: **/some_places/samtools-0.1.19** Found /some_places/samtools-0.1.19/bam.h and /some_places/samtools-0.1.19/libbam.a. Created MYMETA.yml and MYMETA.json Creating new 'Build' script for 'Bio-SamTools' version '1.39' 

Next, when I try to run:

 ./Build 

here is what i get:

  Building Bio-SamTools gcc -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -o blib/arch/auto/Bio/DB/Sam/Sam.so lib/Bio/DB/Sam.o c_bin/bam2bedgraph.o -L/some_places/samtools-0.1.19 -lbam -lpthread -lz /usr/bin/ld: /some_places/samtools-0.1.19/libbam.a(bgzf.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /some_places/samtools-0.1.19/libbam.a: could not read symbols: Bad value collect2: ld returned 1 exit status error building blib/arch/auto/Bio/DB/Sam/Sam.so from lib/Bio/DB/Sam.o c_bin/bam2bedgraph.o at ~/perl5/lib/perl5/ExtUtils/CBuilder/Base.pm line 323. 

I made google possible solutions and tried a couple, but they did not work, for example. --enable-shared OR export CXXFLAGS="$CXXFLAGS -fPIC" .

I already have Bioperl installed in my home directory.

Any help would be appreciated.

Greetings

+6
source share
4 answers

Here is a script that will extract the source of SAMtools and compile it, and then extract and compile the Perl bindings.

 wget http://sourceforge.net/projects/samtools/files/samtools/0.1.18/samtools-0.1.18.tar.bz2 tar xjf samtools-0.1.18.tar.bz2 && cd samtools-0.1.18 make CFLAGS=-fPIC export SAMTOOLS=`pwd` cpanm Bio::DB::Sam 

Part of the problem that you probably see is that the SAMtools project has recently undergone some serious code reorganization (and this, of course, made it difficult to work with external language bindings).

+6
source

I fixed this problem by redoing samtools with the -fPIC option

 make clean make CXXFLAGS=-fPIC CFLAGS=-fPIC CPPFLAGS=-fPIC 

then install using cpan.

 cpan[2]> install Bio::DB::Sam 
+1
source

[solvable]

 wget http://sourceforge.net/projects/samtools/files/samtools/0.1.18/samtools-0.1.18.tar.bz2 tar xjf samtools-0.1.18.tar.bz2 && cd samtools-0.1.18 make CFLAGS=-fPIC 

type cpan into terminal and type

 install Bio::DB::Sam 

Be careful:

You cannot use the following command:

perl -MCPAN -Mlocal :: lib -e 'CPAN :: install (Bio :: DB :: Sam)

You can only use cpan and then use

 install Bio::DB::Sam 
+1
source

I followed the instructions from the README file below Bio-SamTools-1.43 to edit the Makefile in samtools 0.1.17. Then, to install, I used

perl -MCPAN -e shell install Bio :: DB :: Sam

Readme

This is the Perl interface for sequencing the SAMtools interface. It ONLY works on versions of Samtools prior to 0.1.17. It does not work with version 1.0 or higher due to major changes to the library structure.

See http://samtools.sourceforge.net/ for documentation on samtools.

  • INSTALLING ONE STEP

In the root directory of this distribution you will find the script INSTALL.pl. By running this, you download the latest versions of this module and SamTools into a temporary directory, compile them, test and install them. Just run:

perl INSTALL.pl

  • MULTIPLE INSTALLATION

A more traditional installation requires you to separately download, unzip and compile SAMtools from 0.1.10 to 0.1.17 in some available directories. Entering "make" in the samtools directory will usually work. SAMtools version 0.1.18 and higher do not work with this library.

Then set the SAMTOOLS environment variable to specify this directory.

You will also need to install Bio :: Perl from CPAN.

Now run:

perl Build.PL. / build ./Build test (sudo) ./ Build install

MALFUNCTIONS:

If problems arise during compilation, you may need to modify Build.PL so that extra_compiler_flags matches CFLAGS and DFLAGS settings in the SamTools Makefile. Here are some common problems:

  • When creating this module, you will receive the following error: moving R_X86_64_32 in relation to the "local character" cannot be used when creating a shared object; recompile with -fPIC

To fix this, edit the Makefile in the Samtools distribution by adding "-fPIC" to the CFLAGS line. While you're on it, you might also want to get rid of a bunch of unused alert variables that appear under the latest versions of gcc. Modified CFLAGS will look like this:

CFLAGS = -g -Wall -Wno-unused -Wno-unused-result -O2 -fPIC # -m64 # -arch ppc

Then do "make clean, make" in the Samtools directory to recompile the library. After that, you can build this module without error.

  1. When you create this module, you get a library error message.

To fix this, follow the recipe in (1), with the exception of adding -m64 to CFLAGS so it looks like this:

CFLAGS = -g -Wall -O2 -fPIC # -m64 # -arch ppc

TESTS AND CONFIRMATION:

You can get the latest version of this module using its GitHub site at https://github.com/GMOD/GBrowse-Adaptors . please feel free to send bug reports, corrections, etc. via github.

AUTHOR:

Lincoln D. Stein

Copyright (c) 2009-2015 Ontario Cancer Research Institute

This package and its accompanying libraries are free software; you can redistribute it and / or modify it in accordance with the terms of the artistic License 2.0, the Apache 2.0 license, or the GNU General Public License (version 1 or higher). Contact LICENSE for the full text of the license.

0
source

Source: https://habr.com/ru/post/974510/


All Articles