]> git.donarmstrong.com Git - biopieces.git/blobdiff - code_ruby/lib/maasha/sam.rb
polishing on sam.rb
[biopieces.git] / code_ruby / lib / maasha / sam.rb
index a122cc7486205cc0105e755e3efacc1c5a0df176..7f4712bf23082364139d76b7debd5c86cef98b5f 100644 (file)
@@ -59,12 +59,12 @@ class Sam < Filesys
     bp = {}
 
     bp[:REC_TYPE] = 'SAM'
-    bp[:Q_ID]   = sam[:QNAME]
-    bp[:STRAND] = sam[:FLAG].revcomp? ? '-' : '+'
-    bp[:S_ID]   = sam[:RNAME]
-    bp[:S_BEG]  = sam[:POS]
-    bp[:MAPQ]   = sam[:MAPQ]
-    bp[:CIGAR]  = sam[:CIGAR]
+    bp[:Q_ID]     = sam[:QNAME]
+    bp[:STRAND]   = sam[:FLAG].revcomp? ? '-' : '+'
+    bp[:S_ID]     = sam[:RNAME]
+    bp[:S_BEG]    = sam[:POS]
+    bp[:MAPQ]     = sam[:MAPQ]
+    bp[:CIGAR]    = sam[:CIGAR].to_s
 
     unless sam[:RNEXT] == '*'
       bp[:Q_ID2]  = sam[:RNEXT]
@@ -85,7 +85,14 @@ class Sam < Filesys
     bp
   end
 
-  # Create align descriptors according to the KISS format description:
+  # Class method to convert a Biopiece record
+  # into a SAM entry.
+  def self.to_sam(bp)
+    "FISK"
+  end
+
+  # Create alignment descriptors according to the KISS
+  # format description:
   # http://code.google.com/p/biopieces/wiki/KissFormat
   def self.align_descriptors(sam)
     offset     = 0