/*--------------------------------------------------------------------------
 *  Copyright 2008 utgenome.org
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *--------------------------------------------------------------------------*/
//--------------------------------------
// utgb-shell Project
//
// BED2SilkReader.java
// Since: May 26, 2009
//
// $URL: http://svn.utgenome.org/utgb/trunk/utgb/utgb-shell/src/main/java/org/utgenome/shell/db/bed/BED2SilkReader.java $ 
// $Author: leo $
//--------------------------------------
package org.utgenome.format.bed;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;

import org.utgenome.UTGBException;
import org.utgenome.format.FormatConversionReader;
import org.xerial.lens.Lens;

/**
 * BED2SilkReader translates the input BED data into a Silk format
 * 
 * @author leo
 * 
 */
public class BED2SilkReader extends FormatConversionReader {

	public BED2SilkReader(Reader bedReader) throws IOException {
		super(bedReader, new PipeConsumer() {
			@Override
			public void consume(Reader in, Writer out) throws Exception {
				BED2Silk converter = new BED2Silk(in);
				PrintWriter pout = new PrintWriter(out);
				converter.toSilk(pout);
			}
		});

	}

	public static BEDQuery scan(Reader input, BEDQuery query) throws UTGBException {

		try {
			BED2SilkReader in = new BED2SilkReader(input);
			Lens.loadSilk(query, in);
			return query;
		}
		catch (Exception e) {
			throw UTGBException.convert(e);
		}
	}

}

@@ -1359,18 +1359,12 @@
 der 
-translates
+read
  the
@@ -1382,13 +1382,48 @@
 data
- into
+, and the user can read it as if it were
  a S
@@ -1432,16 +1432,17 @@
 k format
+.
 %0D%0A * %0D%0A 
@@ -1850,24 +1850,255 @@
 );%0D%0A%0D%0A%09%7D%0D%0A%0D%0A
+%09/**%0D%0A%09 * Read an input BED data, and retrieves %7B@link BEDTrack%7D and %7B@link BEDGene%7D information through the%0D%0A%09 * %7B@link BEDQuery%7D interface.%0D%0A%09 * %0D%0A%09 * @param input%0D%0A%09 * @param query%0D%0A%09 * @return%0D%0A%09 * @throws UTGBException%0D%0A%09 */%0D%0A
 %09public stat

add a description