Bonjour à tous,
J'ai creer un petit canvas qui me mappe differentes des coordonnées sur le transcript d'un gènes ( qui est representé par un rectangle). Le problème est que j'ai plein plein plein de transcript, et que je voudrais creer un fichier avec le resultat pour chaque transcript, j'ai essayé avec la fonction postscript() mais cela ne fonctionne pas, cela me retourne un fichier vide.
Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/local/bin/perl
use Tk;
use strict;
use warnings;
use Carp qw(confess);
use Getopt::Long;
 
my ($file_file,$cx_file);
my (%hash,%dico);
# ne pas changer $value_fixe
my $value_fixe = 970; # taille du rectangle
 
GetOptions("cx=s" => \$cx_file,"file=s" => \$file_file); 
open(my $file,'<',$file_file) or die "$file_file : $!\n\n";
open(my $cx,'<',$cx_file) or die "$cx_file : $!\n\n";
 
 
while(<$cx>){
	# start des crosslink de chaque FBtr
	chomp;
	my($chr,$start_cx,$stop_cx,$id_cx,$nb_cx,$sens_cx) = split /\t/,$_;
	$chr =~ s/chr//g;
	my ($read,$FBtr,$name,$length_trans)= split /;/,$id_cx;
	push(@{$hash{$chr}->{'cx'}}, $start_cx);
	$hash{$chr}->{'length'}=$length_trans; # longueur du transcript
 
}
 
while(<$file>){
	# coordonnées de l'insert sur chaque transcript
	chomp;
	my($chr,$start_insert,$stop_insert,$id_insert,$other,$nb_insert,$sens_insert) = split /\s+/,$_;
	print "$start_insert\t$stop_insert\n";
	$chr =~ s/chr//g;
	push(@{$hash{$chr}->{'insert'}}, $id_insert);
	$dico{$id_insert}->{'start'} = $start_insert ; #
	$dico{$id_insert}->{'stop'} = $stop_insert ;
	my $length_insert = $stop_insert-$start_insert;
	$dico{$id_insert}->{'length'} = $length_insert; # taille de l'insert
}
 
foreach my $transcript (keys(%hash)){
	# Main Window
	my $mw = new MainWindow;
	$mw->resizable( 0, 0 );
	my $cns = $mw -> Canvas(-relief=>"sunken", -background=>"white", -width => "1000" , -height => "500");
 
	# rectangle representant le transcript
	$cns -> createRectangle(20,400,990,410,-fill => "thistle");
	my $length = $hash{$transcript}->{'length'};
	#my $count_x = 0;
	#my $count_y = 0;
 
	# positionner les cx sur les transcripts :
	foreach my $crosslink (@{$hash{$transcript}->{'cx'}}){	
		my $x1 = (($crosslink*$value_fixe)/$length)+20;
		my $y1 = 400;
		my $x2 = $x1+5;
		my $y2 =410 ;
		$cns -> createRectangle($x1,$y1,$x2,$y2,-fill => "red");
	} 
 
	my $postscript = $cns->postscript(-file=>"$transcript.ps" );	
	exit 0;
 
 
 
}
Quelqu'un aurait la solution à mon problème ?
Merci d'avance,