Skip to content

Commit

Permalink
Added KEGG overview XML files that are no longer available through th…
Browse files Browse the repository at this point in the history
…e API and method for loading from resources
  • Loading branch information
mroemer committed Feb 4, 2015
1 parent a30bb76 commit e7b35fb
Show file tree
Hide file tree
Showing 18 changed files with 102,891 additions and 1 deletion.
22,234 changes: 22,234 additions & 0 deletions resources/de/zbit/kegg/gui/kgml/hsa01100.xml

Large diffs are not rendered by default.

1,371 changes: 1,371 additions & 0 deletions resources/de/zbit/kegg/gui/kgml/hsa01200.xml

Large diffs are not rendered by default.

1,087 changes: 1,087 additions & 0 deletions resources/de/zbit/kegg/gui/kgml/hsa01210.xml

Large diffs are not rendered by default.

2,513 changes: 2,513 additions & 0 deletions resources/de/zbit/kegg/gui/kgml/hsa01220.xml

Large diffs are not rendered by default.

1,482 changes: 1,482 additions & 0 deletions resources/de/zbit/kegg/gui/kgml/hsa01230.xml

Large diffs are not rendered by default.

22,218 changes: 22,218 additions & 0 deletions resources/de/zbit/kegg/gui/kgml/mmu01100.xml

Large diffs are not rendered by default.

8,415 changes: 8,415 additions & 0 deletions resources/de/zbit/kegg/gui/kgml/mmu01120.xml

Large diffs are not rendered by default.

1,371 changes: 1,371 additions & 0 deletions resources/de/zbit/kegg/gui/kgml/mmu01200.xml

Large diffs are not rendered by default.

1,087 changes: 1,087 additions & 0 deletions resources/de/zbit/kegg/gui/kgml/mmu01210.xml

Large diffs are not rendered by default.

2,513 changes: 2,513 additions & 0 deletions resources/de/zbit/kegg/gui/kgml/mmu01220.xml

Large diffs are not rendered by default.

1,486 changes: 1,486 additions & 0 deletions resources/de/zbit/kegg/gui/kgml/mmu01230.xml

Large diffs are not rendered by default.

22,218 changes: 22,218 additions & 0 deletions resources/de/zbit/kegg/gui/kgml/rno01100.xml

Large diffs are not rendered by default.

8,411 changes: 8,411 additions & 0 deletions resources/de/zbit/kegg/gui/kgml/rno01120.xml

Large diffs are not rendered by default.

1,371 changes: 1,371 additions & 0 deletions resources/de/zbit/kegg/gui/kgml/rno01200.xml

Large diffs are not rendered by default.

1,087 changes: 1,087 additions & 0 deletions resources/de/zbit/kegg/gui/kgml/rno01210.xml

Large diffs are not rendered by default.

2,513 changes: 2,513 additions & 0 deletions resources/de/zbit/kegg/gui/kgml/rno01220.xml

Large diffs are not rendered by default.

1,486 changes: 1,486 additions & 0 deletions resources/de/zbit/kegg/gui/kgml/rno01230.xml

Large diffs are not rendered by default.

29 changes: 28 additions & 1 deletion src/de/zbit/kegg/io/KEGGImporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

import java.awt.event.ActionEvent;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

import javax.swing.SwingWorker;

Expand All @@ -41,6 +44,11 @@
* @version $Rev$
*/
public class KEGGImporter extends NotifyingWorker<Object> {
/**
* This directory will be used as target for downloaded pathways.
* This string must end with a "/" and will be prepended to the file.
*/
private final static String localPathwayCacheDir = "res/kgml/";
/**
*
*/
Expand Down Expand Up @@ -106,7 +114,26 @@ protected Object doInBackground() throws Exception {
// PART1: Download
String localFile = null;
try {
localFile = KGMLSelectAndDownload.downloadPathway(KEGGpathwayID, false);
if (KGMLSelectAndDownload.class.getResource("kgml/" + KEGGpathwayID + ".xml") != null) {
System.out.println("Pathway in resources...");
InputStream is = KGMLSelectAndDownload.class.getResourceAsStream("kgml/" + KEGGpathwayID + ".xml");
System.out.println("Copying file...");
localFile = localPathwayCacheDir + KEGGpathwayID + ".xml";
new File("res/kgml/").mkdirs();
OutputStream os = new FileOutputStream(localFile);
int read = 0;
byte[] bytes = new byte[1024];

while ((read = is.read(bytes)) != -1) {
os.write(bytes, 0, read);
}
is.close();
os.close();
System.out.println("Done...");
} else {
System.out.println("Pathway NOT in resources...");
localFile = KGMLSelectAndDownload.downloadPathway(KEGGpathwayID, false);
}
} catch (Exception exc) {
// Mostly 1) pathway does not exists for organism or 2) no connection to server
GUITools.showErrorMessage(null, exc);
Expand Down

0 comments on commit e7b35fb

Please sign in to comment.