# 肿瘤免疫表型-cold (excluded, desert) and hot

### Tumor immune phenotypes # Fixation index (FST)

Subpopulation 1 Subpopulation 2 Subpopulation 3 Total
Genotype AA 125 50 100
Aa 250 30 500
aa 125 20 400
Number of individual 500 100 1000 1600
Number of alleles 1000 200 2000 3200
Step 1. Calculate the gene   (allele) frequencies
Observed allele frequency A (p) (125*2+250)/1000=0.5 (50*2+30)/200=0.65 (2*100+500)/2000=0.35
a (q) 0.5 0.35 0.65
Step 2. Calculate the expected   genotypic counts under Hardy-Weinberg Equilibrium, and then calculate the   excess or deficiency of homozygotes in each subpopulation.
Summary of homozygote deficiency or excess relative to HWE:
Pop. 1. Observed = Expected: perfect fit
Pop. 2. Excess of 15.5 homozygotes: some inbreeding
Pop. 3. Deficiency of 45 homozygotes: outbred or   experiencing a Wahlund effect (isolate breaking).
Expected allele frequency AA 500*0.5^2 = 125 (= observed) 100*0.65^2 = 42.25 (observed has excess of 7.75) 1,000*0.35^2 = 122.5   (observed has deficiency of 22.5)
Aa 500*2*0.5*0.5 = 250 (=   observed) 100*2*0.65*0.35 = 45.5 (observed has deficit of 15.5) 1,000*2*0.65*0.35 = 455   (observed has excess of 45)
aa 500*0.5^2 = 125 (= observed) 100*0.35^2 = 12.25 (observed has excess of 7.75) 1,000*0.35^2 = 422.5   (observed has deficiency of 22.5)
Step 3. Calculate the local   observed heterozygosities of each subpopulation (we will call them Hobs s,   where the s subscript refers to the sth of n populations — 3 in this   example).
Local observed   heterozygosities 250/500 = 0.5 (Hobs 1) 30/100 = 0.3 (Hobs 2) 500/1000 = 0.5(Hobs 3)
Step 4. Calculate the local   expected heterozygosity, or gene diversity, of each subpopulation
Hexp = 2pq
Local expected   heterozygosity 2*0.5*0.5=0.5 (Hexp 1) 2*0.65*3.5=0.455 (Hexp 2) 2*0.35*0.65=0.455 (Hexp 2)
Step 5. Calculate the local   inbreeding coefficient of each subpopulation
F = (Hexps -Hobs)/Hexp
[positive F means fewer heterozygotes than expected indicates   inbreeding]
[negative F means more heterozygotes   than expected means excess outbreeding]
F1=(0.5—0.5)/0.5=0 F2=(0.455—0.3)/0.455=0.341 F3=(0.455—0.5)/0.455=-0.099
Step 6. and 7. Calculate p-bar   (p-bar, the frequency of allele A) over the total population.
Calculate q-bar (q-bar, the frequency of allele a) over the total   population.
Check: p-bar + q-bar = 1.0
the frequency of allele over the total population p-bar (0.5*1000+0.65*200+0.35*2000)/3200=0.4156
q-bar (0.5*1000+0.35*200+0.65*2000)/3200=0.5844
Step 8. Calculate the global   heterozygosity indices (over Individuals, Subpopulations and Total   population)
HI based on observed heterozygosities in individuals in subpopulations
HS based on expected heterozygosities in subpopulations
HT based on expected heterozygosities for overall total population
HI (observed) (0.5*500+0.3*100+0.5*1000)/1600=0.4875
HS (expected) (0.5*500+0.455*100+0.455*1000)/1600=0.4691
HT (in overall total population) 2*p-bar *q-bar    = 2 * 0.4156 * 0.5844 = 0.4858
Step 9. Calculate the global   F-statistics
Compare and contrast the global FISbelow with the “local inbreeding   coefficient” Fs of Step 5.
Here we are using a weighted average of the individual heterozygosities   over all the subpopulations.
Both FIS and Fs are, however, based   on the observed heterozygosities,
whereas FST and FIT are based   on expected heterozygosities.
FIS (Hs-Hi)/Hs=(0.4691-0.4875)/0.4691=-0.0393
FST (Ht-Hs)/Ht=(0.4858-0.4691)/0.4858=-0.0344
FIT (Ht-Hi)/Ht=(0.4858-0.4875)/0.4858=-0.0036
Step 10 conclusions Finally, draw some   conclusions about the genetic structure of the population and its   subpopulations.
1) One of the possible HWE   conclusions we could make:
Pop. 1 is consistent with HWE (results of Step 2)
2) Two of the possible “local   inbreeding” conclusions we could make from Step 5:
Pop. 2 is inbred (results of Step 5), and
Pop. 3 may have disassortative mating or be experiencing a Wahlund effect   (more heterozygotes than expected).
3) Conclusion concerning overall   degree of genetic differentiation (FST)
Subdivision of populations, possibly due to genetic drift,
accounts for approx. 3.4% of the total genetic variation
(result of Eqn FST.8 FST   calculation in Step 9),
4) No excess or deficiency of   heterozygotes over the total population (FIT    is nearly zero).

# 甲基化芯片中的M值和B值

M值和B值的计算公式 ## The relationship curve between M-value and Beta-value

M值和B值的对应关系 ## The histograms of Beta-value (left) and M-value (right) (27578 interrogated CpG sites in total)

M值和B值的分布 minfi包有getM和getBeta来分别计算M-values和Beta-values，包的作者认为，

• M-values具有更好的统计特性，更适合用于进行下游的统计分析（差异分析等）
• Beta-values更加容易解释，更能说明生物学上的意义

一般来说，具体的β值的意义是：

• 任何等于或大于0.6的β值都被认为是完全甲基化的。
• 任何等于或小于0.2的β值被认为是完全未甲基化的。
• β值在0.2和0.6之间被认为是部分甲基化的。
• 参考：

https://zhuanlan.zhihu.com/p/108364645

# Failed to mount 大容量的RAID组

我们的存储服务器有两组RAID，容量均大于150T，我在mount的时候，提示我

```NTFS signature is missing.
Failed to mount '/dev/sdc': Invalid argument
The device '/dev/sdc' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?```

是因为没有分区导致的，分区之后就可以了。分区的命令

```# 使用parted命令进行分区,等同parted; select /dev/sdc
parted /dev/sdc

# 创建分区表
mklabel gpt

# 使用print命令查看当前分区情况
print

# 留1M的空余空间，目的是为了让数据块整齐，提高磁盘的运行效率, -1表示分区的结尾  意思是划分整个硬盘空间为主分区
mkpart primary 1 -1

p  # print的简写

# 使用q命令退出,
quit

# 退出之后会提示
会提示Information: You may need to update /etc/fstab.

# 格式化分区，为分区写入文件系统,格式为ext4
mkfs –t ext4 /dev/sdc1 # 格式化分区

# 使用blkid命令，找到 UUID，然后编辑 /etc/fstab，实现自动挂载
vim /etc/fstab

UUID=******	directory	ext4	defaults	0	0
```

参考:

https://www.cnblogs.com/kreo/p/9462641.html

https://www.cnblogs.com/saszhuqing/p/9964262.html

# 分类模型的性能评估

最常用的就是灵敏度和特异性，不过还有其他的，比如阴性预测值(negative predictive value, NPV)。 通常，先画一个ROC曲线，计算曲线下面积。ROC上的每个点是特定阈值下，分类的sensitivity和specificity，没多点连起来组成ROC，曲线下面积就是AUC。面积越大越好，如果AUC是1，说明模型能够完全区分要预测的类别。

如果不是1，就要考虑阈值取哪里比较好，这里就涉及到Youden index。Youden index 其实就是为了找到使得sensitivity和specificity之和最大max(sensitivities+specificities)的阈值。

另外就是考虑其他指标来评估分类模型的性能：specificity, sensitivity, accuracy, npv, ppv, precision, recall, tpr, fpr, tnr, fnr, fdr。这些指标可谓琳琅满目，不过这之间有重复的，如下，都是基于tn（真阴）, tp（真阳）, fn（假阴）, fp（假阳）的个数进行计算。

 预测 P N 实际 P TP FN N FP TN

因为经常用到，就罗列了一下。

具体描述 公式 别名
tn True negative count真阴数
tp True positive count真阳数
fn False negative count假阴数
fp False positive count假阳数
specificity Specificity特异度 tn / (tn + fp) tnr
sensitivity Sensitivity灵敏度 tp / (tp + fn) recall, tpr
accuracy Accuracy正确率 (tp + tn) / N
npv Negative Predictive Value阴性预测值 tn / (tn + fn)
ppv Positive Predictive Value阳性预测值 tp / (tp + fp) precision
precision Precision精准率 tp / (tp + fp) ppv
recall Recall正确率 tp / (tp + fn) sensitivity, tpr
tpr True Positive Rate真阳性率 tp / (tp + fn) sensitivity, recall
fpr False Positive Rate假阳性率 fp / (tn + fp) 1-specificity
tnr True Negative Rate真阴性率 tn / (tn + fp) specificity
fnr False Negative Rate假阴性率 fn / (tp + fn) 1-sensitivity
fdr False Discovery Rate伪发现率 fp / (tp + fp) 1-ppv