خرید بک لینک

For each GENE_SYMBOLS column of a dataframe, merge the rows and retain only unique comma-separated or dash-separated values. After merging the values of each row into a list, obtain only the unique values.

geneset = pd.read_csv("genesets.v2023.1.Hs.tsv", sep="t", index_col=0)
geneset = geneset.loc["GENE_SYMBOLS"] # retrieve only rows with index name "GENE_SYMBOLS"
for i in geneset.columns:
    genes = i.cat(sep=',').tolist()  # Merge all the rows of strings with "," delimiter and store as a list
genes = genes.split(",") # split by the "," delimiter
genes = genes.split("-") # or the "-" delimiter
genes = genes.unique()      # Keep only if not duplicated

Traceback:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [46], in <cell line: 3>()
      2 geneset = geneset.loc["GENE_SYMBOLS"] # retrieve only rows with index name "GENE_SYMBOLS"
      3 for i in geneset.columns:
----> 4     genes = i.cat(sep=',').tolist()  # Merge all the rows of strings with "," delimiter and store as a list
      5 genes = genes.split(",") # split by the "," delimiter
      6 genes = genes.split("-") # or the "-" delimiter

AttributeError: 'str' object has no attribute 'cat'

Input:

STANDARD_NAME DEURIG_T_CELL_PROLYMPHOCYTIC_LEUKEMIA_UP
SYSTEMATIC_NAME M16431
GENE_SYMBOLS DDR1,CYP2A6,DTX2P1-UPK3BP1-PMS2P11,MARCKSL1
SYSTEMATIC_NAME M16432
GENE_SYMBOLS CCL5,IK,ARL6IP5,EIF1AX,PFKP,PJA2,DDR1
SYSTEMATIC_NAME M16433
GENE_SYMBOLS PJA2,TLR4,GPNMB,TAGLN,COL1A1,CARMN,CD63

Desired output:

genes = ['DDR1','CYP2A6','DTX2P1', 'UPK3BP1', 'PMS2P11','MARCKSL1', 'CCL5','IK','ARL6IP5',EIF1AX,PFKP,PJA2, TLR4,GPNMB,TAGLN,COL1A1,CARMN,CD63]

برچسب: نویسنده: استخدام کار تاريخ: شنبه 30 آبان 1405 ساعت: 17:40

صفحه بندی