# 1.2.Requirement

{% hint style="info" %}

## **作业具体要求**

{% endhint %}

* **报告要求**：提交一份完整的**工作报告**，中英文不限（鼓励英文，可以参考一些发表文献，如 [a three-lncRNA signature for cancer](https://www.ncbi.nlm.nih.gov/pubmed/24522499) ），同时提交**源代码**。请读者使用我们提供的数据，完成以下工作，包括六个主要步骤：
  * **Part I. Prepare Data Matrix**
    * 1\) 完成五个样本的**Reads Processing and Mapping**工作，并**统计相关的比例和长度信息；**
    * 2\) 完成五个样本的**Expression Matrix的构建；**
    * 3\) 完成**数据分析和质量控制**工作；
  * **Part II. Matrix Process**
    * 4\) 完成**矩阵处理**工作: 主要包括 **filter, imputation, normalization, remove batch effect**, etc；
  * **Part III. Machine Learning**&#x20;
    * 5\) 完成**特征选择**并汇报挑选出的**特征（Feature）；**
    * 6\) 完成**模型评估与特征解释**。

> **中期报告要求**：完成上述的最终报告的 **Part I-II** 部分，参照教程示例绘制相应的图，提交一份工作概述，需要至少包括：
>
> * 汇报构建的expression matrix与参考样本的相关系数；
> * 数据分析和质量控制相关绘图；
> * 处理矩阵数据，汇报数据处理各个步骤前后的PCA图和alignment score。

### 1) Reads Processing and Mapping

完成五个样本`Sample_N1, Sample_N7, Sample_N13, Sample_N19, Sample_N25`的mapping和RNA ratio与length的统计工作。

具体步骤请参考 **Helps:** ***Mapping指南***

**Inputs**

| **File format** | **Information contained in file** | **File description**             |
| --------------- | --------------------------------- | -------------------------------- |
| fastq           | **reads**                         | five samples, GEO link: GSE71008 |

**Outputs**

| **File format** | **Information contained in file**          |
| --------------- | ------------------------------------------ |
| sam/bam         | mapped reads to different kinds of indexes |
| tsv format      | stats of RNA ratio and length              |

### 2) Expression Matrix的构建       <a href="#expressmatrix" id="expressmatrix"></a>

完成五个样本`Sample_N1, Sample_N7, Sample_N13, Sample_N19, Sample_N25`的expression matrix的构建，用`Sample_N1, Sample_N7`的expression matrix数据和`/BioII/chenxupeng/student/data/expression_matrix/GSE71008.txt`中相应的两个样本的参考数据计算相关系数以检查结果。

具体步骤请参考 **Helps:** ***Construct Expression Matrix 指南***

**inputs**

| **File format** | **Information contained in file** | **File description**                            | **Notes**                                                                                                                                          |
| --------------- | --------------------------------- | ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| bam             | **alignments**                    | Produced by mapping reads to the transcriptome. | Reads are trimmed using a proprietary version of cutAdapt. We map to transcriptome for a better sensitivity (see details in protocol and example). |

**outputs**

| **File format** | **Information contained in file** | **File description**   | **Notes** |
| --------------- | --------------------------------- | ---------------------- | --------- |
| tsv             | **gene (ncRNA) quantifications**  | Non-normalized counts. |           |

### 3) 数据分析和质量控制（QC）

具体内容请参考 **Helps:** ***数据分析和质量控制指南***

* 统计一套数据中不同RNA type在不同样本的counts分布，可绘制pie plot, barplot, boxplot和lineplot等。参考 **Helps:** ***基本信息统计*** 部分。
* 对数据做基本的quality control，通过经验性的阈值或者PCA中明显离群点去除部分样本。参考

  **Helps:** ***sample QC*** 部分

{% hint style="warning" %}
**关键环节：**

**数据分析和质量控制（QC）**&#x662F;一个很重要的步骤，应该贯穿在第1-2步，甚至后面的每一步，注意利用**统计量**和**可视化的plots**综合进行分析。
{% endhint %}

### 4) 矩阵处理

对expression matrix做相应的处理和加工：

* Filter
* Imputation
* Normalization
* Remove batch effect

{% hint style="warning" %}
**关键环节：**

要求读者通过PCA Plot等分析不同处理策略和步骤后的效果，选定自己认为比较合适的处理方法，可以参考 **Helps:** ***矩阵处理指南***。
{% endhint %}

> **Tips:** 除了该步骤中对测序深度等系统误差进行normalization，可以在下一步特征选择时再进行一次机器学习中常规的normalization（如每列都noramlize到0-1）。

### 5) 特征选择 (Feature Selection)

我们希望读者设计一个稳健的特征选择方法，完成以下几种情况下的feature selection，给出针对每种分类条件所挑选的feature，展示不同个数要求下挑出的feature，比如1\~10,20,30等个数要求下挑出的feature。

* **分类条件**：
  * Colorectal vs Healthy Control
  * Prostate Cancer vs Healthy Control
  * Colorectal vs Prostate Cancer vs Healthy Control（三分类）
* **基础要求**：读者可以从简单的feature selection方法开始尝试，基于分类模型的feature权重挑选feature，。
* **高级要求**：为了帮助读者打开思路，我们给出一个如下的**示例性流程**。
  * 对feature做scale，(using z-scores, min-max, robust normalization)。
  * 使用机器学习二分类/三分类模型 (random forest, logistic regression, linear SVM) 通过feature权重选择feature，使用三折交叉验证选择超参数。
  * Optionally, 使用 recursive feature elimination(RFE)减少feature数量.
  * Resampling 来选择 robust features, 选择那些在resampling runs中重复多次出现的feature(出现频率>50%):&#x20;
    * shuffle and split dataset, 重复特征选择100次(shuffle split)
    * 或者每次测试一个样本 (leave one out).&#x20;
  * 用选择出的feature重新拟合模型

以上步骤会挑出在**resampling runs**中出现频数超过总轮数一半的特征。其中第一步对feature做scale，读者可以尝试不同的对**feature**进行normalization的策略。第二步读者可以尝试不同的机器学习模型，并且在第三步选择是否使用**RFE**来逐步筛除feature。第四步是挑选稳健feature的关键，可以采取random split或leave one out，选择重复出现的稳健的feature。

{% hint style="warning" %}
**关键环节：**

特征的选择是该项目最后结果的一个关键因素，其作用远大于对具体classifier模型的选择，读者可以设计自己的稳健的特征选择方法，甚至应该利用一些生物学上的先验知识进行一些选择，除了**准确度 (Accuracy)** 也请注意体现出自己的方法的**稳健性 (Robustness)**。
{% endhint %}

参考 **Helps:** ***特征选择指南*** 。

### 6) 模型评估与特征解释

* 绘制挑选出的feature counts（经过适当的scale）的clustermap，用颜色块表示class。请参考 **Helps:** ***特征选择结果可视化***。
* 绘制二分类的ROC曲线，请参考 **Helps:** ***用选出的feature进行分类并绘制ROC曲线***。
* 汇报挑选不同数量的feature时分类效果，用AUC作为指标绘制折线图。请参考 **Helps:** ***用AUC评估挑选不同数量feature的效果***。
* 分析挑选出的feature的生物学意义。
* 尝试更多分析模型结果的方法。

参考 **Helps:** ***模型评估与feature解释指南*** 。

{% hint style="warning" %}
**关键环节：**

选出来的**Feature**, 也就是**RNA Panel**，是该项目的重点和目标，要比模型的准确度更为重要。

对于Feautre的选择和解释，都需要注意利用一些生物学上的先验知识，比如优先选择和解释一些已知的oncogene。
{% endhint %}


---

# Agent Instructions: 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://book.ncrnalab.org/teaching/part-v.-assignments/1.quiz_exrna/2018-readme/2018-1.2-requirement.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.
