Skip to content

Commit

Permalink
Rscript
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasrausch committed Jun 16, 2024
1 parent 179b546 commit 970b0e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ all: ${TARGETS}
export PATH="${PBASE}/mamba/bin:${PATH}" && delly --version && touch .check

download: .mamba .tools .rstats .pcks
export PATH="${PBASE}/mamba/bin:${PATH}" && cd data/ && gdown ${FILE} && tar -xzf sv.tar.gz && rm sv.tar.gz
export PATH="${PBASE}/mamba/bin:${PATH}" && cd data/ && gdown ${FILE} && tar -xzf sv.tar.gz && cp ${PBASE}/scripts/cnBafSV.R ${PBASE}/data/sv/ && rm sv.tar.gz

clean:
rm -rf $(TARGETS) $(TARGETS:=.o) mamba/
12 changes: 6 additions & 6 deletions scripts/cnBafSV.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ library(scales)
library(gtable)
library(grid)
library(DNAcopy)
library(gridExtra)
library(cowplot)

args = commandArgs(trailingOnly=TRUE)
x = read.table(args[1], header=T)
Expand All @@ -21,7 +23,8 @@ if (length(args) == 1) { quit(); }
# Read-depth + SVs
sv = read.table(args[2], header=F)
colnames(sv) = c("chr","start","end","type","id")
p2 = p + geom_curve(data=sv, aes(x=start, xend=end, col=type), y=8, yend=8, curvature=-0.5)
p2 = p
if (length(args) <= 2) { p2 = p + geom_curve(data=sv, aes(x=start, xend=end, col=type), y=8, yend=8, curvature=-0.5); }
p2 = p2 + labs(colour="SV type")
seg=segments.summary(segment(smooth.CNA(CNA(log(x[,6]), rep("chr2", nrow(x)), x$start, data.type="logratio", sampleid="tumor")), undo.splits="sdundo", undo.SD=2))
p3=p2 + geom_segment(data=seg, aes(x=loc.start, y=exp(seg.median), xend=loc.end, yend=exp(seg.median)), colour="darkorange")
Expand All @@ -39,9 +42,6 @@ q = q + scale_x_continuous(labels=comma)
q = q + ylim(0,1)
q = q + theme(axis.text.x = element_text(angle=45, hjust=1))
p3 = p3 + xlim(min(baf$pos), max(baf$pos))
g1 = ggplotGrob(p3)
g2 = ggplotGrob(q)
g = rbind(g1, g2, size="first")
g$widths = unit.pmax(g1$widths, g2$widths)
ggsave(g, file="cov.png", width=10, height=7)
plot_grid(q, p3, align="v", nrow=2, rel_heights=c(1/3, 2/3))
ggsave(file="cov.png", width=10, height=7)
print(warnings())

0 comments on commit 970b0e8

Please sign in to comment.