> 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/shu-ju-chu-li-liu-cheng/fen-xi-tong-yuan-ji-yin-fa-sheng-ir-de-pin-shuai.md).

# 分析同源基因中发生IR事件的频率

首先根据已经鉴定好的IR事件，和对应的亚基因组同源基因；分别去看每个棉种中对应基因发生IR的频率或者是数目

就可以大致的将同源基因进行一个分类

1. 四个基因组中都频繁的发生IR事件 >10
2. 四个基因组的基因都不发生IR事件
3. 只有个别基因组频繁的发生了IR事件
4. At与A2 频繁的发生IR事件
5. Dt与D5 频繁的发生IR事件
6. A2与D5 比较频繁发生
7. At与Dt 频繁的发生
8. 各个基因组发生的频数相差都不大

## 同源基因中IR事件数目的统计

```bash
## 将所有棉种的IR事件合并到一个文件中
awk '$3~/IntronR/{print $2}' ../TM-1/end_third |sort |uniq -c |awk '{print $2"\t"$1}' >intronR_count.txt 
awk '$3~/IntronR/{print $2}' ../D5/end_third |sort |uniq -c |awk '{print $2"\t"$1}' >>intronR_count.txt 
awk '$3~/IntronR/{print $2}' ../A2/end_third  |sort |uniq -c |awk '{print $2"\t"$1}' >>intronR_count.txt
## 之后使用自己写的python脚本跑
python Count_homologe_IRcount.py  intronR_count.txt ../GhDt_Gr_GhAt_Ga_end_noScaffold  1
```

## 比较频数相差不大的这些基因中比较保守的IR事件

### 1.首先都没有发生IR事件的同源基因

```bash
awk '$2==0&&$4==0&&$6==0&&$8==0{print $0}' 1
```

### 2.都发生了IR事件但是

```bash
## 数目上相差不超过log2 阀值
awk '$2!=0&&$4!=0&&$6!=0&&$8!=0{if(($2/$4<2&&$2/$4>0.5)&&($2/$6<2&&$2/$6>0.5)&&($2/$8<2&&$2/$8>0.5)&&($4/$6<2&&$4/$6>0.5)&&($4/$6<2&&$4/$8>0.5)&&($6/$8<2&&$6/$8>0.5)){print $0}}' 1
## 存在两倍差异
awk '$2!=0&&$4!=0&&$6!=0&&$8!=0{if(($2/$4<2&&$2/$4>0.5)&&($2/$6<2&&$2/$6>0.5)&&($2/$8<2&&$2/$8>0.5)&&($4/$6<2&&$4/$6>0.5)&&($4/$6<2&&$4/$8>0.5)&&($6/$8<2&&$6/$8>0.5)){}else{print $0}}' 1
```

### 3. 单个基因组有IR而其他3个基因组全为0

```bash
## Dt
awk '$2!=0&&$4==0&&$6==0&&$8==0{print $0}' 1 
## D5
awk '$2==0&&$4!=0&&$6==0&&$8==0{print $0}' 1 
## At
awk '$2==0&&$4==0&&$6!=0&&$8==0{print $0}' 1
## A2
awk '$2==0&&$4==0&&$6==0&&$8!=0{print $0}' 1
```

### 4 两个基因组为0，而另外两个不为0

```bash
## A2=At=0
awk '$2!=0&&$4!=0&&$6==0&&$8==0{print $0}' 1
## A2=D5=0
awk '$2!=0&&$4==0&&$6!=0&&$8==0{print $0}' 1
## A2=Dt=0
awk '$2==0&&$4!=0&&$6!=0&&$8==0{print $0}' 1
## D5=Dt=0
awk '$2==0&&$4==0&&$6!=0&&$8!=0{print $0}' 1
## D5=At=0
awk '$2!=0&&$4==0&&$6==0&&$8!=0{print $0}' 1
## Dt=At=0
```

### 5.只有一个基因组为0，其他不为0

```bash
## Dt=0
awk '$2==0&&$4!=0&&$6!=0&&$8!=0{print $0}' 1
## D5=0
awk '$2!=0&&$4==0&&$6!=0&&$8!=0{print $0}' 1
## At=0
awk '$2!=0&&$4!=0&&$6==0&&$8!=0{print $0}' 1
## A2=0
awk '$2!=0&&$4!=0&&$6!=0&&$8==0{print $0}' 1
```

## 还是得把0换成一个小一点的数去算

把所有的0都换成0.5，然后算

### 1.都没有发生IR的基因对

```bash
awk '$2==0.5&&$4==0.5&&$6==0.5&&$8==0.5{print $0}' 1 >class1
```

### 2.统计各个基因组中频繁发生IR的基因对

```bash
## 排除那些都没有发生IR的基因后，亚基因组IR数目没有明显差异
##awk '$2!=0.5&&$4!=0.5&&$6!=0.5&&$8!=0.5{if(($2/$4<2&&$2/$4>0.5)&&($2/$6<2&&$2/$6>0.5)&&($2/$8<2&&$2/$8>0.5)&&($4/$6<2&&$4/$6>0.5)&&($4/$6<2&&$4/$8>0.5)&&($6/$8<2&&$6/$8>0.5)){print $0}}' 1
## 只在Dt中频繁发生IR的基因对
awk '{if(($2/$4>2)&&($2/$6>2)&&($2/$8>2)){print $0}}' 1 >class2
## 只在D5中频繁发生IR的
awk '{if(($4/$2>2)&&($4/$6>2)&&($4/$8>2)){print $0}}' 1 >class3
## 只在At中频繁发生IR的
awk '{if(($6/$2>2)&&($6/$4>2)&&($6/$8>2)){print $0}}' 1 >class4 
## 只在A2中频繁发生IR
awk '{if(($8/$2>2)&&($8/$4>2)&&($8/$6>2)){print $0}}' 1 >class5
## 在祖先基因组 A2 D5中频繁发生IR 而At与Dt很少
awk '{if(($8/$6>2)&&($4/$2>2)){print $0}}' 1 >class6
## 在祖先中发生的少，而后代频繁的
awk '{if(($8/$6<0.5)&&($4/$2<0.5)){print $0}}' 1 >class7

## 祖先A2 与D5存在差异 而后代不存在
awk '{if(($8/$4<0.5||$8/$4>2)&&($6/$2>0.5&&$6/$2<2)){print $0}}' 1 >class8
## 祖先存在差异，而后代同样存在差异
awk '{if(($8/$4<0.5||$8/$4>2)&&($6/$2<0.5||$6/$2>2)){print $0}}' 1 >class9
## 祖先不存在差异，而后代存在差异
awk '{if(($8/$4>0.5&&$8/$4<2)&&($6/$2<0.5||$6/$2>2)){print $0}}' 1 >class10
## 祖先不存在差异，后代也不存在差异
awk '$2!=0.5&&$4!=0.5&&$6!=0.5&&$8!=0.5{if(($8/$4>0.5&&$8/$4<2)&&($6/$2>0.5&&$6/$2<2)){print $0}}' 1 >class11
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://zpliu.gitbook.io/booknote/ke-bian-jian-qie/shu-ju-chu-li-liu-cheng/fen-xi-tong-yuan-ji-yin-fa-sheng-ir-de-pin-shuai.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
