1.刪除軟鏈接時(shí)把原文件也刪除了
ln -s ~/workspace/tree/test/ ./ #軟鏈接一個(gè)文件夾
rm test # 僅刪除軟鏈接,不影響原文件夾
rm -rf test #刪除軟鏈接履因,同時(shí)刪去原文件夾
2.samtools 合并bam 文件
samtools merge 合并排序后的bam 文件
samtools cat 合并bam 文件
samtools merge -@ 35 merge.hic.REduced.paired_only.sort.bam hic_lib1.REduced.paired_only.sort.bam \
hic_lib2.REduced.paired_only.sort.bam hic_lib3.REduced.paired_only.sort.bam \
hic_lib4.REduced.paired_only.sort.bam
samtools cat -@ 35 merge.hic.REduced.paired_only.bam hic_lib1.REduced.paired_only.bam \
hic_lib2.REduced.paired_only.bam hic_lib3.REduced.paired_only.bam \
hic_lib4.REduced.paired_only.bam
3.二代數(shù)據(jù)或三代數(shù)據(jù)比對
bwa 需要建索引
minimap2 不需要
zcat ./hifi_date/*.fasta.gz > reads_all.fastq
minimap2 -ax map-hifi --split-prefix My_prefix -t 40 ./ref.genome.fasta reads_all.fastq |
samtools sort -@ 40 - > Alignment.bam
samtools index -@ 40 Alignment.bam
bwa index ref.genome.fasta # 建索引
bwa mem -t 15 result.fa Sa_good_1.fastq.gz Sa_good_2.fastq.gz > hic_lib1.sam
4.檢查bam 文件完整性
序列比對產(chǎn)生的文件很大障簿,大小可能會超過存儲空間,產(chǎn)生報(bào)錯(cuò)栅迄。
通過以下命令檢驗(yàn)bam 文件有效性
samtools quickcheck *.bam && echo 'all ok' \
|| echo 'fail!'
5. conda 安裝軟件版本沖突
我使用 conda install -c bioconda pysam=0.16.0.1 命令在python2環(huán)境下安裝pysam,報(bào)的錯(cuò)誤很嚴(yán)重站故。
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: /
Found conflicts! Looking for incompatible packages. failed
UnsatisfiableError: The following specifications were found to be incompatible with each other:
Output in format: Requested package -> Available versionsThe following specifications were found to be incompatible with your system:
- feature:/linux-64::__glibc==2.17=0
- pysam=0.16.0.1 -> libgcc-ng[version='>=9.3.0'] -> __glibc[version='>=2.17']
- python=2.7 -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
Your installed version is: 2.17
沒有太讀明白報(bào)錯(cuò)信息,在師兄建議下使用 pip install pysam==0.16.0.1 -i https://pypi.tuna.tsinghua.edu.cn/simple 成功安裝 毅舆,其中-i 指定國內(nèi)的下載鏡像西篓。
有的文章建議使用下面兩個(gè)命令,但是這次我沒有嘗試憋活。
conda install -c bioconda -c conda-forge softname
conda install -c conda-forge softname
https://www.iotword.com/8375.html
http://www.reibang.com/p/9a4b0ab62ba2
6. fastq or fasta 傻傻乎乎搞不懂岂津?
我昨天用GraphAligner把HiFi數(shù)據(jù)比對到參考基因組,HIFi數(shù)據(jù)完好無損悦即,也輸入正確的文件名吮成,但軟件日志信息提示input 0 reads。后面我發(fā)現(xiàn)是HIFi數(shù)據(jù)的命名問題辜梳。HIFi數(shù)據(jù)按常理來說是fastq格式粱甫,但實(shí)際上是fasta文件∪呙溃可能文件名命名錯(cuò)誤讓軟件無法運(yùn)行魔种。
mv merge_all.fastq merge_all.fasta
GraphAligner -g ref.gfa -f merge_all.fasta -a mapping.gaf -x vg -t 30
7. linux 與win 換行符
Linux 換行符 \n
win 換行符 \r\n
將notepad 開啟顯示符號,打開文件查看換行符區(qū)別(或者使用cat - A )
可以使用以下命令將win 換行符轉(zhuǎn)化為Linux
dos2unix file.txt # win系統(tǒng)換行符轉(zhuǎn)化為Linux
or
sed 's/\r//' file.txt > new.file.txt
8. bam文件排序再建立索引(bam文件需要排序)
samtools sort out.bam -@ 10 -o out.sort.bam
samtools index -@ 10 out.sort.bam