Rules99 commited on
Commit
9f8cc36
·
1 Parent(s): 34bf444

Bioinformatics project

Browse files
.gitignore ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+
113
+ # Spyder project settings
114
+ .spyderproject
115
+ .spyproject
116
+
117
+ # Rope project settings
118
+ .ropeproject
119
+
120
+ # mkdocs documentation
121
+ /site
122
+
123
+ # mypy
124
+ .mypy_cache/
125
+ .dmypy.json
126
+ dmypy.json
127
+
128
+ # Pyre type checker
129
+ .pyre/
130
+ datamdata
Analysis (R).R ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ install.packages("readxl")
2
+ library("readxl")
3
+ setwd("C:/Users/Pablo/Desktop/BioinfoProject")
4
+
5
+ sample_gene <- read_excel("Study Results.xlsx",sheet = 1)
6
+ factors <- read_excel("Study Results.xlsx",sheet = 2)
7
+ factors[names(factors)[1:4]]
8
+
9
+
10
+ merging = merge(x = sample_gene, y = factors, by = 'sampleID')
11
+
12
+
13
+
14
+ merging
Excel Analysis(Pablo).ipynb ADDED
The diff for this file is too large to render. See raw diff
 
README.md CHANGED
@@ -1,37 +1,2 @@
1
- ---
2
- title: Bioinformatics_Project
3
- emoji: ⚡
4
- colorFrom: pink
5
- colorTo: red
6
- sdk: streamlit
7
- app_file: app.py
8
- pinned: false
9
- ---
10
-
11
- # Configuration
12
-
13
- `title`: _string_
14
- Display title for the Space
15
-
16
- `emoji`: _string_
17
- Space emoji (emoji-only character allowed)
18
-
19
- `colorFrom`: _string_
20
- Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
21
-
22
- `colorTo`: _string_
23
- Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
24
-
25
- `sdk`: _string_
26
- Can be either `gradio` or `streamlit`
27
-
28
- `sdk_version` : _string_
29
- Only applicable for `streamlit` SDK.
30
- See [doc](https://hf.co/docs/hub/spaces) for more info on supported versions.
31
-
32
- `app_file`: _string_
33
- Path to your main application file (which contains either `gradio` or `streamlit` Python code).
34
- Path is relative to the root of the repository.
35
-
36
- `pinned`: _boolean_
37
- Whether the Space stays on top of your list.
 
1
+ # Skin-Mutations-Analysis
2
+ The Job is going to be based on a Skin Mutation Analysis
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app.py ADDED
@@ -0,0 +1,570 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ from functions import *
3
+ directory = os.path.abspath("")
4
+ # from EDA_IMDb_functions import *
5
+
6
+
7
+
8
+
9
+
10
+ st.set_page_config(layout="wide")
11
+ st.set_option('deprecation.showPyplotGlobalUse', False)
12
+ dw,col1,wl = st.columns((1,0.5,1))
13
+ col1.image('descarga.jfif')
14
+ st.markdown("<h1 style='text-align:center;'>Somatic Mutations Analysis in skin</h1>",unsafe_allow_html=True)
15
+
16
+ st.sidebar.markdown("<h2 style='text-align:center;'>Index</h2>",unsafe_allow_html=True)
17
+ menu = st.sidebar.radio(
18
+ "",
19
+ ("1. Intro", "2. Analysis of somatic mutations" ,'3. Sample Analysis (IGV)'),
20
+ )
21
+
22
+ # Pone el radio-button en horizontal. Afecta a todos los radio button de una página.
23
+ # Por eso está puesto en este que es general a todo
24
+ # st.write('<style>div.row-widget.stRadio > div{flex-direction:row;}</style>', unsafe_allow_html=True)
25
+
26
+ st.sidebar.markdown('---')
27
+ st.sidebar.markdown("<h2 style='text-align:center;'>Authors</h2>",unsafe_allow_html=True)
28
+ st.sidebar.markdown("<p style='text-align:center;'>Claudio Sotillos Peceroso</p>",unsafe_allow_html=True)
29
+ st.sidebar.markdown("<p style='text-align:center;'>Pablo Reyes Martin</p>",unsafe_allow_html=True)
30
+
31
+
32
+
33
+
34
+ @st.cache(allow_output_mutation=True)
35
+ def read_csv():
36
+ return pd.ExcelFile('datamdata/Study Results.xlsx')
37
+
38
+
39
+ ### Merge two dataframes
40
+ def definemerging(df1,df2):
41
+
42
+ merging = df1.merge(df2,on="sampleID",how="inner")
43
+ return merging
44
+ #### Reading the data
45
+ df = read_csv()
46
+ df1 = pd.read_excel(df, 'Dataset_S1').copy(deep=True)
47
+ df2 = pd.read_excel(df, 'Dataset_S2').copy(deep=True)
48
+ merging = None
49
+ ### functions indexed
50
+ def wrt(text,tag="h1",align="center"):
51
+ return st.markdown(f"""
52
+ <{tag} style='text-align:{align};'>{text}</{tag}>
53
+ """,unsafe_allow_html=True)
54
+ def writetxt(text,tag="h1",align="center",container=st):
55
+ return container.markdown(f"""
56
+ <{tag} style='text-align:{align};'>{text}</{tag}>
57
+ """,unsafe_allow_html=True)
58
+ def space(tag="h1"):
59
+ return wrt("\n",tag=tag)
60
+
61
+ ### 1. Introduciton
62
+ def set_home():
63
+ wrt("1. Introduction to the problem",tag="h2")
64
+
65
+
66
+ par1 = """
67
+ In this project, we have focus our study on the research paper as well as on
68
+ getting some conclusion by ourselves. Therefore there will be some contrast we will do in relation to the paper
69
+ as well as other plots not related with the paper. Also, we will perform the analysis of two samples that are
70
+ from quite opposite individuals."""
71
+
72
+ ### 1.1
73
+ wrt(par1,tag="p style='font-size:21px;'",align="justify")
74
+ tit1 = """
75
+ 1.1 Cancers arise as a result of somatic mutations
76
+ """
77
+ wrt(tit1,tag="h4",align="left")
78
+ ___,col1,_,col2,___ = st.columns((0.4,1,0.7,1,0.4))
79
+
80
+ cap1 = "Fig 1 : Types of Genomic Alterations"
81
+
82
+ col1.image("img/base.png",caption=cap1,width=500,use_column_width=True)
83
+
84
+ cap2 = "Fig 2 : Skin Risk Factors"
85
+ col2.image("img/risk_factors.png",caption=cap2,width=500,use_column_width=True)
86
+
87
+
88
+ with col2:
89
+ col2_par = """
90
+ The proportion of somatic mutations in normal cells is quite similar to the mutations of tumours in the same tissue cell.
91
+ Only a small fraction are the ones which provokes cancer.
92
+ """
93
+ wrt(col2_par,tag="p style='font-size:20px;'",align="justify")
94
+
95
+ space()
96
+
97
+ ### 1.2
98
+
99
+ tit1 = """
100
+ 1.2 State of the art of the research
101
+ """
102
+ wrt(tit1,tag="h4",align="left")
103
+ ___,col1,_,col2,___ = st.columns((0.4,1.4,0.3,0.6,0.4))
104
+
105
+ cap1 = "Fig 1 : Types of Genomic Alterations"
106
+
107
+ col1.image("img/comboskin.JPG",caption="Fig 3 : Cutaneous Sensitivity",width=600,use_column_width=True)
108
+
109
+ # cap2 = "Fig 2 : Skin Risk Factors"
110
+ col2.image("img/s_exposure.JPG",width=600,use_column_width=True)
111
+
112
+
113
+
114
+ # col1,middle,col2 = st.columns((0.2,3,0.2))
115
+ with col2:
116
+
117
+ col2_par = """
118
+ - About 25,50% of the normal skins acquires one driver mutation.
119
+ - Chronic sun exposure tends to proliferate keratinocytes (cutaneous squamous cell carcinoma)
120
+ - Melanomas appears more in sporadic skin sun exposure (attributable to intermittent pattern of sun exposure with recreational activities)
121
+
122
+ """
123
+ st.markdown(col2_par)
124
+ # wrt(col2_par,tag="p",align="center")
125
+
126
+ space()
127
+
128
+
129
+
130
+ par2= """
131
+ The research studies which are the main factors that causes somatic mutations in skin. The research analyzes 46 genes per sample.
132
+ Skin samples were collected from different body areas, classified according to the pattern of sunlight exposure as
133
+ chronically-photoexposed (n = 44) and intermittently photoexposed (n = 79).
134
+ """
135
+
136
+
137
+
138
+
139
+ wrt("1.3 Skin samples analysis",tag="h4",align="left")
140
+
141
+ wrt(par2,tag="p style='font-size:21px;'",align="justify")
142
+ import plotly.graph_objects as go
143
+ set = ["Chronically Sun Exposure","Inttermittently Sun Exposure"]
144
+ n = [44,79]
145
+
146
+ fig = go.Figure(data=[go.Pie(labels=set, values=n,textinfo=f'label+percent',
147
+ insidetextorientation='radial',hole=.3)])
148
+
149
+ fig.update_layout(title_text ="Samples of the dataset depending on the sun exposure",annotations=[dict(text="46 genes per sample",font_size=20, showarrow=False)])
150
+ __,col1,__,col2,__ = st.columns((0.2,1,0.5,0.5,0.2))
151
+ col1.plotly_chart(fig,use_container_width=True)
152
+ val = round(df1.groupby("sampleID").count()["chr"].mean(),2)
153
+ pnt = round(val/46,2)
154
+ col2.header("\n\n\n")
155
+ col2.header("\n\n\n")
156
+ col2.header("\n\n\n")
157
+ col2.metric("Average of mutations per sample",val)
158
+ col2.metric("Average Percentage of genes that mutate per sample",pnt)
159
+
160
+
161
+ #### 2. Plots Dataframe visualization Conclusion
162
+ def set_chintp():
163
+ global merging
164
+ wrt("2. Analysis of somatic mutations",tag="h3")
165
+ par1 = """
166
+ We are going to discuss some plots related to the paper. Moreover, we are going to explore mutations of genes that occured within our samples as well as go beyond our data base, exploring
167
+ mutations that have cosmic ids so that we can show more detailed information about the mutation. We often face samples that are intermittently photoexposed to sunlight against the ones which are continuously exposed
168
+ to contrast two distinct populations.
169
+ """
170
+ wrt(par1,tag="p style='font-size:21px;",align="justify")
171
+
172
+ wrt("2.1 Description of the dataset",tag="h4",align="left")
173
+ par1 = """
174
+ They focused on sequencing 123 samples of healthy skin (from different areas,permanently or intermittently photo-exposed) of cancer-free
175
+ individuals. It was taken just one skin sample per individual.
176
+ From each of these samples, a deep sequencing of 46 genes (which are implicated in skin cancer) is carried out.
177
+ This means that they had to analyze 5658 genes. Out of these amount of genes they found 5214 somatic mutations, which are the ones
178
+ which we have in our dataset.
179
+ """
180
+ wrt(par1,tag="p style='font-size:21px;",align="justify")
181
+
182
+ st.image("img/dataset.png",width=600,use_column_width=True)
183
+ st.image("img/skin.png",width=600,use_column_width=True)
184
+ wrt("2.2 Average and Standard deviation of mutations",tag="h4",align="left")
185
+ par3 ="""
186
+ The research tells that if the skin were exposed more to the skin, it will be more likely to suffer somatic mutations.
187
+ The first plot represent the average and sd of mutations that have samples which are intermittently and continuously exposed to sunlight.
188
+ """
189
+ wrt(par3,tag="p style='font-size:21px;",align="justify")
190
+
191
+ #### CODE PLOT 1
192
+ merging = definemerging(df1,df2)
193
+ plot = merging.groupby("sampleID").agg({"gene_name":"count"}).merge(df2[["sampleID","UV_exposure_tissue"]],on="sampleID",how="inner")
194
+ plot = plot.rename(columns={"gene_name":"n_of_mutations"})
195
+ fig = plt.figure(figsize=(5,3))
196
+ sns.barplot(data=plot,x="UV_exposure_tissue",y="n_of_mutations")
197
+
198
+ plt.suptitle("Average and standard deviation of mutations per type tissue photoexposed")
199
+
200
+ st.pyplot(fig,clear_figure=True)
201
+
202
+
203
+
204
+ wrt("\n")
205
+ ### Plot 3
206
+
207
+ # """Number of samples that has a mutation at least one time per gene"""
208
+ wrt("2.3 Number of samples per gene captured at least one time",tag="h4",align="left")
209
+ par = """
210
+ This takes the number of times that a gene appears at least once time in the samples intermittently and continuously exposed.
211
+ The first plots is used for the samples that are intermittently exposed and the second plot is used for the ones which are continously exposed
212
+ """
213
+ print( merging.UV_exposure_tissue.unique())
214
+ wrt(par,tag="p style='font-size:21px;",align="justify")
215
+ wrt("Select the exposure tissue you want",tag="h6",align="left")
216
+ box = st.selectbox("", merging.UV_exposure_tissue.unique().tolist()+["Total"],key="key1")
217
+ if box==merging.UV_exposure_tissue.unique()[0]:
218
+
219
+
220
+ wrt("Gene proportion (Intermittently Exposed)",tag="h5",align="center")
221
+ pieplot(merging,0)
222
+ st.pyplot()
223
+ if box==merging.UV_exposure_tissue.unique()[1]:
224
+ wrt("Gene proportion (Continuously Exposed)",tag="h5",align="center")
225
+ pieplot(merging,1)
226
+ st.pyplot()
227
+ if box=="Total":
228
+ wrt("Gene proportion (Total)",tag="h5",align="center")
229
+ pieplot(merging,2)
230
+ st.pyplot()
231
+
232
+
233
+ ### Plot 4
234
+
235
+ dfgenes = mergecontintinfo(merging)
236
+ dfgenes["mean_mut"] = dfgenes["mean"]
237
+
238
+ wrt("2.4 Average and standard deviation of mutations per gene",tag="h4",align="left")
239
+ par = """
240
+ In this graph we will visualize the average and standard deviation of mutation per gene
241
+ """
242
+ wrt(par,tag="p style='font-size:21px;",align="justify")
243
+ wrt("Select the exposure tissue you want",tag="h6",align="left")
244
+ box2 = st.selectbox("", merging.UV_exposure_tissue.unique().tolist()+["Total"],key="key2")
245
+ if box2==merging.UV_exposure_tissue.unique()[0]:
246
+
247
+ fig = filterp4(dfgenes)
248
+
249
+ if box2==merging.UV_exposure_tissue.unique()[1]:
250
+ fig = filterp4(dfgenes,1)
251
+ if box2=="Total":
252
+ fig = filterp4(dfgenes,2)
253
+ st.plotly_chart(fig,use_container_width=True)
254
+
255
+
256
+ #### SECTION 2.2
257
+
258
+
259
+ wrt("2.5 Number of mutations per gene and skin phototype",tag="h4",align="left")
260
+ par ="""
261
+ These visualizations reflectas the average of mutations that are per age of samples and is divided per skin_phototype
262
+ """
263
+ wrt(par,tag="p style='font-size:21px;",align="justify")
264
+
265
+ #### CODE PLOT 2
266
+ col1,col2 = st.columns((1,1))
267
+ plot2= df2.merge(merging.groupby("sampleID").agg({"gene_name":"count"}).reset_index(),on="sampleID",how="inner")
268
+ plot2 =plot2.rename(columns={"gene_name":"n_mutations"})
269
+ plot2.n_mutations = plot2.n_mutations.astype(int)
270
+ ### plot 2.1
271
+ sns.set()
272
+ plt.figure()
273
+ sns.lmplot(data=plot2.sort_values(by="skin_phototype"),x="age",y="n_mutations",col="skin_phototype",lowess=True,col_wrap=2)
274
+ col1.pyplot()
275
+
276
+
277
+ ### plot 2.2
278
+
279
+ sns.set()
280
+ plt.figure()
281
+ sns.lmplot(data=plot2,x="age",y="n_mutations",hue="skin_phototype",lowess=True)
282
+ plt.title("Regression of number of mutations per skin phototype")
283
+ col2.pyplot()
284
+ writetxt("""Fig 4:Number of mutations per gene and skin phototype""",tag="h6",container=col2 )
285
+
286
+ wrt("2.6 Number of mutations per exposure tissue condition and sun damage tissue",tag="h4",align="left")
287
+ par ="""
288
+ We take the average of mutations that we have per type of sample (exposure_tissue type) and if it presents sun damage tissue a priori or not
289
+ """
290
+ wrt(par,tag="p style='font-size:21px;",align="justify")
291
+
292
+ fig = plt.figure(figsize=(5,1))
293
+ p = sns.displot(df2, x="UV_exposure_tissue", hue="sun_damage_tissue", multiple="dodge",height=3,aspect=4)
294
+ p.fig.set_dpi(100)
295
+ st.pyplot(clear_figure=True)
296
+
297
+
298
+
299
+ wrt("2.7 Influence of sun damage tissue",tag="h4",align="left")
300
+ par ="""
301
+ We can see that the sun damage tissue influence generally on the number of mutations in the gene.
302
+ """
303
+ wrt(par,tag="p style='font-size:21px;",align="justify")
304
+
305
+ fig = plt.figure(figsize=(5,1))
306
+ p=sns.displot(df2, x="age", hue="sun_damage_tissue", multiple="dodge",height=3,aspect=4).set(title='Age VS Sun Damage')
307
+
308
+ p.fig.set_dpi(100)
309
+ st.pyplot(clear_figure=True)
310
+
311
+
312
+ #### Age vs uv photexposure
313
+ wrt("2.8 Number of mutations per year and UV_exposure tissue",tag="h4",align="left")
314
+ par =""" We can distinguish between two sample the average of mutations that are got per year"""
315
+ wrt(par,tag="p style='font-size:21px;",align="justify")
316
+ fig = plt.figure(figsize=(5,2))
317
+ # sns.set(rc={'figure.figsize':(3,1),"figure.height":2})
318
+ ax = sns.kdeplot(data=df2, x="age", hue="UV_exposure_tissue")
319
+ plt.setp(ax.get_legend().get_texts(), fontsize='5') # for legend text
320
+ plt.setp(ax.get_legend().get_title(), fontsize='8') # for legend title
321
+ st.pyplot()
322
+ ### Mut type cus plot
323
+ wrt("2.9 How is the mutation in comparison with the reference base ?",tag="h4",align="left")
324
+ par ="""
325
+ We want to know between all the mutations occured (with and without cosmic id) what are the most common mutation type occured
326
+ """
327
+
328
+
329
+
330
+ wrt(par,tag="p style='font-size:21px;",align="justify")
331
+ merging["mut_type_cus"] = merging.apply(mut_type,axis=1)
332
+
333
+ hue = st.selectbox("Select label for you want to color: ",['sex', 'UV_exposure_tissue', 'sun_damage_tissue',
334
+ 'sun_history', 'skin_phototype'],index=1)
335
+ fig = distribution_gene(merging,hue)
336
+ # plot4 = merging.groupby(["UV_exposure_tissue","mut_type_cus"]).count().reset_index().iloc[:,:3]
337
+ # plot4 = plot4.rename(columns={"sampleID":"n_mut"})
338
+ # plot4 = plot4.sort_values(by="mut_type_cus",ascending=True)
339
+ # fig = px.bar(plot4,x="mut_type_cus",y="n_mut",color="UV_exposure_tissue",barmode="group")
340
+ st.plotly_chart(fig,use_container_width=True)
341
+
342
+ ### Muations cosmic and non cosmic id
343
+ wrt("2.10 Where does mutations usually occur ?",tag="h4",align="left")
344
+ par = "In this section we visualize where the mutations usually occurs as well as tumours that may be caused these mutations. Note that we can get this information just for all the samples that contains cosmic id."
345
+ wrt(par,tag="p style='font-size:21px;",align="justify")
346
+ # merging = definemerging(df1,df2)
347
+ #### Cosmicinformation
348
+ cosmicinfo = merging[merging.COSMIC_ID.isna()==False].groupby(["gene_name","COSMIC_ID"]).count()
349
+ #### Cosmic ids
350
+ cinfo = cosmicinfo.reset_index()
351
+ cid = cinfo["COSMIC_ID"]
352
+
353
+ ### Read info scrapped
354
+
355
+ cosbase = read_scrap()
356
+ cosmicdb = gendfclean(cosbase,cid)
357
+ cosmerge = merging.merge(cosmicdb,left_on="COSMIC_ID",right_on="cosmic_id",how="inner")
358
+ cols = ["tissue","histology"]
359
+ p1,p2 = st.columns((1,1))
360
+ for col,p in zip(cols,[p1,p2]):
361
+ dtemp = get_N_common(cosmerge,col)
362
+ #### Intermittently exposed
363
+ #### Continuously exposed
364
+ fig = px.bar(dtemp,x=dtemp.columns[0],y=dtemp.columns[1],color=dtemp.columns[2],barmode="group")
365
+ p.plotly_chart(fig)
366
+
367
+ ### Percentage of VAF
368
+ wrt("2.11 Percentage of VAF captured in all mutations and its distribution. Depth Coverage distribution",tag="h4",align="left")
369
+ par=""" We want to proof that somatic mutations are tough to capture . To do that we have plot the variant allele frequency
370
+ distribution of the mutations to proof that the majority of them have a low score VAF
371
+ """
372
+ wrt(par,tag="p style='font-size:21px;'",align="justify")
373
+ res = str(round(((df1.shape[0]-sum(df1['VAF']>0.05))/df1.shape[0])*100,2))+'%'
374
+
375
+ # plt.figure(figsize=(5,3))
376
+
377
+ fig = px.box(df1,y="VAF")
378
+ fig2 = px.box(df1,y="DP")
379
+ __,col1,__,col2,__ = st.columns((0.3,1,0.3,1,0.3))
380
+ # plt.text('Those outliers are the ones higher than 5%. There are',str(df1.shape[0]-sum(df1['VAF']<0.05)),'mutations higher than 5%.')
381
+ col1.plotly_chart(fig,clear_figure=True,use_container_width=True)
382
+ col2.plotly_chart(fig2,clear_figure=True,use_container_width=True)
383
+ par =f"""
384
+ Those outliers are the ones higher than 5%. There are {str(df1.shape[0]-sum(df1['VAF']<0.05))} mutations higher than 5%.
385
+ """
386
+ wrt(par,tag="p",align="center")
387
+
388
+
389
+
390
+ wrt("2.12 Evolution of the C>T mutations with the age",tag="h4",align="left")
391
+ par =f"""
392
+ The plot shows us that the number of C>T (a UV associated mutation) mutations increases with the evolution of the age.
393
+ """
394
+ wrt(par,tag="p style='font-size:21px;'",align="center")
395
+ plts = merging[merging.mut_type=="C>T"].groupby("age").count().reset_index()[["age","VAF"]]
396
+ plts.rename(columns={"VAF":"C>T"},inplace=True)
397
+ __,col1,__ = st.columns((1,3,1))
398
+ fig = plt.figure(5,2)
399
+ sns.lmplot(
400
+ data=plts,
401
+ x="C>T",
402
+ y="age",
403
+ logx=True,
404
+ height=3, aspect=3
405
+ ).set(title="Logarithmic increase of number of C>T")
406
+ col1.pyplot()
407
+
408
+ wrt("2.13 Mean of pathogenic score in different genes",tag="h4",align="left")
409
+ # par =f"""
410
+ # The plot shows us that the number of C>T (a UV associated mutation) mutations increases with the evolution of the age.
411
+ # """
412
+ # wrt(par,tag="p style='font-size:21px;'",align="center")
413
+ # plts = merging[merging.mut_type=="C>T"].groupby("age").count().reset_index()[["age","VAF"]]
414
+ # plts.rename(columns={"VAF":"C>T"},inplace=True)
415
+ # __,col1,__ = st.columns((1,3,1))
416
+ # fig = plt.figure(5,2)
417
+ # sns.lmplot(data=plts,x="C>T",y="age",logx=True,height=3,aspect=3).set(title="Logarithmic increase of number of C>T")
418
+ # col1.pyplot()
419
+ dbinfo = merging.merge(cosmicdb,left_on="COSMIC_ID",right_on="cosmic_id",how="left")
420
+ df12 = dbinfo[dbinfo.cosmic_id.isna()==False].groupby("gene_name").mean().reset_index()[["gene_name","score"]].sort_values(by="score",ascending=False)
421
+ ___,col,___ = st.columns((2,1,2))
422
+ with col:
423
+ st.dataframe(df12)
424
+
425
+
426
+ return None
427
+ def cidvars():
428
+
429
+ wrt("3. Individual gene information",tag="h2")
430
+ par1 = """
431
+ We are going to explore mutations of genes that occured within our samples as well as go beyond our data base, exploring
432
+ mutations that have cosmic ids so that we can show more detailed information about the mutation.
433
+ """
434
+ wrt(par1,tag="p",align="center")
435
+
436
+
437
+
438
+
439
+ wrt("3.1 Where does mutations usually occur ?",tag="h3",align="left")
440
+ par = "In this section we visualize where the mutations usually occurs as well as tumours that may be caused these mutations. Note that we can get this information just for all the samples that contains cosmic id"
441
+ wrt(par,tag="p",align="justify")
442
+ merging = definemerging(df1,df2)
443
+ #### Cosmicinformation
444
+ cosmicinfo = merging[merging.COSMIC_ID.isna()==False].groupby(["gene_name","COSMIC_ID"]).count()
445
+ #### Cosmic ids
446
+ cinfo = cosmicinfo.reset_index()
447
+ cid = cinfo["COSMIC_ID"]
448
+
449
+ ### Read info scrapped
450
+
451
+ cosbase = read_scrap()
452
+ cosmicdb = gendfclean(cosbase,cid)
453
+ cosmerge = merging.merge(cosmicdb,left_on="COSMIC_ID",right_on="cosmic_id",how="inner")
454
+ cols = ["tissue","histology"]
455
+ p1,p2 = st.columns((1,1))
456
+ for col,p in zip(cols,[p1,p2]):
457
+ dtemp = get_N_common(cosmerge,col)
458
+ #### Intermittently exposed
459
+ #### Continuously exposed
460
+ fig = px.bar(dtemp,x=dtemp.columns[0],y=dtemp.columns[1],color=dtemp.columns[2],barmode="group")
461
+ p.plotly_chart(fig)
462
+
463
+ ### Mut type cus plot
464
+ wrt("3.2 How is the mutation in comparison with the reference base ?",tag="h3",align="left")
465
+ par ="""
466
+ We want to know between all the mutations occured (with and without cosmic id) what are the most common mutation type occured
467
+ """
468
+ wrt(par,tag="p",align="justify")
469
+ merging["mut_type_cus"] = merging.apply(mut_type,axis=1)
470
+
471
+ plot4 = merging.groupby(["UV_exposure_tissue","mut_type_cus"]).count().reset_index().iloc[:,:3]
472
+ plot4 = plot4.rename(columns={"sampleID":"n_mut"})
473
+ fig = px.bar(plot4,x="mut_type_cus",y="n_mut",color="UV_exposure_tissue",barmode="group")
474
+
475
+ col1.plotly_chart(fig,use_container_width=True)
476
+ col2.plotly_chart()
477
+ return None
478
+
479
+ ## Slide in which we will explain the pipeline followed in order to analyze the two samples we have.
480
+ def set_igv():
481
+
482
+ wrt("3. Sample Analysis (IGV)",tag="h2")
483
+ par1 = """
484
+ Explanation of the steps followed to process our raw samples into files which can be interpreted with the IGV program (VCF files).
485
+ """
486
+ wrt(par1,tag="p style='font-size:21px;'",align="center")
487
+
488
+
489
+
490
+
491
+ wrt("3.1 Which Samples do we have?",tag="h4",align="left")
492
+ par2 = """
493
+ We wanted two samples of very oposite individuals, with the goal of being able to appreciate noticable differences when sequencing
494
+ the genes.
495
+
496
+ - AG0312: Sample of a Male individual of 70 years old, whose skin sample is Intermittently-photoexposed, and it has a skin phototype of I.
497
+ - AG0322: Sample of a Female individual of 38 years old, whose skin sample is Chronically-photoexposed, and it has a skin phototype of IV.
498
+
499
+ """
500
+
501
+ wrt(par2,tag="p style='font-size:21px;'",align="justify")
502
+
503
+
504
+ wrt("3.2 Processing Steps",tag="h4",align="left")
505
+ par3 = """
506
+ - 1. Quality Control and Alignment
507
+ Initially, both samples were in bam format, thus are samples of good quality (since they passed the quality step) and also are aligned.
508
+ Thus we started our preprocessing by refinning the Alignment.
509
+ """
510
+ par4 = """
511
+ - 2. Refinement of Alignment
512
+ Since for performing Variant Calling we need to have our samples sorted by genomic positions. Once sorted we mark
513
+ the duplicates (in these exist) so that the these are ignored in the Variant Calling step.
514
+ Finally we just index the resulting bam files for its future visualization.
515
+ """
516
+ par5 = """
517
+ - 3. Variant Calling
518
+ Once we arrived to this section we had to solve an error which initially we didn't knew why it happend. The error ocurred when
519
+ we tried to identify the active regions (error shown on the below image).
520
+ The problem consited on that, in the refined bam the chromosomes were represented just with their number, and in the reference
521
+ genome (hg19) chromosomes were represented as "chr N". Thus just by eliminating the "chr" part in the reference genome, the
522
+ variant calling could be accomplished.
523
+ """
524
+
525
+ par6 = """
526
+ - 4. Visualization with IGV
527
+ With the variant calling files computed, we are ready now to display the variants in our Alignments.
528
+ We tried to do a simple task, which was just to try to find the mutations which the researchers of the paper found for our samples.
529
+ For doing this we used the chromosome and position indicators of their dataset.
530
+ Near the positions idicated we found the mentioned mutation in the dataset, however not in the exact position.
531
+ """
532
+ wrt(par3,tag="p style='font-size:21px;'",align="justify")
533
+ wrt(par4,tag="p style='font-size:21px;'",align="justify")
534
+ wrt(par5,tag="p style='font-size:21px;'",align="justify")
535
+ st.image("img/error.png",use_column_width=True)
536
+ wrt(par6,tag="p style='font-size:21px;'",align="justify")
537
+ st.image("img/chartc.png",use_column_width=True)
538
+ st.header("\n")
539
+ st.header("\n")
540
+ st.header("\n")
541
+
542
+ wrt("Igv Images",tag="h1",align="center")
543
+ st.header("\n")
544
+ st.header("\n")
545
+ st.header("\n")
546
+
547
+
548
+ __,col1,__,col2,__ = st.columns((0.2,1.5,0.3,1,0.2))
549
+ with col1:
550
+ st.image("img/col1igv.png",use_column_width=True,caption="Fig 5: Igv rep AG0312")
551
+ with col2:
552
+ st.image("img/col2igv.png",use_column_width=True,caption="Fig 6: Igv representation AG0322")
553
+ return None
554
+
555
+
556
+ if menu == '1. Intro':
557
+ set_home()
558
+ elif menu == '2. Analysis of somatic mutations':
559
+ set_chintp()
560
+ # elif menu == '3. Individual sample information':
561
+ # cidvars()
562
+
563
+ elif menu == '3. Sample Analysis (IGV)':
564
+ set_igv()
565
+ # elif menu == 'Otras variables':
566
+ # set_otras_variables()
567
+ # elif menu == 'Relaciones entre variables':
568
+ # set_relations()
569
+ # elif menu == 'Matrices de correlación':
570
+ # set_arrays()
dataset.png ADDED
descarga.jfif ADDED
Binary file (5.93 kB). View file
 
functions.py ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pickle
3
+ import pandas as pd
4
+ import requests
5
+ from selenium import webdriver
6
+ import matplotlib.pyplot as plt
7
+ #Simple assignment
8
+ from selenium.webdriver import Firefox
9
+ from selenium.webdriver.common.keys import Keys
10
+ from selenium.common.exceptions import NoSuchElementException
11
+ import requests
12
+ import os
13
+ import seaborn as sns
14
+ from collections import Counter
15
+ import plotly.express as px
16
+ import streamlit as st
17
+
18
+
19
+
20
+ ### Scrap the cosmic id information
21
+ # ### FRAMEWORKS NEEDED
22
+
23
+ def scrap():
24
+ #### Setting options to the driver
25
+ options = webdriver.FirefoxOptions()
26
+ options.add_argument('--headless')
27
+ options.add_argument('--no-sandbox')
28
+ options.add_argument('--disable-dev-shm-usage')
29
+ options.capabilities
30
+ ### Setting options of webdriver
31
+ # a) Setting the chromedriver
32
+ browser = Firefox(options=options,executable_path=r"C:\Users\Pablo\OneDrive\Documents\Documentos\Escuela Politécnica Superior Leganés\4 AÑO\ASIGNATURAS\1 CUATRI\WEB ANALYTICS\PART 2\Milestone3\geckodriver.exe")
33
+ ### Functions and execution to run the scrapping
34
+
35
+
36
+ def getinfofromtable(oddrows:list,score:float,headertable)->list:
37
+ rows = []
38
+ for row in oddrows:
39
+ cols = []
40
+ for (i,col) in enumerate(row.find_elements_by_css_selector("td")):
41
+ if i==headertable.index( 'Primary Tissue') or i==headertable.index('Primary Histology') or i==headertable.index('Zygosity'):
42
+ cols.append(col.text)
43
+ cols.append(score)
44
+ rows.append(cols)
45
+ return rows
46
+ def getinfocosmic(mutationid):
47
+ import time
48
+ search = browser.find_element_by_id('search-field')
49
+ search = search.find_element_by_class_name("text_def")
50
+ search.send_keys(mutationid)
51
+ search.send_keys(Keys.RETURN)
52
+ time.sleep(5)
53
+ try:
54
+ container = browser.find_element_by_id("section-list")
55
+
56
+ except NoSuchElementException:
57
+ return []
58
+
59
+ try:
60
+
61
+ subq1 = container.text[container.text.find("score")+len("score"):]
62
+ score = float(subq1[:subq1.find(")")].strip())
63
+ except ValueError:
64
+ score = 0
65
+
66
+
67
+
68
+ section = browser.find_element_by_id("DataTables_Table_0")
69
+
70
+
71
+ headertable = [header.text for header in section.find_element_by_tag_name("thead").find_elements_by_tag_name("th")]
72
+
73
+ oddrows = section.find_elements_by_class_name("odd")
74
+ evenrows = section.find_elements_by_class_name("even")
75
+
76
+ l1 = getinfofromtable(oddrows,score,headertable)
77
+ l1.extend(getinfofromtable(evenrows,score,headertable))
78
+
79
+ # browser.close()
80
+ return l1
81
+ ## Looking for cosmic id info
82
+ cosl = []
83
+ browser.get("https://cancer.sanger.ac.uk/cosmic")
84
+ for cos in cosmicinfo.reset_index()["COSMIC_ID"].iloc[20:]:
85
+ if cos.find(",")!=-1:
86
+ cos = cos.split(",")[0]
87
+
88
+ cosl.append(getinfocosmic(cos))
89
+ browser.get("https://cancer.sanger.ac.uk/cosmic")
90
+ ### Pieplots
91
+ def pieplot(merging,id=0):
92
+ genecount = merging.groupby(by=["gene_name","UV_exposure_tissue","sampleID"]).count().reset_index()
93
+ if id==0:
94
+ gtype = genecount[genecount.UV_exposure_tissue=="Intermittently-photoexposed"]
95
+ if id ==1 :
96
+ gtype = genecount[genecount.UV_exposure_tissue=="Chronically-photoexposed"]
97
+ else:
98
+ gtype = genecount
99
+
100
+ gtype = gtype.groupby("gene_name").count()["sampleID"].reset_index()
101
+ gtype.sort_values(by="sampleID",ascending=False,inplace=True)
102
+ #define Seaborn color palette to use
103
+ colors = sns.color_palette('pastel')[0:len(gtype)]
104
+ #create pie chart
105
+ # plt.suptitle("Gene Occuring for different genes")
106
+ plt.pie(gtype.sampleID, labels =gtype.gene_name, colors = colors, autopct='%.0f%%',radius=2,textprops={"fontsize":9})
107
+ plt.show()
108
+
109
+ ### Depending on what result you want you return one or another
110
+ def filterp4(dfgenes,id=0):
111
+ if id==0 or id==1:
112
+
113
+ if id==0:
114
+ chexposed= dfgenes[dfgenes.UV_exposure_tissue=="Intermittently-photoexposed"].sort_values(by=["mean_mut"],ascending=False)
115
+ if id==1:
116
+ chexposed= dfgenes[dfgenes.UV_exposure_tissue=="Chronically-photoexposed"].sort_values(by=["mean_mut"],ascending=False)
117
+ return px.bar(chexposed,x="gene_name",y="mean_mut",error_y="std")
118
+ if id==2:
119
+ return px.bar(dfgenes,x="gene_name",y="mean_mut",color="UV_exposure_tissue",barmode='group',error_y="std")
120
+
121
+ ### Read scrapping done with cosmic ids
122
+ def read_scrap()->list:
123
+ with open('my_pickle_file.pickle', 'rb') as f :
124
+ cosbase = pickle.load(f)
125
+ return cosbase
126
+ ### GendfClean
127
+ def gendfclean(cosbase,cid)->pd.DataFrame:
128
+ dfd = {"tissue": None , "histology": None,"zygosity": None, "score": None }
129
+ for i,key in enumerate(list(dfd.keys())):
130
+ dfd[key] = list(map(lambda x : np.array(x)[:,i].tolist() if x!=[] else [] ,cosbase))
131
+
132
+ dfd["cosmic_id"] = cid.tolist()
133
+ cosmicdb = pd.DataFrame(dfd)
134
+ cosmicdb = cosmicdb[(cosmicdb['tissue'].map(lambda d: len(d)) > 0) & (cosmicdb['histology'].map(lambda d: len(d)) > 0) & (cosmicdb['zygosity'].map(lambda d: len(d)) > 0) & (cosmicdb['score'].map(lambda d: len(d)) > 0) ]
135
+
136
+ cosmicdb["score"] = cosmicdb.score.apply(lambda x: float(x[0]))
137
+
138
+ return cosmicdb
139
+
140
+ ### Look for stats of a gene
141
+ def inputgene(lookforgene,merging,id =0)->dict:
142
+ ### id = 0--> Intermittently exposed
143
+ ### id = 1--> Continuously exposed
144
+ genecount = merging.groupby(by=["gene_name","UV_exposure_tissue","sampleID"]).count().reset_index()
145
+ tgene = genecount[genecount.gene_name==lookforgene]
146
+ if id==0:
147
+ ph_gene = tgene[tgene.UV_exposure_tissue=='Intermittently-photoexposed']
148
+ else:
149
+ ph_gene = tgene[tgene.UV_exposure_tissue=="Chronically-photoexposed"]
150
+ ### Statistiacs about gene|samples
151
+ stats = ph_gene.chr.describe()
152
+ dc = dict(stats)
153
+ dc["gene_name"] = lookforgene
154
+ if id==0:
155
+ dc["UV_exposure_tissue"] = 'Intermittently-photoexposed'
156
+ else:
157
+ dc["UV_exposure_tissue"] = 'Chronically-photoexposed'
158
+ return dc
159
+ ### Look for stats of all genes
160
+ def gene_exposed(merging,id=0):
161
+ return pd.DataFrame(list(map(lambda gene: inputgene(gene,merging,id),merging.gene_name.unique())))
162
+ ### Merge stats for continuous and intermittently exposed
163
+ def mergecontintinfo(merging):
164
+ ### Continuously Exposed
165
+ cont_exposed_info = gene_exposed(merging,1)
166
+ ### Intermittently Exposed
167
+ int_exposed_info = gene_exposed(merging,0)
168
+ return pd.concat([cont_exposed_info,int_exposed_info],axis=0)
169
+
170
+ #### Common tissues, zygosities and histologies
171
+ def explodecommon(bd,N,col):
172
+ return Counter(bd[col].apply(lambda x: list(x.keys())).explode()).most_common(N)
173
+ def pdcommon(db,col,uv:str)->pd.DataFrame:
174
+ df = pd.DataFrame(db).rename(columns={0:col,1:"Times_{}".format(col)})
175
+ df["UV_exposure_tissue"] = uv
176
+ return df
177
+ def get_N_common(df,col,N=10)->pd.DataFrame:
178
+ cosm = df.copy(True)
179
+ cosm[col] = cosm[col].apply(lambda x: Counter(x))
180
+ intcosm = cosm[cosm.UV_exposure_tissue=="Intermittently-photoexposed"]
181
+ contcosm = cosm[cosm.UV_exposure_tissue=="Chronically-photoexposed"]
182
+
183
+ infotissues = explodecommon(cosm,N,col)
184
+ inttissues = explodecommon(intcosm,N,col)
185
+ contissues = explodecommon(contcosm,N,col)
186
+
187
+ df1 = pdcommon(infotissues,col,"Total")
188
+ df2 = pdcommon(inttissues,col,"Intermittently-photoexposed")
189
+ df3 = pdcommon(contissues,col,"Chronically-photoexposed")
190
+ return pd.concat([df1,df2,df3],axis=0)
191
+
192
+ ### Deatiled information of mutation type
193
+ def mut_type(x):
194
+ if x.mut_type=="Indel":
195
+
196
+ if len(x.ref)>len(x.mut):
197
+ return "Del"
198
+ elif len(x.mut)>len(x.ref):
199
+ return "In"
200
+ # if len(x.ref)>1 and len(x.mut)>1:
201
+
202
+ return x.ref+">"+x.mut
203
+ return x.mut_type
204
+
205
+
206
+ def distribution_gene(df,hue):
207
+
208
+
209
+ plot4 = df.groupby([hue,"mut_type_cus"]).count().reset_index().iloc[:,:3]
210
+ plot4 = plot4.rename(columns={"sampleID":"n_mut"})
211
+ plot4 = plot4.sort_values(by="mut_type_cus",ascending=True)
212
+ fig = px.bar(plot4,x="mut_type_cus",y="n_mut",color=hue,barmode="group")
213
+ return fig
img/base.png ADDED
img/chartc.png ADDED
img/col1igv.png ADDED
img/col2igv.png ADDED
img/comboskin.JPG ADDED
img/comboskin2.JPG ADDED
img/dataset.png ADDED
img/error.png ADDED
img/melanocyte.JPG ADDED
img/nocream.jpg ADDED
img/pap0.JPG ADDED
img/pap1.JPG ADDED
img/risk_factors.png ADDED
img/s_exposure.JPG ADDED
img/skin.png ADDED
img/skincream.jpg ADDED
my_pickle_file.pickle ADDED
Binary file (91.5 kB). View file
 
requirements.txt ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ altair==4.1.0
2
+ argon2-cffi==21.1.0
3
+ astor==0.8.1
4
+ attrs==21.2.0
5
+ backcall==0.2.0
6
+ base58==2.1.1
7
+ bleach==4.1.0
8
+ blinker==1.4
9
+ cachetools==4.2.4
10
+ certifi==2021.10.8
11
+ cffi==1.15.0
12
+ charset-normalizer==2.0.8
13
+ click==7.1.2
14
+ colorama==0.4.4
15
+ debugpy==1.5.1
16
+ decorator==5.1.0
17
+ defusedxml==0.7.1
18
+ easydict==1.9
19
+ entrypoints==0.3
20
+ gitdb==4.0.9
21
+ GitPython==3.1.24
22
+ idna==3.3
23
+ imageio==2.13.1
24
+ ipykernel==6.5.1
25
+ ipython==7.30.0
26
+ ipython-genutils==0.2.0
27
+ ipywidgets==7.6.5
28
+ jedi==0.18.1
29
+ Jinja2==3.0.3
30
+ joblib==1.1.0
31
+ jsonschema==4.2.1
32
+ jupyter-client==7.1.0
33
+ jupyter-core==4.9.1
34
+ jupyterlab-pygments==0.1.2
35
+ jupyterlab-widgets==1.0.2
36
+ lxml==4.6.4
37
+ MarkupSafe==2.0.1
38
+ matplotlib-inline==0.1.3
39
+ mistune==0.8.4
40
+ multitasking==0.0.10
41
+ nbclient==0.5.9
42
+ nbconvert==6.3.0
43
+ nbformat==5.1.3
44
+ nest-asyncio==1.5.1
45
+ networkx==2.6.3
46
+ notebook==6.4.6
47
+ numpy==1.21.4
48
+ opencv-python==4.5.4.60
49
+ packaging==21.3
50
+ pandas==1.3.4
51
+ pandocfilters==1.5.0
52
+ parso==0.8.2
53
+ pickleshare==0.7.5
54
+ Pillow==8.4.0
55
+ pip==21.3.1
56
+ prometheus-client==0.12.0
57
+ prompt-toolkit==3.0.23
58
+ protobuf==3.19.1
59
+ pyarrow==6.0.1
60
+ pycparser==2.21
61
+ pydeck==0.7.1
62
+ pydicom==2.2.2
63
+ Pygments==2.10.0
64
+ Pympler==0.9
65
+ pyparsing==3.0.6
66
+ pyrsistent==0.18.0
67
+ python-dateutil==2.8.2
68
+ pytz==2021.3
69
+ pytz-deprecation-shim==0.1.0.post0
70
+ PyWavelets==1.2.0
71
+ pywin32==302
72
+ pywinpty==1.1.6
73
+ PyYAML==6.0
74
+ pyzmq==22.3.0
75
+ requests==2.26.0
76
+ scikit-image==0.19.0
77
+ scikit-learn==1.0.1
78
+ scipy==1.7.3
79
+ Send2Trash==1.8.0
80
+ six==1.16.0
81
+ sklearn==0.0
82
+ smmap==5.0.0
83
+ streamlit==1.2.0
84
+ tensorboardX==2.4.1
85
+ terminado==0.12.1
86
+ testpath==0.5.0
87
+ threadpoolctl==3.0.0
88
+ tifffile==2021.11.2
89
+ toml==0.10.2
90
+ toolz==0.11.2
91
+ torch==1.10.0
92
+ torchvision==0.11.1
93
+ torchxrayvision==0.0.32
94
+ tornado==6.1
95
+ tqdm==4.62.3
96
+ traitlets==5.1.1
97
+ typing_extensions==4.0.0
98
+ tzdata==2021.5
99
+ tzlocal==4.1
100
+ urllib3==1.26.7
101
+ validators==0.18.2
102
+ watchdog==2.1.6
103
+ wcwidth==0.2.5
104
+ webencodings==0.5.1
105
+ widgetsnbextension==3.5.2
106
+ yfinance==0.1.67