#!/usr/bin/perl -w # Author: Kara Dolinski # This is free software; you can redistribute it and/or modify # it under the same terms as Perl itself. # This is a simple perl script that converts a Cytoscape-formatted file that you download from SGD # via the SGD Batch Download tool to a file format that can be read by the Osprey interaction viewer. # More info on the interaction viewers can be found here: # Osprey: http://biodata.mshri.on.ca/osprey/servlet/Index # Cytoscape: http://www.cytoscape.org/ use strict; my $Usage = "cytoscape2osprey.pl [cytoscape file] [output file]"; my $CytoscapeFile = $ARGV[0]; my $OspreyFile = $ARGV[1]; if ((!$ARGV[0]) || (!$ARGV[1])) { print ("Usage: $Usage\n\n"); } else { open (IN, "< $CytoscapeFile") or die "Cannot open $CytoscapeFile for reading\n$!"; open (OUT, "> $OspreyFile") or die "Cannot open $OspreyFile for writing\n$!"; my $Line; while ($Line=) { chomp $Line; my ($Gene, $Type, @Interactors) = split (/\t/,$Line); foreach my $GeneB (@Interactors) { print OUT ("$Gene\t$GeneB\t$Type\t-\t-\n"); } } close (IN); close (OUT); }