GenerateDoc.tcl 3.42 KB
Newer Older
1
#!/usr/bin/tclsh
Marie-Josee Cros's avatar
Marie-Josee Cros committed
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

# ------------------------------------------------------------------
# Copyright (C) 2004 INRA <eugene@ossau.toulouse.inra.fr>
#
# This program is open source; you can redistribute it and/or modify
# it under the terms of the Artistic License (see LICENSE file).
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
#
# You should have received a copy of Artistic License along with
# this program; if not, please see http://www.opensource.org
#
#  $Id$
# ------------------------------------------------------------------
# File:     GenerateDoc.tcl
# Contents: Generation of the eugene documentation
# ------------------------------------------------------------------
21
22
23
24
25
26


#===========================================================================
# definition of variables related to I/O

set SEQ Sequences/SYNO_ARATH.fasta
27
set SEQALT Sequences/At5g18830.fasta.genomicAJ011613.fasta
28
set SEQPROK Sequences/SMc.1541000-1552500.fasta
Marie-Josee Cros's avatar
v 3.2    
Marie-Josee Cros committed
29
set EUGENE ../src/eugene
30
set env(EUGENEDIR) [pwd]/..
31
32
33
34
35
36
37

set FIC_TEX "Doc.tex"
set FIC_TEX_TMP "EuGeneDoc"
set FIC_TMP "tmp"
set CMDFLAGS_INDEX "CmdFlags"

set Cmd_end " >& $FIC_TMP"
38
39
40
41
set Flag(1) EXECUTION_TRACE1; set Cmd_begin(1) ""; set Cmd(1) "$EUGENE -s -po $SEQ"
set Flag(2) EXECUTION_TRACE2; set Cmd_begin(2) ""; set Cmd(2) "$EUGENE -s -po -d $SEQ"
set Flag(3) EXECUTION_TRACE3; set Cmd_begin(3) ""; set Cmd(3) "$EUGENE -s -po -d -E $SEQ"
set Flag(4) EXECUTION_TRACE4; set Cmd_begin(4) ""; set Cmd(4) "$EUGENE -s -po -d -b012 -B $SEQ"
42
set Flag(5) EXECUTION_TRACE5; set Cmd_begin(5) ""; set Cmd(5) "$EUGENE -P -pog -b01 $SEQPROK"
sallet's avatar
sallet committed
43
#set Flag(6) EXECUTION_TRACE6; set Cmd_begin(6) ""; set Cmd(6) "$EUGENE -s -a -po $SEQALT"
44

sallet's avatar
sallet committed
45
set nbflags 5
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#===========================================================================


# read tex doc file
set f [open $FIC_TEX r]
set content [read $f]
close $f


# substitution of flags with execution trace
set new_content ""
for {set i 1} {$i<= $nbflags} {incr i} {
    set FlagPos [string first $Flag($i) $content]
    if { $FlagPos == -1 } {
	puts "ERROR no $Flag($i) set."
	set i $nbflags
    } else {
	set begin_new_content [string range $content 0 [expr $FlagPos - 1]]
	set new_content "$new_content $begin_new_content" 
	set begin_content [expr $FlagPos + [string length $Flag($i)]]
	set content [string range $content $begin_content [string length $content]]

	if {[string length $Cmd_begin($i)] != 0} {
	    eval exec $Cmd_begin($i)
	}

Marie-Josee Cros's avatar
v 3.2    
Marie-Josee Cros committed
72
	eval exec $Cmd($i) $Cmd_end
73
74

	# write the executed command in the documentation before the result
75
	set new_content "$new_content>$Cmd($i)\n"
76
	set f [open $FIC_TMP r]
77
	set new_content "$new_content[read $f]"
78
	close $f
79
80
81
82
83
84
85
86

	# for (3) & (4) print the misc_info file
	if { $i==3 || $i==4 } {
	    set new_content "$new_content> cat SYNO_ARATH.misc_info\n"
	    set f [open SYNO_ARATH.misc_info r]
	    set new_content "$new_content[read $f]"
	    close $f
	}
87
88
89
90
91
    }	
}
set new_content "$new_content $content"

# write new tex doc file
Marie-Josee Cros's avatar
Marie-Josee Cros committed
92
set f [open $FIC_TEX_TMP.tex w]
93
94
95
96
puts $f $new_content
close $f

# clean directory (beware except image .png)
Marie-Josee Cros's avatar
v 3.2    
Marie-Josee Cros committed
97
exec rm  $FIC_TMP
98
exec rm  SYNO_ARATH.misc_info
99
exec rm SMc.1541000-1552500.misc_info
100
# ask for compilation
101
exec pdflatex -interaction=nonstopmode $FIC_TEX_TMP.tex
102
catch {exec makeindex $CMDFLAGS_INDEX}
103
exec pdflatex -interaction=nonstopmode $FIC_TEX_TMP.tex
Marie-Josee Cros's avatar
Marie-Josee Cros committed
104
puts "eugene documentation generated."