> For the complete documentation index, see [llms.txt](https://zpliu.gitbook.io/booknote/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zpliu.gitbook.io/booknote/ke-bian-jian-qie/di-8-ge-jie-guo.md).

# 第8个结果

## 四倍体内亚基因组间的比较

* At、Dt中共有的AS
* At、Dt中特有的AS

```bash
##目录 allopolyploid
python ASBias.py  -homolog ~/work/Alternative/result/homologo/homologGene/At_vs_Dt_collinerity.txt -AS1 ~/work/Alternative/result/Gh_result/CO31_32_result/11_AS/At_splice.txt  -AS2 ~/work/Alternative/result/Gh_result/CO31_32_result/11_AS/Dt_splice.txt  -C ../blast/IR/At_Dt_conserve_end  -o 11 -T IntronR
```

### 同源基因间AS保守程度计算

```bash
python ./conservePrecentage.py -homolog ~/work/Alternative/result/homologo/homologGene/At_vs_Dt_collinerity.txt  -isform ../ASCount/IR/At_Dt_IR  -AS ../blast/IR/At_Dt_conserve_end  -o 1111
##转换格式
awk 'NR%2!=0{printf $0"\t"}NR%2==0{print $0}' 1111
```

### 不是类型的比例

* 完全保守的基因对
* 部分保守的基因对
* 完全不保守的基因对
  * 同源基因间都存在剪切事件
  * 只有单个基因存在剪切事件

```bash
## 完全保守
awk 'NR%2!=0{printf $0"\t"}NR%2==0{print $0}' 1111 |awk '$2==1{print $0}'|wc -l
## 部分保守
awk 'NR%2!=0{printf $0"\t"}NR%2==0{print $0}' 1111 |awk '$2>0&&$2<1{print $0}'|wc -l
## 完全不保守
awk 'NR%2!=0{printf $0"\t"}NR%2==0{print $0}' 1111 |awk '$2==0{print $0}'|wc -l
## 完全不保守，并且都存在AS
awk 'NR%2!=0{printf $0"\t"}NR%2==0{print $0}' 1111 |awk '$2==0{print $0}'|awk '$3!=0&&$6!=0{print $0}'|wc -l
## 完全不保守，只有一个基因组存在AS
```

| 同源基因间IR事件 | 数目   | 比例        |
| --------- | ---- | --------- |
| 完全保守      | 74   |           |
| 部分保守      | 1748 |           |
| 完全不保守     | 6796 | 6796/8618 |
| 同源基因都存在AS | 1089 |           |
| 只有A存在     | 2789 |           |
| 只有D存在     | 2918 |           |

## 二倍体不同亚基因组间的比较

```bash
python ../ASBias.py  -homolog ~/work/Alternative/result/homologo/homologGene/A2_vs_D5_collinearity.txt  -AS1 ~/work/Alternative/result/Ga_result/CO11_12_result/11_AS/end_splice.txt  -AS2 ~/work/Alternative/result/Gr_result/CO41_42_result/11_AS/end_splice.txt  -C ../../blast/IR/A2_D5_conserve_end  -o 11 -T IntronR
```

| A2 D5间比较 | 数目   | 比例        |
| -------- | ---- | --------- |
| 完全保守     | 105  |           |
| 部分保守     | 2198 |           |
| 完全不保守    | 7567 | 7567/9870 |
| 两个都存在AS  | 1306 |           |
| 只有A中存在AS | 3923 |           |
| 只有D中存在AS | 2338 |           |

![不同亚基因组间比较](https://s1.ax1x.com/2020/05/22/YX0ctJ.png)

## 寻找一些证据，支持同源基因间AS的差异

* 只在一个同源基因中存在剪切事件，而另外一个不存在

```bash
目录 ASMissing
#找到对应同源基因中没有发生AS的坐标
python extractIntronbed.py -fasta ~/work/Alternative/data/Ghirsutum_genome_HAU_v1.0/Ghirsutum_genome_HAU_v1.0.fasta -r ~/work/Alternative/data/Ghirsutum_genome_HAU_v1.0/Ghifrsutum_gene_model.gtf -p ~/work/Alternative/result/Gh_result/CO31_32_result/07_annotation/merge.gtf -o ./11 -f 22
## 得到参考基因组与PacBio合并后的所有intron坐标，去除scaffold上的基因
sort -k1,1 -k2,3n 11 |uniq|sed '/Scaffold/d' >all_intron.bed
##得到所有intron两端的FESTs
makeblastdb  -in all_intron_FEST.fa  -dbtype nucl -out ./DB/all_intron
##得到只在一个同源基因中存在的剪切事件
awk 'NR%2!=0{printf $0"\t"}NR%2==0{print $0}' 1111 |awk '$2==0{print $0}'|awk '$3!=0&&$6==0{print $0}'|cut -f1 |xargs  -I {} grep {} -A 1 ../TM1/1  >../ASMissing/TM/At.fa
## 进行blast
blastn -query At.fa  -db DB/all_intron -evalue 1e-5 -num_threads 10 -outfmt '6  qseqid sseqid qstart qend sstart send nident pident qcovs evalue bitscore' -out At.blast
## 分解同源基因和比对的情况得到对应同源基因的坐标
python ~/scripte/Alternative/module/homologBlast.py  -homolog ~/work/Alternative/result/homologo/homologGene/At_vs_Dt_collinerity.txt -Blast  At.blast -o 2222
cat 2222|awk '$1~/^Ghir_A/&&$2~/^Ghir_D/{print $0}$1~/^Ghir_D/&&$2~/^Ghir_A/{print $2,$1,$3}' OFS="\t"|sort |uniq |awk '{print $2,$3,$1}' OFS="\t"|sort  -k3 -k2,2nr|uniq -f2|awk '{print $3"\t"$2"\t"$1}'|sort -k3 -k2,2nr|uniq -f2  >333
```

统计找到对应坐标的比例

## 同源基因对应位置上的差异

* intron长度的差异

```bash
## 比较长度是否存在差异
awk -F "-" '$NF=="+"{print $4-$3+1"\t"$(NF-1)-$(NF-2)+1}$NF!="+"{print $4-$3+1"\t"$(NF-2)-$(NF-3)+1}' At.end
```

* 表观上的差异

```bash
## 计算两个重复的平均甲基化程度
paste constitutive_CpG_rep*|awk '{print ($4+$8)/2"\tconstiutiveIR"}'  >constitutive_CpG.txt
```
