Skip to content
Snippets Groups Projects
Commit 8ebefab1 authored by Saskia Hiltemann's avatar Saskia Hiltemann
Browse files

add code

parent c091c911
No related branches found
No related tags found
No related merge requests found
Pipeline #481 passed
source diff could not be displayed: it is too large. Options to address this: view the blob.
<!DOCTYPE html>
<html lang="en" dir="ltr" class="no-js">
<head>
<meta charset="utf-8" />
<title>personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r [DataWiki]</title>
<script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
<meta name="generator" content="DokuWiki"/>
<meta name="theme-color" content="#008800"/>
<meta name="robots" content="index,follow"/>
<meta name="keywords" content="personal,haasf,2021,madland,rnaseqhoecker,3d_pca_plot_hoecker_20210527.r"/>
<link rel="search" type="application/opensearchdescription+xml" href="/lab/wiki/lib/exe/opensearch.php" title="DataWiki"/>
<link rel="start" href="/lab/wiki/"/>
<link rel="contents" href="/lab/wiki/personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r?do=index" title="Sitemap"/>
<link rel="manifest" href="/lab/wiki/lib/exe/manifest.php"/>
<link rel="alternate" type="application/rss+xml" title="Recent Changes" href="/lab/wiki/feed.php"/>
<link rel="alternate" type="application/rss+xml" title="Current namespace" href="/lab/wiki/feed.php?mode=list&amp;ns=personal:haasf:2021:madland:rnaseqhoecker"/>
<link rel="edit" title="Edit this page" href="/lab/wiki/personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r?do=edit"/>
<link rel="alternate" type="text/html" title="Plain HTML" href="/lab/wiki/_export/xhtml/personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r"/>
<link rel="alternate" type="text/plain" title="Wiki Markup" href="/lab/wiki/_export/raw/personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r"/>
<link rel="canonical" href="https://plantcode.cup.uni-freiburg.de/lab/wiki/personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r"/>
<link rel="stylesheet" href="/lab/wiki/lib/exe/css.php?t=dokuwiki&amp;tseed=a9de8a0d5a8e7168381d427189602bc9"/>
<!--[if gte IE 9]><!-->
<script >/*<![CDATA[*/var NS='personal:haasf:2021:madland:rnaseqhoecker';var SIG=" --- \/\/[[saskiahiltemann@gmail.com|Saskia Hiltemann]] 2023\/10\/11 13:15\/\/";var JSINFO = {"plugins":{"edittable":{"default columnwidth":""}},"id":"personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r","namespace":"personal:haasf:2021:madland:rnaseqhoecker","ACT":"show","useHeadingNavigation":1,"useHeadingContent":1};
/*!]]>*/</script>
<script charset="utf-8" src="/lab/wiki/lib/exe/jquery.php?tseed=34a552433bc33cc9c3bc32527289a0b2" defer="defer"></script>
<script charset="utf-8" src="/lab/wiki/lib/exe/js.php?t=dokuwiki&amp;tseed=a9de8a0d5a8e7168381d427189602bc9" defer="defer"></script>
<!--<![endif]-->
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="shortcut icon" href="/lab/wiki/lib/tpl/dokuwiki/images/favicon.ico" />
<link rel="apple-touch-icon" href="/lab/wiki/lib/tpl/dokuwiki/images/apple-touch-icon.png" />
</head>
<body>
<div id="dokuwiki__site"><div id="dokuwiki__top" class="site dokuwiki mode_show tpl_dokuwiki loggedIn ">
<!-- ********** HEADER ********** -->
<div id="dokuwiki__header"><div class="pad group">
<div class="headings group">
<ul class="a11y skip">
<li><a href="#dokuwiki__content">skip to content</a></li>
</ul>
<h1><a href="/lab/wiki/start" accesskey="h" title="[H]"><img src="/lab/wiki/lib/tpl/dokuwiki/images/logo.png" width="64" height="64" alt="" /> <span>DataWiki</span></a></h1>
</div>
<div class="tools group">
<!-- USER TOOLS -->
<div id="dokuwiki__usertools">
<h3 class="a11y">User Tools</h3>
<ul>
<li class="user">Logged in as: <bdi>Saskia Hiltemann</bdi> (<bdi>saskia</bdi>)</li><li class="action profile"><a href="/lab/wiki/personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r?do=profile" title="Update Profile" rel="nofollow"><span>Update Profile</span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M2 3h20c1.05 0 2 .95 2 2v14c0 1.05-.95 2-2 2H2c-1.05 0-2-.95-2-2V5c0-1.05.95-2 2-2m12 3v1h8V6h-8m0 2v1h8V8h-8m0 2v1h7v-1h-7m-6 3.91C6 13.91 2 15 2 17v1h12v-1c0-2-4-3.09-6-3.09M8 6a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3z"/></svg></a></li><li class="action admin"><a href="/lab/wiki/personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r?do=admin" title="Admin" rel="nofollow"><span>Admin</span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 15.5A3.5 3.5 0 0 1 8.5 12 3.5 3.5 0 0 1 12 8.5a3.5 3.5 0 0 1 3.5 3.5 3.5 3.5 0 0 1-3.5 3.5m7.43-2.53c.04-.32.07-.64.07-.97 0-.33-.03-.66-.07-1l2.11-1.63c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.31-.61-.22l-2.49 1c-.52-.39-1.06-.73-1.69-.98l-.37-2.65A.506.506 0 0 0 14 2h-4c-.25 0-.46.18-.5.42l-.37 2.65c-.63.25-1.17.59-1.69.98l-2.49-1c-.22-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64L4.57 11c-.04.34-.07.67-.07 1 0 .33.03.65.07.97l-2.11 1.66c-.19.15-.25.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1.01c.52.4 1.06.74 1.69.99l.37 2.65c.04.24.25.42.5.42h4c.25 0 .46-.18.5-.42l.37-2.65c.63-.26 1.17-.59 1.69-.99l2.49 1.01c.22.08.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.66z"/></svg></a></li><li class="action logout"><a href="/lab/wiki/personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r?do=logout&amp;sectok=82d4f55b849f74a21b9e52ddbd99f445" title="Log Out" rel="nofollow"><span>Log Out</span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M17 17.25V14h-7v-4h7V6.75L22.25 12 17 17.25M13 2a2 2 0 0 1 2 2v4h-2V4H4v16h9v-4h2v4a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9z"/></svg></a></li> </ul>
</div>
<!-- SITE TOOLS -->
<div id="dokuwiki__sitetools">
<h3 class="a11y">Site Tools</h3>
<form action="/lab/wiki/start" method="get" role="search" class="search doku_form" id="dw__search" accept-charset="utf-8"><input type="hidden" name="do" value="search" /><input type="hidden" name="id" value="personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r" /><div class="no"><input name="q" type="text" class="edit" title="[F]" accesskey="f" placeholder="Search" autocomplete="on" id="qsearch__in" value="" /><button value="1" type="submit" title="Search">Search</button><div id="qsearch__out" class="ajax_qsearch JSpopup"></div></div></form> <div class="mobileTools">
<form action="/lab/wiki/doku.php" method="get" accept-charset="utf-8"><div class="no"><input type="hidden" name="id" value="personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r" /><input type="hidden" name="sectok" value="82d4f55b849f74a21b9e52ddbd99f445" /><select name="do" class="edit quickselect" title="Tools"><option value="">Tools</option><optgroup label="Page Tools"><option value="edit">Edit this page</option><option value="revisions">Old revisions</option><option value="export_pdf">Export to PDF</option><option value="backlink">Backlinks</option></optgroup><optgroup label="Site Tools"><option value="recent">Recent Changes</option><option value="media">Media Manager</option><option value="index">Sitemap</option></optgroup><optgroup label="User Tools"><option value="profile">Update Profile</option><option value="admin">Admin</option><option value="logout">Log Out</option></optgroup></select><button type="submit">&gt;</button></div></form> </div>
<ul>
<li class="action recent"><a href="/lab/wiki/personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r?do=recent" title="Recent Changes [r]" rel="nofollow" accesskey="r">Recent Changes</a></li><li class="action media"><a href="/lab/wiki/personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r?do=media&amp;ns=personal%3Ahaasf%3A2021%3Amadland%3Arnaseqhoecker" title="Media Manager" rel="nofollow">Media Manager</a></li><li class="action index"><a href="/lab/wiki/personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r?do=index" title="Sitemap [x]" rel="nofollow" accesskey="x">Sitemap</a></li> </ul>
</div>
</div>
<!-- BREADCRUMBS -->
<div class="breadcrumbs">
<div class="youarehere"><span class="bchead">You are here: </span><span class="home"><bdi><a href="/lab/wiki/start" class="wikilink1" title="start" data-wiki-id="start">Data</a></bdi></span> » <bdi><a href="/lab/wiki/personal:start" class="wikilink2" title="personal:start" rel="nofollow" data-wiki-id="personal:start">personal</a></bdi> » <bdi><a href="/lab/wiki/personal:haasf:start" class="wikilink1" title="personal:haasf:start" data-wiki-id="personal:haasf:start">Personal page - Fabian Haas</a></bdi> » <bdi><a href="/lab/wiki/personal:haasf:2021" class="wikilink1" title="personal:haasf:2021" data-wiki-id="personal:haasf:2021">Labbook Fabian Haas</a></bdi> » <bdi><a href="/lab/wiki/personal:haasf:2021:madland:start" class="wikilink2" title="personal:haasf:2021:madland:start" rel="nofollow" data-wiki-id="personal:haasf:2021:madland:start">madland</a></bdi> » <bdi><a href="/lab/wiki/personal:haasf:2021:madland:rnaseqhoecker" class="wikilink1" title="personal:haasf:2021:madland:rnaseqhoecker" data-wiki-id="personal:haasf:2021:madland:rnaseqhoecker">RNA-seq Höcker Lab</a></bdi> » <bdi><a href="/lab/wiki/personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r" class="wikilink1" title="personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r" data-wiki-id="personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r">3d_pca_plot_hoecker_20210527.r</a></bdi></div>
<div class="trace"><span class="bchead">Trace:</span> <span class="bcsep"></span> <bdi><a href="/lab/wiki/personal:saskia:2023:10_2023_diary" class="breadcrumbs" title="personal:saskia:2023:10_2023_diary">Friday 13 October</a></bdi> <span class="bcsep"></span> <bdi><a href="/lab/wiki/personal:haasf:2021:madland:rnaseqhoecker" class="breadcrumbs" title="personal:haasf:2021:madland:rnaseqhoecker">RNA-seq Höcker Lab</a></bdi> <span class="bcsep"></span> <span class="curid"><bdi><a href="/lab/wiki/personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r" class="breadcrumbs" title="personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r">3d_pca_plot_hoecker_20210527.r</a></bdi></span></div>
</div>
<hr class="a11y" />
</div></div><!-- /header -->
<div class="wrapper group">
<!-- ********** CONTENT ********** -->
<div id="dokuwiki__content"><div class="pad group">
<div class="notify">Hotfix release available: 2023-04-04a "Jack Jackrum".
<a href="http://download.dokuwiki.org">upgrade now!</a> [54.1] <a href="http://www.dokuwiki.org/update_check">(what's this?)</a></div><div class="notify">New release available: 2023-04-04 "Jack Jackrum".
<a href="http://download.dokuwiki.org">upgrade now!</a> [54] <a href="http://www.dokuwiki.org/update_check">(what's this?)</a></div><div class="notify">Hotfix release available: 2022-07-31b "Igor".
<a href="http://download.dokuwiki.org">upgrade now!</a> [53.1] <a href="http://www.dokuwiki.org/update_check">(what's this?)</a></div><div class="notify">Hotfix release available: 2022-07-31a "Igor".
<a href="http://download.dokuwiki.org">upgrade now!</a> [53] <a href="http://www.dokuwiki.org/update_check">(what's this?)</a></div><div class="notify">New release available: 2022-07-31 "Igor".
<a href="http://download.dokuwiki.org">upgrade now!</a> [52.2] <a href="http://www.dokuwiki.org/update_check">(what's this?)</a></div><div class="notify">New release candidate 2 available: rc2022-06-26 "Igor".
<a href="http://download.dokuwiki.org">upgrade now!</a> [52.1] <a href="http://www.dokuwiki.org/update_check">(what's this?)</a></div><div class="notify">New release candidate available: 2022-06-26 "Igor".
<a href="http://download.dokuwiki.org">upgrade now!</a> [52] <a href="http://www.dokuwiki.org/update_check">(what's this?)</a></div><div class="notify">Hotfix release available: 2020-07-29a "Hogfather".
<a href="http://download.dokuwiki.org">upgrade now!</a> [51.4] <a href="http://www.dokuwiki.org/update_check">(what's this?)</a></div>
<div class="pageId"><span>personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r</span></div>
<div class="page group">
<!-- wikipage start -->
<dl class="file">
<dt><a href="/lab/wiki/_export/code/personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r?codeblock=0" title="Download Snippet" class="mediafile mf_r">:personal:haasf:2021:madland:3d_pca_plot_hoecker_20210527.r</a></dt>
<dd><pre class="code file rsplus"><span class="co1"># 3d R plot</span>
saveat <span class="sy0">&lt;-</span> <span class="st0">&quot;/mnt/NAS_coruscant_datashare/haasf/madland_RNA-seq_Hoecker&quot;</span>
&nbsp;
file.<span class="me1">rpkm</span> <span class="sy0">&lt;-</span> <span class="st0">'/mnt/NAS_coruscant_datashare/haasf/madland_RNA-seq_Hoecker/31315.p.sort.rpkm'</span>
&nbsp;
&nbsp;
<span class="co1">## Windows ###</span>
<span class="co1">#-#saveat &lt;- &quot;Q:/haasf/leubner_RNA-seq/Celery/DEGs_0.9/&quot;</span>
&nbsp;
<span class="co1">#-#file.rpkm &lt;- 'Q:/haasf/leubner_RNA-seq/Celery/DEGs/Celery_merged_isoforms.p.sort.rpkm'</span>
<span class="co1">#-#file.count &lt;- 'Q:/haasf/leubner_RNA-seq/Celery/DEGs_0.9/Celery_merged_isoforms.p.sort.counts'</span>
<span class="co1">###</span>
&nbsp;
data.<span class="me1">rpkm</span> <span class="sy0">&lt;-</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/utils/html/read.table.html"><span class="kw8">read.<span class="me1">table</span></span></a><span class="br0">&#40;</span>file.<span class="me1">rpkm</span>, header<span class="sy0">=</span><a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/T.html"><span class="kw2">T</span></a>, sep<span class="sy0">=</span><span class="st0">&quot;<span class="es0">\t</span>&quot;</span>, <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/row.names.html"><span class="kw2">row.<span class="me1">names</span></span></a><span class="sy0">=</span><span class="nu0">1</span><span class="br0">&#41;</span>
&nbsp;
&nbsp;
<span class="co1"># sort by colnames</span>
data.<span class="me1">rpkm</span> <span class="sy0">&lt;-</span> data.<span class="me1">rpkm</span><span class="br0">&#91;</span>,<a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/order.html"><span class="kw2">order</span></a><span class="br0">&#40;</span><a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/colnames.html"><span class="kw2">colnames</span></a><span class="br0">&#40;</span>data.<span class="me1">rpkm</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#93;</span>
&nbsp;
&nbsp;
librariesName <span class="sy0">&lt;-</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/list.html"><span class="kw2">list</span></a><span class="br0">&#40;</span>
cop_D <span class="sy0">=</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/c.html"><span class="kw2">c</span></a><span class="br0">&#40;</span><span class="st0">&quot;cop_D&quot;</span>, <span class="st0">&quot;red&quot;</span><span class="br0">&#41;</span>,
cop_L <span class="sy0">=</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/c.html"><span class="kw2">c</span></a><span class="br0">&#40;</span><span class="st0">&quot;cop_L&quot;</span>, <span class="st0">&quot;blue&quot;</span><span class="br0">&#41;</span>,
spa_D <span class="sy0">=</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/c.html"><span class="kw2">c</span></a><span class="br0">&#40;</span><span class="st0">&quot;spa_D&quot;</span>, <span class="st0">&quot;green&quot;</span><span class="br0">&#41;</span>,
spa_L <span class="sy0">=</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/c.html"><span class="kw2">c</span></a><span class="br0">&#40;</span><span class="st0">&quot;spa_L&quot;</span>, <span class="st0">&quot;yellow&quot;</span><span class="br0">&#41;</span>,
WT_D <span class="sy0">=</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/c.html"><span class="kw2">c</span></a><span class="br0">&#40;</span><span class="st0">&quot;WT_D&quot;</span>, <span class="st0">&quot;black&quot;</span><span class="br0">&#41;</span>,
WT_L <span class="sy0">=</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/c.html"><span class="kw2">c</span></a><span class="br0">&#40;</span><span class="st0">&quot;WT_L&quot;</span>, <span class="st0">&quot;violet&quot;</span><span class="br0">&#41;</span>
<span class="br0">&#41;</span>
&nbsp;
<span class="co1"># </span>
<span class="co1"># header.ori &lt;- c(&quot;56754_WT_Naturally_3.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56753_WT_Naturally_2.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56752_WT_Naturally_1.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56751_tt_6_days_3.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56750_tt_6_days_2.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56749_tt_6_days_1.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56748_tt_0_days_3.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56747_tt_0_days_2.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56746_tt_0_days_1.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56745_WT_10_days_3.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56744_WT_10_days_2.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56743_WT_10_days_1.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56742_WT_6_days_3.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56741_WT_6_days_2.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56740_WT_6_days_1.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56739_WT_0_days_3.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56738_WT_0_days_2.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56737_WT_0_days_1.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56736_tt_T1_tt_6d_3.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56735_tt_T1_tt_6d_2.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56734_tt_T1_tt_6d_1.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56733_tt_T1_tt_0d_3.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56732_tt_T1_tt_0d_2.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56731_tt_T1_tt_0d_1.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56730_tt_T1_tt_0d_3.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56729_tt_T1_tt_0d_2.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56728_tt_T1_tt_0d_1.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56727_WT_T1_NA_3.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56726_WT_T1_NA_2.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56725_WT_T1_NA_1.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56724_WT_T1_WT_0d_3.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56723_WT_T1_WT_0d_2.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56722_WT_T1_WT_0d_1.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56721_WT_T1_WT_10d_3.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56720_WT_T1_WT_10d_2.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56719_WT_T1_WT_10d_1.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56718_WT_T1_WT_0d_3.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56717_WT_T1_WT_0d_2.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56716_WT_T1_WT_0d_1.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56715_WT_T1_WT_6d_3.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56714_WT_T1_WT_6d_2.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56713_WT_T1_WT_6d_1.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56712_WT_T1_WT_0d_3.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56711_WT_T1_WT_0d_2.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56710_WT_T1_WT_0d_1.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56709_WT_T1_WT_0d_3.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56708_WT_T1_WT_0d_2.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56707_WT_T1_WT_0d_1.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56706_WT_T1_tt_0d_3.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56705_WT_T1_tt_0d_2.bam.sort.fastq.unmapped.sam.sort.bam&quot;, &quot;56704_WT_T1_tt_0d_1.bam.sort.fastq.unmapped.sam.sort.bam&quot;)</span>
<span class="co1"># header.new &lt;- c(&quot;T17_Dry_Naturally_Freezedryseed&quot;, &quot;T17_Dry_Naturally_Freezedryseed.1&quot;, &quot;T17_Dry_Naturally_Freezedryseed.2&quot;, &quot;T16_Dry_6days_Freezeafter6dageing&quot;, &quot;T16_Dry_6days_Freezeafter6dageing.1&quot;, &quot;T16_Dry_6days_Freezeafter6dageing.2&quot;, &quot;T15_Dry_0days_Freezedryseed&quot;, &quot;T15_Dry_0days_Freezedryseed.1&quot;, &quot;T15_Dry_0days_Freezedryseed.2&quot;, &quot;T14_Dry_10days_Freezeafter10dageing&quot;, &quot;T14_Dry_10days_Freezeafter10dageing.1&quot;, &quot;T14_Dry_10days_Freezeafter10dageing.2&quot;, &quot;T13_Dry_6days_Freezeafter6dageing&quot;, &quot;T13_Dry_6days_Freezeafter6dageing.1&quot;, &quot;T13_Dry_6days_Freezeafter6dageing.2&quot;, &quot;T12_Dry_0days_Freezedryseed&quot;, &quot;T12_Dry_0days_Freezedryseed.1&quot;, &quot;T12_Dry_0days_Freezedryseed.2&quot;, &quot;T11_Imbibe_6days_12h&quot;, &quot;T11_Imbibe_6days_12h.1&quot;, &quot;T11_Imbibe_6days_12h.2&quot;, &quot;T10_Imbibe_6days_5h&quot;, &quot;T10_Imbibe_6days_5h.1&quot;, &quot;T10_Imbibe_6days_5h.2&quot;, &quot;T9_Imbibe_0dyas_5h&quot;, &quot;T9_Imbibe_0dyas_5h.1&quot;, &quot;T9_Imbibe_0dyas_5h.2&quot;, &quot;T8_Imbibe_Naturally_47h&quot;, &quot;T8_Imbibe_Naturally_47h.1&quot;, &quot;T8_Imbibe_Naturally_47h.2&quot;, &quot;T7_Imbibe_Naturally_24h&quot;, &quot;T7_Imbibe_Naturally_24h.1&quot;, &quot;T7_Imbibe_Naturally_24h.2&quot;, &quot;T6_Imbibe_10days_72h&quot;, &quot;T6_Imbibe_10days_72h.1&quot;, &quot;T6_Imbibe_10days_72h.2&quot;, &quot;T5_Imbibe_10days_24h&quot;, &quot;T5_Imbibe_10days_24h.1&quot;, &quot;T5_Imbibe_10days_24h.2&quot;, &quot;T4_Imbibe_6days_47h&quot;, &quot;T4_Imbibe_6days_47h.1&quot;, &quot;T4_Imbibe_6days_47h.2&quot;, &quot;T3_Imbibe_6days_24h&quot;, &quot;T3_Imbibe_6days_24h.1&quot;, &quot;T3_Imbibe_6days_24h.2&quot;, &quot;T2_Imbibe_0days_24h&quot;, &quot;T2_Imbibe_0days_24h.1&quot;, &quot;T2_Imbibe_0days_24h.2&quot;, &quot;T1_Imbibe_0days_5h&quot;, &quot;T1_Imbibe_0days_5h.1&quot;, &quot;T1_Imbibe_0days_5h.2&quot;)</span>
<span class="co1"># </span>
<span class="co1"># header.new &lt;- header.new[order(header.ori)]</span>
<span class="co1"># header.ori &lt;- header.ori[order(header.ori)]</span>
<span class="co1"># </span>
<span class="co1"># col.header &lt;- header.new</span>
<span class="co1"># </span>
<span class="co1"># colnames(data.rpkm) &lt;- col.header</span>
&nbsp;
<a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/library.html"><span class="kw2">library</span></a><span class="br0">&#40;</span><span class="st0">&quot;DESeq2&quot;</span><span class="br0">&#41;</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/library.html"><span class="kw2">library</span></a><span class="br0">&#40;</span><span class="st0">&quot;ggplot2&quot;</span><span class="br0">&#41;</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/library.html"><span class="kw2">library</span></a><span class="br0">&#40;</span><span class="st0">&quot;RColorBrewer&quot;</span><span class="br0">&#41;</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/library.html"><span class="kw2">library</span></a><span class="br0">&#40;</span><span class="st0">&quot;pheatmap&quot;</span><span class="br0">&#41;</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/library.html"><span class="kw2">library</span></a><span class="br0">&#40;</span><span class="st0">&quot;BiocGenerics&quot;</span><span class="br0">&#41;</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/library.html"><span class="kw2">library</span></a><span class="br0">&#40;</span><span class="st0">&quot;rgl&quot;</span><span class="br0">&#41;</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/library.html"><span class="kw2">library</span></a><span class="br0">&#40;</span><span class="st0">&quot;magick&quot;</span><span class="br0">&#41;</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/library.html"><span class="kw2">library</span></a><span class="br0">&#40;</span><span class="st0">&quot;sjmisc&quot;</span><span class="br0">&#41;</span>
&nbsp;
&nbsp;
<span class="co1">################### running ######################</span>
<span class="co1">### PCA RPKM ###</span>
&nbsp;
<a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/set.seed.html"><span class="kw2">set.<span class="me1">seed</span></span></a><span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span>
&nbsp;
data.<span class="me1">inv</span> <span class="sy0">&lt;-</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/t.html"><span class="kw2">t</span></a><span class="br0">&#40;</span>data.<span class="me1">rpkm</span><span class="br0">&#41;</span>
data.<span class="me1">dist</span> <span class="sy0">&lt;-</span><a href="http://stat.ethz.ch/R-manual/R-devel/library/stats/html/dist.html"><span class="kw7">dist</span></a><span class="br0">&#40;</span>data.<span class="me1">inv</span>, method<span class="sy0">=</span><span class="st0">&quot;euclidean&quot;</span><span class="br0">&#41;</span> <span class="co1"># &quot;euclidean&quot;, &quot;maximum&quot;, &quot;manhattan&quot;, &quot;canberra&quot;, &quot;binary&quot; or &quot;minkowski&quot;</span>
data.<span class="me1">dist</span>.<span class="me1">hc</span> <span class="sy0">&lt;-</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/stats/html/hclust.html"><span class="kw7">hclust</span></a><span class="br0">&#40;</span>data.<span class="me1">dist</span>,method<span class="sy0">=</span><span class="st0">&quot;ward.D2&quot;</span><span class="br0">&#41;</span>
data.<span class="me1">dist</span>.<span class="me1">pca</span> <span class="sy0">&lt;-</span><a href="http://stat.ethz.ch/R-manual/R-devel/library/stats/html/princomp.html"><span class="kw7">princomp</span></a><span class="br0">&#40;</span>data.<span class="me1">dist</span>,<a href="http://stat.ethz.ch/R-manual/R-devel/library/stats/html/cor.html"><span class="kw7">cor</span></a><span class="sy0">=</span><a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/T.html"><span class="kw2">T</span></a><span class="br0">&#41;</span>
&nbsp;
pc1 <span class="sy0">&lt;-</span> data.<span class="me1">dist</span>.<span class="me1">pca</span>$scores<span class="br0">&#91;</span>,<span class="nu0">1</span><span class="br0">&#93;</span>
pc2 <span class="sy0">&lt;-</span> data.<span class="me1">dist</span>.<span class="me1">pca</span>$scores<span class="br0">&#91;</span>,<span class="nu0">2</span><span class="br0">&#93;</span>
pc3 <span class="sy0">&lt;-</span> data.<span class="me1">dist</span>.<span class="me1">pca</span>$scores<span class="br0">&#91;</span>,<span class="nu0">3</span><span class="br0">&#93;</span>
&nbsp;
<span class="co1"># create data frame for pc1 pc2 pc3</span>
data.<span class="me1">dist</span>.<span class="me1">pca</span>.<span class="me1">frame</span> <span class="sy0">=</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/data.frame.html"><span class="kw2">data.<span class="me1">frame</span></span></a><span class="br0">&#40;</span>pc1,pc2,pc3<span class="br0">&#41;</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/rownames.html"><span class="kw2">rownames</span></a><span class="br0">&#40;</span>data.<span class="me1">dist</span>.<span class="me1">pca</span>.<span class="me1">frame</span><span class="br0">&#41;</span> <span class="sy0">&lt;-</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/names.html"><span class="kw2">names</span></a><span class="br0">&#40;</span>data.<span class="me1">dist</span>.<span class="me1">pca</span>$scale<span class="br0">&#41;</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/colnames.html"><span class="kw2">colnames</span></a><span class="br0">&#40;</span>data.<span class="me1">dist</span>.<span class="me1">pca</span>.<span class="me1">frame</span><span class="br0">&#41;</span> <span class="sy0">&lt;-</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/c.html"><span class="kw2">c</span></a><span class="br0">&#40;</span><span class="st0">&quot;pc1&quot;</span>,<span class="st0">&quot;pc2&quot;</span>,<span class="st0">&quot;pc3&quot;</span><span class="br0">&#41;</span>
&nbsp;
condition.<span class="me1">values</span> <span class="sy0">&lt;-</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/c.html"><span class="kw2">c</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>
condition.<span class="me1">values</span>.<span class="me1">color</span> <span class="sy0">&lt;-</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/c.html"><span class="kw2">c</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>
&nbsp;
&nbsp;
<a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/for.html"><span class="kw2">for</span></a><span class="br0">&#40;</span>a <span class="kw1">in</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/colnames.html"><span class="kw2">colnames</span></a><span class="br0">&#40;</span>data.<span class="me1">rpkm</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
&nbsp;
v <span class="sy0">&lt;-</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/substr.html"><span class="kw2">substr</span></a><span class="br0">&#40;</span>a, <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/nchar.html"><span class="kw2">nchar</span></a><span class="br0">&#40;</span>a<span class="br0">&#41;</span>, <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/nchar.html"><span class="kw2">nchar</span></a><span class="br0">&#40;</span>a<span class="br0">&#41;</span><span class="br0">&#41;</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/if.html"><span class="kw2">if</span></a><span class="br0">&#40;</span>str_contains<span class="br0">&#40;</span>v, <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/c.html"><span class="kw2">c</span></a><span class="br0">&#40;</span><span class="nu0">1</span>,<span class="nu0">2</span>,<span class="nu0">3</span>,<span class="nu0">4</span>,<span class="nu0">5</span>,<span class="nu0">6</span>,<span class="nu0">7</span>,<span class="nu0">8</span>,<span class="nu0">9</span>,<span class="nu0">0</span><span class="br0">&#41;</span>, logic <span class="sy0">=</span> <span class="st0">&quot;or&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/if.html"><span class="kw2">if</span></a> <span class="br0">&#40;</span><a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/substr.html"><span class="kw2">substr</span></a><span class="br0">&#40;</span><a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/substr.html"><span class="kw2">substr</span></a><span class="br0">&#40;</span>a, <span class="nu0">1</span>, <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/nchar.html"><span class="kw2">nchar</span></a><span class="br0">&#40;</span>a<span class="br0">&#41;</span><span class="sy0">-</span><span class="nu0">2</span><span class="br0">&#41;</span>, <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/nchar.html"><span class="kw2">nchar</span></a><span class="br0">&#40;</span><a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/substr.html"><span class="kw2">substr</span></a><span class="br0">&#40;</span>a, <span class="nu0">1</span>, <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/nchar.html"><span class="kw2">nchar</span></a><span class="br0">&#40;</span>a<span class="br0">&#41;</span><span class="sy0">-</span><span class="nu0">2</span><span class="br0">&#41;</span><span class="br0">&#41;</span>, <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/nchar.html"><span class="kw2">nchar</span></a><span class="br0">&#40;</span><a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/substr.html"><span class="kw2">substr</span></a><span class="br0">&#40;</span>a, <span class="nu0">1</span>, <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/nchar.html"><span class="kw2">nchar</span></a><span class="br0">&#40;</span>a<span class="br0">&#41;</span><span class="sy0">-</span><span class="nu0">2</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">==</span> <span class="st0">&quot;.&quot;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
n <span class="sy0">&lt;-</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/substr.html"><span class="kw2">substr</span></a><span class="br0">&#40;</span>a, <span class="nu0">1</span>, <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/nchar.html"><span class="kw2">nchar</span></a><span class="br0">&#40;</span>a<span class="br0">&#41;</span><span class="sy0">-</span><span class="nu0">3</span><span class="br0">&#41;</span>
<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span>
n <span class="sy0">&lt;-</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/substr.html"><span class="kw2">substr</span></a><span class="br0">&#40;</span>a, <span class="nu0">1</span>, <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/nchar.html"><span class="kw2">nchar</span></a><span class="br0">&#40;</span>a<span class="br0">&#41;</span><span class="sy0">-</span><span class="nu0">2</span><span class="br0">&#41;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span>
n <span class="sy0">&lt;-</span> a
&nbsp;
<span class="br0">&#125;</span>
condition.<span class="me1">values</span> <span class="sy0">&lt;-</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/c.html"><span class="kw2">c</span></a><span class="br0">&#40;</span>condition.<span class="me1">values</span>, librariesName<span class="br0">&#91;</span>n<span class="br0">&#93;</span><span class="br0">&#91;</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="br0">&#41;</span>
condition.<span class="me1">values</span>.<span class="me1">color</span> <span class="sy0">&lt;-</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/c.html"><span class="kw2">c</span></a><span class="br0">&#40;</span>condition.<span class="me1">values</span>.<span class="me1">color</span>, librariesName<span class="br0">&#91;</span>n<span class="br0">&#93;</span><span class="br0">&#91;</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">2</span><span class="br0">&#93;</span><span class="br0">&#41;</span>
<span class="br0">&#125;</span>
&nbsp;
&nbsp;
data.<span class="me1">dist</span>.<span class="me1">pca</span>.<span class="me1">frame</span><span class="br0">&#91;</span><span class="st0">&quot;tissue&quot;</span><span class="br0">&#93;</span> <span class="sy0">&lt;-</span> condition.<span class="me1">values</span>
data.<span class="me1">dist</span>.<span class="me1">pca</span>.<span class="me1">frame</span><span class="br0">&#91;</span><span class="st0">&quot;color&quot;</span><span class="br0">&#93;</span> <span class="sy0">&lt;-</span> condition.<span class="me1">values</span>.<span class="me1">color</span>
data.<span class="me1">dist</span>.<span class="me1">pca</span>.<span class="me1">frame</span><span class="br0">&#91;</span><span class="st0">&quot;name&quot;</span><span class="br0">&#93;</span> <span class="sy0">&lt;-</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/names.html"><span class="kw2">names</span></a><span class="br0">&#40;</span>data.<span class="me1">dist</span>.<span class="me1">pca</span>$scale<span class="br0">&#41;</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/attr.html"><span class="kw2">attr</span></a><span class="br0">&#40;</span>data.<span class="me1">dist</span>.<span class="me1">pca</span>.<span class="me1">frame</span>, <span class="st0">&quot;percentVar&quot;</span><span class="br0">&#41;</span> <span class="sy0">&lt;-</span> <span class="br0">&#40;</span>data.<span class="me1">dist</span>.<span class="me1">pca</span>$sdev<span class="br0">&#41;</span><span class="sy0">^</span><span class="nu0">2</span> <span class="sy0">/</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/sum.html"><span class="kw2">sum</span></a><span class="br0">&#40;</span>data.<span class="me1">dist</span>.<span class="me1">pca</span>$sdev<span class="sy0">^</span><span class="nu0">2</span><span class="br0">&#41;</span> <span class="co1"># cumsum()</span>
&nbsp;
<span class="co1"># simple plot</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/png.html"><span class="kw5">png</span></a><span class="br0">&#40;</span>filename<span class="sy0">=</span>paste0<span class="br0">&#40;</span>saveat, <span class="st0">&quot;/HC_RPKM_normalized.png&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/graphics/html/plot.html"><span class="kw4">plot</span></a><span class="br0">&#40;</span>data.<span class="me1">dist</span>.<span class="me1">hc</span><span class="br0">&#41;</span> <span class="co1"># hc plot</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/dev.off.html"><span class="kw5">dev.<span class="me1">off</span></span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/png.html"><span class="kw5">png</span></a><span class="br0">&#40;</span>filename<span class="sy0">=</span>paste0<span class="br0">&#40;</span>saveat, <span class="st0">&quot;/PCA_variance_RPKM_normalized.png&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/graphics/html/plot.html"><span class="kw4">plot</span></a><span class="br0">&#40;</span>data.<span class="me1">dist</span>.<span class="me1">pca</span><span class="br0">&#41;</span> <span class="co1"># variances; var(data.dist.pca$sdev[1:9])</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/dev.off.html"><span class="kw5">dev.<span class="me1">off</span></span></a><span class="br0">&#40;</span><span class="br0">&#41;</span>
<span class="co1"># get the parcent variation</span>
percentVar <span class="sy0">&lt;-</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/round.html"><span class="kw2">round</span></a><span class="br0">&#40;</span><span class="nu0">100</span> <span class="sy0">*</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/attr.html"><span class="kw2">attr</span></a><span class="br0">&#40;</span>data.<span class="me1">dist</span>.<span class="me1">pca</span>.<span class="me1">frame</span>, <span class="st0">&quot;percentVar&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>
&nbsp;
<span class="co1"># 3d plot</span>
plot3d<span class="br0">&#40;</span>pc1, pc2, pc3,
type <span class="sy0">=</span> <span class="st0">&quot;s&quot;</span>, <span class="co1"># p, s, l, h, n</span>
<span class="co1">#pch = c(1:3),</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/col.html"><span class="kw2">col</span></a> <span class="sy0">=</span> condition.<span class="me1">values</span>.<span class="me1">color</span>,
size <span class="sy0">=</span> <span class="nu0">1</span>,
xlab <span class="sy0">=</span> paste0<span class="br0">&#40;</span><span class="st0">&quot;PC1: &quot;</span>,percentVar<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span>,<span class="st0">&quot;% variance&quot;</span><span class="br0">&#41;</span>,
ylab <span class="sy0">=</span> paste0<span class="br0">&#40;</span><span class="st0">&quot;PC2: &quot;</span>,percentVar<span class="br0">&#91;</span><span class="nu0">2</span><span class="br0">&#93;</span>,<span class="st0">&quot;% variance&quot;</span><span class="br0">&#41;</span>,
zlab <span class="sy0">=</span> paste0<span class="br0">&#40;</span><span class="st0">&quot;PC3: &quot;</span>,percentVar<span class="br0">&#91;</span><span class="nu0">3</span><span class="br0">&#93;</span>,<span class="st0">&quot;% variance&quot;</span><span class="br0">&#41;</span>,
cex <span class="sy0">=</span> <span class="nu0">2</span>,
main <span class="sy0">=</span> <span class="st0">&quot;&quot;</span>, <span class="co1"># -&gt; princomp&quot;,</span>
<span class="br0">&#41;</span>
&nbsp;
<span class="co1"># shift &lt;- matrix(4, 4, 4, byrow = TRUE)</span>
<span class="co1"># text3d(shift,texts=1:3)</span>
grid3d<span class="br0">&#40;</span><a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/c.html"><span class="kw2">c</span></a><span class="br0">&#40;</span><span class="st0">&quot;x&quot;</span>, <span class="st0">&quot;y&quot;</span>, <span class="st0">&quot;z&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>
&nbsp;
<span class="co1">## add legend</span>
legend3d<span class="br0">&#40;</span><span class="st0">&quot;right&quot;</span>, <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/unique.html"><span class="kw2">unique</span></a><span class="br0">&#40;</span>condition.<span class="me1">values</span><span class="br0">&#41;</span>, pch <span class="sy0">=</span> <span class="nu0">19</span>, <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/col.html"><span class="kw2">col</span></a> <span class="sy0">=</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/unique.html"><span class="kw2">unique</span></a><span class="br0">&#40;</span>condition.<span class="me1">values</span>.<span class="me1">color</span><span class="br0">&#41;</span><span class="br0">&#41;</span>
&nbsp;
<span class="co1">#### video #####</span>
M <span class="sy0">&lt;-</span> par3d<span class="br0">&#40;</span><span class="st0">&quot;userMatrix&quot;</span><span class="br0">&#41;</span>
play3d<span class="br0">&#40;</span> par3dinterp<span class="br0">&#40;</span> userMatrix<span class="sy0">=</span><a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/list.html"><span class="kw2">list</span></a><span class="br0">&#40;</span>M,
rotate3d<span class="br0">&#40;</span>M, <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/pi.html"><span class="kw2">pi</span></a><span class="sy0">/</span><span class="nu0">2</span>, <span class="nu0">1</span>, <span class="nu0">0</span>, <span class="nu0">0</span><span class="br0">&#41;</span>,
rotate3d<span class="br0">&#40;</span>M, <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/pi.html"><span class="kw2">pi</span></a><span class="sy0">/</span><span class="nu0">2</span>, <span class="nu0">0</span>, <span class="nu0">1</span>, <span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> <span class="br0">&#41;</span>,
duration<span class="sy0">=</span><span class="nu0">2</span> <span class="br0">&#41;</span>
&nbsp;
movie3d<span class="br0">&#40;</span>spin3d<span class="br0">&#40;</span><a href="http://stat.ethz.ch/R-manual/R-devel/library/graphics/html/axis.html"><span class="kw4">axis</span></a> <span class="sy0">=</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/c.html"><span class="kw2">c</span></a><span class="br0">&#40;</span><span class="nu0">1</span>, <span class="nu0">2</span>, <span class="nu0">1</span><span class="br0">&#41;</span><span class="br0">&#41;</span>, duration <span class="sy0">=</span> <span class="nu0">5</span>,
<a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/dir.html"><span class="kw2">dir</span></a> <span class="sy0">=</span> saveat<span class="br0">&#41;</span>
&nbsp;
<span class="co1">#### video end ####</span>
&nbsp;
<span class="co1"># pc1, pc2</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/png.html"><span class="kw5">png</span></a><span class="br0">&#40;</span>filename<span class="sy0">=</span>paste0<span class="br0">&#40;</span>saveat, <span class="st0">&quot;/PCA_RPKM_normalized.png&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>
ggplot<span class="br0">&#40;</span>
data.<span class="me1">dist</span>.<span class="me1">pca</span>.<span class="me1">frame</span>,
aes<span class="br0">&#40;</span>
pc1,
pc2,
color<span class="sy0">=</span>tissue<span class="br0">&#41;</span>
<span class="br0">&#41;</span> <span class="sy0">+</span>
geom_point<span class="br0">&#40;</span>size<span class="sy0">=</span><span class="nu0">2.5</span><span class="br0">&#41;</span> <span class="sy0">+</span>
xlab<span class="br0">&#40;</span>
paste0<span class="br0">&#40;</span><span class="st0">&quot;PC1: &quot;</span>,percentVar<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span>,<span class="st0">&quot;% variance&quot;</span><span class="br0">&#41;</span>
<span class="br0">&#41;</span> <span class="sy0">+</span>
ylab<span class="br0">&#40;</span>
paste0<span class="br0">&#40;</span><span class="st0">&quot;PC2: &quot;</span>,percentVar<span class="br0">&#91;</span><span class="nu0">2</span><span class="br0">&#93;</span>,<span class="st0">&quot;% variance&quot;</span><span class="br0">&#41;</span>
<span class="br0">&#41;</span> <span class="sy0">+</span>
<span class="co1">#theme() + #, face=&quot;bold&quot;</span>
scale_colour_manual<span class="br0">&#40;</span>
values<span class="sy0">=</span> <a href="http://stat.ethz.ch/R-manual/R-devel/library/base/html/c.html"><span class="kw2">c</span></a><span class="br0">&#40;</span><span class="st0">&quot;red&quot;</span>, <span class="st0">&quot;blue&quot;</span>, <span class="st0">&quot;green&quot;</span>, <span class="st0">&quot;yellow&quot;</span>, <span class="st0">&quot;black&quot;</span>, <span class="st0">&quot;violet&quot;</span><span class="br0">&#41;</span> <span class="co1"># dodgerblue3</span>
<span class="br0">&#41;</span> <span class="sy0">+</span>
ggtitle<span class="br0">&#40;</span><span class="st0">&quot;PCA of all samples (RPKM normalized)&quot;</span><span class="br0">&#41;</span> <span class="sy0">+</span>
theme<span class="br0">&#40;</span>
plot.<span class="me1">title</span> <span class="sy0">=</span> element_text<span class="br0">&#40;</span>lineheight<span class="sy0">=</span>.8<span class="br0">&#41;</span>,
panel.<span class="me1">background</span> <span class="sy0">=</span> element_rect<span class="br0">&#40;</span>fill <span class="sy0">=</span> <span class="st0">&quot;gray95&quot;</span><span class="br0">&#41;</span>
<span class="br0">&#41;</span>
<a href="http://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/dev.off.html"><span class="kw5">dev.<span class="me1">off</span></span></a><span class="br0">&#40;</span><span class="br0">&#41;</span></pre>
</dd></dl>
<!-- wikipage stop -->
</div>
<div class="docInfo"><bdi>personal/haasf/2021/madland/rnaseqhoecker/3d_pca_plot_hoecker_20210527.r.txt</bdi> · Last modified: 2021/06/01 12:22 by <bdi>Fabian Haas</bdi></div>
</div></div><!-- /content -->
<hr class="a11y" />
<!-- PAGE ACTIONS -->
<div id="dokuwiki__pagetools">
<h3 class="a11y">Page Tools</h3>
<div class="tools">
<ul>
<li class="edit"><a href="/lab/wiki/personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r?do=edit" title="Edit this page [e]" rel="nofollow" accesskey="e"><span>Edit this page</span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25z"/></svg></a></li><li class="revs"><a href="/lab/wiki/personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r?do=revisions" title="Old revisions [o]" rel="nofollow" accesskey="o"><span>Old revisions</span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M11 7v5.11l4.71 2.79.79-1.28-4-2.37V7m0-5C8.97 2 5.91 3.92 4.27 6.77L2 4.5V11h6.5L5.75 8.25C6.96 5.73 9.5 4 12.5 4a7.5 7.5 0 0 1 7.5 7.5 7.5 7.5 0 0 1-7.5 7.5c-3.27 0-6.03-2.09-7.06-5h-2.1c1.1 4.03 4.77 7 9.16 7 5.24 0 9.5-4.25 9.5-9.5A9.5 9.5 0 0 0 12.5 2z"/></svg></a></li><li class="backlink"><a href="/lab/wiki/personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r?do=backlink" title="Backlinks" rel="nofollow"><span>Backlinks</span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M10.59 13.41c.41.39.41 1.03 0 1.42-.39.39-1.03.39-1.42 0a5.003 5.003 0 0 1 0-7.07l3.54-3.54a5.003 5.003 0 0 1 7.07 0 5.003 5.003 0 0 1 0 7.07l-1.49 1.49c.01-.82-.12-1.64-.4-2.42l.47-.48a2.982 2.982 0 0 0 0-4.24 2.982 2.982 0 0 0-4.24 0l-3.53 3.53a2.982 2.982 0 0 0 0 4.24m2.82-4.24c.39-.39 1.03-.39 1.42 0a5.003 5.003 0 0 1 0 7.07l-3.54 3.54a5.003 5.003 0 0 1-7.07 0 5.003 5.003 0 0 1 0-7.07l1.49-1.49c-.01.82.12 1.64.4 2.43l-.47.47a2.982 2.982 0 0 0 0 4.24 2.982 2.982 0 0 0 4.24 0l3.53-3.53a2.982 2.982 0 0 0 0-4.24.973.973 0 0 1 0-1.42z"/></svg></a></li><li class="export_pdf"><a href="/lab/wiki/personal:haasf:2021:madland:rnaseqhoecker:3d_pca_plot_hoecker_20210527.r?do=export_pdf" title="Export to PDF" rel="nofollow"><span>Export to PDF</span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M14 9h5.5L14 3.5V9M7 2h8l6 6v12a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2m4.93 10.44c.41.9.93 1.64 1.53 2.15l.41.32c-.87.16-2.07.44-3.34.93l-.11.04.5-1.04c.45-.87.78-1.66 1.01-2.4m6.48 3.81c.18-.18.27-.41.28-.66.03-.2-.02-.39-.12-.55-.29-.47-1.04-.69-2.28-.69l-1.29.07-.87-.58c-.63-.52-1.2-1.43-1.6-2.56l.04-.14c.33-1.33.64-2.94-.02-3.6a.853.853 0 0 0-.61-.24h-.24c-.37 0-.7.39-.79.77-.37 1.33-.15 2.06.22 3.27v.01c-.25.88-.57 1.9-1.08 2.93l-.96 1.8-.89.49c-1.2.75-1.77 1.59-1.88 2.12-.04.19-.02.36.05.54l.03.05.48.31.44.11c.81 0 1.73-.95 2.97-3.07l.18-.07c1.03-.33 2.31-.56 4.03-.75 1.03.51 2.24.74 3 .74.44 0 .74-.11.91-.3m-.41-.71l.09.11c-.01.1-.04.11-.09.13h-.04l-.19.02c-.46 0-1.17-.19-1.9-.51.09-.1.13-.1.23-.1 1.4 0 1.8.25 1.9.35M8.83 17c-.65 1.19-1.24 1.85-1.69 2 .05-.38.5-1.04 1.21-1.69l.48-.31m3.02-6.91c-.23-.9-.24-1.63-.07-2.05l.07-.12.15.05c.17.24.19.56.09 1.1l-.03.16-.16.82-.05.04z"/></svg></a></li><li class="top"><a href="#dokuwiki__top" title="Back to top [t]" rel="nofollow" accesskey="t"><span>Back to top</span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"/></svg></a></li> </ul>
</div>
</div>
</div><!-- /wrapper -->
<!-- ********** FOOTER ********** -->
<div id="dokuwiki__footer"><div class="pad">
<div class="buttons">
<a href="https://www.dokuwiki.org/donate" title="Donate" ><img
src="/lab/wiki/lib/tpl/dokuwiki/images/button-donate.gif" width="80" height="15" alt="Donate" /></a>
<a href="https://php.net" title="Powered by PHP" ><img
src="/lab/wiki/lib/tpl/dokuwiki/images/button-php.gif" width="80" height="15" alt="Powered by PHP" /></a>
<a href="//validator.w3.org/check/referer" title="Valid HTML5" ><img
src="/lab/wiki/lib/tpl/dokuwiki/images/button-html5.png" width="80" height="15" alt="Valid HTML5" /></a>
<a href="//jigsaw.w3.org/css-validator/check/referer?profile=css3" title="Valid CSS" ><img
src="/lab/wiki/lib/tpl/dokuwiki/images/button-css.png" width="80" height="15" alt="Valid CSS" /></a>
<a href="https://dokuwiki.org/" title="Driven by DokuWiki" ><img
src="/lab/wiki/lib/tpl/dokuwiki/images/button-dw.png" width="80" height="15"
alt="Driven by DokuWiki" /></a>
</div>
</div></div><!-- /footer -->
</div></div><!-- /site -->
<div class="no"><img src="/lab/wiki/lib/exe/taskrunner.php?id=personal%3Ahaasf%3A2021%3Amadland%3Arnaseqhoecker%3A3d_pca_plot_hoecker_20210527.r&amp;1697030124" width="2" height="1" alt="" /></div>
<div id="screen__mode" class="no"></div></body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment