<?xml version='1.0'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom" >
<channel>
	<title><![CDATA[BOL: Transpose the file coordinates and plot dendrogram in R]]></title>
	<link>https://bioinformaticsonline.com/snippets/view/31356/transpose-the-file-coordinates-and-plot-dendrogram-in-r?</link>
	<atom:link href="https://bioinformaticsonline.com/snippets/view/31356/transpose-the-file-coordinates-and-plot-dendrogram-in-r?" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/31356/transpose-the-file-coordinates-and-plot-dendrogram-in-r</guid>
	<pubDate>Mon, 06 Mar 2017 04:57:54 -0600</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/31356/transpose-the-file-coordinates-and-plot-dendrogram-in-r</link>
	<title><![CDATA[Transpose the file coordinates and plot dendrogram in R]]></title>
	<description><![CDATA[<code>#Save this as tr.awk
{ 
    for (i=1; i&lt;=NF; i++) a[NR,i]=$i
}
END {
    for (i=1; i&lt;=NF; i++) {
        for (j=1; j&lt;=NR; j++) {
            printf &quot;%s&quot;, a[j,i]
            if (j&lt;NR) printf &quot;%s&quot;, OFS
        }
        printf &quot;%s&quot;,ORS
    }
}

#Run this on command-line to transpose ur file
awk -f tr.awk bbb.txt &gt; bbbout.txt

#Plot in R
tetra &lt;- read.csv(&quot;bbbout.txt&quot;, header=T, stringsAsFactors = F, sep = &quot;\t&quot;, row.names = 1)
hc = hclust(dist(tetra))
plot (hc)</code>]]></description>
	<dc:creator>Abhimanyu Singh</dc:creator>
</item>

</channel>
</rss>