我想通过只保留第三个连字符之前的子字符串来重命名我的熊猫数据索引。我的代码不修改索引。为什么?
import re
for i in meth_450.index:
re.sub(r"^[^-]*-[^-]*:[^-]*", "", i)
meth_450.index
Index(['TCGA-06-0125-01A-01D-A45W-05', 'TCGA-06-0125-02A-11D-2004-05',
'TCGA-06-0152-01A-02D-A45W-05', 'TCGA-
假设输入文件按照第3列排序(条形码以“TCGA”开头):
Joe 1 TCGA-A8-A08L-01A-11W-A019-09 T
John 2 TCGA-A8-A08L-01A-11W-A019-09 T
Jack 3 TCGA-A8-CVDL-01A-11W-A019-09 T
Jane 4 TCGA-A8-CVDL-01A-11W-A019-09 F
Justin 5 TCGA-A8-E08L-01A-11W-A019-09 F
Jasmine 6 TCGA-A8-E08L-01A-11W-A019-09 T
Jacob 7 TCGA-A8-E08L-01A-11W-A019-09 T
我正在尝试从ggstatplot运行ggwithinstats函数,但是我得到了以下错误。
这是我在跑
ggwithinstats( # independent samples
data = dat,
x = FAB,
y = BM_percentage,
plot.type = "box", # for boxplot
type = "nonparametric", # for wilcoxon
centrality.plotting = FALSE # remove median
)
########################
我正在尝试将Sample ID与tissue_names列表相匹配。一个Sample ID可以有多个组织。因此,我最初创建了一个空数组,并希望将组织名称添加到下面的tissue_name列中。
TCGA_luad['tissue_name'] = 'NA'
for index, row in TCGA_luad.iterrows():
for item in TCGA_lung_tissue_names:
if row['Sample ID'] in item:
if row['tissue