0

I was trying to run a bash code chunk on my R Markdown file (see below), but I get this error. I am taking a bioinformatics course and am new to this. Can some help? thank you I have a MacBook Pro 2019, Ventura OS.

Code chunk:

cd ./fastq/bowtie2

samples="WT_H1 WT_H2 WT_H3 WT_H4 WT_U1 WT_U2 WT_U3 WT_U4"

for sample in $samples
do
  samtools view -bo ${sample}.bam ${sample}.sam
done

#generates bam files from sam. Bam format is preferred for many downstream applications

Error:

/var/folders/8d/nh1q0pys0m1743fbksr66m4h0000gn/T/RtmpbxnwRw/chunk-code-533221e5a1d6.txt: line 10: samtools: command not found
/var/folders/8d/nh1q0pys0m1743fbksr66m4h0000gn/T/RtmpbxnwRw/chunk-code-533221e5a1d6.txt: line 10: samtools: command not found
/var/folders/8d/nh1q0pys0m1743fbksr66m4h0000gn/T/RtmpbxnwRw/chunk-code-533221e5a1d6.txt: line 10: samtools: command not found
/var/folders/8d/nh1q0pys0m1743fbksr66m4h0000gn/T/RtmpbxnwRw/chunk-code-533221e5a1d6.txt: line 10: samtools: command not found
/var/folders/8d/nh1q0pys0m1743fbksr66m4h0000gn/T/RtmpbxnwRw/chunk-code-533221e5a1d6.txt: line 10: samtools: command not found
/var/folders/8d/nh1q0pys0m1743fbksr66m4h0000gn/T/RtmpbxnwRw/chunk-code-533221e5a1d6.txt: line 10: samtools: command not found
/var/folders/8d/nh1q0pys0m1743fbksr66m4h0000gn/T/RtmpbxnwRw/chunk-code-533221e5a1d6.txt: line 10: samtools: command not found
/var/folders/8d/nh1q0pys0m1743fbksr66m4h0000gn/T/RtmpbxnwRw/chunk-code-533221e5a1d6.txt: line 10: samtools: command not found

I updated my RStudio, but it didn't solve anything.

I tried running my code chunk from terminal and got the following error:

dyld[23215]: Library not loaded: @rpath/libcrypto.1.0.0.dylib
  Referenced from: <3FAE4B52-2497-3D93-BE35-525AAAE38804> /Users/roykhair/opt/anaconda3/bin/samtools
  Reason: tried: '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS@rpath/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/usr/local/lib/libcrypto.1.0.0.dylib' (no such file), '/usr/lib/libcrypto.1.0.0.dylib' (no such file, not in dyld cache)
Abort trap: 6
dyld[23216]: Library not loaded: @rpath/libcrypto.1.0.0.dylib
  Referenced from: <3FAE4B52-2497-3D93-BE35-525AAAE38804> /Users/roykhair/opt/anaconda3/bin/samtools
  Reason: tried: '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS@rpath/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/usr/local/lib/libcrypto.1.0.0.dylib' (no such file), '/usr/lib/libcrypto.1.0.0.dylib' (no such file, not in dyld cache)
Abort trap: 6
dyld[23217]: Library not loaded: @rpath/libcrypto.1.0.0.dylib
  Referenced from: <3FAE4B52-2497-3D93-BE35-525AAAE38804> /Users/roykhair/opt/anaconda3/bin/samtools
  Reason: tried: '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS@rpath/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/usr/local/lib/libcrypto.1.0.0.dylib' (no such file), '/usr/lib/libcrypto.1.0.0.dylib' (no such file, not in dyld cache)
Abort trap: 6
dyld[23218]: Library not loaded: @rpath/libcrypto.1.0.0.dylib
  Referenced from: <3FAE4B52-2497-3D93-BE35-525AAAE38804> /Users/roykhair/opt/anaconda3/bin/samtools
  Reason: tried: '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS@rpath/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/usr/local/lib/libcrypto.1.0.0.dylib' (no such file), '/usr/lib/libcrypto.1.0.0.dylib' (no such file, not in dyld cache)
Abort trap: 6
dyld[23219]: Library not loaded: @rpath/libcrypto.1.0.0.dylib
  Referenced from: <3FAE4B52-2497-3D93-BE35-525AAAE38804> /Users/roykhair/opt/anaconda3/bin/samtools
  Reason: tried: '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS@rpath/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/usr/local/lib/libcrypto.1.0.0.dylib' (no such file), '/usr/lib/libcrypto.1.0.0.dylib' (no such file, not in dyld cache)
Abort trap: 6
dyld[23220]: Library not loaded: @rpath/libcrypto.1.0.0.dylib
  Referenced from: <3FAE4B52-2497-3D93-BE35-525AAAE38804> /Users/roykhair/opt/anaconda3/bin/samtools
  Reason: tried: '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS@rpath/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/usr/local/lib/libcrypto.1.0.0.dylib' (no such file), '/usr/lib/libcrypto.1.0.0.dylib' (no such file, not in dyld cache)
Abort trap: 6
dyld[23221]: Library not loaded: @rpath/libcrypto.1.0.0.dylib
  Referenced from: <3FAE4B52-2497-3D93-BE35-525AAAE38804> /Users/roykhair/opt/anaconda3/bin/samtools
  Reason: tried: '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS@rpath/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/usr/local/lib/libcrypto.1.0.0.dylib' (no such file), '/usr/lib/libcrypto.1.0.0.dylib' (no such file, not in dyld cache)
Abort trap: 6
dyld[23222]: Library not loaded: @rpath/libcrypto.1.0.0.dylib
  Referenced from: <3FAE4B52-2497-3D93-BE35-525AAAE38804> /Users/roykhair/opt/anaconda3/bin/samtools
  Reason: tried: '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS@rpath/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/Users/roykhair/opt/anaconda3/bin/../lib/libcrypto.1.0.0.dylib' (no such file), '/usr/local/lib/libcrypto.1.0.0.dylib' (no such file), '/usr/lib/libcrypto.1.0.0.dylib' (no such file, not in dyld cache)
Abort trap: 6
shafee
  • 15,566
  • 3
  • 19
  • 47
Roy Khair
  • 1
  • 2
  • 2
    The issue involves the use of the function `samtools`. Try running `samtools` in your cmd and see as to whether its recognized – Onyambu Nov 18 '22 at 21:21
  • 4
    In this case, `samtools` could be a bash function, a shell script (using bash or any other language), or a compiled executable. You will need to review what the `PATH` environment variable looks like both inside the r-markdown rendering and on your shell console (in R, `Sys.getenv("PATH")` and `Sys.which("samtools")`; in bash, `echo "$PATH"` and `which samtools`). – r2evans Nov 18 '22 at 21:29
  • If you google the error string `Library not loaded: @rpath/libcrypto.1.0.0.dylib`, there are several discussions of the problem and some workarounds. One `conda/conda` discussion with at least 2-3 "solved with ..." comments: https://github.com/conda/conda/issues/8103 – r2evans Nov 19 '22 at 17:33

0 Answers0