-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnalisis.html
More file actions
1142 lines (1096 loc) · 85.6 KB
/
Analisis.html
File metadata and controls
1142 lines (1096 loc) · 85.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
<meta charset="utf-8">
<meta name="generator" content="quarto-1.3.450">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>RNASeq Navarra</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
div.columns{display: flex; gap: min(4vw, 1.5em);}
div.column{flex: auto; overflow-x: auto;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
ul.task-list li input[type="checkbox"] {
width: 0.8em;
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
vertical-align: middle;
}
/* CSS for syntax highlighting */
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
}
pre.numberSource { margin-left: 3em; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
</style>
<script src="Analisis_files/libs/clipboard/clipboard.min.js"></script>
<script src="Analisis_files/libs/quarto-html/quarto.js"></script>
<script src="Analisis_files/libs/quarto-html/popper.min.js"></script>
<script src="Analisis_files/libs/quarto-html/tippy.umd.min.js"></script>
<script src="Analisis_files/libs/quarto-html/anchor.min.js"></script>
<link href="Analisis_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="Analisis_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles">
<script src="Analisis_files/libs/bootstrap/bootstrap.min.js"></script>
<link href="Analisis_files/libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
<link href="Analisis_files/libs/bootstrap/bootstrap.min.css" rel="stylesheet" id="quarto-bootstrap" data-mode="light">
</head>
<body class="fullcontent">
<div id="quarto-content" class="page-columns page-rows-contents page-layout-article">
<main class="content" id="quarto-document-content">
<header id="title-block-header" class="quarto-title-block default">
<div class="quarto-title">
<h1 class="title">RNASeq Navarra</h1>
</div>
<div class="quarto-title-meta">
</div>
</header>
<section id="rnaseq-report" class="level1">
<h1>RNASeq Report</h1>
<p>All the data of this analysis can be found in !(https://github.com/irycisBioinfo/ReportNavarraRNASeq)</p>
<div class="cell">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(DESeq2)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Cargando paquete requerido: S4Vectors</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Cargando paquete requerido: stats4</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Cargando paquete requerido: BiocGenerics</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>
Adjuntando el paquete: 'BiocGenerics'</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following objects are masked from 'package:stats':
IQR, mad, sd, var, xtabs</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following objects are masked from 'package:base':
anyDuplicated, aperm, append, as.data.frame, basename, cbind,
colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find,
get, grep, grepl, intersect, is.unsorted, lapply, Map, mapply,
match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
Position, rank, rbind, Reduce, rownames, sapply, setdiff, table,
tapply, union, unique, unsplit, which.max, which.min</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>
Adjuntando el paquete: 'S4Vectors'</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following object is masked from 'package:utils':
findMatches</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following objects are masked from 'package:base':
expand.grid, I, unname</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Cargando paquete requerido: IRanges</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Cargando paquete requerido: GenomicRanges</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Cargando paquete requerido: GenomeInfoDb</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Cargando paquete requerido: SummarizedExperiment</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Cargando paquete requerido: MatrixGenerics</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Cargando paquete requerido: matrixStats</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>
Adjuntando el paquete: 'MatrixGenerics'</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following objects are masked from 'package:matrixStats':
colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
colWeightedMeans, colWeightedMedians, colWeightedSds,
colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
rowWeightedSds, rowWeightedVars</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Cargando paquete requerido: Biobase</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>
Adjuntando el paquete: 'Biobase'</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following object is masked from 'package:MatrixGenerics':
rowMedians</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following objects are masked from 'package:matrixStats':
anyMissing, rowMedians</code></pre>
</div>
<div class="sourceCode cell-code" id="cb24"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(tidyverse)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.5
✔ forcats 1.0.0 ✔ stringr 1.5.1
✔ ggplot2 3.5.1 ✔ tibble 3.2.1
✔ lubridate 1.9.3 ✔ tidyr 1.3.1
✔ purrr 1.0.2 </code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ lubridate::%within%() masks IRanges::%within%()
✖ dplyr::collapse() masks IRanges::collapse()
✖ dplyr::combine() masks Biobase::combine(), BiocGenerics::combine()
✖ dplyr::count() masks matrixStats::count()
✖ dplyr::desc() masks IRanges::desc()
✖ tidyr::expand() masks S4Vectors::expand()
✖ dplyr::filter() masks stats::filter()
✖ dplyr::first() masks S4Vectors::first()
✖ dplyr::lag() masks stats::lag()
✖ ggplot2::Position() masks BiocGenerics::Position(), base::Position()
✖ purrr::reduce() masks GenomicRanges::reduce(), IRanges::reduce()
✖ dplyr::rename() masks S4Vectors::rename()
✖ lubridate::second() masks S4Vectors::second()
✖ lubridate::second<-() masks S4Vectors::second<-()
✖ dplyr::slice() masks IRanges::slice()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors</code></pre>
</div>
<div class="sourceCode cell-code" id="cb27"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(ggrepel)</span>
<span id="cb27-2"><a href="#cb27-2" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(ggsci)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="load-data" class="level1">
<h1>Load Data</h1>
<div class="cell">
<div class="sourceCode cell-code" id="cb28"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb28-1"><a href="#cb28-1" aria-hidden="true" tabindex="-1"></a>reads_genes <span class="ot"><-</span> <span class="fu">read_tsv</span>(<span class="st">"/storage2/Hincode/S-60-47-61-2024-RNASeq_0240725_LH00206_0043_A22MLN2LT3/navarra/results_strand/star_salmon/salmon.merged.gene_counts_length_scaled.tsv"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Rows: 63140 Columns: 8
── Column specification ────────────────────────────────────────────────────────
Delimiter: "\t"
chr (2): gene_id, gene_name
dbl (6): X1O, X2O, X3O, P11_1, P11_2, P11_3
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.</code></pre>
</div>
<div class="sourceCode cell-code" id="cb30"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb30-1"><a href="#cb30-1" aria-hidden="true" tabindex="-1"></a>reads_transcripts <span class="ot"><-</span> <span class="fu">read_tsv</span>(<span class="st">"/storage2/Hincode/S-60-47-61-2024-RNASeq_0240725_LH00206_0043_A22MLN2LT3/navarra/results_strand/star_salmon/salmon.merged.transcript_counts.tsv"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Rows: 254129 Columns: 8
── Column specification ────────────────────────────────────────────────────────
Delimiter: "\t"
chr (2): tx, gene_id
dbl (6): X1O, X2O, X3O, P11_1, P11_2, P11_3
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.</code></pre>
</div>
<div class="sourceCode cell-code" id="cb32"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb32-1"><a href="#cb32-1" aria-hidden="true" tabindex="-1"></a>ids <span class="ot"><-</span> <span class="fu">read_tsv</span>(<span class="st">"/storage2/Hincode/S-60-47-61-2024-RNASeq_0240725_LH00206_0043_A22MLN2LT3/navarra/results_strand/star_salmon/salmon_tx2gene.tsv"</span>, <span class="at">col_names =</span> <span class="fu">c</span>(<span class="st">"Transcrip_ID"</span>,<span class="st">"Gene_ID"</span>,<span class="st">"Gene_Name"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Rows: 254129 Columns: 3
── Column specification ────────────────────────────────────────────────────────
Delimiter: "\t"
chr (3): Transcrip_ID, Gene_ID, Gene_Name
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.</code></pre>
</div>
<div class="sourceCode cell-code" id="cb34"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb34-1"><a href="#cb34-1" aria-hidden="true" tabindex="-1"></a>metadata <span class="ot"><-</span> <span class="fu">read_csv</span>(<span class="st">"/storage2/Hincode/S-60-47-61-2024-RNASeq_0240725_LH00206_0043_A22MLN2LT3/navarra/metadata.csv"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Rows: 6 Columns: 2
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (2): Sample, Grupo
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.</code></pre>
</div>
</div>
<div class="cell">
<div class="sourceCode cell-code" id="cb36"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb36-1"><a href="#cb36-1" aria-hidden="true" tabindex="-1"></a>mart <span class="ot"><-</span> biomaRt<span class="sc">::</span><span class="fu">useMart</span>(<span class="at">biomart =</span> <span class="st">"ENSEMBL_MART_ENSEMBL"</span>,</span>
<span id="cb36-2"><a href="#cb36-2" aria-hidden="true" tabindex="-1"></a> <span class="at">dataset =</span> <span class="st">"hsapiens_gene_ensembl"</span>,</span>
<span id="cb36-3"><a href="#cb36-3" aria-hidden="true" tabindex="-1"></a> <span class="at">host =</span> <span class="st">'https://www.ensembl.org'</span>)</span>
<span id="cb36-4"><a href="#cb36-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb36-5"><a href="#cb36-5" aria-hidden="true" tabindex="-1"></a>ttg <span class="ot"><-</span> biomaRt<span class="sc">::</span><span class="fu">getBM</span>(</span>
<span id="cb36-6"><a href="#cb36-6" aria-hidden="true" tabindex="-1"></a> <span class="at">attributes =</span> <span class="fu">c</span>(<span class="st">"ensembl_transcript_id"</span>,<span class="st">"ensembl_gene_id"</span>,<span class="st">"external_gene_name"</span>, <span class="st">"description"</span>,</span>
<span id="cb36-7"><a href="#cb36-7" aria-hidden="true" tabindex="-1"></a> <span class="st">"entrezgene_id"</span>,<span class="st">"gene_biotype"</span>,<span class="st">"transcript_biotype"</span>),</span>
<span id="cb36-8"><a href="#cb36-8" aria-hidden="true" tabindex="-1"></a> <span class="at">mart =</span> mart)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
</section>
<section id="transcript-level" class="level1">
<h1>Transcript Level</h1>
<div class="cell">
<div class="sourceCode cell-code" id="cb37"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb37-1"><a href="#cb37-1" aria-hidden="true" tabindex="-1"></a>table_sum <span class="ot"><-</span> reads_transcripts <span class="sc">%>%</span> </span>
<span id="cb37-2"><a href="#cb37-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">pivot_longer</span>(<span class="at">names_to =</span> <span class="st">"Sample"</span>, <span class="at">values_to =</span> <span class="st">"counts"</span>, <span class="sc">-</span>(tx<span class="sc">:</span>gene_id)) <span class="sc">%>%</span> </span>
<span id="cb37-3"><a href="#cb37-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">group_by</span>(tx,gene_id) <span class="sc">%>%</span> </span>
<span id="cb37-4"><a href="#cb37-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">TotalGeneCounts =</span> <span class="fu">sum</span>(counts), </span>
<span id="cb37-5"><a href="#cb37-5" aria-hidden="true" tabindex="-1"></a> <span class="at">TotalZerosCounts =</span> <span class="fu">sum</span>(counts<span class="sc">==</span><span class="dv">0</span>))</span>
<span id="cb37-6"><a href="#cb37-6" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb37-7"><a href="#cb37-7" aria-hidden="true" tabindex="-1"></a>table_sum <span class="sc">%>%</span> <span class="fu">ggplot</span>(<span class="fu">aes</span>(<span class="at">x =</span> TotalGeneCounts)) <span class="sc">+</span> <span class="fu">geom_histogram</span>() <span class="sc">+</span> <span class="fu">geom_vline</span>(<span class="at">xintercept =</span> <span class="dv">10</span>)<span class="sc">+</span><span class="fu">scale_x_log10</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning in scale_x_log10(): log-10 transformation introduced infinite values.</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 601074 rows containing non-finite outside the scale range
(`stat_bin()`).</code></pre>
</div>
<div class="cell-output-display">
<p><img src="Analisis_files/figure-html/unnamed-chunk-4-1.png" class="img-fluid" width="672"></p>
</div>
<div class="sourceCode cell-code" id="cb41"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb41-1"><a href="#cb41-1" aria-hidden="true" tabindex="-1"></a>table_counts <span class="ot"><-</span> table_sum <span class="sc">%>%</span> </span>
<span id="cb41-2"><a href="#cb41-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">ungroup</span>() <span class="sc">%>%</span> </span>
<span id="cb41-3"><a href="#cb41-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(TotalGeneCounts <span class="sc">></span> <span class="dv">10</span>) <span class="sc">%>%</span> </span>
<span id="cb41-4"><a href="#cb41-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(TotalZerosCounts <span class="sc"><</span> <span class="dv">3</span>) <span class="sc">%>%</span> </span>
<span id="cb41-5"><a href="#cb41-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">select</span>(tx,Sample,counts) <span class="sc">%>%</span> </span>
<span id="cb41-6"><a href="#cb41-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">pivot_wider</span>(<span class="at">names_from =</span> Sample, <span class="at">values_from =</span> counts, <span class="at">values_fill =</span> <span class="dv">0</span>) <span class="sc">%>%</span> </span>
<span id="cb41-7"><a href="#cb41-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">column_to_rownames</span>(<span class="st">"tx"</span>) <span class="sc">%>%</span> </span>
<span id="cb41-8"><a href="#cb41-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">round</span>() <span class="sc">%>%</span> </span>
<span id="cb41-9"><a href="#cb41-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">as.matrix</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="cell">
<div class="sourceCode cell-code" id="cb42"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb42-1"><a href="#cb42-1" aria-hidden="true" tabindex="-1"></a>dds_transcript <span class="ot"><-</span><span class="fu">DESeqDataSetFromMatrix</span>(<span class="at">countData =</span> table_counts, </span>
<span id="cb42-2"><a href="#cb42-2" aria-hidden="true" tabindex="-1"></a> <span class="at">colData =</span> metadata <span class="sc">%>%</span> <span class="fu">column_to_rownames</span>(<span class="st">"Sample"</span>), </span>
<span id="cb42-3"><a href="#cb42-3" aria-hidden="true" tabindex="-1"></a> <span class="at">design =</span> <span class="sc">~</span>Grupo) </span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>converting counts to integer mode</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
design formula are characters, converting to factors</code></pre>
</div>
<div class="sourceCode cell-code" id="cb45"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb45-1"><a href="#cb45-1" aria-hidden="true" tabindex="-1"></a>dds_transcript <span class="ot"><-</span> <span class="fu">DESeq</span>(dds_transcript,<span class="at">sfType =</span> <span class="st">"poscounts"</span>, <span class="at">fitType =</span> <span class="st">"mean"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>estimating size factors</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>estimating dispersions</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>gene-wise dispersion estimates</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>mean-dispersion relationship</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>final dispersion estimates</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>fitting model and testing</code></pre>
</div>
</div>
<section id="quality-control" class="level2">
<h2 class="anchored" data-anchor-id="quality-control">Quality Control</h2>
<div class="cell">
<div class="sourceCode cell-code" id="cb52"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb52-1"><a href="#cb52-1" aria-hidden="true" tabindex="-1"></a>reads_transcripts <span class="sc">%>%</span> <span class="fu">pivot_longer</span>(<span class="at">names_to =</span> <span class="st">"Sample"</span>, <span class="at">values_to =</span> <span class="st">"counts"</span>, <span class="sc">-</span>(tx<span class="sc">:</span>gene_id)) <span class="sc">%>%</span> </span>
<span id="cb52-2"><a href="#cb52-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">group_by</span>(Sample) <span class="sc">%>%</span> </span>
<span id="cb52-3"><a href="#cb52-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">summarise</span>(<span class="at">TotalCounts =</span> <span class="fu">sum</span>(counts)) <span class="sc">%>%</span> </span>
<span id="cb52-4"><a href="#cb52-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">full_join</span>(metadata) <span class="sc">%>%</span> </span>
<span id="cb52-5"><a href="#cb52-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(<span class="at">x=</span> Sample, <span class="at">y =</span> TotalCounts, <span class="at">fill =</span> Grupo)) <span class="sc">+</span> <span class="fu">geom_col</span>() <span class="sc">+</span> <span class="fu">coord_flip</span>() <span class="sc">+</span> <span class="fu">theme_light</span>()<span class="sc">+</span> <span class="fu">labs</span>(<span class="at">title =</span> <span class="st">"Raw Data"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(Sample)`</code></pre>
</div>
<div class="cell-output-display">
<p><img src="Analisis_files/figure-html/unnamed-chunk-6-1.png" class="img-fluid" width="672"></p>
</div>
</div>
<div class="cell">
<div class="sourceCode cell-code" id="cb54"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb54-1"><a href="#cb54-1" aria-hidden="true" tabindex="-1"></a><span class="fu">counts</span>(dds_transcript, <span class="at">normalized =</span> T) <span class="sc">%>%</span> <span class="fu">as_tibble</span>(<span class="at">rownames =</span> <span class="st">"tx"</span>) <span class="sc">%>%</span> <span class="fu">pivot_longer</span>(<span class="at">names_to =</span> <span class="st">"Sample"</span>, <span class="at">values_to =</span> <span class="st">"counts"</span>, <span class="sc">-</span>tx) <span class="sc">%>%</span> </span>
<span id="cb54-2"><a href="#cb54-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">group_by</span>(Sample) <span class="sc">%>%</span> </span>
<span id="cb54-3"><a href="#cb54-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">summarise</span>(<span class="at">TotalCounts =</span> <span class="fu">sum</span>(counts)) <span class="sc">%>%</span> </span>
<span id="cb54-4"><a href="#cb54-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">full_join</span>(metadata) <span class="sc">%>%</span> </span>
<span id="cb54-5"><a href="#cb54-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(<span class="at">x=</span> Sample, <span class="at">y =</span> TotalCounts, <span class="at">fill =</span> Grupo)) <span class="sc">+</span> <span class="fu">geom_col</span>() <span class="sc">+</span> <span class="fu">coord_flip</span>() <span class="sc">+</span> <span class="fu">theme_light</span>() <span class="sc">+</span> <span class="fu">labs</span>(<span class="at">title =</span> <span class="st">"Normalize Data"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(Sample)`</code></pre>
</div>
<div class="cell-output-display">
<p><img src="Analisis_files/figure-html/unnamed-chunk-7-1.png" class="img-fluid" width="672"></p>
</div>
</div>
<div class="cell">
<div class="sourceCode cell-code" id="cb56"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb56-1"><a href="#cb56-1" aria-hidden="true" tabindex="-1"></a>mds <span class="ot"><-</span> vegan<span class="sc">::</span><span class="fu">metaMDS</span>(<span class="fu">counts</span>(dds_transcript, <span class="at">normalized =</span> T) <span class="sc">%>%</span> <span class="fu">t</span>())</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>Square root transformation
Wisconsin double standardization
Run 0 stress 0
Run 1 stress 0
... Procrustes: rmse 0.1108175 max resid 0.1860917
Run 2 stress 0
... Procrustes: rmse 0.1356621 max resid 0.1692757
Run 3 stress 0
... Procrustes: rmse 0.04359694 max resid 0.0606364
Run 4 stress 0
... Procrustes: rmse 0.1207311 max resid 0.2186946
Run 5 stress 8.945418e-05
... Procrustes: rmse 0.09424843 max resid 0.1176287
Run 6 stress 0
... Procrustes: rmse 0.08787099 max resid 0.1507089
Run 7 stress 9.724341e-05
... Procrustes: rmse 0.07622908 max resid 0.1087503
Run 8 stress 0
... Procrustes: rmse 0.1304832 max resid 0.2408138
Run 9 stress 8.83889e-05
... Procrustes: rmse 0.2088338 max resid 0.4135797
Run 10 stress 0
... Procrustes: rmse 0.02595927 max resid 0.04222413
Run 11 stress 0
... Procrustes: rmse 0.03999584 max resid 0.05092603
Run 12 stress 8.614669e-05
... Procrustes: rmse 0.2208293 max resid 0.4449926
Run 13 stress 0
... Procrustes: rmse 0.03786088 max resid 0.07064924
Run 14 stress 5.645838e-05
... Procrustes: rmse 0.1681995 max resid 0.321639
Run 15 stress 9.42519e-05
... Procrustes: rmse 0.1826439 max resid 0.2806114
Run 16 stress 9.052716e-05
... Procrustes: rmse 0.2115271 max resid 0.3960785
Run 17 stress 2.126536e-05
... Procrustes: rmse 0.1330298 max resid 0.2298839
Run 18 stress 9.448357e-05
... Procrustes: rmse 0.2101482 max resid 0.3725563
Run 19 stress 0
... Procrustes: rmse 0.08884164 max resid 0.167338
Run 20 stress 9.726836e-05
... Procrustes: rmse 0.2101798 max resid 0.3742234
*** Best solution was not repeated -- monoMDS stopping criteria:
20: stress < smin</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning in vegan::metaMDS(counts(dds_transcript, normalized = T) %>% t()):
stress is (nearly) zero: you may have insufficient data</code></pre>
</div>
<div class="sourceCode cell-code" id="cb59"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb59-1"><a href="#cb59-1" aria-hidden="true" tabindex="-1"></a>mds<span class="sc">$</span>points <span class="sc">%>%</span> </span>
<span id="cb59-2"><a href="#cb59-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">as.data.frame</span>() <span class="sc">%>%</span> </span>
<span id="cb59-3"><a href="#cb59-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">rownames_to_column</span>(<span class="st">"Sample"</span>) <span class="sc">%>%</span> </span>
<span id="cb59-4"><a href="#cb59-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">inner_join</span>(metadata) <span class="sc">%>%</span> </span>
<span id="cb59-5"><a href="#cb59-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(<span class="at">x =</span> MDS1, <span class="at">y =</span> MDS2, <span class="at">fill =</span> Grupo, <span class="at">label =</span>Sample)) <span class="sc">+</span> <span class="fu">geom_label</span>() <span class="sc">+</span></span>
<span id="cb59-6"><a href="#cb59-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme_light</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(Sample)`</code></pre>
</div>
<div class="cell-output-display">
<p><img src="Analisis_files/figure-html/unnamed-chunk-8-1.png" class="img-fluid" width="672"></p>
</div>
</div>
</section>
<section id="differential-expression-test" class="level2">
<h2 class="anchored" data-anchor-id="differential-expression-test">Differential Expression Test</h2>
<div class="cell">
<div class="sourceCode cell-code" id="cb61"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb61-1"><a href="#cb61-1" aria-hidden="true" tabindex="-1"></a><span class="fu">resultsNames</span>(dds_transcript)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "Intercept" "Grupo_X_vs_P"</code></pre>
</div>
<div class="sourceCode cell-code" id="cb63"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb63-1"><a href="#cb63-1" aria-hidden="true" tabindex="-1"></a>de_test <span class="ot"><-</span> <span class="fu">results</span>(dds_transcript) <span class="sc">%>%</span> </span>
<span id="cb63-2"><a href="#cb63-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">as_tibble</span>(<span class="at">rownames =</span> <span class="st">"Transcrip_ID"</span>) <span class="sc">%>%</span> <span class="fu">inner_join</span>(ids)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(Transcrip_ID)`</code></pre>
</div>
<div class="sourceCode cell-code" id="cb65"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb65-1"><a href="#cb65-1" aria-hidden="true" tabindex="-1"></a>de_test<span class="sc">%>%</span> </span>
<span id="cb65-2"><a href="#cb65-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">sig =</span> <span class="fu">ifelse</span>(padj <span class="sc"><</span> <span class="fl">0.005</span>,<span class="st">"Significative"</span>,<span class="st">"No-Significative"</span>)) <span class="sc">%>%</span></span>
<span id="cb65-3"><a href="#cb65-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">label =</span> <span class="fu">ifelse</span>(sig <span class="sc">==</span> <span class="st">"Significative"</span>,Gene_Name,<span class="cn">NA</span>)) <span class="sc">%>%</span> </span>
<span id="cb65-4"><a href="#cb65-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(<span class="at">x=</span> log2FoldChange, </span>
<span id="cb65-5"><a href="#cb65-5" aria-hidden="true" tabindex="-1"></a> <span class="at">y =</span> <span class="sc">-</span><span class="fu">log10</span>(padj), </span>
<span id="cb65-6"><a href="#cb65-6" aria-hidden="true" tabindex="-1"></a> <span class="at">color =</span> sig, </span>
<span id="cb65-7"><a href="#cb65-7" aria-hidden="true" tabindex="-1"></a> <span class="at">size =</span> <span class="fu">sqrt</span>(baseMean), </span>
<span id="cb65-8"><a href="#cb65-8" aria-hidden="true" tabindex="-1"></a> <span class="at">label =</span> label)) <span class="sc">+</span></span>
<span id="cb65-9"><a href="#cb65-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_point</span>(<span class="at">alpha =</span> <span class="fl">0.5</span>) <span class="sc">+</span></span>
<span id="cb65-10"><a href="#cb65-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_text_repel</span>(<span class="at">size =</span> <span class="dv">1</span>)<span class="sc">+</span></span>
<span id="cb65-11"><a href="#cb65-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_color_d3</span>() <span class="sc">+</span></span>
<span id="cb65-12"><a href="#cb65-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme_light</span>() <span class="sc">+</span> </span>
<span id="cb65-13"><a href="#cb65-13" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(<span class="at">title =</span> <span class="st">"Volcano Plot Grupo_X_vs_P"</span>) </span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 7693 rows containing missing values or values outside the scale range
(`geom_point()`).</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 94886 rows containing missing values or values outside the scale range
(`geom_text_repel()`).</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: ggrepel: 34 unlabeled data points (too many overlaps). Consider
increasing max.overlaps</code></pre>
</div>
<div class="cell-output-display">
<p><img src="Analisis_files/figure-html/unnamed-chunk-9-1.png" class="img-fluid" width="672"></p>
</div>
<div class="sourceCode cell-code" id="cb69"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb69-1"><a href="#cb69-1" aria-hidden="true" tabindex="-1"></a>de_test<span class="sc">%>%</span> </span>
<span id="cb69-2"><a href="#cb69-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">sig =</span> <span class="fu">ifelse</span>(padj <span class="sc"><</span> <span class="fl">0.005</span>,<span class="st">"Significative"</span>,<span class="st">"No-Significative"</span>)) <span class="sc">%>%</span></span>
<span id="cb69-3"><a href="#cb69-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">label =</span> <span class="fu">ifelse</span>(sig <span class="sc">==</span> <span class="st">"Significative"</span>,Gene_Name,<span class="cn">NA</span>)) <span class="sc">%>%</span> </span>
<span id="cb69-4"><a href="#cb69-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(<span class="at">x=</span> baseMean, </span>
<span id="cb69-5"><a href="#cb69-5" aria-hidden="true" tabindex="-1"></a> <span class="at">y =</span> log2FoldChange, </span>
<span id="cb69-6"><a href="#cb69-6" aria-hidden="true" tabindex="-1"></a> <span class="at">color =</span> sig, </span>
<span id="cb69-7"><a href="#cb69-7" aria-hidden="true" tabindex="-1"></a> <span class="at">size =</span> <span class="fu">sqrt</span>(baseMean), </span>
<span id="cb69-8"><a href="#cb69-8" aria-hidden="true" tabindex="-1"></a> <span class="at">label =</span> label)) <span class="sc">+</span></span>
<span id="cb69-9"><a href="#cb69-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_point</span>(<span class="at">alpha =</span> <span class="fl">0.5</span>) <span class="sc">+</span></span>
<span id="cb69-10"><a href="#cb69-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_text_repel</span>(<span class="at">size =</span> <span class="dv">1</span>)<span class="sc">+</span></span>
<span id="cb69-11"><a href="#cb69-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_color_d3</span>() <span class="sc">+</span></span>
<span id="cb69-12"><a href="#cb69-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_x_log10</span>()<span class="sc">+</span></span>
<span id="cb69-13"><a href="#cb69-13" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme_light</span>() <span class="sc">+</span> </span>
<span id="cb69-14"><a href="#cb69-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(<span class="at">title =</span> <span class="st">"MA Plot Grupo_X_vs_P"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 7693 rows containing missing values or values outside the scale range
(`geom_point()`).</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 94886 rows containing missing values or values outside the scale range
(`geom_text_repel()`).</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: ggrepel: 13 unlabeled data points (too many overlaps). Consider
increasing max.overlaps</code></pre>
</div>
<div class="cell-output-display">
<p><img src="Analisis_files/figure-html/unnamed-chunk-9-2.png" class="img-fluid" width="672"></p>
</div>
</div>
<div class="cell">
<div class="sourceCode cell-code" id="cb73"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb73-1"><a href="#cb73-1" aria-hidden="true" tabindex="-1"></a>significativos <span class="ot"><-</span> de_test<span class="sc">%>%</span> </span>
<span id="cb73-2"><a href="#cb73-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(padj <span class="sc"><</span> <span class="fl">0.005</span>) <span class="sc">%>%</span> <span class="fu">pull</span>(Transcrip_ID)</span>
<span id="cb73-3"><a href="#cb73-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb73-4"><a href="#cb73-4" aria-hidden="true" tabindex="-1"></a><span class="fu">counts</span>(dds_transcript, <span class="at">normalized =</span> T) <span class="sc">%>%</span> </span>
<span id="cb73-5"><a href="#cb73-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">as.data.frame</span>() <span class="sc">%>%</span> </span>
<span id="cb73-6"><a href="#cb73-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">rownames_to_column</span>(<span class="st">"tx"</span>) <span class="sc">%>%</span> </span>
<span id="cb73-7"><a href="#cb73-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(tx <span class="sc">%in%</span> significativos) <span class="sc">%>%</span> </span>
<span id="cb73-8"><a href="#cb73-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">pivot_longer</span>(<span class="at">names_to =</span> <span class="st">"Sample"</span>,<span class="at">values_to =</span> <span class="st">"counts"</span>, <span class="sc">-</span>tx) <span class="sc">%>%</span> </span>
<span id="cb73-9"><a href="#cb73-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">inner_join</span>(metadata) <span class="sc">%>%</span> </span>
<span id="cb73-10"><a href="#cb73-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(<span class="at">x =</span> Grupo, <span class="at">y =</span> counts, <span class="at">fill =</span> Grupo)) <span class="sc">+</span> <span class="fu">geom_boxplot</span>() <span class="sc">+</span> <span class="fu">facet_wrap</span>(<span class="sc">~</span>tx, <span class="at">scales =</span> <span class="st">"free_y"</span>) <span class="sc">+</span> <span class="fu">scale_fill_d3</span>() <span class="sc">+</span> <span class="fu">theme_light</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(Sample)`</code></pre>
</div>
<div class="cell-output-display">
<p><img src="Analisis_files/figure-html/unnamed-chunk-10-1.png" class="img-fluid" width="1920"></p>
</div>
</div>
</section>
<section id="funtional-annotation" class="level2">
<h2 class="anchored" data-anchor-id="funtional-annotation">Funtional Annotation</h2>
<div class="cell">
<div class="sourceCode cell-code" id="cb75"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb75-1"><a href="#cb75-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(clusterProfiler)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code></code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>clusterProfiler v4.12.6 Learn more at https://yulab-smu.top/contribution-knowledge-mining/
Please cite:
S Xu, E Hu, Y Cai, Z Xie, X Luo, L Zhan, W Tang, Q Wang, B Liu, R Wang,
W Xie, T Wu, L Xie, G Yu. Using clusterProfiler to characterize
multiomics data. Nature Protocols. 2024, doi:10.1038/s41596-024-01020-z</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>
Adjuntando el paquete: 'clusterProfiler'</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following object is masked from 'package:purrr':
simplify</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following object is masked from 'package:IRanges':
slice</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following object is masked from 'package:S4Vectors':
rename</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following object is masked from 'package:stats':
filter</code></pre>
</div>
<div class="sourceCode cell-code" id="cb83"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb83-1"><a href="#cb83-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(org.Hs.eg.db)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Cargando paquete requerido: AnnotationDbi</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>
Adjuntando el paquete: 'AnnotationDbi'</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following object is masked from 'package:clusterProfiler':
select</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>The following object is masked from 'package:dplyr':
select</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code></code></pre>
</div>
</div>
<div class="cell">
<div class="sourceCode cell-code" id="cb89"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb89-1"><a href="#cb89-1" aria-hidden="true" tabindex="-1"></a>sig_transcripts <span class="ot"><-</span> de_test <span class="sc">%>%</span> </span>
<span id="cb89-2"><a href="#cb89-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">inner_join</span>(ttg, <span class="at">by =</span> <span class="fu">c</span>(<span class="st">"Transcrip_ID"</span> <span class="ot">=</span> <span class="st">"ensembl_transcript_id"</span>)) <span class="sc">%>%</span> <span class="fu">filter</span>(padj <span class="sc"><</span> <span class="fl">0.005</span>) <span class="sc">%>%</span> </span>
<span id="cb89-3"><a href="#cb89-3" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">select</span>(entrezgene_id) <span class="sc">%>%</span> </span>
<span id="cb89-4"><a href="#cb89-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">distinct</span>() <span class="sc">%>%</span> </span>
<span id="cb89-5"><a href="#cb89-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">drop_na</span>() <span class="sc">%>%</span> </span>
<span id="cb89-6"><a href="#cb89-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">pull</span>(entrezgene_id)</span>
<span id="cb89-7"><a href="#cb89-7" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb89-8"><a href="#cb89-8" aria-hidden="true" tabindex="-1"></a>GO_enrichment <span class="ot"><-</span> <span class="fu">enrichGO</span>(<span class="at">gene =</span>sig_transcripts,</span>
<span id="cb89-9"><a href="#cb89-9" aria-hidden="true" tabindex="-1"></a> <span class="at">OrgDb =</span> org.Hs.eg.db,</span>
<span id="cb89-10"><a href="#cb89-10" aria-hidden="true" tabindex="-1"></a> <span class="at">ont =</span> <span class="st">"ALL"</span>,</span>
<span id="cb89-11"><a href="#cb89-11" aria-hidden="true" tabindex="-1"></a> <span class="at">pAdjustMethod =</span> <span class="st">"BH"</span>,</span>
<span id="cb89-12"><a href="#cb89-12" aria-hidden="true" tabindex="-1"></a> <span class="at">pvalueCutoff =</span> <span class="fl">0.01</span>,</span>
<span id="cb89-13"><a href="#cb89-13" aria-hidden="true" tabindex="-1"></a> <span class="at">qvalueCutoff =</span> <span class="fl">0.05</span>,</span>
<span id="cb89-14"><a href="#cb89-14" aria-hidden="true" tabindex="-1"></a> <span class="at">readable =</span> <span class="cn">TRUE</span>)</span>
<span id="cb89-15"><a href="#cb89-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb89-16"><a href="#cb89-16" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> ((GO_enrichment <span class="sc">%>%</span> <span class="fu">as.data.frame</span>() <span class="sc">%>%</span> <span class="fu">nrow</span>()) <span class="sc">></span> <span class="dv">0</span> )</span>
<span id="cb89-17"><a href="#cb89-17" aria-hidden="true" tabindex="-1"></a>{</span>
<span id="cb89-18"><a href="#cb89-18" aria-hidden="true" tabindex="-1"></a> <span class="fu">barplot</span>(GO_enrichment, <span class="at">showCategory =</span> <span class="dv">20</span>)</span>
<span id="cb89-19"><a href="#cb89-19" aria-hidden="true" tabindex="-1"></a>} <span class="cf">else</span>{</span>
<span id="cb89-20"><a href="#cb89-20" aria-hidden="true" tabindex="-1"></a> <span class="fu">print</span>(<span class="st">"No enriched Pathways"</span>)</span>
<span id="cb89-21"><a href="#cb89-21" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "No enriched Pathways"</code></pre>
</div>
<div class="sourceCode cell-code" id="cb91"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb91-1"><a href="#cb91-1" aria-hidden="true" tabindex="-1"></a>KEGG_enrichment <span class="ot"><-</span> <span class="fu">enrichKEGG</span>(<span class="at">gene =</span> sig_transcripts,</span>
<span id="cb91-2"><a href="#cb91-2" aria-hidden="true" tabindex="-1"></a> <span class="at">organism =</span> <span class="st">'hsa'</span>,</span>
<span id="cb91-3"><a href="#cb91-3" aria-hidden="true" tabindex="-1"></a> <span class="at">pvalueCutoff =</span> <span class="fl">0.05</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Reading KEGG annotation online: "https://rest.kegg.jp/link/hsa/pathway"...</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Reading KEGG annotation online: "https://rest.kegg.jp/list/pathway/hsa"...</code></pre>
</div>
<div class="sourceCode cell-code" id="cb94"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb94-1"><a href="#cb94-1" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> ((KEGG_enrichment <span class="sc">%>%</span> <span class="fu">as.data.frame</span>() <span class="sc">%>%</span> <span class="fu">nrow</span>()) <span class="sc">></span> <span class="dv">0</span> )</span>
<span id="cb94-2"><a href="#cb94-2" aria-hidden="true" tabindex="-1"></a>{</span>
<span id="cb94-3"><a href="#cb94-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">barplot</span>(KEGG_enrichment, <span class="at">showCategory =</span> <span class="dv">20</span>)</span>
<span id="cb94-4"><a href="#cb94-4" aria-hidden="true" tabindex="-1"></a>} <span class="cf">else</span>{</span>
<span id="cb94-5"><a href="#cb94-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">print</span>(<span class="st">"No enriched Pathways"</span>)</span>
<span id="cb94-6"><a href="#cb94-6" aria-hidden="true" tabindex="-1"></a>}</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "No enriched Pathways"</code></pre>
</div>
</div>
</section>
</section>
<section id="gene-level" class="level1">
<h1>Gene Level</h1>
<div class="cell">
<div class="sourceCode cell-code" id="cb96"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb96-1"><a href="#cb96-1" aria-hidden="true" tabindex="-1"></a>table_sum <span class="ot"><-</span> reads_genes <span class="sc">%>%</span> </span>
<span id="cb96-2"><a href="#cb96-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">pivot_longer</span>(<span class="at">names_to =</span> <span class="st">"Sample"</span>, <span class="at">values_to =</span> <span class="st">"counts"</span>, <span class="sc">-</span>(gene_id<span class="sc">:</span>gene_name)) <span class="sc">%>%</span> </span>
<span id="cb96-3"><a href="#cb96-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">group_by</span>(gene_id) <span class="sc">%>%</span> </span>
<span id="cb96-4"><a href="#cb96-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">TotalGeneCounts =</span> <span class="fu">sum</span>(counts), </span>
<span id="cb96-5"><a href="#cb96-5" aria-hidden="true" tabindex="-1"></a> <span class="at">TotalZerosCounts =</span> <span class="fu">sum</span>(counts<span class="sc">==</span><span class="dv">0</span>))</span>
<span id="cb96-6"><a href="#cb96-6" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb96-7"><a href="#cb96-7" aria-hidden="true" tabindex="-1"></a>table_sum <span class="sc">%>%</span> <span class="fu">ggplot</span>(<span class="fu">aes</span>(<span class="at">x =</span> TotalGeneCounts)) <span class="sc">+</span> <span class="fu">geom_histogram</span>() <span class="sc">+</span> <span class="fu">geom_vline</span>(<span class="at">xintercept =</span> <span class="dv">10</span>)<span class="sc">+</span><span class="fu">scale_x_log10</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning in scale_x_log10(): log-10 transformation introduced infinite values.</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 144900 rows containing non-finite outside the scale range
(`stat_bin()`).</code></pre>
</div>
<div class="cell-output-display">
<p><img src="Analisis_files/figure-html/unnamed-chunk-13-1.png" class="img-fluid" width="672"></p>
</div>
<div class="sourceCode cell-code" id="cb100"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb100-1"><a href="#cb100-1" aria-hidden="true" tabindex="-1"></a>table_counts <span class="ot"><-</span> table_sum <span class="sc">%>%</span> </span>
<span id="cb100-2"><a href="#cb100-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">ungroup</span>() <span class="sc">%>%</span> </span>
<span id="cb100-3"><a href="#cb100-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(TotalGeneCounts <span class="sc">></span> <span class="dv">10</span>) <span class="sc">%>%</span> </span>
<span id="cb100-4"><a href="#cb100-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(TotalZerosCounts <span class="sc"><</span> <span class="dv">3</span>) <span class="sc">%>%</span> </span>
<span id="cb100-5"><a href="#cb100-5" aria-hidden="true" tabindex="-1"></a> dplyr<span class="sc">::</span><span class="fu">select</span>(gene_id,Sample,counts) <span class="sc">%>%</span> </span>
<span id="cb100-6"><a href="#cb100-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">pivot_wider</span>(<span class="at">names_from =</span> Sample, <span class="at">values_from =</span> counts, <span class="at">values_fill =</span> <span class="dv">0</span>) <span class="sc">%>%</span> </span>
<span id="cb100-7"><a href="#cb100-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">column_to_rownames</span>(<span class="st">"gene_id"</span>) <span class="sc">%>%</span> </span>
<span id="cb100-8"><a href="#cb100-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">round</span>() <span class="sc">%>%</span> </span>
<span id="cb100-9"><a href="#cb100-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">as.matrix</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="cell">
<div class="sourceCode cell-code" id="cb101"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb101-1"><a href="#cb101-1" aria-hidden="true" tabindex="-1"></a>dds_genes <span class="ot"><-</span><span class="fu">DESeqDataSetFromMatrix</span>(<span class="at">countData =</span> table_counts, </span>
<span id="cb101-2"><a href="#cb101-2" aria-hidden="true" tabindex="-1"></a> <span class="at">colData =</span> metadata <span class="sc">%>%</span> <span class="fu">column_to_rownames</span>(<span class="st">"Sample"</span>), </span>
<span id="cb101-3"><a href="#cb101-3" aria-hidden="true" tabindex="-1"></a> <span class="at">design =</span> <span class="sc">~</span>Grupo) </span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>converting counts to integer mode</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
design formula are characters, converting to factors</code></pre>
</div>
<div class="sourceCode cell-code" id="cb104"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb104-1"><a href="#cb104-1" aria-hidden="true" tabindex="-1"></a>dds_genes <span class="ot"><-</span> <span class="fu">DESeq</span>(dds_genes,<span class="at">sfType =</span> <span class="st">"poscounts"</span>, <span class="at">fitType =</span> <span class="st">"mean"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>estimating size factors</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>estimating dispersions</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>gene-wise dispersion estimates</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>mean-dispersion relationship</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>final dispersion estimates</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>fitting model and testing</code></pre>
</div>
</div>
<section id="quality-control-1" class="level2">
<h2 class="anchored" data-anchor-id="quality-control-1">Quality Control</h2>
<div class="cell">
<div class="sourceCode cell-code" id="cb111"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb111-1"><a href="#cb111-1" aria-hidden="true" tabindex="-1"></a>reads_genes <span class="sc">%>%</span> <span class="fu">pivot_longer</span>(<span class="at">names_to =</span> <span class="st">"Sample"</span>, <span class="at">values_to =</span> <span class="st">"counts"</span>, <span class="sc">-</span>(gene_id<span class="sc">:</span>gene_name)) <span class="sc">%>%</span> </span>
<span id="cb111-2"><a href="#cb111-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">group_by</span>(Sample) <span class="sc">%>%</span> </span>
<span id="cb111-3"><a href="#cb111-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">summarise</span>(<span class="at">TotalCounts =</span> <span class="fu">sum</span>(counts)) <span class="sc">%>%</span> </span>
<span id="cb111-4"><a href="#cb111-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">full_join</span>(metadata) <span class="sc">%>%</span> </span>
<span id="cb111-5"><a href="#cb111-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(<span class="at">x=</span> Sample, <span class="at">y =</span> TotalCounts, <span class="at">fill =</span> Grupo)) <span class="sc">+</span> <span class="fu">geom_col</span>() <span class="sc">+</span> <span class="fu">coord_flip</span>() <span class="sc">+</span> <span class="fu">theme_light</span>()<span class="sc">+</span> <span class="fu">labs</span>(<span class="at">title =</span> <span class="st">"Raw Data"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(Sample)`</code></pre>
</div>
<div class="cell-output-display">
<p><img src="Analisis_files/figure-html/unnamed-chunk-15-1.png" class="img-fluid" width="672"></p>
</div>
</div>
<div class="cell">
<div class="sourceCode cell-code" id="cb113"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb113-1"><a href="#cb113-1" aria-hidden="true" tabindex="-1"></a><span class="fu">counts</span>(dds_genes, <span class="at">normalized =</span> T) <span class="sc">%>%</span> <span class="fu">as_tibble</span>(<span class="at">rownames =</span> <span class="st">"genes_id"</span>) <span class="sc">%>%</span> <span class="fu">pivot_longer</span>(<span class="at">names_to =</span> <span class="st">"Sample"</span>, <span class="at">values_to =</span> <span class="st">"counts"</span>, <span class="sc">-</span>genes_id) <span class="sc">%>%</span> </span>
<span id="cb113-2"><a href="#cb113-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">group_by</span>(Sample) <span class="sc">%>%</span> </span>
<span id="cb113-3"><a href="#cb113-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">summarise</span>(<span class="at">TotalCounts =</span> <span class="fu">sum</span>(counts)) <span class="sc">%>%</span> </span>
<span id="cb113-4"><a href="#cb113-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">full_join</span>(metadata) <span class="sc">%>%</span> </span>
<span id="cb113-5"><a href="#cb113-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(<span class="at">x=</span> Sample, <span class="at">y =</span> TotalCounts, <span class="at">fill =</span> Grupo)) <span class="sc">+</span> <span class="fu">geom_col</span>() <span class="sc">+</span> <span class="fu">coord_flip</span>() <span class="sc">+</span> <span class="fu">theme_light</span>() <span class="sc">+</span> <span class="fu">labs</span>(<span class="at">title =</span> <span class="st">"Normalize Data"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(Sample)`</code></pre>
</div>
<div class="cell-output-display">
<p><img src="Analisis_files/figure-html/unnamed-chunk-16-1.png" class="img-fluid" width="672"></p>
</div>
</div>
<div class="cell">
<div class="sourceCode cell-code" id="cb115"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb115-1"><a href="#cb115-1" aria-hidden="true" tabindex="-1"></a>pca <span class="ot"><-</span> vegan<span class="sc">::</span><span class="fu">metaMDS</span>(<span class="fu">counts</span>(dds_genes, <span class="at">normalized =</span> T) <span class="sc">%>%</span> <span class="fu">t</span>())</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>Square root transformation
Wisconsin double standardization
Run 0 stress 3.011127e-06
Run 1 stress 9.951677e-05
... Procrustes: rmse 0.05733086 max resid 0.07237598
Run 2 stress 9.631749e-05
... Procrustes: rmse 0.1844333 max resid 0.298856
Run 3 stress 0.0001570931
... Procrustes: rmse 0.2745601 max resid 0.4276428
Run 4 stress 9.897194e-05
... Procrustes: rmse 0.06611347 max resid 0.1068708
Run 5 stress 0.0001124797
... Procrustes: rmse 0.103359 max resid 0.1388761
Run 6 stress 9.865475e-05
... Procrustes: rmse 0.05599918 max resid 0.1040803
Run 7 stress 9.174916e-05
... Procrustes: rmse 0.06230543 max resid 0.09691084
Run 8 stress 9.926535e-05
... Procrustes: rmse 0.06165909 max resid 0.1005196
Run 9 stress 9.725589e-05
... Procrustes: rmse 0.2683456 max resid 0.4114146
Run 10 stress 9.66827e-05
... Procrustes: rmse 0.1778812 max resid 0.2806731
Run 11 stress 8.406666e-05
... Procrustes: rmse 0.04711978 max resid 0.06316471
Run 12 stress 9.259858e-05
... Procrustes: rmse 0.2603827 max resid 0.3947313
Run 13 stress 0.000102759
... Procrustes: rmse 0.2823459 max resid 0.4921391
Run 14 stress 9.630233e-05
... Procrustes: rmse 0.09151013 max resid 0.1379625
Run 15 stress 9.710327e-05
... Procrustes: rmse 0.04966385 max resid 0.06469398
Run 16 stress 0.00126747
Run 17 stress 9.387538e-05
... Procrustes: rmse 0.1426553 max resid 0.1967929
Run 18 stress 0.001297242
Run 19 stress 9.685712e-05
... Procrustes: rmse 0.1344736 max resid 0.2819467
Run 20 stress 8.86192e-05
... Procrustes: rmse 0.06884409 max resid 0.08364656
*** Best solution was not repeated -- monoMDS stopping criteria:
5: no. of iterations >= maxit
15: stress < smin</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning in vegan::metaMDS(counts(dds_genes, normalized = T) %>% t()): stress is
(nearly) zero: you may have insufficient data</code></pre>
</div>
<div class="sourceCode cell-code" id="cb118"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb118-1"><a href="#cb118-1" aria-hidden="true" tabindex="-1"></a>pca<span class="sc">$</span>points <span class="sc">%>%</span> </span>
<span id="cb118-2"><a href="#cb118-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">as.data.frame</span>() <span class="sc">%>%</span> </span>
<span id="cb118-3"><a href="#cb118-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">rownames_to_column</span>(<span class="st">"Sample"</span>) <span class="sc">%>%</span> </span>
<span id="cb118-4"><a href="#cb118-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">inner_join</span>(metadata) <span class="sc">%>%</span> </span>
<span id="cb118-5"><a href="#cb118-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(<span class="at">x =</span> MDS1, <span class="at">y =</span> MDS2, <span class="at">fill =</span> Grupo, <span class="at">label =</span>Sample)) <span class="sc">+</span> <span class="fu">geom_label</span>() <span class="sc">+</span></span>
<span id="cb118-6"><a href="#cb118-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme_light</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(Sample)`</code></pre>
</div>
<div class="cell-output-display">
<p><img src="Analisis_files/figure-html/unnamed-chunk-17-1.png" class="img-fluid" width="672"></p>
</div>
</div>
</section>
<section id="differential-expression-test-1" class="level2">
<h2 class="anchored" data-anchor-id="differential-expression-test-1">Differential Expression Test</h2>
<div class="cell">
<div class="sourceCode cell-code" id="cb120"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb120-1"><a href="#cb120-1" aria-hidden="true" tabindex="-1"></a><span class="fu">resultsNames</span>(dds_genes)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "Intercept" "Grupo_X_vs_P"</code></pre>
</div>
<div class="sourceCode cell-code" id="cb122"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb122-1"><a href="#cb122-1" aria-hidden="true" tabindex="-1"></a>de_test <span class="ot"><-</span> <span class="fu">results</span>(dds_genes) <span class="sc">%>%</span> </span>
<span id="cb122-2"><a href="#cb122-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">as_tibble</span>(<span class="at">rownames =</span> <span class="st">"Gene_ID"</span>) <span class="sc">%>%</span> <span class="fu">inner_join</span>(ids)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(Gene_ID)`</code></pre>
</div>
<div class="sourceCode cell-code" id="cb124"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb124-1"><a href="#cb124-1" aria-hidden="true" tabindex="-1"></a>de_test<span class="sc">%>%</span> </span>
<span id="cb124-2"><a href="#cb124-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">sig =</span> <span class="fu">ifelse</span>(padj <span class="sc"><</span> <span class="fl">0.01</span>,<span class="st">"Significative"</span>,<span class="st">"No-Significative"</span>)) <span class="sc">%>%</span></span>
<span id="cb124-3"><a href="#cb124-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">label =</span> <span class="fu">ifelse</span>(sig <span class="sc">==</span> <span class="st">"Significative"</span>,Gene_Name,<span class="cn">NA</span>)) <span class="sc">%>%</span> </span>
<span id="cb124-4"><a href="#cb124-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(<span class="at">x=</span> log2FoldChange, </span>
<span id="cb124-5"><a href="#cb124-5" aria-hidden="true" tabindex="-1"></a> <span class="at">y =</span> <span class="sc">-</span><span class="fu">log10</span>(padj), </span>
<span id="cb124-6"><a href="#cb124-6" aria-hidden="true" tabindex="-1"></a> <span class="at">color =</span> sig, </span>
<span id="cb124-7"><a href="#cb124-7" aria-hidden="true" tabindex="-1"></a> <span class="at">size =</span> <span class="fu">sqrt</span>(baseMean), </span>
<span id="cb124-8"><a href="#cb124-8" aria-hidden="true" tabindex="-1"></a> <span class="at">label =</span> label)) <span class="sc">+</span></span>
<span id="cb124-9"><a href="#cb124-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_point</span>(<span class="at">alpha =</span> <span class="fl">0.5</span>) <span class="sc">+</span></span>
<span id="cb124-10"><a href="#cb124-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_text_repel</span>(<span class="at">size =</span> <span class="dv">1</span>)<span class="sc">+</span></span>
<span id="cb124-11"><a href="#cb124-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_color_d3</span>() <span class="sc">+</span></span>
<span id="cb124-12"><a href="#cb124-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme_light</span>() <span class="sc">+</span> </span>
<span id="cb124-13"><a href="#cb124-13" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(<span class="at">title =</span> <span class="st">"Volcano Plot Grupo_X_vs_P"</span>) </span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 5373 rows containing missing values or values outside the scale range
(`geom_point()`).</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 183875 rows containing missing values or values outside the scale range
(`geom_text_repel()`).</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: ggrepel: 29 unlabeled data points (too many overlaps). Consider
increasing max.overlaps</code></pre>
</div>
<div class="cell-output-display">
<p><img src="Analisis_files/figure-html/unnamed-chunk-18-1.png" class="img-fluid" width="672"></p>
</div>
<div class="sourceCode cell-code" id="cb128"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb128-1"><a href="#cb128-1" aria-hidden="true" tabindex="-1"></a>de_test<span class="sc">%>%</span> </span>
<span id="cb128-2"><a href="#cb128-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">sig =</span> <span class="fu">ifelse</span>(padj <span class="sc"><</span> <span class="fl">0.01</span>,<span class="st">"Significative"</span>,<span class="st">"No-Significative"</span>)) <span class="sc">%>%</span></span>
<span id="cb128-3"><a href="#cb128-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">mutate</span>(<span class="at">label =</span> <span class="fu">ifelse</span>(sig <span class="sc">==</span> <span class="st">"Significative"</span>,Gene_Name,<span class="cn">NA</span>)) <span class="sc">%>%</span> </span>
<span id="cb128-4"><a href="#cb128-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(<span class="at">x=</span> baseMean, </span>
<span id="cb128-5"><a href="#cb128-5" aria-hidden="true" tabindex="-1"></a> <span class="at">y =</span> log2FoldChange, </span>
<span id="cb128-6"><a href="#cb128-6" aria-hidden="true" tabindex="-1"></a> <span class="at">color =</span> sig, </span>
<span id="cb128-7"><a href="#cb128-7" aria-hidden="true" tabindex="-1"></a> <span class="at">size =</span> <span class="fu">sqrt</span>(baseMean), </span>
<span id="cb128-8"><a href="#cb128-8" aria-hidden="true" tabindex="-1"></a> <span class="at">label =</span> label)) <span class="sc">+</span></span>
<span id="cb128-9"><a href="#cb128-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_point</span>(<span class="at">alpha =</span> <span class="fl">0.5</span>) <span class="sc">+</span></span>
<span id="cb128-10"><a href="#cb128-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_text_repel</span>(<span class="at">size =</span> <span class="dv">1</span>)<span class="sc">+</span></span>
<span id="cb128-11"><a href="#cb128-11" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_color_d3</span>() <span class="sc">+</span></span>
<span id="cb128-12"><a href="#cb128-12" aria-hidden="true" tabindex="-1"></a> <span class="fu">scale_x_log10</span>()<span class="sc">+</span></span>
<span id="cb128-13"><a href="#cb128-13" aria-hidden="true" tabindex="-1"></a> <span class="fu">theme_light</span>() <span class="sc">+</span> </span>
<span id="cb128-14"><a href="#cb128-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">labs</span>(<span class="at">title =</span> <span class="st">"MA Plot Grupo_X_vs_P"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 5373 rows containing missing values or values outside the scale range
(`geom_point()`).</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: Removed 183875 rows containing missing values or values outside the scale range
(`geom_text_repel()`).</code></pre>
</div>
<div class="cell-output cell-output-stderr">
<pre><code>Warning: ggrepel: 29 unlabeled data points (too many overlaps). Consider
increasing max.overlaps</code></pre>
</div>
<div class="cell-output-display">
<p><img src="Analisis_files/figure-html/unnamed-chunk-18-2.png" class="img-fluid" width="672"></p>
</div>
</div>
<div class="cell">
<div class="sourceCode cell-code" id="cb132"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb132-1"><a href="#cb132-1" aria-hidden="true" tabindex="-1"></a>significativos <span class="ot"><-</span> de_test<span class="sc">%>%</span> </span>
<span id="cb132-2"><a href="#cb132-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>(padj <span class="sc"><</span> <span class="fl">0.01</span>) <span class="sc">%>%</span> <span class="fu">pull</span>(Gene_Name)</span>
<span id="cb132-3"><a href="#cb132-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb132-4"><a href="#cb132-4" aria-hidden="true" tabindex="-1"></a><span class="fu">counts</span>(dds_genes, <span class="at">normalized =</span> T) <span class="sc">%>%</span> </span>
<span id="cb132-5"><a href="#cb132-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">as.data.frame</span>() <span class="sc">%>%</span> </span>
<span id="cb132-6"><a href="#cb132-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">rownames_to_column</span>(<span class="st">"Gene_Name"</span>) <span class="sc">%>%</span> </span>
<span id="cb132-7"><a href="#cb132-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">filter</span>( Gene_Name <span class="sc">%in%</span> significativos) <span class="sc">%>%</span> </span>
<span id="cb132-8"><a href="#cb132-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">pivot_longer</span>(<span class="at">names_to =</span> <span class="st">"Sample"</span>,<span class="at">values_to =</span> <span class="st">"counts"</span>, <span class="sc">-</span>Gene_Name) <span class="sc">%>%</span> </span>
<span id="cb132-9"><a href="#cb132-9" aria-hidden="true" tabindex="-1"></a> <span class="fu">inner_join</span>(metadata) <span class="sc">%>%</span> </span>
<span id="cb132-10"><a href="#cb132-10" aria-hidden="true" tabindex="-1"></a> <span class="fu">ggplot</span>(<span class="fu">aes</span>(<span class="at">x =</span> Grupo, <span class="at">y =</span> counts, <span class="at">fill =</span> Grupo)) <span class="sc">+</span> <span class="fu">geom_boxplot</span>() <span class="sc">+</span> <span class="fu">facet_wrap</span>(<span class="sc">~</span>Gene_Name, <span class="at">scales =</span> <span class="st">"free_y"</span>) <span class="sc">+</span> <span class="fu">scale_fill_d3</span>() <span class="sc">+</span> <span class="fu">theme_light</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stderr">
<pre><code>Joining with `by = join_by(Sample)`</code></pre>
</div>
<div class="cell-output-display">
<p><img src="Analisis_files/figure-html/unnamed-chunk-19-1.png" class="img-fluid" width="672"></p>
</div>
</div>
</section>
</section>
</main>
<!-- /main column -->
<script id="quarto-html-after-body" type="application/javascript">
window.document.addEventListener("DOMContentLoaded", function (event) {
const toggleBodyColorMode = (bsSheetEl) => {
const mode = bsSheetEl.getAttribute("data-mode");
const bodyEl = window.document.querySelector("body");
if (mode === "dark") {
bodyEl.classList.add("quarto-dark");
bodyEl.classList.remove("quarto-light");
} else {
bodyEl.classList.add("quarto-light");
bodyEl.classList.remove("quarto-dark");
}
}
const toggleBodyColorPrimary = () => {
const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
if (bsSheetEl) {
toggleBodyColorMode(bsSheetEl);
}
}
toggleBodyColorPrimary();
const icon = "";
const anchorJS = new window.AnchorJS();
anchorJS.options = {
placement: 'right',
icon: icon
};
anchorJS.add('.anchored');
const isCodeAnnotation = (el) => {
for (const clz of el.classList) {
if (clz.startsWith('code-annotation-')) {
return true;
}
}
return false;
}
const clipboard = new window.ClipboardJS('.code-copy-button', {
text: function(trigger) {
const codeEl = trigger.previousElementSibling.cloneNode(true);
for (const childEl of codeEl.children) {
if (isCodeAnnotation(childEl)) {
childEl.remove();
}
}
return codeEl.innerText;
}
});
clipboard.on('success', function(e) {
// button target
const button = e.trigger;
// don't keep focus
button.blur();
// flash "checked"
button.classList.add('code-copy-button-checked');
var currentTitle = button.getAttribute("title");
button.setAttribute("title", "Copied!");
let tooltip;
if (window.bootstrap) {
button.setAttribute("data-bs-toggle", "tooltip");
button.setAttribute("data-bs-placement", "left");
button.setAttribute("data-bs-title", "Copied!");
tooltip = new bootstrap.Tooltip(button,
{ trigger: "manual",
customClass: "code-copy-button-tooltip",
offset: [0, -8]});
tooltip.show();
}
setTimeout(function() {
if (tooltip) {
tooltip.hide();
button.removeAttribute("data-bs-title");
button.removeAttribute("data-bs-toggle");
button.removeAttribute("data-bs-placement");
}
button.setAttribute("title", currentTitle);
button.classList.remove('code-copy-button-checked');
}, 1000);
// clear code selection
e.clearSelection();
});
function tippyHover(el, contentFn) {
const config = {
allowHTML: true,
content: contentFn,
maxWidth: 500,
delay: 100,
arrow: false,
appendTo: function(el) {
return el.parentElement;
},
interactive: true,
interactiveBorder: 10,
theme: 'quarto',
placement: 'bottom-start'
};
window.tippy(el, config);
}