Calling a package specific function in a for loop
1
0
Entering edit mode
georgewwp • 0
@georgewwp-9719
Last seen 3.7 years ago

Dear all,

I'm trying to include a Bioconductor package specific function in a for loop to output pdf files.

Specifically, I ran the Swimming downstream workflow and look for DTU in 2 group of samples. After stageR following DEXSeq, I got a table dex.padj with transcripts with DTU. 

geneID        txID         gene transcript
1 FBgn0000008 FBtr0100521 1.133918e-02          0
2 FBgn0000008 FBtr0071763 1.133918e-02          0
3 FBgn0000053 FBtr0079431 1.706116e-04          0
4 FBgn0000053 FBtr0100353 1.706116e-04          0
5 FBgn0000182 FBtr0080804 5.051515e-13          0
6 FBgn0000182 FBtr0080803 5.051515e-13          0

I want to use the plotProportions function from DRIMSeq to output a pdf for each gene. 

I came up with a for loop here. It created empty pdfs with correct names. 

for (i in 1:length(unique(dex.padj$geneID))){
  pdf(paste(unique(dex.padj$geneID)[i],".pdf", sep = ""), width = 11, height = 8.5)
  plotProportions(d, res$gene_id[res$gene_id==unique(dex.padj$geneID)[i]], "celltype")
  dev.off()
}

I guess the plotProportions function did not work in the loop? I suspect this is the problem 

What's the best way to go about it? An sapply solution would be lovely. 

 

Thank you!

 

Wanpeng

drimseq swimming downstream for loop sapply • 911 views
ADD COMMENT
1
Entering edit mode
@martin-morgan-1513
Last seen 3 months ago
United States

Try using print(plotProportions(...)).

ADD COMMENT

Login before adding your answer.

Traffic: 864 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6