1.删除软链接时把原文件也删除了
ln -s ~/workspace/tree/test/ ./ #软链接一个文件夹
rm test # 仅删除软链接,不影响原文件夹
rm -rf test #删除软链接,同时删去原文件夹
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.二代数据或三代数据比对
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 文件完整性
序列比对产生的文件很大,大小可能会超过存储空间,产生报错。
通过以下命令检验bam 文件有效性
samtools quickcheck *.bam && echo 'all ok' \
|| echo 'fail!'
5. conda 安装软件版本冲突
我使用 conda install -c bioconda pysam=0.16.0.1 命令在python2环境下安装pysam,报的错误很严重。
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
没有太读明白报错信息,在师兄建议下使用 pip install pysam==0.16.0.1 -i https://pypi.tuna.tsinghua.edu.cn/simple 成功安装 ,其中-i 指定国内的下载镜像。
有的文章建议使用下面两个命令,但是这次我没有尝试。
conda install -c bioconda -c conda-forge softname
conda install -c conda-forge softname
https://www.iotword.com/8375.html
https://www.jianshu.com/p/9a4b0ab62ba2
6. fastq or fasta 傻傻乎乎搞不懂?
我昨天用GraphAligner把HiFi数据比对到参考基因组,HIFi数据完好无损,也输入正确的文件名,但软件日志信息提示input 0 reads。后面我发现是HIFi数据的命名问题。HIFi数据按常理来说是fastq格式,但实际上是fasta文件。可能文件名命名错误让软件无法运行。
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 开启显示符号,打开文件查看换行符区别(或者使用cat - A )
win 换行符
Linux 换行符
可以使用以下命令将win 换行符转化为Linux
dos2unix file.txt # win系统换行符转化为Linux
or
sed 's/\r//' file.txt > new.file.txt
网友评论