【问题标题】:Merge probes and Gene IDs with GEOparse使用 GEOparse 合并探针和基因 ID
【发布时间】:2020-09-05 11:23:34
【问题描述】:

我正在尝试使用 Python 包 GEOparse 下载微阵列数据。我已经到了合并探针和基因 ID 的步骤。我想用 ENTREZ_GENE_ID 替换 ID_REF。

但是,这不起作用。这是我到目前为止所拥有的,我正在关注这个演练:https://geoparse.readthedocs.io/en/latest/Analyse_hsa-miR-124a-3p_transfection_time-course.html

# Import tools
import GEOparse
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt


# download datasets
gse1 = GEOparse.get_GEO(geo="GSE99039", destdir="C:/Users/Highf_000/PycharmProjects/TFTest")
gse2 = GEOparse.get_GEO(geo="GSE6613", destdir="C:/Users/Highf_000/PycharmProjects/TFTest")
gse3 = GEOparse.get_GEO(geo="GSE72267", destdir="C:/Users/Highf_000/PycharmProjects/TFTest")

# import all GSM data for each GSE file
with open("GSE99039_GPL570.csv") as f:
    GSE99039_GPL570 = f.read().splitlines()
with open("GSE6613_GPL96.csv") as f:
    GSE6613_GPL96 = f.read().splitlines()
with open("GSE72267_GPL571.csv") as f:
    GSE72267_GPL571 = f.read().splitlines()

gse1.gsm = gse1.phenotype_data
print(gse1.gsm)
gse2.gsm = gse1.phenotype_data
print(gse2.gsm)
gse3.gsm = gse1.phenotype_data
print(gse3.gsm)

gse1.gpls['GPL570'].table
gse2.gpls['GPL96'].table
gse3.gpls['GPL571'].table

# gse1
pivoted_control_samples = gse1.pivot_samples('VALUE')[GSE99039_GPL570]
print(pivoted_control_samples)


# gse1
# Pulls the probes out
pivoted_control_samples_average = pivoted_control_samples.median(axis=1)
# Print number of probes before filtering
print("Number of probes before filtering: ", len(pivoted_control_samples_average))
# Extract all probes > 0.25
expression_threshold = pivoted_control_samples_average.quantile(0.25)
expressed_probes = pivoted_control_samples_average[pivoted_control_samples_average >= expression_threshold].index.tolist()
# Print probes above cut off
print("Number of probes above threshold: ", len(expressed_probes))
# confirm filtering worked
samples = gse1.pivot_samples("VALUE").ix[expressed_probes]

【问题讨论】:

  • “它不工作”到底是什么意思?
  • AttributeError: 'DataFrame' 对象没有属性 'ix'

标签: python merge genetics


【解决方案1】:

我能够关注一个线程并找到这个:AttributeError: 'DataFrame' object has no attribute 'ix'

这表明 .ix 已被弃用并在适当位置使用 loc。

【讨论】:

    猜你喜欢
    • 2020-04-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-22
    • 2023-02-16
    • 2021-09-27
    • 2014-07-16
    相关资源
    最近更新 更多