def open()
raise SAMException.new(), "Writing not supported yet" if @write
raise SAMException.new(), "No SAM file specified" unless @sam
opts = @write ? "w" : "r"
if @binary then
opts += "b"
if @write then
unless @compressed then
opts += "u"
end
end
end
valid = ["r", "w", "wh", "rb", "wb" , "wbu"]
unless valid.include?(opts) then
raise SAMException.new(), "Invalid options for samopen: " + opts
end
samFile = Bio::DB::SAM::Tools.samopen(@sam, opts, nil)
if samFile.null? then
@sam_file = nil
raise SAMException.new(), "File not opened: " + @sam
end
@sam_file = Bio::DB::SAM::Tools::SamfileT.new(samFile)
end