#!/usr/perl/perl580/bin/perl open (IN, "$ARGV[0]"); open (IN2, "$ARGV[1]"); open (OUT, ">$ARGV[0].ok"); ##This script will generate the "in" format to my clusterization algorithm. ##This first loop will get the gene IDs and print them in the output file; print OUT ("patient\tclass"); while () { $line = $_; chomp $line; # @fields = split (/\s:\s/, $line); @fields = split (/\t/, $line); if ($fields[0] eq '') { next; } print OUT ("\t$fields[0]"); # print ("\t$fields[0]"); } print OUT ("\n"); @fileds = (); $i = 0; while () { $line = $_; chomp $line; $line =~ s/\r//g; ##some lina have carriage return, I *really* don't know why... @fields = split (/,/, $line); if ($fields[0] eq '') { next; } $class_id = pop @fields; print OUT ("entity_$i\t"); print OUT ("$class_id\t"); $line = join ("\t", @fields); print OUT $line; print OUT ("\n"); # $a = ; print ("$i\n"); $i++; }