String sequence, int start, int end) throws IOException{
checkExportableAlignmentFile(inlocator.getTypeString());
AlignmentReader reader = AlignmentReaderFactory.getReader(inlocator);
CloseableIterator<PicardAlignment> iter = reader.query(sequence, start, end, false);
final SAMFileHeader fileHeader = reader.getFileHeader();
SAMWriter writer = new SAMWriter(fileHeader);
int count = writer.writeToFile(new File(outPath), iter, true);
iter.close();