這里是佳奧疑俭!這一部分是Linux常用的命令粮呢。
1、釋放WSL2子系統(tǒng)空間
Windows PowerShell
wsl -l -v
wsl --shutdown
diskpart
進入新窗口
select vdisk file="C:\Users\22789\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc\LocalState\ext4.vhdx"
DiskPart 已成功選擇虛擬磁盤文件。
compact vdisk
DiskPart 已成功壓縮虛擬磁盤文件啄寡。
detach vdisk
2豪硅、刪除進程
ps -ef | grep fastq | grep -v grep | cut -c 9-15 | xargs kill -s 9
3、改命令行配色
echo 'export PS1="\[\033]2;\h:\u \w\007\033[33;1m\]\u \033[35;1m\t\033[0m \[\033[36;1m\]\w\[\033[0m\]\n\[\e[32;1m\]$ \[\e[0m\]"' >> ~/.bashrc
source ~/.bashrc
4这难、啟動ssh服務
sudo service ssh start
解決報錯:sshd: no hostkeys available -- exiting.
ssh-keygen -A
/etc/init.d/ssh start
5舟误、conda鏡像:
$ wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py39_4.12.0-Linux-x86_64.sh
6、啟動conda進程
$ source ~/.bashrc
7姻乓、conda創(chuàng)建小環(huán)境報錯嵌溢,排除網(wǎng)絡問題和頻道問題后,運行:
conda clean --packages && conda clean --all && conda update --all
8蹋岩、賦予文件全部權限赖草,xxx文件名
sudo chmod -R 777 xxx/
9、賦予腳本運行權限剪个,xxx腳本名
chmod u+x xxx
10秧骑、conda/memba安裝軟件
mamba install fastqc
11、conda全局更新
conda update --all
12扣囊、conda報錯solving environment: failed with repodata from current_repodata.json, will retry with next repodata
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
再新創(chuàng)建小環(huán)境即可
13乎折、添加sratoolkit到環(huán)境
$ export PATH="$PATH:/home/kaoku/biosoft/sratoolkit/sratoolkit.3.0.0-ubuntu64/bin"
echo 'export PATH=$PATH:/opt/sratoolkit/bin' >> ~/.bashrc
source ./bashrc
vdb-config -i #進入配置文件后按c,在location of user-repository設置下載好的文件的位置,設置完成后按s保存x退出界面
14、添加TrimGalore到環(huán)境
export PATH="$PATH:/home/kaoku/biosoft/trimgalory/TrimGalore-0.6.7"
15侵歇、Linux全局更新
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
16骂澄、循環(huán)比對bwa(wes分析)
ls *_1.fastq>1
ls *_2.fastq>2
paste 1 2 > config
然后進vim添加一列sample名,用tab鍵分隔
##已有config文件
##7E5241 7E5241.L1_1.fastq 7E5241.L1_2.fastq
INDEX=/home/.../hg38
cat config | while read id
do
arr=($id)
fq1=${arr[1]}
fq2=${arr[2]}
sample=${arr[0]}
bwa mem -t 5 -R "@RG\tID:$sample\tSM:$sample\tLB:WGS\tPL:Illumia" $INDEX $fq1 $fq2 | samtools sort -@ 5 -o $sample.bam -
done
17惕虑、解壓tar.gz
tar -zxvf file
18坟冲、解壓.gz(刪除壓縮文件)
gzip -d file
批量壓縮(刪除原文件)
gzip *
19、conda第一次建立環(huán)境后激活
conda create -n rnaseq
source activate rnaseq
conda activate rnaseq
20溃蔫、去除文件的全部雙引號健提、單引號
##雙引號
sed -i 's/"http://g' tmp.bed
##單引號
sed -i $'s/\'//g' tmp.bed
##;
sed -i 's/;//g' tmp.bed
s表示替換伟叛,\%就表示百分號私痹,s/\%//將%替換為空,最后的g標志表示全部替換
21痪伦、批量.sra轉.fq.gz
for id in *sra
do
echo $id
fastq-dump --gzip --split-3 $id
done