I will be very grateful for your help. I get an error message, stated below, from this part of my code, which I want to use, to elucidate differentially expressed genes in conditions of Crohn's disease and ulcerative colitis, from affymetrix microarray analysis(raw data link is https://www.ncbi.nlm.nih.gov/sites/GDSbrowser?acc=GDS1615). BUT when I run this code:
import gzip
import numpy as np
"""
Read in a SOFT format data file. The following values can be exported:
GID : A list of gene identifiers of length d
SID : A list of sample identifiers of length n
STP : A list of sample descriptions of length d
X : A dxn array of gene expression values
"""
fname = "../Anchang Charles/GDS1615_full.soft.gz"
with gzip.open(fname) as fid:
SIF = {}
for line in fid:
if line.startswith(line, len("!dataset_table_begin")):
break
elif line.startswith(line, len("!subject_description")):
subset_description = line.split("=")[1].strip()
elif line.startswith(line, len("!subset_sample_id")):
subset_ids = [x.strip() for x in subset_ids]
for k in subset_ids:
SIF[k] = subset_description
#.next().split("\t")
SID = fid.next().split("\t")
I = [i for i,x in enumerate(SID) if x.startswith("GSM")]
SID = [SID[i] for i in I]
STP = [SIF[k] for k in SID]
I get an error message which says
Traceback (most recent call last):
File "", line 1, in runfile('C:/Users/Anchang Charles/new affymetrix.py', wdir='C:/Users/Anchang Charles')
File "C:\Anaconda\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile execfile(filename, namespace)
File "C:\Anaconda\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/Anchang Charles/new affymetrix.py", line 1, in from affymetrix import X,GID,STP,SID,UC,CD
File "C:\Users\Anchang Charles\affymetrix.py", line 26, in SID = fid.next().split("\t")
AttributeError: 'GzipFile' object has no attribute 'next'