# Last-edition: 20060313

#
# Html links
#
$links= {
}

$rules={

#
# Entry
#
entry:	~ { $In:[file:text] $Out pre {$Skip:0} }
	('SEQUENCE_ID' {$entryFip=$Fip $Wrt} toln {$App}
	('SEQUENCE_ID' {$Not} toln {$App})+ )?
~

#
# Fields
#
fields:		~ {$In:entry $Out} sequence_id promoter_id gene_id sequence end
~

sequence_id:	~ {$Wrt:sequence_id} 'SEQUENCE_ID' sp_toln ~
promoter_id:	~ {$Wrt:promoter_id} 'PROMOTER_ID' sp_toln ~
gene_id:	~ {$Wrt:gene_id} 'GENE_ID' sp_toln ~
sequence:	~ {$Wrt:sequence} 'SEQUENCE' sp_toln+ ~
end:		~ {$Wrt} 'END' toln ~

#
# Indexing
#
i_sequence_id:	~ {$In:[fields c:sequence_id] $Out:sequence_id} tag_sp
	id_ext {$Wrt} ln
~

#
# Html
#
h_promoter_id:	~ { $In:[fields c:promoter_id t:html] pre {if:$ParInt:isTable $Fail} }
	tag ( id_ext
	{$Rep:$Hlink:[entryR p:{"($ParStr:userIdOpt)" 'TGP_PROMOTER' 'PromoterID' $Ct $Ct} ]}
	| sp_or_ln )*
~
h_gene_id:	~ { $In:[fields c:gene_id t:html] pre {if:$ParInt:isTable $Fail} }
	tag ( id_ext
	{$Rep:$Hlink:[entryR p:{"($ParStr:userIdOpt)" 'TGP_GENE' 'GeneID' $Ct $Ct} ]}
	| sp_or_ln )*
~

#
# Special
#
id_ext:		~ /^[a-zA-Z]+:[a-zA-Z0-9_;+.-]+/ ~

#
# Other
#
toln:		~ /[^\n]*\n/ ~
noln:		~ /[^\n]*/ ~
ln:		~ /\n/ ~
sp_or_ln:	~ /[ \n]+/ ~
sp_toln:	~ / [^\n]*\n/ ~
tag:		~ /[A-Z0-9_-]+/ ~
tag_sp:		~ /[A-Z0-9_-]+ / ~
spaces:		~ /[ ]+/ ~
word:		~ /[a-zA-Z0-9]+/ ~
nonword:	~ /[^a-zA-Z0-9]*/ ~
wordext:	~ /[a-zA-Z0-9_-]+/ ~
fill:		~ /[^ \t\n]+/ ~
nonfill:	~ /[ \t\n]*/ ~

} # rules