Skip to content
Snippets Groups Projects
Commit afa3bbee authored by Venkat Malladi's avatar Venkat Malladi
Browse files

remove annotate peak vennpie and update test.

parent 673c0718
Branches
Tags
No related merge requests found
...@@ -40,17 +40,26 @@ design <- read.csv(design_file, sep ='\t') ...@@ -40,17 +40,26 @@ design <- read.csv(design_file, sep ='\t')
files <- as.list(as.character(design$Peaks)) files <- as.list(as.character(design$Peaks))
names(files) <- design$Condition names(files) <- design$Condition
# Granges of files
peaks <- lapply(files, readPeakFile, as = "GRanges", header = FALSE)
peakAnnoList <- lapply(peaks, annotatePeak, TxDb=txdb, annoDb=annodb, tssRegion=c(-3000, 3000), verbose=FALSE)
column_names <- c("chr", "start", "end", "width", "strand_1", "name", "score", "strand", "signalValue",
"pValue", "qValue", "peak", "annotation", "geneChr", "geneStart", "geneEnd",
"geneLength" ,"geneStrand", "geneId", "transcriptId", "distanceToTSS",
"ENSEMBL", "symbol", "geneName")
peakAnnoList <- lapply(files, annotatePeak, TxDb=txdb, annoDb=annodb, tssRegion=c(-3000, 3000), verbose=FALSE)
for(index in c(1:length(peakAnnoList))) { for(index in c(1:length(peakAnnoList))) {
filename <- paste(names(files)[index],".chipseeker_annotation.csv",sep="") filename <- paste(names(peaks)[index], ".chipseeker_annotation.csv", sep="")
write.table(as.data.frame(peakAnnoList[[index]]),filename,sep=",",quote=F) df <- as.data.frame(peakAnnoList[[index]])
colnames(df) <- column_names
write.table(df[ , !(names(df) %in% c('strand_1'))], filename, sep="," ,quote=F, row.names=F)
# Draw individual plots # Draw individual plots
# Define names of Plots # Define names of Plots
pie_name <- paste(names(files)[index],".chipseeker_pie.pdf",sep="") pie_name <- paste(names(files)[index],".chipseeker_pie.pdf",sep="")
vennpie_name <- paste(names(files)[index],".chipseeker_vennpie.pdf",sep="")
upsetplot_name <- paste(names(files)[index],".chipseeker_upsetplot.pdf",sep="") upsetplot_name <- paste(names(files)[index],".chipseeker_upsetplot.pdf",sep="")
# Pie Plots # Pie Plots
...@@ -58,11 +67,6 @@ for(index in c(1:length(peakAnnoList))) { ...@@ -58,11 +67,6 @@ for(index in c(1:length(peakAnnoList))) {
plotAnnoPie(peakAnnoList[[index]]) plotAnnoPie(peakAnnoList[[index]])
dev.off() dev.off()
# Venn Diagrams
pdf(vennpie_name)
vennpie(peakAnnoList[[index]])
dev.off()
# Upset Plot # Upset Plot
pdf(upsetplot_name) pdf(upsetplot_name)
upsetplot(peakAnnoList[[index]]) upsetplot(peakAnnoList[[index]])
......
...@@ -13,8 +13,7 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \ ...@@ -13,8 +13,7 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
@pytest.mark.singleend @pytest.mark.singleend
def test_annotate_peaks_singleend(): def test_annotate_peaks_singleend():
assert os.path.exists(os.path.join(test_output_path, 'ENCSR238SGC.chipseeker_pie.pdf')) assert os.path.exists(os.path.join(test_output_path, 'ENCSR238SGC.chipseeker_pie.pdf'))
assert os.path.exists(os.path.join(test_output_path, 'ENCSR238SGC.chipseeker_pie.pdf')) assert os.path.exists(os.path.join(test_output_path, 'ENCSR238SGC.chipseeker_upsetplot.pdf'))
assert os.path.exists(os.path.join(test_output_path, 'ENCSR238SGC.chipseeker_pie.pdf'))
annotation_file = test_output_path + 'ENCSR238SGC.chipseeker_annotation.csv' annotation_file = test_output_path + 'ENCSR238SGC.chipseeker_annotation.csv'
assert os.path.exists(annotation_file) assert os.path.exists(annotation_file)
assert utils.count_lines(annotation_file) == 152839 assert utils.count_lines(annotation_file) == 152839
...@@ -23,8 +22,7 @@ def test_annotate_peaks_singleend(): ...@@ -23,8 +22,7 @@ def test_annotate_peaks_singleend():
@pytest.mark.pairedend @pytest.mark.pairedend
def test_annotate_peaks_pairedend(): def test_annotate_peaks_pairedend():
assert os.path.exists(os.path.join(test_output_path, 'ENCSR217LRF.chipseeker_pie.pdf')) assert os.path.exists(os.path.join(test_output_path, 'ENCSR217LRF.chipseeker_pie.pdf'))
assert os.path.exists(os.path.join(test_output_path, 'ENCSR217LRF.chipseeker_pie.pdf')) assert os.path.exists(os.path.join(test_output_path, 'ENCSR217LRF.chipseeker_upsetplot.pdf'))
assert os.path.exists(os.path.join(test_output_path, 'ENCSR217LRF.chipseeker_pie.pdf'))
annotation_file = test_output_path + 'ENCSR217LRF.chipseeker_annotation.csv' annotation_file = test_output_path + 'ENCSR217LRF.chipseeker_annotation.csv'
assert os.path.exists(annotation_file) assert os.path.exists(annotation_file)
assert utils.count_lines(annotation_file) == 25390 assert utils.count_lines(annotation_file) == 25390
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