This is the sidebar. Without it, the main text is too wide!
- Genome project
- Linux
2019년 11월 교육 자료
- 실습용 스크립트 구글 문서라서 접속 환경에 따라 열리지 않을 수도 있습니다.
This is the sidebar. Without it, the main text is too wide!
2019년 11월 교육 자료
Conda base environment에서 되도록 많은 응용프로그램이 무난하게 돌아갈 수 있도록 조건을 잡느라 시간이 많이 걸렸다. 우분투 및 프로그램 설치, distro 파일 제작과 재설치를 통한 테스트를 족히 수십 차례는 진행한 것 같다. 2022년 3월 22일 드디어 myUbuntu distro 최초 버전이 나왔고 5월 31일 KRIBBuntu-focal_2205를 제작하였다. 두 디스트로는 전부 Ubuntu 20.04 LTS를 이용한 것이다.
사용자명은 'kribb', 암호는 Kribb#1234로 하였다.
> wsl --list --online 다음은 설치할 수 있는 유효한 배포 목록입니다. 'wsl --install -d <배포>'를 사용하여 설치하세요. NAME FRIENDLY NAME Ubuntu Ubuntu Debian Debian GNU/Linux kali-linux Kali Linux Rolling openSUSE-42 openSUSE Leap 42 SLES-12 SUSE Linux Enterprise Server v12 Ubuntu-16.04 Ubuntu 16.04 LTS Ubuntu-18.04 Ubuntu 18.04 LTS Ubuntu-20.04 Ubuntu 20.04 LTS > wsl --install -d Ubuntu-20.04 Installing, this may take a few minutes... Please create a default UNIX user account. The username does not need to match your Windows username. For more information visit: https://aka.ms/wslusers Enter new UNIX username: kribb New password: Retype new password: password updated successfully Installation successful! To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.10.60.1-microsoft-standard-WSL2 x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Mon May 30 20:38:35 KST 2022 System load: 0.27 Processes: 8 Usage of /: 0.5% of 250.98GB Users logged in: 0 Memory usage: 1% IPv4 address for eth0: 172.25.20.3 Swap usage: 0% 1 update can be applied immediately. To see these additional updates run: apt list --upgradable The list of available updates is more than a week old. To check for new updates run: sudo apt update This message is shown once a day. To disable it please create the /home/kribb/.hushlogin file. kribb@DESKTOP-HA1DTJ2:~$ exit # 설치 후 상태 > wsl -l Linux용 Windows 하위 시스템 배포: Ubuntu-20.04(기본값)
관리자 권한으로 /etc/wsl.conf 파일을 만들어 다음의 내용을 삽입한다. 이렇게 해야 .tar 파일로 export한 배포를 import로 재설치했을 때 kribb 사용자명으로 사용할 수 있다.
[user] default=kribb
Microsoft Store에서 원하는 우분투 배포를 선택하여 설치해도 된다. Ubuntu 22.04 LTS(Jammy Jellyfish)는 Microsoft Store에는 있지만 2022년 5월 30일 현재 'wsl --list --online' 명령에서는 나타나지 않는다. 22.04는 WSL로 설치하기가 약간 까다롭다(0x8027025a 오류와 관련된 참조의 글 링크).
2022년 5월 31일에 적용하였다.
$ sudo apt update $ sudo apt upgrade $ sudo apt autoremove # Removing libfwupdplugin1:amd64 # System restart $ sudo apt install gnuplot-nox # MUMmer 결과의 시각화에 필요함 $ sudo apt install python3-pip $ sudo pip3 install khmer merge-gbk-records
파이썬 3.8 기반의 miniconda installer를 사용한다. 2022년 5월 30일 현재 최신 installer는 파이썬 3.9 기반이다.
$ wget https://repo.anaconda.com/miniconda/Miniconda3-py38_4.11.0-Linux-x86_64.sh $ bash Miniconda3-py38_4.11.0-Linux-x86_64.sh
설치 중에는 'conda init' 스크립트를 이용하여 startup script를 수정하도록 만든다. 종료 후 재시작하면 자동으로 conda base environment에 들어갈 것이다. 혹은 재시작하지 않고 다음과 같이 'source ~/.bashrc'를 실행해도 된다. conda config 파일을 수정하여 'conda activate' 명령을 입력해야만 conda base environment에 진입하도록 수정한다.
$ source ~/.bashrc (base) $ conda config --set auto_activate_base false (base) $ conda update conda
이 단계에서 CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/linux-64/current_repodata.json> 에러가 발생하면 종료하고 'wsl --shutdown'을 실시한 뒤 재시작한다. conda 명령어를 업데이트한 뒤 채널을 설정하고 필요한 패키지를 설치한다. zga를 설치할 때에는 checkm과 dfasta의 DB의 다운로드 및 설치가 이루어지므로 시간이 꽤 많이 걸린다.
(base) $ conda config --show channels channels: - defaults (base) $ conda config --add channels bioconda (base) $ conda config --add channels conda-forge
가장 중요한 zga부터 설치한다. GitHub 문서의 설치 사례를 조금 수정하였다.
(base) $ conda install fastp "spades>=3.12" unicycler checkm-genome dfast bbmap blast biopython=1.77 nxtrim "mash>=2" flye minimap2 racon "samtools>=1.9" emboss (base) $ dfast_file_downloader.py --protein dfast --cdd Cog --hmm TIGR (base) $ pip install zga
나머지 conda package를 설치한다. pyani는 base environment 내에서 pip로 설치하였다.
(base) $ conda install ncbi-genome-download fastani sra-tools filtlong fasttree trimal mafft mummer (base) $ pip install pyani # 설치된 conda environment 확인 (base) $ conda info --env # conda environments: # base * /home/kribb/miniconda3
~/bin에 다음의 6가지 프로그램을 복사한 다음 ~/.bashrc 파일의 끝부분에 다음을 추가한다.
export PATH=/home/kribb/bin:$PATH
Jim Kent의 유틸리티 중에서 다음의 두 개를 가져온다.
Sprai 패키지의 압축을 풀고 check_circularity.pl 파일을 꺼낸 뒤 1-4줄을 다음과 같이 수정한다.
#!/usr/bin/env perl eval 'exec /usr/bin/env perl -S $0 ${1+"$@"}' if 0; # not running under some shell
내가 만든 짤막한 스크립트. 우분투에서는 shebang line에 '/bin/sh'라고 해 놓으면 bash가 아니라 dash로 연결되므로 유의해야 한다.
#!/usr/bin/bash # # run-mummer4.sh: MUMmer-based shell script for aligning draft sequences to a # finished genome. # if [ $# = 0 ] then echo "Usage : run-mummer4.sh <prefix> <ref_seq_file> <query_seq_file> [-q]" 1>&2 echo "The last option is for delta-filter." echo "Other nucmer default options: -maxmatch -c 100" exit 1 fi #nucmer --prefix=$1 -mum -c 100 $2 $3 nucmer --prefix=$1 -mum -c 1000 $2 $3 if [ "$4" = "-q" ] then delta-filter $4 $1.delta > tmp mv $1.delta $1.delta.org mv tmp $1.delta fi show-coords -rcl $1.delta > $1.coords REFNAME=`awk '$1~/^>/{print $1}' $2 | sed 's/^>//'` for QRYNAME in `awk '$1~/^>/{print $1}' $3 | sed 's/^>//'` do show-aligns $1.delta $REFNAME $QRYNAME > $1.aligns done mummerplot --postscript $1.delta -R $2 -Q $3 --layout --prefix=$1
https://github.com/markschl/seqtool에서 리눅스 X86_64용 바이너리(seqtool-v0.3.0-x86_64-unknown-linux-gnu.tar.gz)를 가져다가 압축을 푼다.
~/bin 디렉토리의 내용물은 다음과 같아야 한다.
$ ls ~/bin ANI.pl check_circularity.pl faSomeRecords faSplit run-mummer4.sh st
ANI.pl과 pyani 실행에 필요하다. GitHub에서 blast-2.2.26-x64-linux.tar.gz를 가져다가 ~/apps 아래에서 압축을 푼다. ZGA pipeline의 dFAST annotation 과정에서는 여기에 포함된 rpsblast를 참조해서는 안된다. 따라서 ANI.pl 또는 pyani 실행 직전에 /home/kribb/bin/apps/blast-2.2.26/bin을 PATH에 포함시키도록 한다.
KRIBB 전산망 내에 있다면 SSLPrism.crt를 설치해야 한다. 리눅스에서 SSL 인증서 문제의 해결 방법 위키 문서에서 Ubuntu 항목을 참조하여 설치한다.
홈 디렉토리에서 꼭 필요하지 않은 파일을 지운다.
$ rm .viminfo .wget-hsts .sudo_as_admin_successful .bash_history
용량을 줄이기 위해 원본 패키지를 삭제한다.
$ sudo apt clean # cleaning /var/cache/apt/archives $ conda activate (base) $ conda clean --all
Windows Terminal에서 배포를 export하여 .tar 파일을 만든 뒤 md5 checksum을 구한다.
> wsl --export Ubuntu-20.04 $env:USERPROFILE\Desktop\KRIBBuntu-focal_2205a.tar > certutil -hashfile $env:USERPROFILE\Desktop\KRIBBuntu-focal_2205a.tar md5 MD5의 C:\Users\jeong\Desktop\KRIBBuntu-focal_2205a.tar 해시: 016a0ef6429f49482344ebb75e870dc5 CertUtil: -hashfile 명령이 성공적으로 완료되었습니다.
이 파일은 이제 다른 컴퓨터로 복사하여 자유롭게 설치할 수 있다. USB 플래시 드라이브에 4 GB 이상의 파일을 복사하려면 저장 매체를 NTFS로 수정해야 한다.
> mkdir C:\Distros\myUbuntu > wsl --import myUbuntu C:\Distros\myUbuntu $env:USERPROFILE\Desktop\KRIBBuntu-focal_2205a.tar