Entering edit mode
3.2 years ago
graeme.thorn
▴
100
I have multiple DExSeq results files I want to export to tables, but I'm finding that when I output the results directly using write.table() then with large numbers of transcripts for the exon (more than 27), the output is split over two files like:
ENSG00000005302 E052 139.860053137518 0.0139936600509854 6.47551836787261 0.0109370410611376 0.0760304762292286 chrX 11763780 1176381031 + 130 129 129 125 228 124 227 68 46 161 176 149 67 69 248 170 142 213 175 196 67 60 129 150 136 169 183 117 301 207 149 143 145 97 90 167 114 156 159 152 185 220 81 157 112 200 129 c("ENST00000649785", "ENST00000648013", "ENST00000650215", "ENST00000380692", "ENST00000649684", "ENST00000649308", "ENST00000649988", "ENST00000647701", "ENST00000650628", "ENST00000312196", "ENST00000649602", "ENST00000482871", "ENST00000649078", "ENST00000649685", "ENST00000649130", "ENST00000649649", "ENST00000398527", "ENST00000380691", "ENST00000650370", "ENST00000650050", "ENST00000473380", "ENST00000649797", "ENST00000648918", "ENST00000380693", "ENST00000468149", "ENST00000648614", "ENST00000361672",
"ENST00000648207", "ENST00000337339", "ENST00000649851", "ENST00000649271", "ENST00000648889", "ENST00000494268", "ENST00000421368", "ENST00000647869", "ENST00000647985", "ENST00000647857")
I have looked directly at the output result for this line, and the row-break is in the output:
> dxr1[2765,]
LRT p-value: full vs reduced
DataFrame with 1 row and 10 columns
groupID featureID exonBaseMean
<character> <character> <numeric>
ENSG00000005302:E052 ENSG00000005302 E052 139.860053137518
dispersion stat pvalue
<numeric> <numeric> <numeric>
ENSG00000005302:E052 0.0139936600509854 6.47551836787261 0.0109370410611376
padj genomicData
<numeric> <GRanges>
ENSG00000005302:E052 0.0760304762292286 chrX:11763780-11763810:+
countData
<matrix>
ENSG00000005302:E052 130:129:129:...
transcripts
<list>
ENSG00000005302:E052 c("ENST00000649785", "ENST00000648013", "ENST00000650215", "ENST00000380692", "ENST00000649684", "ENST00000649308", "ENST00000649988", "ENST00000647701", "ENST00000650628", "ENST00000312196", "ENST00000649602", "ENST00000482871", "ENST00000649078", "ENST00000649685", "ENST00000649130", "ENST00000649649", "ENST00000398527", "ENST00000380691", "ENST00000650370", "ENST00000650050", "ENST00000473380", "ENST00000649797", "ENST00000648918", "ENST00000380693", "ENST00000468149", "ENST00000648614", "ENST00000361672", \n"ENST00000648207", "ENST00000337339", "ENST00000649851", "ENST00000649271", "ENST00000648889", "ENST00000494268", "ENST00000421368", "ENST00000647869", "ENST00000647985", "ENST00000647857")
but doesn't show when looking at the entry directly:
> dxr1[2765,"transcripts"]
[[1]]
[1] "ENST00000649785" "ENST00000648013" "ENST00000650215" "ENST00000380692"
[5] "ENST00000649684" "ENST00000649308" "ENST00000649988" "ENST00000647701"
[9] "ENST00000650628" "ENST00000312196" "ENST00000649602" "ENST00000482871"
[13] "ENST00000649078" "ENST00000649685" "ENST00000649130" "ENST00000649649"
[17] "ENST00000398527" "ENST00000380691" "ENST00000650370" "ENST00000650050"
[21] "ENST00000473380" "ENST00000649797" "ENST00000648918" "ENST00000380693"
[25] "ENST00000468149" "ENST00000648614" "ENST00000361672" "ENST00000648207"
[29] "ENST00000337339" "ENST00000649851" "ENST00000649271" "ENST00000648889"
[33] "ENST00000494268" "ENST00000421368" "ENST00000647869" "ENST00000647985"
[37] "ENST00000647857"
Is there a way to prevent this occurring?
I could use sed
after the fact to join the lines together, but would prefer an R solution.
How are you using write.table, could you share the code?
Maybe use paste before writing to a file?
Please do not delete posts that have received feedback. If the feedback helped solve the problem, vote/respond accordingly. If you solved your problem by yourself, add an answer outlining your steps so others in your position benefit from your effort.