Commit fc2f3556 authored by Blaise Li's avatar Blaise Li
Browse files

Missing target og a link.

parent e97f55e8
#!/usr/bin/env Rscript
options(show.error.locations=TRUE)
# Trying to automatically install docopt
if(!require(docopt)){
if (!requireNamespace("BiocManager", quietly = TRUE)){
install.packages("BiocManager")}
BiocManager::install("docopt", ask=FALSE)
}
# To generate documented command-line options
library(docopt)
"Usage:
plot_last_base.R [options]
Options:
-i, --input_file <last_bases_data> last_bases_data
-o, --output_graph <last_bases_pdf> last_bases_pdf
-t, --title <title> title
" -> doc
opts <- docopt(doc)
#print(opts$input_file)
#print(opts$output_graph)
args <- commandArgs()
# See https://github.com/docopt/docopt.R/issues/25
# In the calling context:
# commandArgs <- function() {c("from_parent", "pseudogene", "/pasteur/entites/Mhe/bli/RNA_Seq_analyses", "/pasteur/entites/Mhe/bli/RNA_Seq_analyses/interactive", "/pasteur/entites/Mhe/bli/RNA_Seq_analyses/load_WT_prg1_data.R")}
if (args[1] == "from_parent") {
opts$input_file <- args[2]
opts$output_graph <- args[3]
opts$title <- args[4]
}
table <- read.table(file.path(opts$input_file), header=T, comment.char="")
colnames(table) <- c("length", "nb_reads", "A", "C", "G", "T", "N")
y_range = range(c(table$A, table$C, table$G, table$T))
pdf(file.path(opts$output_graph))
par(mar=c(5, 4, 4, 4) + 0.1)
plot(
table$length,
table$A,
ylim=y_range,
xlab="read length",
ylab="freq(nucleotide) at last position",
type="l",
col="green",
)
lines(
table$length,
table$C,
col="blue",
)
lines(
table$length,
table$G,
col="black",
)
lines(
table$length,
table$T,
col="red",
)
lines(
table$length,
table$N,
col="gray",
)
par(new=T)
plot(
table$length,
table$nb_reads,
xlab=NA,
ylab=NA,
pch=20,
col="gray",
axes=F
)
axis(side=4)
mtext(side=4, line=3, "number of reads")
mtext(side=3, line=2, opts$title, cex=1.25)
legend("topleft", legend=c("A", "C", "G", "T", "N", "nb_reads"), col=c("green", "blue", "black", "red", "gray", "gray"), pch=20)
dev.off()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment