Guest User

Untitled

a guest
Jun 24th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. require 'bio-assembly'
  2.  
  3. # ace file path
  4. asm = Bio::Assembly.new("data.ace", :ace)
  5.  
  6. # iterate through contigs (streams each contig)
  7. asm.each_contig do |contig|
  8.  
  9. # print name and consensus seq
  10. puts contig.name
  11. puts contig.consensus_seq
  12.  
  13. # iterate through reads
  14. contig.each_read do |read|
  15.  
  16. # print name, sequence and orientation
  17. puts read.name
  18. puts read.seq
  19. puts read.orientation
  20.  
  21. # print the postion of the read
  22. # in relation to the consensus seq
  23. puts read.from
  24. puts read.to
  25.  
  26. # print the portion of the read
  27. # that was used to create the consensus
  28. puts read.clear_range_from
  29. puts read.clear_range_to
  30.  
  31. end
  32.  
  33. # grab the reads that make up a particular region of the contig
  34. reads_in_region = contig.find_reads_in_range(10, 50)
  35.  
  36. end
  37.  
  38. # experimental - output ace
  39. file = File.new('out.ace', 'w')
  40. file.puts asm.to_ace
Add Comment
Please, Sign In to add comment