Giter Site home page Giter Site logo

ruby-igv's Introduction

ruby-igv

Gem Version Docs Stable Docs Latest The MIT License DOI

Ruby-IGV is a simple tool for controlling the Integrated Genomics Viewer (IGV) from the Ruby language. It provides an automated way to load files, specify genome locations, and take and save screenshots using IGV.

Installation

Requirement :

gem install ruby-igv

Quickstart

require 'igv'

igv = IGV.start # This launch IGV

igv.set      :SleepInterval, 200 # give a time interval
igv.genome   'hg19'
igv.load     'http://hgdownload.cse.ucsc.edu/goldenPath/' \
             'hg19/encodeDCC/wgEncodeUwRepliSeq/' \
             'wgEncodeUwRepliSeqK562G1AlnRep1.bam'
igv.go       'chr18:78016233-78016640'
igv.snapshot 'region.png'

Usage

IGV batch commands

The commonly used commands in IGV are summarized in the official list of batch commands. (but even this does not seem to be all of them). You can also call the commands method from Ruby to open a browser and view the list.

igv.commands # Show the IGV command reference in your browser

docs

See yard docs. Commonly used IGV batch commands can be called from Ruby methods of the same name. However, not all IGV batch commands are implemented in Ruby. Use the send method described below.

send

Commands that are not implemented can be sent using the send method.

igv.send("maxPanelHeight", 10)

To avoid unexpected behavior, ruby-igv does not use the method_missing mechanism.

Launch IGV

Launch IGV from Ruby script.

igv = IGV.start # launch IGV app using spawn

You can specify the port.

igv = IGV.start(port: 60152)

If you start IGV in this way, you can force IGV to terminate by calling the kill method.

igv.kill

Open socket connection to IGV

If IGV is already running, use new or open.

new

igv = IGV.new   # create an IGV object. Then you will type `igv.connect`
igv = IGV.new(host: "127.0.0.1", port: 60151, snapshot_dir: "~/igv_snapshot")
igv.connect # To start a connection, call connect explicitly.
igv.close

open

igv = IGV.open  # create an IGV object and connect it to an already activated IGV.
igv.close
IGV.open(host: "127.0.0.1", port: 60151, snapshot_dir: "~/igv_snapshot") do |igv|
  # do something
end # The socket is automatically closed.

Close IGV

The behavior of the following methods is different.

igv.close       # close the socket connection
igv.exit        # send exit command to IGV then close the socket connection
igv.quit        # alias method to exit
igv.kill        # kill group pid created with IGV.start

Contributing

Do you need commit rights to this repository?
Do you want to get admin rights and take over the project?
If so, please feel free to contact me @kojix2.

Acknowledgement

This gem is strongly inspired by a Python script developed by Brent Pedersen.

License

The gem is available as open source under the terms of the MIT License.

ruby-igv's People

Contributors

kojix2 avatar

Watchers

 avatar  avatar

ruby-igv's Issues

Implementation

  • collapse
  • colorBy
  • echo
  • exit
  • expand
  • genome
  • goto
  • group
  • load
  • maxPanelHeight
  • new <- clear?
  • overlay
  • preference
  • region
  • saveSession
  • separate
  • setAltColor
  • setColor
  • setDataRange
  • setLogScale
  • setSequenceStrand
  • setSequenceShowTranslation
  • setSleepInterval
  • setTrackHeight
  • snapshotDirectory
  • snapshot
  • sort
  • squish
  • viewaspairs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.