Read a fasta RNA sequence
@param inStream
@return
@throws IOException
552353
public static LinkedHashMap<String, RNASequence> readFastaRNASequence(
			InputStream inStream) throws IOException {
		FastaReader<RNASequence, NucleotideCompound> fastaReader = new FastaReader<RNASequence, NucleotideCompound>(
				inStream,
				new GenericFastaHeaderParser<RNASequence, NucleotideCompound>(),
				new RNASequenceCreator(RNACompoundSet.getRNACompoundSet()));
		return fastaReader.process();
	}
867925
public static String loadText(InputStream in) throws IOException {
        StringBuilder builder = new StringBuilder();
        InputStreamReader isr = new InputStreamReader(in);
        try {
            BufferedReader reader = new BufferedReader(isr);
            while (true) {
                String line = reader.readLine();
                if (line != null) {
                    builder.append(line);
                    builder.append("\n");
                } else {
                    break;
                }
            }
            return builder.toString();
        } finally {
            try {
                isr.close();
            } catch (Exception e) {
                // ignore
            }
            try {
                in.close();
            } catch (Exception e) {
                // ignore
            }
        }
    }
787909
private static Reader loadInputStream(InputStream propertiesStream) throws IOException {
        StringBuilder buff = new StringBuilder();

        try (InputStreamReader isr = new InputStreamReader(propertiesStream, Charset.defaultCharset());
                BufferedReader reader = new BufferedReader(isr)) {
            String line;
            while ((line = reader.readLine()) != null) {
                buff.append(line).append("\n");
            }
        }

        return new StringReader(StrSubstitutor.replaceSystemProperties(buff.toString()));
    }
1161754
public Buffer readFrom(InputStream in) throws IOException {
    readFrom(in, Long.MAX_VALUE, true);
    return this;
  }
302522
public static LinkedHashMap<String, DNASequence> readGenbankDNASequence(
			InputStream inStream) throws Exception {
		GenbankReader<DNASequence, NucleotideCompound> GenbankReader = new GenbankReader<DNASequence, NucleotideCompound>(
				inStream,
				new GenericGenbankHeaderParser<DNASequence, NucleotideCompound>(),
				new DNASequenceCreator(DNACompoundSet.getDNACompoundSet()));
		return GenbankReader.process();
	}
1008685
static Map<String, String> readFasta(final File inputFastqFile) throws IOException, NoSuchElementException, BioException{
    	
    	BufferedReader reader = null;
    	HashMap<String, String> fasta = new HashMap<String, String>();
        
    	try{
    		 reader = reader(inputFastqFile);
    		 for (SequenceIterator sequences = SeqIOTools.readFastaDNA(reader); sequences.hasNext(); ) 
    		{
                 Sequence sequence = sequences.nextSequence();
                 String sequenceId = sequence.getName();
                 String fastaSeq   = sequence.seqString();
                 fasta.put(sequenceId, fastaSeq);
             }
    		
    	}finally {
            try {
            	reader.close();
            }
            catch (Exception e) {
            	 e.printStackTrace();
            	 System.exit(1);
            }
        }
    
        
        return fasta;
    	
    }
222955
void readFrom(InputStream in) throws IOException {
		//TODO could optimize for aligned instances
		final int size = finish - start;
		final int length = (size + 7) >> 3;
		if (length == 0) return;
		int p = size & 7;
		final int q = finish - p;
		if (p != 0) performAdj(SET, q, (long) in.read(), p);
		p = q;
		while (p > start) {
			p -= 8;
			performAdj(SET, p, (long) in.read(), 8);
		}
	}
619500
public static void writeFasta(final OutputStream outstream,
		final List<FastaSequence> sequences, final int width)
		throws IOException {
	final OutputStreamWriter writer = new OutputStreamWriter(outstream);
	final BufferedWriter fastawriter = new BufferedWriter(writer);
	for (final FastaSequence fs : sequences) {
		fastawriter.write(fs.getFormatedSequence(width));
	}
	outstream.flush();
	fastawriter.close();
	writer.close();
	}
898122
public static LinkedHashMap<String, RNASequence> readGenbankRNASequence(
			InputStream inStream) throws Exception {
		GenbankReader<RNASequence, NucleotideCompound> GenbankReader = new GenbankReader<RNASequence, NucleotideCompound>(
				inStream,
				new GenericGenbankHeaderParser<RNASequence, NucleotideCompound>(),
				new RNASequenceCreator(RNACompoundSet.getRNACompoundSet()));
		return GenbankReader.process();
	}
962106
public int readFrom(InputStream stream) throws IOException {
        int bytesRead = stream.read(buffer);
        if (bytesRead < 0) {
            bytesInBuffer = 0;
        } else {
            bytesInBuffer = bytesRead;
        }
        return bytesRead;
    }
1363863
private static byte[] readStream(final InputStream in) throws IOException {
    final ByteArrayOutputStream bos = new ByteArrayOutputStream();
    final byte[] data = new byte[4096];
    int bytesRead;
    while ((bytesRead = in.read(data, 0, data.length)) != -1) {
      bos.write(data, 0, bytesRead);
    }
    return bos.toByteArray();
  }
490513
public static String read(InputStream in, Charset charset) throws IORuntimeException {
		FastByteArrayOutputStream out = read(in);
		return null == charset ? out.toString() : out.toString(charset);
	}
1100252
public static LinkedHashMap<String, ProteinSequence> readGenbankProteinSequence(
			InputStream inStream) throws Exception {
		GenbankReader<ProteinSequence, AminoAcidCompound> GenbankReader = new GenbankReader<ProteinSequence, AminoAcidCompound>(
				inStream,
				new GenericGenbankHeaderParser<ProteinSequence, AminoAcidCompound>(),
				new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet()));
		return GenbankReader.process();
	}
1146145
public static LinkedHashMap<String, ProteinSequence> readFastaProteinSequence(
			File file) throws IOException {
		FileInputStream inStream = new FileInputStream(file);
		LinkedHashMap<String, ProteinSequence> proteinSequences = readFastaProteinSequence(inStream);
		inStream.close();
		return proteinSequences;
	}
274734
public static String readStreamToString(InputStream is, String encoding) throws IOException {
		try {
			StringBuilder sb = new StringBuilder();
			byte[] buf = new byte[1024 * 10];
			int read;
			while ((read = is.read(buf)) >= 0) {
				sb.append(new String(buf, 0, read, encoding));
			}
			return sb.toString();
		} finally {
			is.close();
		}
	}
1263922
public static List<GeneName> getGeneNames(InputStream inStream) throws IOException{

		ArrayList<GeneName> geneNames = new ArrayList<GeneName>();
		BufferedReader reader = new BufferedReader(new InputStreamReader(inStream));

		// skip reading first line (it is the legend)
		String line = reader.readLine();

		while ((line = reader.readLine()) != null) {
			// process line...
			//System.out.println(Arrays.toString(line.split("\t")));

			GeneName  geneName = getGeneName(line);
			if ( geneName != null)
				geneNames.add(geneName);
				//System.out.println(geneName);

		}

		// since this is a large list, let's free up unused space...
		geneNames.trimToSize();
		return geneNames;
	}
543326
protected String read(InputStream inputStream) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, encoding));
        StringBuffer stringBuffer = new StringBuffer();
        String line = reader.readLine();
        while (line != null) {
            stringBuffer.append(line).append("\n");
            line = reader.readLine();
        }
        return stringBuffer.toString();
    }