记录一下学习samtools遇到的问题,我安装后使用过程出了点问题,找到一个帖子https://www.jianshu.com/p/d72ff8ddd99f,做了相关调整,最后还是没能解决问题,最后重新新建了一个小环境用conda安装后就解决了问题,具体过程如下
先进行如下尝试:
(base) Cheng-MacBook-Pro:bam chelsea$ samtools view X391Y_504KO.AddRG.Reorder.Sort.bam |head
dyld: Library not loaded: @rpath/libcrypto.1.0.0.dylib
Referenced from: /Users/chelsea/miniconda3/bin/samtools
Reason: image not found
(base) Cheng-MacBook-Pro:bam chelsea$ brew update
fatal: unable to access 'https://github.com/Homebrew/homebrew-core/': Failed to connect to github.com port 443: Operation timed out
fatal: unable to access 'https://github.com/Homebrew/brew/': Failed to connect to github.com port 443: Operation timed out
Error: Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core failed!
Fetching /usr/local/Homebrew failed!
(base) Cheng-MacBook-Pro:bam chelsea$ brew install openssl
Updating Homebrew...
Error: openssl@1.1 1.1.1f is already installed
To upgrade to 1.1.1g, run `brew upgrade openssl@1.1`
(base) Cheng-MacBook-Pro:bam chelsea$ brew upgrade openssl@1.1
Updating Homebrew...
==> Upgrading 1 outdated package:
openssl@1.1 1.1.1f -> 1.1.1g
==> Upgrading openssl@1.1 1.1.1f -> 1.1.1g
==> Downloading https://homebrew.bintray.com/bottles/openssl%401.1-1.1.1g.high_sierra.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/ee/eebad96faa46489dc8bf8502b16ec0192f5ff9d803794c9744ad503
######################################################################## 100.0%
==> Pouring openssl@1.1-1.1.1g.high_sierra.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl@1.1/certs
and run
/usr/local/opt/openssl@1.1/bin/c_rehash
openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.
If you need to have openssl@1.1 first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> /Users/chelsea/.bash_profile
For compilers to find openssl@1.1 you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
==> Summary
🍺 /usr/local/Cellar/openssl@1.1/1.1.1g: 8,059 files, 18.4MB
==> `brew cleanup` has not been run in 30 days, running now...
Removing: /Users/chelsea/Library/Caches/Homebrew/gd--2.2.5.high_sierra.bottle.tar.gz... (290.2KB)
Removing: /Users/chelsea/Library/Caches/Homebrew/glib--2.64.1_1.high_sierra.bottle.tar.gz... (4.6MB)
Removing: /Users/chelsea/Library/Caches/Homebrew/graphviz--2.42.3.high_sierra.bottle.tar.gz... (7.5MB)
Removing: /Users/chelsea/Library/Caches/Homebrew/libffi--3.2.1.high_sierra.bottle.tar.gz... (97.2KB)
Removing: /Users/chelsea/Library/Caches/Homebrew/netpbm--10.86.12.high_sierra.bottle.tar.gz... (1.5MB)
Removing: /usr/local/Cellar/openssl@1.1/1.1.1d... (7,976 files, 17.9MB)
Removing: /usr/local/Cellar/openssl@1.1/1.1.1f... (8,057 files, 18.4MB)
Removing: /Users/chelsea/Library/Caches/Homebrew/openssl@1.1--1.1.1f.high_sierra.bottle.tar.gz... (5.4MB)
Removing: /Users/chelsea/Library/Logs/Homebrew/fontconfig... (41KB)
Removing: /Users/chelsea/Library/Logs/Homebrew/freetype... (68B)
Removing: /Users/chelsea/Library/Logs/Homebrew/gd... (68B)
Removing: /Users/chelsea/Library/Logs/Homebrew/gdbm... (68B)
Removing: /Users/chelsea/Library/Logs/Homebrew/glib... (68B)
Removing: /Users/chelsea/Library/Logs/Homebrew/go... (5 files, 238B)
Removing: /Users/chelsea/Library/Logs/Homebrew/graphviz... (68B)
Removing: /Users/chelsea/Library/Logs/Homebrew/gts... (68B)
Removing: /Users/chelsea/Library/Logs/Homebrew/jasper... (68B)
Removing: /Users/chelsea/Library/Logs/Homebrew/jpeg... (68B)
Removing: /Users/chelsea/Library/Logs/Homebrew/libffi... (68B)
Removing: /Users/chelsea/Library/Logs/Homebrew/libpng... (68B)
Removing: /Users/chelsea/Library/Logs/Homebrew/libtiff... (68B)
Removing: /Users/chelsea/Library/Logs/Homebrew/libtool... (68B)
Removing: /Users/chelsea/Library/Logs/Homebrew/netpbm... (68B)
Removing: /Users/chelsea/Library/Logs/Homebrew/openjdk... (68B)
Removing: /Users/chelsea/Library/Logs/Homebrew/openssl@1.1... (68B)
Removing: /Users/chelsea/Library/Logs/Homebrew/pandoc... (68B)
Removing: /Users/chelsea/Library/Logs/Homebrew/pcre... (68B)
Removing: /Users/chelsea/Library/Logs/Homebrew/python@3.8... (3 files, 148.8KB)
Removing: /Users/chelsea/Library/Logs/Homebrew/readline... (68B)
Removing: /Users/chelsea/Library/Logs/Homebrew/selenium-server-standalone... (128B)
Removing: /Users/chelsea/Library/Logs/Homebrew/sqlite... (68B)
Removing: /Users/chelsea/Library/Logs/Homebrew/webp... (68B)
Removing: /Users/chelsea/Library/Logs/Homebrew/xz... (68B)
Pruned 0 symbolic links and 9 directories from /usr/local
==> Checking for dependents of upgraded formulae...
==> Upgrading 3 dependents:
glib 2.64.1_1 -> 2.64.3, graphviz 2.42.3 -> 2.44.0, wget 1.20.3_1 -> 1.20.3_2
==> Upgrading glib 2.64.1_1 -> 2.64.3
==> Downloading https://homebrew.bintray.com/bottles/gettext-0.20.2_1.high_sierra.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/4a/4a999c75dcc53cbc711e3ac6545db69ab3aeca6c29c1cb6b21c353f
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/libffi-3.3.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/glib-2.64.3.high_sierra.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/1e/1e5fadb54980899f293ea99796c33f25109c72ad745b9bc5583a1f8
######################################################################## 100.0%
==> Installing dependencies for glib: gettext and libffi
==> Installing glib dependency: gettext
==> Pouring gettext-0.20.2_1.high_sierra.bottle.tar.gz
==> Caveats
Emacs Lisp files have been installed to:
/usr/local/share/emacs/site-lisp/gettext
==> Summary
🍺 /usr/local/Cellar/gettext/0.20.2_1: 1,929 files, 18.7MB
==> Installing glib dependency: libffi
==> Pouring libffi-3.3.high_sierra.bottle.tar.gz
==> Caveats
libffi is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
For compilers to find libffi you may need to set:
export LDFLAGS="-L/usr/local/opt/libffi/lib"
export CPPFLAGS="-I/usr/local/opt/libffi/include"
==> Summary
🍺 /usr/local/Cellar/libffi/3.3: 16 files, 485.1KB
==> Installing glib
==> Pouring glib-2.64.3.high_sierra.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
==> Summary
🍺 /usr/local/Cellar/glib/2.64.3: 436 files, 15.7MB
Removing: /usr/local/Cellar/glib/2.64.1_1... (436 files, 15.7MB)
==> Upgrading graphviz 2.42.3 -> 2.44.0
==> Downloading https://homebrew.bintray.com/bottles/gd-2.3.0.high_sierra.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/0b/0bd97ae0be0bfaa7554d0628a69b5fd8cba27de7ff5bde0533d4a1b
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/netpbm-10.86.13.high_sierra.bottle.1.tar.gz
==> Downloading from https://akamai.bintray.com/13/13780d3a1ab3ec9856a8da98909829a4457f514031db7844245158a
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/lzo-2.10.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/pixman-0.40.0.high_sierra.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/e5/e5b78e3dca71370ccc06a013ebda8b9f1c2b89a238e2f3ef11a8086
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/cairo-1.16.0_3.high_sierra.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/5c/5c383ad4625fb1bd15e44e99fba1201490fa478b26178abaca5abb0
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/fribidi-1.0.9.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/graphite2-1.3.14.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/icu4c-66.1.high_sierra.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/87/87f2446c5de0991c6bf959a61e63a746ebb6687f6bd68186ecd74ff
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/harfbuzz-2.6.6.high_sierra.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/93/9339baeb14615890e90b8c06c081603b9375fa97391f8400bb6a89a
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/pango-1.44.7.high_sierra.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/42/42552a9d26655f006f2361c9a1773d56bd5c5cabcd4f6ad5861fec2
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/graphviz-2.44.0.high_sierra.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/c3/c3b0269db2fb418c0e1b7413f10e0bec2d4f69485cfda484e8acf99
######################################################################## 100.0%
==> Installing dependencies for graphviz: gd, netpbm, lzo, pixman, cairo, fribidi, graphite2, icu4c, harfbuzz and pango
==> Installing graphviz dependency: gd
==> Pouring gd-2.3.0.high_sierra.bottle.tar.gz
🍺 /usr/local/Cellar/gd/2.3.0: 34 files, 1.1MB
==> Installing graphviz dependency: netpbm
==> Pouring netpbm-10.86.13.high_sierra.bottle.1.tar.gz
🍺 /usr/local/Cellar/netpbm/10.86.13: 410 files, 6.5MB
==> Installing graphviz dependency: lzo
==> Pouring lzo-2.10.high_sierra.bottle.tar.gz
🍺 /usr/local/Cellar/lzo/2.10: 31 files, 556.6KB
==> Installing graphviz dependency: pixman
==> Pouring pixman-0.40.0.high_sierra.bottle.tar.gz
🍺 /usr/local/Cellar/pixman/0.40.0: 14 files, 1.3MB
==> Installing graphviz dependency: cairo
==> Pouring cairo-1.16.0_3.high_sierra.bottle.tar.gz
🍺 /usr/local/Cellar/cairo/1.16.0_3: 117 files, 5.5MB
==> Installing graphviz dependency: fribidi
==> Pouring fribidi-1.0.9.high_sierra.bottle.tar.gz
🍺 /usr/local/Cellar/fribidi/1.0.9: 67 files, 601.2KB
==> Installing graphviz dependency: graphite2
==> Pouring graphite2-1.3.14.high_sierra.bottle.tar.gz
🍺 /usr/local/Cellar/graphite2/1.3.14: 18 files, 232.3KB
==> Installing graphviz dependency: icu4c
==> Pouring icu4c-66.1.high_sierra.bottle.tar.gz
==> Caveats
icu4c is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).
If you need to have icu4c first in your PATH run:
echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> /Users/chelsea/.bash_profile
echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> /Users/chelsea/.bash_profile
For compilers to find icu4c you may need to set:
export LDFLAGS="-L/usr/local/opt/icu4c/lib"
export CPPFLAGS="-I/usr/local/opt/icu4c/include"
==> Summary
🍺 /usr/local/Cellar/icu4c/66.1: 258 files, 70.6MB
==> Installing graphviz dependency: harfbuzz
==> Pouring harfbuzz-2.6.6.high_sierra.bottle.tar.gz
🍺 /usr/local/Cellar/harfbuzz/2.6.6: 165 files, 11.4MB
==> Installing graphviz dependency: pango
==> Pouring pango-1.44.7.high_sierra.bottle.tar.gz
🍺 /usr/local/Cellar/pango/1.44.7: 62 files, 4.2MB
==> Installing graphviz
==> Pouring graphviz-2.44.0.high_sierra.bottle.tar.gz
🍺 /usr/local/Cellar/graphviz/2.44.0: 508 files, 11.1MB
Removing: /usr/local/Cellar/graphviz/2.42.3... (506 files, 12MB)
==> Upgrading wget 1.20.3_1 -> 1.20.3_2
==> Downloading https://homebrew.bintray.com/bottles/libidn2-2.3.0.high_sierra.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/45/4530dd74cbd31c49b0f499eda0f9ea29ec7ff6ae00f9aff39742473
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/wget-1.20.3_2.high_sierra.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/91/91dd0caca9bd3f38c439d5a7b6f68440c4274945615fae035ff0a36
######################################################################## 100.0%
==> Installing dependencies for wget: libidn2
==> Installing wget dependency: libidn2
==> Pouring libidn2-2.3.0.high_sierra.bottle.tar.gz
🍺 /usr/local/Cellar/libidn2/2.3.0: 70 files, 719.6KB
==> Installing wget
==> Pouring wget-1.20.3_2.high_sierra.bottle.tar.gz
🍺 /usr/local/Cellar/wget/1.20.3_2: 50 files, 4.0MB
Removing: /usr/local/Cellar/wget/1.20.3_1... (50 files, 4.0MB)
==> Checking for dependents of upgraded formulae...
==> No broken dependents found!
==> Caveats
==> openssl@1.1
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl@1.1/certs
and run
/usr/local/opt/openssl@1.1/bin/c_rehash
openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.
If you need to have openssl@1.1 first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> /Users/chelsea/.bash_profile
For compilers to find openssl@1.1 you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
==> gettext
Emacs Lisp files have been installed to:
/usr/local/share/emacs/site-lisp/gettext
==> libffi
libffi is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
For compilers to find libffi you may need to set:
export LDFLAGS="-L/usr/local/opt/libffi/lib"
export CPPFLAGS="-I/usr/local/opt/libffi/include"
==> glib
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
==> icu4c
icu4c is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).
If you need to have icu4c first in your PATH run:
echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> /Users/chelsea/.bash_profile
echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> /Users/chelsea/.bash_profile
For compilers to find icu4c you may need to set:
export LDFLAGS="-L/usr/local/opt/icu4c/lib"
export CPPFLAGS="-I/usr/local/opt/icu4c/include"
(base) Cheng-MacBook-Pro:bam chelsea$ echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> /Users/chelsea/.bash_profile
(base) Cheng-MacBook-Pro:bam chelsea$ echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> /Users/chelsea/.bash_profile
(base) Cheng-MacBook-Pro:bam chelsea$ export LDFLAGS="-L/usr/local/opt/icu4c/lib"
(base) Cheng-MacBook-Pro:bam chelsea$ export CPPFLAGS="-I/usr/local/opt/icu4c/include"
(base) Cheng-MacBook-Pro:bam chelsea$ samtools
dyld: Library not loaded: @rpath/libcrypto.1.0.0.dylib
Referenced from: /Users/chelsea/miniconda3/bin/samtools
Reason: image not found
Abort trap: 6
找到安装 的libcrypto.1.1.dylib
ln -s /usr/local/opt/openssl/lib/libcrypto.1.1.dylib /usr/local/lib/
更改
(base) Cheng-MacBook-Pro:bam chelsea$ ln -s /usr/local/opt/openssl/lib/libcrypto.1.1.dylib /usr/local/lib/
ln: /usr/local/lib//libcrypto.1.1.dylib: File exists
(base) Cheng-MacBook-Pro:bam chelsea$
(base) Cheng-MacBook-Pro:bam chelsea$ samtools
dyld: Library not loaded: @rpath/libcrypto.1.0.0.dylib
Referenced from: /Users/chelsea/miniconda3/bin/samtools
Reason: image not found
Abort trap: 6
在新的小环境中安装软件
conda list
conda info -e
conda activate rna
conda install samtools
安装完成后结果:
(rna) Cheng-MacBook-Pro:bam chelsea$ samtools
Program: samtools (Tools for alignments in the SAM format)
Version: 1.9 (using htslib 1.9)
Usage: samtools <command> [options]
Commands:
-- Indexing
dict create a sequence dictionary file
faidx index/extract FASTA
fqidx index/extract FASTQ
index index alignment
-- Editing
calmd recalculate MD/NM tags and '=' bases
fixmate fix mate information
reheader replace BAM header
targetcut cut fosmid regions (for fosmid pool only)
addreplacerg adds or replaces RG tags
markdup mark duplicates
-- File operations
collate 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
quickcheck quickly check if SAM/BAM/CRAM file appears intact
fastq converts a BAM to a FASTQ
fasta converts a BAM to a FASTA
-- Statistics
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
depad convert padded BAM to unpadded BAM
查看bam文件的头部信息,找到比对相关信息:
samtools view -h X391Y_595KO.AddRG.Reorder.Sort.bam | less -S
结果如下:
@PG ID:hisat2 VN:2.1.0 CL:"/hwfswh2/BC_PUB/P_bc_ccp/RNA/RNA_RNAref/RNA_RNAref_2018a/software/01_SoftAll/hisat2-2.1.0/hisat2-align-s --wrapper basic-0 --phred33 --sensitive -p 8 -x /ifswh1/BC_COM_P11/BioSysDB/v1904/10090/NCBI/GCF_000001635.26_GRCm38.p6/GenomeHisat2Index/GCF_000001635.26_GRCm38.p6_genomic --novel-splicesite-outfile /hwfswh2/BC_COM_P11/F19FTSSCWLJ1750/MOUxbkR/result/backups/Alignment_hisat/X391Y_595KO/X391Y_595KO.junction -U /tmp/131514.unp" PN:hisat2
从此处可知,使用的是hisat2
比对软件,参考注释基因组文件为GCF_000001635.26_GRCm38.p6_genomic
。
下载地址:
ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/000/001/635/GCA_000001635.8_GRCm38.p6