Calling a package specific function in a for loop
Entering edit mode
georgewwp • 0
Last seen 15 months 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")

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!



drimseq swimming downstream for loop sapply • 365 views
Entering edit mode
Last seen 18 days ago
United States

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


Login before adding your answer.

Traffic: 792 users visited in the last hour
Help About
Access RSS

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

Powered by the version 2.3.6