将txt文件加载到GSEA

时间:2016-12-06 20:32:48

标签: java r

我正在尝试上传包含基因表达数据的text file以便用GSEA进行分析,我收到以下Java错误:

<Error Details>

---- Full Error Message ----
There were errors: ERROR(S) #:1
Parsing trouble
java.lang.NumberFormatException: ...

---- Stack Trace ----
# of exceptions: 1
------For input string: "NA"------
java.lang.NumberFormatException: For input string: "NA"
    at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
    at sun.misc.FloatingDecimal.parseFloat(FloatingDecimal.java:122)
    at java.lang.Float.parseFloat(Float.java:451)
    at edu.mit.broad.genome.parsers.TxtDatasetParser._parseNoDesc(TxtDatasetParser.java:178)
    at edu.mit.broad.genome.parsers.TxtDatasetParser.parse(TxtDatasetParser.java:140)
    at edu.mit.broad.genome.parsers.TxtDatasetParser.parse(TxtDatasetParser.java:96)
    at edu.mit.broad.genome.parsers.ParserFactory.readDatasetTXT(ParserFactory.java:455)
    at edu.mit.broad.genome.parsers.ParserFactory.readDatasetTXT(ParserFactory.java:410)
    at edu.mit.broad.genome.parsers.ParserFactory.readDatasetTXT(ParserFactory.java:406)
    at edu.mit.broad.genome.parsers.ParserFactory.read(ParserFactory.java:1897)
    at edu.mit.broad.genome.parsers.ParserFactory$1.run(ParserFactory.java:2766)
    at xapps.api.AppDataLoaderWidget$2.actionPerformed(AppDataLoaderWidget.java:251)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6533)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6298)
    at java.awt.Container.processEvent(Container.java:2236)
    at java.awt.Component.dispatchEventImpl(Component.java:4889)
    at java.awt.Container.dispatchEventImpl(Container.java:2294)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
    at java.awt.Container.dispatchEventImpl(Container.java:2280)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.awt.EventQueue$4.run(EventQueue.java:729)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

我的文字文件是从R​​保存的,其中包含以下内容:列&#39; NAME&#39;有基因ID,列&#39;描述&#39;使用&#39; NA&#39;和样品1-30以及相关的基因计数信息。

> head(IL2.ZAvsIL2_GSEA)
     NAME DESCRIPTION SM01 SM02 SM03 SM04 SM05 SM06 SM07 SM08 SM09 SM10 SM11 SM12
1   MRPS6          NA  457  905  660  685  656  650 1361 1019 1421 1006  510 1182
2     APP          NA  199  191  210  196  200  179  235  225  252  228  159   95
3 POLR3GL          NA  800  658  763  655  602  814  866  709 1141  802  743  545
4    OMA1          NA  233  758  958  709  747  206  851  876 1272  832  239  821
5 TSC22D1          NA  426  456  577  441  433  390  579  646  709  504  580  574
6  ARRDC3          NA 6073 1496 2128 1706 1435 6033 2761 3238 4390 3306 6216 2359
  SM13 SM14 SM15 SM16 SM17 SM18 SM19 SM20 SM21 SM22 SM23 SM24 SM25 SM26 SM27 SM28
1 1305  909  944  423  812  595  673  527  441  495  562  633  738  895 1571 1255
2  387  253  200  121   85  130  116  133  288  194  267  241  395  178  119  239
3 1179  707  765 1032  675  671  908  754 1345  531  877  896 1073 1444  765 1085
4 1183  879  904  219  731  911 1043  898  357  699 1069 1021 1374  272  960 1136
5 1151  799  884  420  462  594  543  421  715  486  586  506  900  822  624  768
6 4479 3376 3449 6656  954 1181 1682 1221 8437  912 1808 1819 2172 7182 1560 2173
  SM29 SM30
1 1022 1307
2  187  242
3  907  905
4  975 1217
5  649  761
6 1918 2063
> write.table(IL2.ZAvsIL2_GSEA, file="IL2.ZAvsIL2_GSEA.txt",row.names = FALSE,sep = "\t") 

由于“描述”中的“NA”,Java看起来会引发格式错误。专栏,但我不知道如何纠正这个问题。

2 个答案:

答案 0 :(得分:0)

解析器区分大小写。将“NA”更改为“na”以修复,例如

write.table(IL2.ZAvsIL2_GSEA, file="IL2.ZAvsIL2_GSEA.txt",row.names = FALSE,sep = "\t", na.strings = "na")

答案 1 :(得分:0)

我也遇到了同样的问题,即使使用A.liberzon提到的“ na”把戏,仍然遇到错误。我继续将数字值放在“说明”列中(即df$Description <- 1),然后就可以正常加载了。