Mercurial > repos > davidvanzessen > phenotype_gene_relations
changeset 10:768df9ba57e8 draft
Uploaded
author | davidvanzessen |
---|---|
date | Fri, 04 Sep 2015 04:52:05 -0400 |
parents | 98a908a5cd2f |
children | e907c881779b |
files | phenotype_gene_relations_plot.r phenotype_gene_relations_plot.sh |
diffstat | 2 files changed, 42 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/phenotype_gene_relations_plot.r Thu Sep 03 10:47:59 2015 -0400 +++ b/phenotype_gene_relations_plot.r Fri Sep 04 04:52:05 2015 -0400 @@ -20,26 +20,36 @@ OMTs = dat$OMT.1 %in% omt1 | dat$OMT.2 %in% omt2 | dat$OMT.3 %in% omt3 | dat$OMT.4 %in% omt4 | dat$OMT.5 %in% omt5 +print(sum(OMTs)) + dat.sub = dat[OMTs,] -selectA = dcast(dat.sub, OMT.5~disease.gene, length, value.var="disease.gene") +selectA = dcast(dat.sub, OMT.1+OMT.2+OMT.3+OMT.4+OMT.5~disease.gene, length, value.var="disease.gene") selectA[selectA > 0] = 1 +print(selectA) +print(sum(colSums(selectA) == nrow(selectA))) + selectA = selectA[,colSums(selectA) == nrow(selectA)] disease.in.omt = dat$disease.gene %in% names(selectA) inheritance.filter = dat$inheritance %in% inheritance -dat.sub2 = dat[OMTs & disease.in.omt & inheritance.filter ,c("disease.gene", "GROUP.CODE", "ratio")] +print(sum(disease.in.omt)) + +print(sum(inheritance.filter)) + +dat.sub2 = dat[OMTs & disease.in.omt & inheritance.filter ,c("disease.gene", "GROUP.CODE", "GROUP.NAME", "ratio")] dat.sub2 = dat.sub2[!duplicated(dat.sub2),] -p = ggplot(dat.sub2, aes(disease.gene, GROUP.CODE)) + geom_tile(aes(fill = ratio), colour = "white") + scale_fill_gradient(low = "white",high = "red") +p = ggplot(dat.sub2, aes(disease.gene, GROUP.NAME)) + geom_tile(aes(fill = ratio), colour = "white") + scale_fill_gradient(low = "white",high = "red") p = p + theme(axis.text.x = element_text(angle = 45, hjust = 1)) -png("plot1.png") + +png("plot1.png", width=length(unique(dat.sub2$diseaseId)) * 30 + 300) print(p) dev.off() @@ -49,7 +59,7 @@ p = p + theme(axis.text.x = element_text(angle = 45, hjust = 1)) -png("plot2.png") +png("plot2.png", width=length(unique(dat.sub3$diseaseId)) * 30 + 300) print(p) dev.off() @@ -59,10 +69,17 @@ p = p + theme(axis.text.x = element_text(angle = 45, hjust = 1)) -png("plot3.png", width=length(unique(dat.sub3$diseaseId)) * 30 + 200) +png("plot3.png", width=length(unique(dat.sub3$diseaseId)) * 30 + 300) print(p) dev.off() +disease.gene.url = dat[OMTs & disease.in.omt & inheritance.filter ,c("diseaseId", "gene.symbol", "url")] +disease.gene.url = disease.gene.url[!duplicated(disease.gene.url),] + +names(disease.gene.url) = c("Disease ID","Gene Symbol","URL") + +write.table(disease.gene.url, "disease_gene_url.txt", quote=F, sep="\t", row.names=F, col.names=T) + @@ -89,6 +106,3 @@ - - -
--- a/phenotype_gene_relations_plot.sh Thu Sep 03 10:47:59 2015 -0400 +++ b/phenotype_gene_relations_plot.sh Fri Sep 04 04:52:05 2015 -0400 @@ -28,6 +28,25 @@ Rscript --verbose $dir/phenotype_gene_relations_plot.r "$input" "$omt1" "$omt2" "$omt3" "$omt4" "$omt5" "$inheritance" "$outdir" 2>&1 +echo "<h2>CulaPhenAGen</h2><br />" > "$html" echo "<img src='plot1.png' /><br />" >> "$html" echo "<img src='plot2.png' /><br />" >> "$html" echo "<img src='plot3.png' /><br />" >> "$html" + +echo "<table border='1'>" >> $html +first="true" +while read diseaseId gene url + do + if [[ "$first" == "true" ]] ; then + echo "<thead><tr><th>$diseaseId</th><th>$gene</th><th>$url</th></tr></thead>" >> $html + first="false" + continue + fi + echo "<tr>" >> $html + echo "<td>$diseaseId</td>" >> $html + echo "<td>$gene</td>" >> $html + echo "<td><a href='$url'>$url</a></td>" >> $html + echo "</tr>" >> $html +done < "${outdir}/disease_gene_url.txt" +echo "</center>" >> $html +