File outFile = new File(outPath);
try {
AlignmentDataManager dataManager = alignmentTrack.getDataManager();
ResourceLocator inlocator = dataManager.getLocator();
Range range = frame.getCurrentRange();
//Read directly from file
//return SAMWriter.writeAlignmentFilePicard(inlocator, outPath, range.getChr(), range.getStart(), range.getEnd());
//Export those in memory, overlapping current view
return SAMWriter.writeAlignmentFilePicard(dataManager, outFile, range.getChr(), range.getStart(), range.getEnd());
} catch (IOException e) {
log.error(e.getMessage(), e);
throw new RuntimeException(e);
}