Example usage for org.apache.poi.poifs.filesystem POIFSFileSystem POIFSFileSystem

List of usage examples for org.apache.poi.poifs.filesystem POIFSFileSystem POIFSFileSystem

Introduction

In this page you can find the example usage for org.apache.poi.poifs.filesystem POIFSFileSystem POIFSFileSystem.

Prototype


public POIFSFileSystem(InputStream stream) throws IOException 

Source Link

Document

Create a POIFSFileSystem from an InputStream.

Usage

From source file:ubic.BAMSandAllen.AllenDataLoaders.AllenTop50DataLoader.java

License:Apache License

public AllenTop50DataLoader() {
    try {/*from   w  w  w .  j a  va  2s.  c o m*/
        NeuroNamesMappingLoader NNLoader = new NeuroNamesMappingLoader();

        allenRegions = new HashSet<String>();

        POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(spreadSheetLocation));
        HSSFWorkbook allen = new HSSFWorkbook(fs);
        HSSFSheet sheet;
        for (int i = 0; i < allen.getNumberOfSheets(); i++) {
            sheet = allen.getSheetAt(i);
            allenRegions.add(allen.getSheetName(i));
            // System.out.println( allen.getSheetName( i ) );
        }

        Set<String> allenRegions = getAllenRegions();
        Set<NomenClatureEntry> dongEntries = NNLoader.getDongEntries();
        allenEnrichedEntries = new HashSet<NomenClatureEntry>();

        for (String allenEnrichedAcro : allenRegions) {
            for (NomenClatureEntry dongEntry : dongEntries) {
                if (allenEnrichedAcro.equals(dongEntry.acro)) {
                    allenEnrichedEntries.add(dongEntry);
                }
            }
        }

        // make entry <-> gene links
        for (NomenClatureEntry dongEntry : allenEnrichedEntries) {
            sheet = allen.getSheet(dongEntry.acro);
            // System.out.println(dongEntry.acro);
            for (short i = 2; true; i++) {
                String gene = ExcelUtil.getValue(sheet, i, (short) 0);
                if (gene == null)
                    break;
                dongEntry.expressedGenes.add(gene);
                // System.out.println( gene );

            }
        }

    } catch (Exception e) {
        e.printStackTrace();
        System.exit(1);
    }

}