In [14]:
df = pd.read_csv('../canseq/tcga/tcga.brca.metadata.txt', sep='\t')
In [15]:
df.count()
Out[15]:
Sample Type 919
PAM50_mRna 579
name 919
Complete_TCGA_ID 919
Gender 909
Age_at_Initial_Pathologic_Diagnosis 909
ER_Status 909
PR_Status 909
HER2_Final_Status 876
Tumor 876
Tumor_T1_Coded 873
Node 876
Node_Coded 876
Metastasis 870
Metastasis_Coded 870
AJCC_Stage 876
Converted_Stage 876
Survival_Data_Form 909
Vital_Status 909
Days_to_Date_of_Last_Contact 909
Days_to_date_of_Death 131
OS_event 909
OS_Time 909
PAM50_mRNA 579
SigClust_Unsupervised_mRNA 579
SigClust_Intrinsic_mRNA 579
miRNA_Clusters 777
methylation_Clusters 896
RPPA_Clusters 449
CN_Clusters 869
Integrated_Clusters_with_PAM50 393
Integrated_Clusters_no_exp 393
Integrated_Clusters_unsup_exp 393
dtype: int64
In [16]:
df.Days_to_date_of_Death
Out[16]:
0 1555
1 NaN
2 NaN
3 2762
4 NaN
5 NaN
6 NaN
7 NaN
8 NaN
9 NaN
10 NaN
11 NaN
12 NaN
13 NaN
14 NaN
...
904 NaN
905 NaN
906 2192
907 NaN
908 NaN
909 1388
910 1759
911 2052
912 1796
913 NaN
914 NaN
915 NaN
916 NaN
917 NaN
918 1998
Name: Days_to_date_of_Death, Length: 919, dtype: float64
In [19]:
df[['Days_to_date_of_Death', 'Vital_Status']]
Out[19]:
Days_to_date_of_Death
Vital_Status
0
1555
DECEASED
1
NaN
LIVING
2
NaN
LIVING
3
2762
DECEASED
4
NaN
LIVING
5
NaN
LIVING
6
NaN
LIVING
7
NaN
LIVING
8
NaN
LIVING
9
NaN
LIVING
10
NaN
LIVING
11
NaN
LIVING
12
NaN
LIVING
13
NaN
LIVING
14
NaN
LIVING
15
967
DECEASED
16
NaN
LIVING
17
NaN
LIVING
18
NaN
LIVING
19
NaN
LIVING
20
NaN
LIVING
21
NaN
LIVING
22
NaN
LIVING
23
NaN
LIVING
24
NaN
LIVING
25
NaN
LIVING
26
NaN
LIVING
27
NaN
LIVING
28
NaN
LIVING
29
NaN
LIVING
30
NaN
LIVING
31
NaN
LIVING
32
523
DECEASED
33
NaN
LIVING
34
NaN
LIVING
35
NaN
LIVING
36
NaN
LIVING
37
NaN
LIVING
38
NaN
LIVING
39
NaN
LIVING
40
NaN
LIVING
41
NaN
LIVING
42
NaN
LIVING
43
NaN
LIVING
44
NaN
LIVING
45
NaN
LIVING
46
NaN
LIVING
47
NaN
LIVING
48
NaN
LIVING
49
NaN
LIVING
50
NaN
LIVING
51
NaN
LIVING
52
NaN
LIVING
53
NaN
LIVING
54
754
DECEASED
55
NaN
LIVING
56
NaN
LIVING
57
NaN
LIVING
58
NaN
LIVING
59
NaN
LIVING
...
...
919 rows × 2 columns
In [20]:
df.Vital_Status.value_counts()
Out[20]:
LIVING 778
DECEASED 131
dtype: int64
In [21]:
((df.Vital_Status == 'DECEASED') & (df.Age_at_Initial_Pathologic_Diagnosis <= 70)).sum()
Out[21]:
94
In [22]:
df
Out[22]:
Sample Type
PAM50_mRna
name
Complete_TCGA_ID
Gender
Age_at_Initial_Pathologic_Diagnosis
ER_Status
PR_Status
HER2_Final_Status
Tumor
Tumor_T1_Coded
Node
Node_Coded
Metastasis
Metastasis_Coded
AJCC_Stage
Converted_Stage
Survival_Data_Form
Vital_Status
Days_to_Date_of_Last_Contact
0
Metastatic
Basal-like
unc.edu.ded1efed-b3b9-4d1a-b4c9-b595543fc461.1...
TCGA-BH-A18V
FEMALE
48
Negative
Negative
Negative
T2
T_Other
N1
Positive
M0
Negative
Stage IIB
No_Conversion
enrollment
DECEASED
1555
...
1
Primary solid Tumor
Basal-like
unc.edu.4d12d021-3673-4e14-9fd9-033f811f87da.1...
TCGA-A2-A04U
FEMALE
47
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
Stage IIA
followup
LIVING
670
...
2
Primary solid Tumor
Basal-like
unc.edu.3e57b40c-7079-4f05-bf37-f560304966c1.1...
TCGA-AR-A0TS
FEMALE
46
Negative
Negative
Negative
T2
T_Other
N1
Positive
M0
Negative
Stage II
No_Conversion
enrollment
LIVING
1138
...
3
Primary solid Tumor
Basal-like
unc.edu.78e00469-0dd6-490e-93f1-068b9a386839.1...
TCGA-BH-A18K
FEMALE
46
Positive
Positive
Negative
T1
T1
N0
Negative
M0
Negative
Stage I
Stage I
enrollment
DECEASED
2547
...
4
Primary solid Tumor
Basal-like
unc.edu.46262a6c-8a11-4bb9-8851-8b6e44c95288.1...
TCGA-E2-A150
FEMALE
48
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
Stage IIA
enrollment
LIVING
591
...
5
Primary solid Tumor
Basal-like
unc.edu.c1dc3f35-324b-4a69-b32c-24652ccf9e3a.1...
TCGA-AN-A0FX
FEMALE
52
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
No_Conversion
enrollment
LIVING
10
...
6
Primary solid Tumor
Basal-like
unc.edu.e3b4918d-43c1-4dde-9a92-f9c5cd6e63a0.1...
TCGA-A1-A0SO
FEMALE
67
Negative
Negative
Negative
T2
T_Other
N1
Positive
M0
Negative
Stage IIB
Stage IIB
enrollment
LIVING
852
...
7
Primary solid Tumor
Basal-like
unc.edu.ce045098-cbfb-4c73-9bbe-6a1d677ae0b0.1...
TCGA-A8-A07R
FEMALE
80
Negative
Negative
Equivocal
T2
T_Other
N3
Positive
M0
Negative
Stage IIIC
Stage IIIC
enrollment
LIVING
273
...
8
Primary solid Tumor
Basal-like
unc.edu.79d7a589-60bd-4b4a-89c1-d557fe24c733.1...
TCGA-A2-A04T
FEMALE
62
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
Stage IIA
followup
LIVING
2246
...
9
Primary solid Tumor
Basal-like
unc.edu.d9f827bb-2498-49b0-aa85-71cb554eb926.1...
TCGA-E2-A14X
FEMALE
55
Negative
Negative
Negative
T2
T_Other
N2
Positive
M0
Negative
Stage IIIA
Stage IIIA
enrollment
LIVING
692
...
10
Primary solid Tumor
Basal-like
unc.edu.6d2744ba-4817-482b-ad46-2e4e0897ad88.1...
TCGA-BH-A0B3
FEMALE
53
Negative
Negative
Negative
T2
T_Other
N1
Positive
M0
Negative
Stage IIB
No_Conversion
followup
LIVING
1203
...
11
Primary solid Tumor
Basal-like
unc.edu.920e47c0-1b19-46e6-b1db-b5fd95e44df0.1...
TCGA-A2-A0ST
FEMALE
62
Negative
Negative
Negative
T1
T1
N1
Positive
M0
Negative
Stage IIA
No_Conversion
enrollment
LIVING
1643
...
12
Primary solid Tumor
Basal-like
unc.edu.4808bc63-000a-4a49-a25b-4b817ca5ea54.1...
TCGA-AO-A0J4
FEMALE
41
Negative
Negative
Negative
T1
T1
N0
Negative
M0
Negative
Stage IA
Stage I
followup
LIVING
294
...
13
Primary solid Tumor
Basal-like
unc.edu.6e45dd01-225d-4871-9a3a-f591808ad234.1...
TCGA-E2-A14N
FEMALE
37
Negative
Negative
Negative
T2
T_Other
N1
Positive
M0
Negative
Stage IIB
Stage IIB
enrollment
LIVING
1350
...
14
Primary solid Tumor
Basal-like
unc.edu.2e9c893c-1d72-49a7-8755-1ede20b26fcf.1...
TCGA-B6-A0IQ
FEMALE
40
Negative
Negative
Negative
T3
T_Other
N1
Positive
M0
Negative
Stage IIIA
No_Conversion
followup
LIVING
4284
...
15
Primary solid Tumor
Basal-like
unc.edu.a63583ca-0ef2-4417-b435-5f3a6951d0c2.1...
TCGA-A1-A0SK
FEMALE
54
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
Stage IIA
followup
DECEASED
594
...
16
Primary solid Tumor
Basal-like
unc.edu.1fe98b05-6803-4803-83cd-a59e794b956e.1...
TCGA-AO-A0J6
FEMALE
61
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
Stage IIA
followup
LIVING
775
...
17
Primary solid Tumor
Basal-like
unc.edu.95c7abfa-a417-4d81-96c2-a952a081d997.1...
TCGA-E2-A159
FEMALE
50
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
Stage IIA
enrollment
LIVING
515
...
18
Primary solid Tumor
Basal-like
unc.edu.74cba80b-7677-41d6-ab22-10f1a962ba2f.1...
TCGA-AN-A0XU
FEMALE
54
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
Stage IIA
enrollment
LIVING
10
...
19
Primary solid Tumor
Basal-like
unc.edu.2ad8d416-08a4-4e6f-947e-d74269d02ab1.1...
TCGA-A2-A0D2
FEMALE
45
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIB
Stage IIA
followup
LIVING
1027
...
20
Primary solid Tumor
Basal-like
unc.edu.9f440cd6-d55f-4cb6-a433-637ef1f9d38f.1...
TCGA-D8-A142
FEMALE
74
Negative
Negative
Negative
T3
T_Other
N0
Negative
M0
Negative
Stage IIB
Stage IIB
followup
LIVING
425
...
21
Primary solid Tumor
Basal-like
unc.edu.a8a7a335-8e21-4f24-b48b-8764caa21329.1...
TCGA-BH-A18G
FEMALE
81
Negative
Negative
Negative
T1
T1
N0
Negative
M0
Negative
Stage X
No_Conversion
enrollment
LIVING
61
...
22
Primary solid Tumor
Basal-like
unc.edu.fa462e79-c5a4-4ddc-b3e6-32e8adcdd80c.1...
TCGA-E2-A1AZ
FEMALE
63
Negative
Negative
Negative
T2
T_Other
N1
Positive
M0
Negative
Stage IIB
Stage IIB
enrollment
LIVING
1964
...
23
Primary solid Tumor
Basal-like
unc.edu.43326f71-c61c-410b-af4b-c71a054e27c9.1...
TCGA-E2-A158
FEMALE
43
Negative
Negative
Negative
T1
T1
N1
Positive
M0
Negative
Stage IIA
Stage IIA
enrollment
LIVING
450
...
24
Primary solid Tumor
Basal-like
unc.edu.dea20128-b180-4da1-9da5-0f00bea3b1ab.1...
TCGA-AR-A0U0
FEMALE
73
Negative
Negative
Negative
T2
T_Other
N1
Positive
M0
Negative
Stage II
No_Conversion
enrollment
LIVING
8
...
25
Primary solid Tumor
Basal-like
unc.edu.c09e8a88-5a82-4fd6-8d03-ef3ecb988003.1...
TCGA-AN-A0G0
FEMALE
56
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
No_Conversion
enrollment
LIVING
16
...
26
Primary solid Tumor
Basal-like
unc.edu.ad46ed65-3cc2-4956-9d90-3e1edca24417.1...
TCGA-B6-A0RE
FEMALE
61
Negative
Negative
Negative
TX
NaN
N0
Negative
M0
Negative
[Not Available]
No_Conversion
followup
LIVING
6434
...
27
Primary solid Tumor
Basal-like
unc.edu.1013446f-5beb-485d-809a-efe81a2138dd.1...
TCGA-BH-A0DL
FEMALE
64
Positive
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
Stage IIA
enrollment
LIVING
1467
...
28
Primary solid Tumor
Basal-like
unc.edu.77daa4a6-93c2-4455-a173-ead372d92010.1...
TCGA-A8-A07U
FEMALE
66
Negative
Positive
Negative
T2
T_Other
N2
Positive
M0
Negative
Stage IIIA
Stage IIIA
enrollment
LIVING
303
...
29
Primary solid Tumor
Basal-like
unc.edu.a2c80f8e-f08d-4574-90a0-f0651c0a9b1b.1...
TCGA-E2-A1B5
FEMALE
46
Positive
Positive
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
Stage IIA
enrollment
LIVING
774
...
30
Primary solid Tumor
Basal-like
unc.edu.b7f491a9-eddf-43b1-9baf-862db2d50383.1...
TCGA-A7-A13E
FEMALE
62
Positive
Negative
Negative
T2
T_Other
N1
Positive
M0
Negative
Stage IIB
No_Conversion
followup
LIVING
326
...
31
Primary solid Tumor
Basal-like
unc.edu.7953e62d-4871-4928-a2ba-a38c740134e1.1...
TCGA-AO-A0JL
FEMALE
59
Negative
Negative
Negative
T2
T_Other
N2
Positive
M0
Negative
Stage IIIA
No_Conversion
followup
LIVING
1319
...
32
Primary solid Tumor
Basal-like
unc.edu.6d066a72-f59f-45a8-ab90-216000b36da4.1...
TCGA-AR-A1AR
FEMALE
50
Negative
Negative
Negative
T1
T1
N2
Positive
M0
Negative
Stage III
Stage IIIA
enrollment
DECEASED
[Not Available]
...
33
Primary solid Tumor
Basal-like
unc.edu.f77e9ef0-0a62-426b-98d9-6813edeb63a5.1...
TCGA-B6-A0IJ
FEMALE
42
Positive
Positive
Negative
T3
T_Other
N0
Negative
M0
Negative
Stage IIB
Stage IIB
followup
LIVING
5383
...
34
Primary solid Tumor
Basal-like
unc.edu.5cd42d4a-5971-4a01-8c10-99321105a864.1...
TCGA-AO-A124
FEMALE
38
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
Stage IIA
followup
LIVING
3119
...
35
Primary solid Tumor
Basal-like
unc.edu.afe0fbfe-18e0-4b80-a44c-7abe3c7e5c93.1...
TCGA-BH-A0AV
FEMALE
52
Negative
Negative
Negative
T1
T1
N0
Negative
M0
Negative
Stage I
Stage I
enrollment
LIVING
1180
...
36
Primary solid Tumor
Basal-like
unc.edu.2877059f-b560-413b-b8be-40d9fde8fbcf.1...
TCGA-AR-A0TU
FEMALE
35
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage II
No_Conversion
enrollment
LIVING
360
...
37
Primary solid Tumor
Basal-like
unc.edu.9d04c180-7c23-490e-92cf-c018629b8b7f.1...
TCGA-A7-A0DA
FEMALE
62
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
Stage IIA
followup
LIVING
373
...
38
Primary solid Tumor
Basal-like
unc.edu.1ee60bda-48df-4288-90cb-480fbfbc5d50.1...
TCGA-BH-A0HL
FEMALE
56
Positive
Positive
Negative
T2
T_Other
N1
Positive
M0
Negative
Stage IIB
No_Conversion
followup
LIVING
72
...
39
Primary solid Tumor
Basal-like
unc.edu.b12c9095-55c7-4add-9e22-3d65eeef2040.1...
TCGA-C8-A12V
FEMALE
55
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
Stage IIA
enrollment
LIVING
0
...
40
Primary solid Tumor
Basal-like
unc.edu.6f0cf450-76f1-489d-9890-5093816c0680.1...
TCGA-BH-A0HN
FEMALE
67
Positive
Positive
Negative
T1
T1
N0
Negative
M0
Negative
Stage IA
Stage I
followup
LIVING
516
...
41
Primary solid Tumor
Basal-like
unc.edu.0b743ba9-a340-46a0-9276-a5ddd3ee69d6.1...
TCGA-A8-A07O
FEMALE
51
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
Stage IIA
enrollment
LIVING
304
...
42
Primary solid Tumor
Basal-like
unc.edu.299add94-3b97-41a6-9fd4-c572f88982d5.1...
TCGA-AN-A0FL
FEMALE
62
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
No_Conversion
enrollment
LIVING
230
...
43
Primary solid Tumor
Basal-like
unc.edu.39ca8590-3733-4b61-9a46-4ec5e6e0501e.1...
TCGA-BH-A0BL
FEMALE
35
Negative
Negative
Negative
T1
T1
N0
Negative
M0
Negative
Stage I
Stage I
enrollment
LIVING
1339
...
44
Primary solid Tumor
Basal-like
unc.edu.f9739b94-ac64-40d5-bfdd-041a412976c4.1...
TCGA-AR-A0TP
FEMALE
43
Positive
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage II
No_Conversion
enrollment
LIVING
2392
...
45
Primary solid Tumor
Basal-like
unc.edu.5162ef6d-6978-4ff7-b385-a59325cefe17.1...
TCGA-C8-A131
FEMALE
82
Negative
Negative
Negative
T2
T_Other
N2
Positive
M0
Negative
Stage III
Stage IIIA
enrollment
LIVING
0
...
46
Primary solid Tumor
Basal-like
unc.edu.4a93eaee-d821-4640-a441-255008aaf3b4.1...
TCGA-AO-A128
FEMALE
61
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
Stage IIA
followup
LIVING
2877
...
47
Primary solid Tumor
Basal-like
unc.edu.7175b3eb-5198-4d7f-b205-91ae8df344b4.1...
TCGA-B6-A0I2
FEMALE
45
Performed but Not Available
Performed but Not Available
Negative
T1
T1
N0
Negative
M0
Negative
Stage IA
Stage I
followup
LIVING
4360
...
48
Primary solid Tumor
Basal-like
unc.edu.98703904-572d-4220-b959-a1293a2e1c33.1...
TCGA-AR-A1AJ
FEMALE
83
Positive
Negative
Negative
T1
T1
N0
Negative
M0
Negative
Stage I
Stage I
enrollment
LIVING
1604
...
49
Primary solid Tumor
Basal-like
unc.edu.3af60b03-66c3-48a1-a42b-1e05fdb529c4.1...
TCGA-A7-A13D
FEMALE
46
Negative
Positive
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
Stage IIA
followup
LIVING
267
...
50
Primary solid Tumor
Basal-like
unc.edu.a09baab9-3eac-4271-9c12-2684642f8869.1...
TCGA-AN-A04D
FEMALE
58
Negative
Negative
Negative
T2
T_Other
N1
Positive
M0
Negative
Stage IIB
No_Conversion
enrollment
LIVING
52
...
51
Primary solid Tumor
Basal-like
unc.edu.4bf5f56d-448a-426a-8edc-f1bdbf6a8d55.1...
TCGA-D8-A143
FEMALE
51
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
Stage IIA
followup
LIVING
431
...
52
Primary solid Tumor
Basal-like
unc.edu.fac9101c-a974-4415-9eac-d2d433d02b13.1...
TCGA-BH-A0E0
FEMALE
38
Negative
Negative
Negative
T3
T_Other
N3
Positive
M0
Negative
Stage IIIC
No_Conversion
followup
LIVING
133
...
53
Primary solid Tumor
Basal-like
unc.edu.76a625e9-22b3-42b8-8813-27c133d0b248.1...
TCGA-E2-A14R
FEMALE
62
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
Stage IIA
enrollment
LIVING
845
...
54
Primary solid Tumor
Basal-like
unc.edu.62dd11c2-2271-45e7-b753-d0f0d79fdf23.1...
TCGA-A2-A0CM
FEMALE
40
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage IIA
Stage IIA
followup
DECEASED
754
...
55
Primary solid Tumor
Basal-like
unc.edu.2b721e04-5452-4b34-b3df-c6cdd04e87b1.1...
TCGA-B6-A0RT
FEMALE
39
Negative
Negative
Negative
T3
T_Other
N1
Positive
M0
Negative
Stage IIIA
No_Conversion
followup
LIVING
2721
...
56
Primary solid Tumor
Basal-like
unc.edu.52ff562f-6a13-435a-acab-16a064633b1d.1...
TCGA-AR-A1AI
FEMALE
47
Negative
Negative
Negative
T2
T_Other
N0
Negative
M0
Negative
Stage II
Stage IIA
enrollment
LIVING
1881
...
57
Primary solid Tumor
Basal-like
unc.edu.d71e12c1-d92c-4cb6-8244-d100b2ef1c43.1...
TCGA-A2-A04Q
FEMALE
48
Negative
Negative
Negative
T1
T1
N0
Negative
M0
Negative
Stage IA
Stage I
followup
LIVING
1275
...
58
Primary solid Tumor
Basal-like
unc.edu.330bf4ac-9ed5-4bd1-93d0-f89b4f52bc19.1...
TCGA-A2-A0YJ
FEMALE
39
Positive
Negative
Negative
T3
T_Other
N2
Positive
M0
Negative
Stage IIIA
No_Conversion
followup
LIVING
565
...
59
Primary solid Tumor
Basal-like
unc.edu.7f57b9e7-1b1b-4e07-beb4-b877b7651f7b.1...
TCGA-A2-A0YE
FEMALE
48
Negative
Negative
Negative
T2
T_Other
N1
Positive
M0
Negative
Stage IIB
No_Conversion
followup
LIVING
553
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
919 rows × 33 columns
In [23]:
df[df.Vital_Status == 'DECEASED']['OS_Time'].hist()
Out[23]:
<matplotlib.axes.AxesSubplot at 0x109da4110>
In [24]:
df[df.Vital_Status == 'LIVING']['OS_Time'].hist(hold= True)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-24-75aa82614dde> in <module>()
----> 1 df[df.Vital_Status == 'LIVING']['OS_Time'].hist(hold= True)
/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas/tools/plotting.pyc in hist_series(self, by, ax, grid, xlabelsize, xrot, ylabelsize, yrot, figsize, **kwds)
2144 values = self.dropna().values
2145
-> 2146 ax.hist(values, **kwds)
2147 ax.grid(grid)
2148 axes = np.array([ax])
/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axes.pyc in hist(self, x, bins, range, normed, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, **kwargs)
8525 if patch:
8526 p = patch[0]
-> 8527 p.update(kwargs)
8528 if lbl is not None:
8529 p.set_label(lbl)
/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/artist.pyc in update(self, props)
737 func = getattr(self, 'set_' + k, None)
738 if func is None or not callable(func):
--> 739 raise AttributeError('Unknown property %s' % k)
740 func(v)
741 changed = True
AttributeError: Unknown property hold
In [25]:
df[df['Vital_Status'] == 'LIVING']['OS_Time'].hist?
In [26]:
df[df['Vital_Status'] == 'LIVING']['OS_Time'].hist
Out[26]:
<bound method Series.hist_series of 1 670
2 1138
4 591
5 10
6 852
7 273
8 2246
9 692
10 1203
11 1643
12 294
13 1350
14 4284
16 775
17 515
...
896 2875
898 0
899 20
900 0
901 21
902 0
904 1228
905 48
907 34
908 0
913 587
914 837
915 1707
916 1187
917 1324
Name: OS_Time, Length: 778, dtype: float64>
In [27]:
df[df['Vital_Status'] == 'LIVING']['OS_Time'].hist
Out[27]:
<bound method Series.hist_series of 1 670
2 1138
4 591
5 10
6 852
7 273
8 2246
9 692
10 1203
11 1643
12 294
13 1350
14 4284
16 775
17 515
...
896 2875
898 0
899 20
900 0
901 21
902 0
904 1228
905 48
907 34
908 0
913 587
914 837
915 1707
916 1187
917 1324
Name: OS_Time, Length: 778, dtype: float64>
In [28]:
df[df.Vital_Status == 'LIVING']['OS_Time'].hist
Out[28]:
<bound method Series.hist_series of 1 670
2 1138
4 591
5 10
6 852
7 273
8 2246
9 692
10 1203
11 1643
12 294
13 1350
14 4284
16 775
17 515
...
896 2875
898 0
899 20
900 0
901 21
902 0
904 1228
905 48
907 34
908 0
913 587
914 837
915 1707
916 1187
917 1324
Name: OS_Time, Length: 778, dtype: float64>
In [29]:
ax = plt.axes()
living_os = np.array(df[df.Vital_Status == 'LIVING']['OS_Time'])
living_os = living_os[living_os > 1825]
print len(living_os)
ax.hist(living_os)
deceased_os = np.array(df[df.Vital_Status == 'DECEASED']['OS_Time'])
deceased_os = deceased_os[deceased_os < 1095]
print len(deceased_os)
ax.hist(deceased_os)
79
42
Out[29]:
(array([ 6., 2., 3., 1., 5., 3., 4., 6., 4., 8.]),
array([ 157. , 242.1, 327.2, 412.3, 497.4, 582.5, 667.6,
752.7, 837.8, 922.9, 1008. ]),
<a list of 10 Patch objects>)
In [30]:
deceased_mask = (df.Vital_Status == 'DECEASED') & (df['OS_Time'] < (3*365))
living_mask = (df.Vital_Status == 'LIVING') & (df['OS_Time'] < (5*365))
deceased_names = df[deceased_mask].name
living_names = df[living_mask].name
In [31]:
rna_df = pd.read_csv('../canseq/tcga/tcga.rnaSeqV2.brca.tau.txt', sep=',')
In [99]:
In [32]:
pat = "unc\.edu\.(.*)\.\d*\.rsem\.genes\.normalized_results"
living_names = [match_group[0] for match_group in living_names.str.match(pat)]
deceased_names = [match_group[0] for match_group in deceased_names.str.match(pat)]
/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas/core/strings.py:367: UserWarning: In future versions of pandas, match will change to always return a bool indexer.
" always return a bool indexer.""", UserWarning)
In [33]:
living_rsem = rna_df.ix[:, living_names]
deceased_rsem = rna_df.ix[:, deceased_names]
In [34]:
deceased_rsem
Out[34]:
a63583ca-0ef2-4417-b435-5f3a6951d0c2
6d066a72-f59f-45a8-ab90-216000b36da4
62dd11c2-2271-45e7-b753-d0f0d79fdf23
09c248f8-cdd7-4c13-9085-26c56544bcf7
357ba9f6-716c-4ef0-8ac8-41977397dbf5
491c6c41-d1c5-4be7-bb7c-9df7275aa388
d31b476c-c047-4e5f-a0cb-eff1065f0121
8dc04505-fae5-4185-b3f8-53882fbbb4fd
889f6f61-9b3a-406c-9af8-ddee74a8a19e
4dac7a33-db46-4815-8c6c-fb326959c741
0b3c65ed-ff55-45c9-b6a3-dd3a596a0271
3b48796b-8591-4d7a-a502-5c4293647156
8fb338fe-ffa8-45c2-857b-f713d1935330
1a99c4ba-6948-4054-96cd-62164ff4a6f0
f97f68be-6838-455c-91bf-7549543a82c3
08236177-a046-4cfe-a11c-a24292a1f777
7b234c36-729b-422d-8e2a-ebd42af74bce
89f9e509-5f4c-439b-b610-860f209332d2
733890d7-6557-454e-8697-fe9c619874e3
c71ca9f7-248f-460c-b5d3-afb2c648fef2
100130426
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
...
100133144
4.359073e-06
5.108017e-07
1.734503e-06
2.659838e-06
5.249666e-08
1.144935e-06
5.792443e-07
7.972724e-08
4.868381e-07
8.321021e-07
9.119847e-07
2.314170e-06
5.639532e-07
2.314428e-06
3.616698e-07
5.063103e-07
1.281190e-06
2.197569e-06
6.442920e-07
5.094094e-07
...
100134869
1.797453e-06
1.419259e-07
2.446509e-07
7.656375e-07
1.073556e-07
2.433461e-07
2.621854e-07
4.108058e-07
2.440426e-07
4.593287e-07
3.333725e-07
6.038682e-07
2.341821e-07
9.487183e-07
1.398782e-07
1.694214e-07
5.209550e-07
9.264722e-07
1.204358e-06
3.611131e-07
...
10357
2.248426e-04
1.366804e-05
4.765121e-05
2.867874e-05
2.356971e-05
1.661132e-05
2.167340e-05
1.086382e-05
2.098130e-05
4.710670e-05
2.130732e-05
3.125738e-05
1.392086e-05
2.529897e-05
1.458849e-05
1.946973e-05
2.479213e-05
1.140481e-05
2.720707e-05
1.460284e-05
...
10431
9.821766e-05
1.366488e-04
1.313625e-04
8.088577e-05
1.435102e-04
1.798669e-04
8.295820e-05
1.218280e-04
6.354504e-05
7.600721e-05
7.134431e-05
7.861641e-05
9.317366e-05
1.018602e-04
7.090746e-05
4.682867e-05
6.708020e-05
8.406468e-05
2.001179e-04
8.403933e-05
...
136542
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
...
155060
5.381789e-06
3.295121e-06
4.123380e-06
5.382254e-06
5.307697e-06
2.032588e-06
3.891341e-06
3.842630e-06
6.083398e-06
2.007006e-06
6.742844e-06
7.279470e-06
4.012338e-06
5.914379e-06
4.569233e-06
4.027347e-06
5.941460e-06
2.518442e-06
3.804135e-06
1.358719e-05
...
26823
7.997161e-08
6.122452e-08
0.000000e+00
1.143710e-07
6.228845e-08
1.450217e-07
1.067934e-07
0.000000e+00
7.122398e-08
9.151405e-08
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
8.191813e-07
0.000000e+00
1.288122e-07
3.528681e-07
7.094503e-08
1.572220e-07
...
280660
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
...
317712
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
...
340602
9.537459e-08
1.306792e-08
0.000000e+00
6.966527e-08
0.000000e+00
0.000000e+00
3.991958e-07
1.657443e-08
0.000000e+00
0.000000e+00
1.663615e-08
0.000000e+00
0.000000e+00
1.553388e-08
0.000000e+00
0.000000e+00
2.908395e-07
1.773010e-07
0.000000e+00
0.000000e+00
...
388795
0.000000e+00
1.811013e-08
4.409498e-08
2.130224e-08
4.242854e-08
0.000000e+00
3.061342e-08
7.652259e-09
3.376417e-08
4.183743e-08
7.718815e-09
2.001517e-08
0.000000e+00
4.274398e-08
3.971697e-08
3.468972e-08
3.643769e-08
1.218143e-07
0.000000e+00
1.321752e-07
...
390284
2.265727e-06
1.982668e-06
2.754884e-06
1.143399e-06
1.610436e-06
1.978470e-06
2.067312e-06
7.217063e-07
3.133805e-06
4.463056e-06
4.352816e-06
9.736118e-06
2.294900e-06
1.346113e-06
6.326031e-06
2.328709e-06
3.500484e-06
2.024853e-06
3.178439e-06
4.702231e-06
...
391343
0.000000e+00
0.000000e+00
2.213372e-08
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
1.532157e-08
8.486747e-09
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
1.923120e-07
0.000000e+00
0.000000e+00
2.442408e-08
3.274304e-08
1.380738e-08
1.846446e-08
...
391714
0.000000e+00
1.851463e-08
0.000000e+00
3.308381e-08
0.000000e+00
0.000000e+00
0.000000e+00
2.349285e-08
0.000000e+00
2.609359e-08
2.349050e-08
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
2.692853e-08
1.881166e-08
0.000000e+00
4.239708e-08
6.838034e-08
...
404770
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
...
441362
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
...
442388
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
...
553137
1.212170e-08
3.002717e-08
3.846576e-07
1.773101e-08
8.047412e-08
1.913949e-07
6.426757e-06
1.269170e-08
8.982029e-08
1.255212e-07
7.659812e-08
0.000000e+00
2.006848e-08
1.091142e-06
0.000000e+00
4.330652e-08
1.010092e-07
1.352961e-08
8.002858e-08
9.777204e-08
...
57714
3.250660e-06
1.556926e-05
2.873718e-05
9.817471e-06
5.649482e-06
2.740873e-06
3.372504e-05
5.966974e-06
5.358180e-06
1.482250e-05
1.142220e-05
3.849033e-05
4.410800e-06
4.082212e-05
2.426864e-05
1.334215e-05
1.851917e-05
3.339261e-05
1.658388e-05
6.109519e-05
...
645851
1.441191e-06
1.151064e-06
1.706330e-06
1.073576e-06
1.661732e-07
3.784814e-07
1.015981e-06
1.295122e-06
8.997917e-07
9.074522e-06
2.770959e-06
1.765862e-06
3.306793e-07
1.796060e-06
1.745376e-07
1.019064e-06
3.245160e-06
1.143071e-06
1.890383e-06
2.176159e-06
...
652919
7.788417e-07
2.253626e-06
3.904365e-07
9.935949e-150
0.000000e+00
0.000000e+00
7.224712e-07
0.000000e+00
3.248664e-246
6.590450e-07
0.000000e+00
0.000000e+00
0.000000e+00
6.230535e-07
1.634749e-07
1.376514e-06
3.670379e-06
8.562843e-07
3.144294e-07
1.127500e-06
...
653553
3.285515e-05
2.547867e-05
1.165507e-04
4.354101e-05
1.711455e-04
1.186159e-04
3.137461e-05
8.709508e-05
6.219671e-05
4.144862e-05
1.283304e-04
2.694074e-05
7.749701e-05
1.611846e-04
8.859075e-05
3.868928e-05
4.316962e-05
1.595772e-04
2.911976e-05
2.622019e-04
...
728045
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
...
728603
4.431107e-07
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
8.891667e-08
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
...
728788
1.416840e-07
0.000000e+00
0.000000e+00
1.365386e-07
0.000000e+00
4.331671e-08
1.934039e-07
9.522179e-08
5.141924e-07
0.000000e+00
0.000000e+00
1.961748e-07
0.000000e+00
0.000000e+00
0.000000e+00
5.553813e-08
7.730470e-08
5.238604e-08
0.000000e+00
4.698608e-08
...
729884
1.978950e-07
0.000000e+00
1.066438e-07
0.000000e+00
1.545384e-06
7.871559e-07
4.936490e-08
1.329061e-07
2.876937e-07
3.252188e-08
4.451144e-07
1.363495e-07
6.538683e-07
1.382144e-07
9.209250e-08
1.177490e-07
2.000324e-07
5.677738e-07
1.463743e-07
0.000000e+00
...
8225
2.921617e-05
1.064089e-05
2.429716e-05
2.604782e-05
1.994005e-05
2.299334e-05
2.661818e-05
3.802856e-05
3.697443e-05
2.742563e-05
4.298507e-05
2.503190e-05
1.925500e-05
6.959719e-05
3.907856e-05
3.245595e-05
1.784818e-05
1.859660e-05
2.987891e-05
2.743556e-05
...
90288
3.221127e-07
2.076973e-07
1.056696e-07
6.141770e-08
1.276096e-07
2.599759e-07
8.804485e-08
1.126752e-06
4.146337e-07
4.543313e-06
2.602503e-06
3.280722e-07
4.165219e-07
5.888616e-07
1.672979e-07
6.666729e-07
1.224174e-06
2.265814e-06
2.109689e-07
8.183827e-07
...
1
4.623308e-06
1.992749e-06
2.532690e-06
3.451246e-06
2.853227e-06
1.755374e-05
2.285745e-06
7.315108e-06
2.716170e-06
7.434529e-06
8.674235e-06
8.208854e-06
1.766158e-06
4.279792e-06
1.549980e-06
2.048380e-06
2.311181e-06
1.120480e-05
2.671145e-06
5.512144e-06
...
29974
0.000000e+00
1.178847e-08
0.000000e+00
2.092095e-08
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
4.939561e-08
0.000000e+00
1.972397e-08
0.000000e+00
4.146431e-08
0.000000e+00
0.000000e+00
0.000000e+00
3.193868e-08
7.113854e-08
0.000000e+00
...
54715
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
5.039523e-09
1.511694e-08
3.957278e-08
0.000000e+00
1.524922e-08
6.918674e-08
0.000000e+00
0.000000e+00
0.000000e+00
8.245623e-09
7.797662e-08
5.614525e-08
0.000000e+00
0.000000e+00
...
87769
2.362049e-05
3.436414e-06
1.562620e-06
3.084435e-06
2.964923e-06
4.106002e-06
4.393369e-06
3.720113e-06
4.883882e-06
2.330275e-06
4.666835e-06
4.854836e-06
2.863985e-06
5.050402e-06
5.871178e-06
4.192135e-06
3.321476e-06
1.635261e-06
8.513547e-07
5.393251e-06
...
144568
5.134527e-07
6.481258e-07
1.968846e-05
5.156069e-07
2.084420e-05
5.924791e-06
6.933368e-08
2.954825e-06
2.918244e-08
2.649586e-06
2.625219e-06
5.744547e-08
1.457077e-06
3.737655e-08
1.199773e-05
5.970524e-08
2.334703e-06
2.124109e-07
1.976916e-04
1.408846e-07
...
2
1.206022e-04
3.539427e-04
2.624673e-04
3.059584e-04
2.101238e-04
3.298680e-04
6.294977e-04
4.767124e-04
8.651702e-04
2.151259e-04
3.017445e-04
2.147139e-04
2.881606e-04
2.078783e-04
5.711173e-04
6.729542e-04
9.022020e-04
2.206301e-04
1.404131e-04
2.476410e-04
...
53947
3.659576e-06
4.657289e-06
6.197037e-06
4.720960e-05
3.473165e-06
5.060608e-06
1.419854e-05
1.355006e-05
1.754860e-05
9.999308e-06
5.675277e-06
3.348795e-06
4.801539e-06
4.454723e-06
3.925246e-06
1.039556e-05
9.756347e-06
1.312311e-05
1.225137e-06
1.400156e-05
...
51146
3.483216e-08
7.146286e-08
5.243371e-08
3.560150e-07
0.000000e+00
0.000000e+00
7.281796e-08
9.064733e-08
2.251300e-07
1.001478e-07
0.000000e+00
2.401065e-08
0.000000e+00
6.804480e-08
3.770924e-08
2.070084e-07
5.789198e-08
9.710302e-08
0.000000e+00
0.000000e+00
...
404744
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
3.757447e-08
0.000000e+00
0.000000e+00
0.000000e+00
...
8086
5.400690e-05
2.042712e-05
2.826705e-05
2.811134e-05
2.168992e-05
2.155724e-05
2.172080e-05
2.162326e-05
2.498475e-05
4.057236e-05
3.827363e-05
4.032175e-05
2.633969e-05
4.158594e-05
4.638581e-05
2.610507e-05
2.683204e-05
3.741199e-05
2.782877e-05
3.632141e-05
...
729522
1.387683e-08
3.288734e-07
2.094259e-08
0.000000e+00
8.671194e-09
0.000000e+00
8.044996e-08
0.000000e+00
1.283979e-08
0.000000e+00
2.206047e-08
0.000000e+00
0.000000e+00
3.405793e-06
3.941202e-07
3.303034e-08
0.000000e+00
0.000000e+00
3.760013e-07
1.398170e-08
...
65985
7.176978e-05
1.682350e-05
1.905693e-05
2.404367e-05
1.697232e-05
2.576174e-05
2.333984e-05
1.178101e-05
2.039660e-05
1.596567e-05
1.319579e-05
3.469523e-05
2.604047e-05
2.183670e-05
8.004885e-05
4.038406e-05
3.232480e-05
4.174455e-05
3.132338e-05
3.061446e-05
...
344752
5.466589e-07
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
2.354455e-08
1.235483e-07
0.000000e+00
4.681374e-08
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
1.062433e-07
0.000000e+00
0.000000e+00
0.000000e+00
...
126767
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
5.281223e-09
0.000000e+00
6.597242e-09
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
2.693237e-08
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
...
343066
1.991800e-08
0.000000e+00
2.992905e-08
0.000000e+00
1.640506e-08
0.000000e+00
0.000000e+00
0.000000e+00
3.672709e-08
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
0.000000e+00
...
13
0.000000e+00
1.019858e-06
0.000000e+00
0.000000e+00
0.000000e+00
4.868117e-07
9.480625e-08
1.617264e-07
7.179854e-08
2.014270e-07
6.075097e-08
0.000000e+00
0.000000e+00
0.000000e+00
1.682583e-07
1.155884e-07
6.301463e-07
0.000000e+00
0.000000e+00
7.827640e-08
...
51166
1.754104e-05
7.750855e-07
1.034564e-05
4.554675e-06
1.614082e-06
6.572625e-07
1.355741e-06
3.134349e-06
3.173922e-06
7.847575e-07
1.651564e-05
1.595833e-06
4.488197e-07
4.748858e-07
1.399758e-06
2.390292e-06
7.965851e-06
1.723537e-07
1.251349e-05
7.134686e-07
...
79719
6.414559e-05
4.275895e-05
2.571267e-05
3.631867e-05
9.772432e-06
2.915194e-05
3.284310e-05
2.556556e-05
3.360114e-05
4.671382e-05
3.324072e-05
9.087091e-05
8.892603e-05
6.282623e-05
5.370893e-05
2.045309e-05
4.061970e-05
5.859704e-05
4.029410e-05
6.890680e-05
...
22848
5.390292e-06
1.839766e-05
8.190292e-06
1.003008e-05
1.818350e-06
5.470124e-06
1.249076e-05
1.234715e-05
9.541662e-06
1.791499e-05
1.064033e-05
2.068229e-05
6.802703e-06
1.625221e-05
6.229031e-06
1.263973e-05
1.649746e-05
1.248004e-05
1.234283e-05
1.465132e-05
...
14
8.485792e-05
7.295397e-05
1.147752e-04
8.737947e-05
7.319146e-05
8.475771e-05
1.001114e-04
1.314327e-04
1.024809e-04
9.251664e-05
1.800862e-04
1.399536e-04
1.859392e-04
1.416749e-04
1.044788e-04
9.648713e-05
6.569627e-05
1.540437e-04
1.649805e-04
1.405399e-04
...
15
0.000000e+00
6.262418e-08
0.000000e+00
1.133866e-07
8.837683e-08
9.422956e-08
5.369143e-08
0.000000e+00
6.232851e-08
0.000000e+00
7.882910e-08
0.000000e+00
0.000000e+00
3.311470e-08
2.907989e-07
4.612890e-08
0.000000e+00
7.579324e-08
7.196107e-08
0.000000e+00
...
57505
6.644244e-06
7.867412e-06
8.860626e-06
6.312502e-06
7.522720e-06
1.152077e-05
8.807854e-06
5.910472e-06
6.697813e-06
9.489051e-06
1.170830e-05
1.216589e-05
8.896154e-06
1.566584e-05
5.259441e-06
5.488663e-06
5.758484e-06
8.783840e-06
7.439318e-06
1.069291e-05
...
80755
3.292233e-05
1.633661e-05
4.239107e-05
2.891128e-05
2.490836e-05
2.916562e-05
5.881798e-05
3.595555e-05
3.176734e-05
4.462145e-05
2.843981e-05
3.530867e-05
3.538068e-05
1.942200e-05
1.808740e-05
3.043285e-05
2.866304e-05
4.416695e-05
3.163806e-05
4.627620e-05
...
16
7.954391e-05
4.851268e-05
1.408186e-04
2.110450e-04
3.752954e-05
5.677418e-05
7.787435e-05
6.888558e-05
6.367174e-05
7.393211e-05
1.500594e-04
6.922170e-05
1.048632e-04
2.409716e-04
8.917113e-05
6.387113e-05
5.877557e-05
1.866216e-04
1.028807e-04
6.374216e-05
...
60496
5.308244e-05
5.152102e-05
2.429585e-05
4.463740e-05
1.094191e-05
1.378654e-05
3.394533e-05
1.965162e-05
2.955369e-05
3.125715e-05
1.961552e-05
2.806767e-05
2.054099e-05
2.122998e-05
2.082407e-05
2.512662e-05
3.615451e-05
2.194131e-05
4.028403e-05
5.006279e-05
...
132949
7.474610e-06
1.418511e-05
5.053437e-06
9.172523e-06
3.028027e-06
2.652357e-06
1.041219e-05
6.046397e-06
1.120017e-05
1.013133e-05
6.187154e-06
1.184710e-05
4.006096e-06
9.491157e-06
5.922073e-06
1.013668e-05
1.598537e-05
9.633630e-06
6.465200e-06
5.850760e-06
...
10157
8.348270e-07
2.463061e-06
1.650513e-06
1.078799e-06
2.026176e-06
8.117191e-07
3.436024e-06
2.584399e-06
1.255668e-05
1.852908e-06
1.440596e-06
5.140390e-06
2.501438e-06
1.812997e-06
1.189560e-06
2.034966e-05
1.945499e-05
1.252911e-06
1.942100e-06
9.293850e-07
...
26574
7.669591e-05
3.078812e-05
6.435018e-05
3.987809e-05
1.930206e-05
5.273333e-05
6.848045e-05
6.383621e-05
4.529864e-05
3.183521e-05
8.141137e-05
5.830224e-05
3.831710e-05
3.328468e-04
5.258589e-05
3.305213e-05
3.074732e-05
1.177600e-04
1.085006e-04
7.280831e-05
...
9625
1.087188e-06
4.384394e-07
3.302347e-07
2.703765e-06
7.357584e-07
5.371093e-07
6.572137e-07
1.656648e-06
8.373700e-07
6.366919e-07
1.352137e-06
1.272023e-06
1.761870e-06
3.363866e-07
3.167213e-07
6.092035e-07
3.950688e-07
6.280597e-07
6.890529e-07
1.102125e-06
...
18
1.078774e-06
1.704097e-06
1.494676e-06
1.390386e-06
6.330194e-07
1.180213e-06
2.929787e-06
2.818772e-06
9.688310e-06
3.013363e-05
5.343732e-06
2.462633e-05
5.914198e-06
7.481296e-06
2.158414e-06
8.619755e-06
1.293650e-05
1.490164e-05
5.508002e-07
1.102350e-05
...
10349
8.923781e-08
4.256044e-07
2.550588e-07
1.926456e-07
8.307990e-07
5.990535e-08
1.731684e-06
8.176846e-07
8.089481e-06
3.813757e-08
3.385560e-07
3.387040e-07
1.366422e-07
3.205415e-07
1.738000e-07
5.265119e-06
1.474915e-05
7.410228e-08
2.936464e-08
5.982439e-07
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
20531 rows × 42 columns
In [35]:
genes = pd.read_csv('../canseq/tcga/entrez_immune_genes.csv', sep=',', index_col=0)
In [36]:
genes
Out[36]:
Name
EntrezID
6351
CCL4
6352
CCL5
2920
CXCL2
4283
CXCL9
3627
CXCL10
4818
NKG7
3001
GZMA
3002
GZMB
5551
PRF1
6772
STAT1
30001
TBX21
915
CD3D
925
CD8A
13 rows × 1 columns
In [37]:
deceased_rsem.merge?
In [38]:
deceased_rsem_immune = deceased_rsem.merge(genes, left_index=True, right_index=True)
In [39]:
deceased_rsem_immune.index = [str(genes.ix[idx].Name) for idx in deceased_rsem_immune.index]
In [40]:
living_rsem.join(genes, how='inner')
Out[40]:
4d12d021-3673-4e14-9fd9-033f811f87da
3e57b40c-7079-4f05-bf37-f560304966c1
46262a6c-8a11-4bb9-8851-8b6e44c95288
c1dc3f35-324b-4a69-b32c-24652ccf9e3a
e3b4918d-43c1-4dde-9a92-f9c5cd6e63a0
ce045098-cbfb-4c73-9bbe-6a1d677ae0b0
d9f827bb-2498-49b0-aa85-71cb554eb926
6d2744ba-4817-482b-ad46-2e4e0897ad88
920e47c0-1b19-46e6-b1db-b5fd95e44df0
4808bc63-000a-4a49-a25b-4b817ca5ea54
6e45dd01-225d-4871-9a3a-f591808ad234
1fe98b05-6803-4803-83cd-a59e794b956e
95c7abfa-a417-4d81-96c2-a952a081d997
74cba80b-7677-41d6-ab22-10f1a962ba2f
2ad8d416-08a4-4e6f-947e-d74269d02ab1
9f440cd6-d55f-4cb6-a433-637ef1f9d38f
a8a7a335-8e21-4f24-b48b-8764caa21329
43326f71-c61c-410b-af4b-c71a054e27c9
dea20128-b180-4da1-9da5-0f00bea3b1ab
c09e8a88-5a82-4fd6-8d03-ef3ecb988003
6351
0.000004
0.000014
0.000016
0.000008
0.000013
0.000008
0.000027
0.000047
0.000088
0.000023
0.000025
0.000072
0.000038
0.000055
0.000021
0.000014
0.000009
3.491277e-06
0.000050
0.000018
...
6352
0.000011
0.000114
0.000081
0.000018
0.000017
0.000059
0.000067
0.000123
0.000395
0.000079
0.000144
0.000258
0.000174
0.000081
0.000129
0.000041
0.000022
1.027848e-05
0.000488
0.000023
...
2920
0.000000
0.000003
0.000005
0.000002
0.000001
0.000001
0.000001
0.000001
0.000022
0.000001
0.000020
0.000001
0.000005
0.000002
0.000006
0.000002
0.000003
5.118764e-08
0.000001
0.000003
...
4283
0.000004
0.000078
0.000254
0.000015
0.000059
0.000003
0.000135
0.000141
0.000466
0.000259
0.000063
0.000032
0.000373
0.000146
0.000074
0.000046
0.000004
5.225933e-05
0.000109
0.000064
...
3627
0.000012
0.000276
0.000280
0.000024
0.000068
0.000052
0.000042
0.000224
0.000478
0.000469
0.000415
0.000154
0.000138
0.000217
0.000079
0.000033
0.000011
4.474604e-05
0.001568
0.000058
...
4818
0.000003
0.000032
0.000008
0.000006
0.000003
0.000002
0.000020
0.000018
0.000127
0.000022
0.000012
0.000058
0.000044
0.000025
0.000029
0.000009
0.000006
2.068295e-06
0.000069
0.000008
...
3001
0.000002
0.000021
0.000006
0.000005
0.000003
0.000001
0.000017
0.000010
0.000082
0.000017
0.000010
0.000055
0.000054
0.000032
0.000020
0.000008
0.000008
1.555396e-06
0.000047
0.000007
...
3002
0.000002
0.000022
0.000006
0.000002
0.000004
0.000002
0.000005
0.000025
0.000044
0.000014
0.000008
0.000046
0.000056
0.000037
0.000035
0.000003
0.000006
1.838088e-06
0.000082
0.000008
...
5551
0.000001
0.000009
0.000002
0.000002
0.000001
0.000000
0.000004
0.000005
0.000025
0.000007
0.000002
0.000022
0.000017
0.000012
0.000008
0.000003
0.000002
6.036557e-07
0.000023
0.000006
...
6772
0.000040
0.000137
0.000204
0.000073
0.000179
0.000596
0.000086
0.000475
0.000467
0.000307
0.000355
0.000273
0.000175
0.000488
0.000068
0.000079
0.000034
1.074429e-04
0.000793
0.000110
...
30001
0.000006
0.000021
0.000049
0.000015
0.000016
0.000026
0.000006
0.000035
0.000019
0.000023
0.000036
0.000029
0.000060
0.000135
0.000016
0.000018
0.000028
1.239100e-05
0.000034
0.000030
...
915
0.000002
0.000079
0.000012
0.000005
0.000004
0.000001
0.000038
0.000020
0.000111
0.000038
0.000016
0.000025
0.000034
0.000015
0.000024
0.000011
0.000005
2.851724e-06
0.000036
0.000006
...
925
0.000002
0.000019
0.000004
0.000003
0.000004
0.000001
0.000010
0.000007
0.000047
0.000009
0.000005
0.000019
0.000025
0.000008
0.000010
0.000007
0.000002
3.112513e-06
0.000026
0.000002
...
13 rows × 700 columns
In [41]:
def extract_immune_genes(df, genes):
merged = df.join(genes, how='inner')
merged.index = merged.Name
return merged.drop('Name', axis=1).T
In [42]:
deceased_immune_rsem = extract_immune_genes(deceased_rsem, genes)
living_immune_rsem = extract_immune_genes(living_rsem, genes)
In [42]:
In [43]:
def overlay_histograms(good, bad):
ax = plt.axes()
ax.hist(np.array(good), normed=True)
ax.hist(np.array(bad), normed=True)
ax.legend(('Good', 'Bad'))
In [44]:
overlay_histograms(living_immune_rsem.STAT1, deceased_immune_rsem.STAT1)
In [ ]:
Content source: hammerlab/immuno_research
Similar notebooks: