Java FileReader Read loadKeggInteractions(String species, String location)

Here you can find the source of loadKeggInteractions(String species, String location)

Description

load Kegg Interactions

License

Open Source License

Declaration

public static ArrayList loadKeggInteractions(String species, String location) 

Method Source Code

//package com.java2s;
/* This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *///from w  ww.j  av a  2s  . c o m

import java.util.ArrayList;

import java.io.FileReader;
import java.io.IOException;

import java.io.LineNumberReader;

public class Main {
    public static ArrayList loadKeggInteractions(String species, String location) {
        ArrayList<String> kegg = new ArrayList<String>();
        String fileName = location + species + "_kegg_edges.txt";
        try {
            FileReader fr = new FileReader(fileName);
            LineNumberReader lnr = new LineNumberReader(fr);
            String s = null;
            while ((s = lnr.readLine()) != null) {
                s = s.trim();
                kegg.add(s);
            }
            lnr.close();
            fr.close();
            System.out.println("Loaded KEGG edges: " + kegg.size());
            return kegg;
        } catch (IOException ioe) {
            System.out.println(ioe);
        }

        return null;
    }
}

Related

  1. load(String filename)
  2. load(String fileName, Class klass)
  3. loadIndex(File root_)
  4. loadJSON(File file)
  5. readFile(File f)
  6. readFile(File f)
  7. readFile(File file)
  8. readFile(File file)