emblake
emblake

Reputation: 63

Java error when loading txt file to GSEA

I am trying to upload a text file containing gene expression data for analysis with GSEA, and I am getting the following Java error:

<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)

My text file was saved from R and contains the following: column 'NAME' with gene IDs, a column 'DESCRIPTION' with 'NA', and samples 1-30 with associated gene count information.

> 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") 

It looks like Java is throwing a format error due to the 'NA's found in the 'DESCRIPTION' column, but I don't know how to correct the issue.

Upvotes: 2

Views: 4599

Answers (2)

KeelyD
KeelyD

Reputation: 161

I had the same problem and was still getting an error even with the "na" trick mentioned by A.liberzon. I went ahead and put a numeric value in my Description column (i.e. df$Description <- 1) and it loaded just fine.

Upvotes: 1

A. Liberzon
A. Liberzon

Reputation: 11

The parser is case sensitive. Change your 'NA' to 'na' to fix, e.g.

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

Upvotes: 1

Related Questions