<?xml version="1.0" encoding="UTF-8"?>

<!-- 	document	: sequenceML schema definition
	version 		: 3.0 gamma
	date 		: 2009-09-17
	author		:  			  			 
			  Richard Madsack <rmadsack@cebitec.uni-bielfeld.de>
			  Jan Krueger <jkrueger@cebitec.uni-bielefeld.de>
			  Daniel Hagemeieger <dhagemei@cebitec.uni-bielefeld.de>
-->

<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
	targetNamespace="http://hobit.sourceforge.net/xsds/20090917/sequenceML"
	xmlns:bt="http://schemas.bioservices.net/2005/biotypes"
	xmlns:seq="http://hobit.sourceforge.net/xsds/20090917/sequenceML"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	version="3.0 gamma">

	<xs:import namespace="http://schemas.bioservices.net/2005/biotypes" schemaLocation="http://bibiserv.techfak.uni-bielefeld.de/xsd/net/bioservices/schemas/2005/biotypes.xsd" />
	

	
	<!--                   -->
	<!-- ELEMENTS -->
	<!--                   -->
	<xs:element name="sequenceML">
		<xs:annotation>
			<xs:documentation>
				SequenceML deals with all kinds of simple sequence information often used as input
				for several common bioinformatics tools. It is designed to be used as a replacement 
				for the FASTA format, containing all of FASTA's information content while avoiding that 
				format's aforementioned consistency problems. SequenceML differentiates between 
				nucleic- and aminoacid sequences following the IUPAC standard and also allows the 
				user to add free sequence information based on basic types defined by BioTypes. 
				SequenceML also supports a mandatory sequence id and an optional detailed 
				sequence description. In difference to previous versions SequenceML &gt;3.0 offers the possibility
				to add simple annotations.
			</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" maxOccurs="unbounded" name="sequence" type="seq:sequenceType" />
			</xs:sequence>
			<xs:attribute name="version" type="bt:version" use="optional" />
		</xs:complexType>
	</xs:element>
	<!--             -->
	<!-- TYPES -->
	<!--             -->
	<xs:complexType name="sequenceType">
		<xs:sequence>
			<xs:element minOccurs="0" maxOccurs="unbounded" name="annotation" type="seq:tannotation"/>
			<xs:element minOccurs="0" name="name" type="xs:string" />
			<xs:element minOccurs="0" maxOccurs="unbounded" name="synonyms" type="xs:string">
				<xs:annotation>
					<xs:documentation>Synonyms for this element</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element minOccurs="0" name="description" type="xs:string" />
			<xs:choice>
				<xs:element name="aminoAcidSequence" type="bt:ambiguousAminoAcidOneLetterSequence" />
				<xs:element name="nucleicAcidSequence" type="bt:ambiguousNucleotideSequence" />
				<xs:element name="freeSequence" type="bt:sequence" />
				<xs:element name="emptySequence" fixed=""/>
			</xs:choice>
			<xs:element maxOccurs="unbounded" minOccurs="0" name="comment" type="xs:string" />
		</xs:sequence>
		<xs:attribute name="seqID" type="bt:accessionNumber" use="required" />
		<xs:anyAttribute/>
	</xs:complexType>
	
	<xs:complexType name="tannotation">		
		<xs:annotation>
			<xs:documentation>Element for annotation of sequence data. Contains one or more positions associated 
				with a set of properties, which can be freely defined. Optional attributes allow for specification of annotation 
				source (e.g. the generating program), creation date and a human readable description of the meaning of 
				this annotation.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="position" type="seq:tposition" minOccurs="1" maxOccurs="unbounded"/>
			<xs:element name="property" type="seq:tproperty" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="source" type="xs:string" use="optional"/>
		<xs:attribute name="date" type="xs:dateTime" use="optional"/>
		<xs:attribute name="description" type="xs:string" use="optional"/>
		<xs:anyAttribute/>
	</xs:complexType>
		
		
	<xs:complexType name="tproperty">
		<xs:annotation>
			<xs:documentation>Definition of an annotation property, identified by 'key' attribute, with optional human readable 
				description.</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="key" type="xs:string"/>
				<xs:attribute name="description" type="xs:string"/>			
			</xs:extension>
		</xs:simpleContent>			
	</xs:complexType>	
		
	
	<xs:complexType name="tposition">
		<xs:annotation>
			<xs:documentation>Location information for annotation. Optional strand attribute for e.g. nucleic 
				acid sequences.</xs:documentation>
		</xs:annotation>
		<xs:attribute name="start" type="xs:int" use="required"/>
		<xs:attribute name="stop" type="xs:int" use="required"/>
		<xs:attribute name="strand" type="seq:tstrand" use="optional"/>
	</xs:complexType>
	
	<xs:simpleType name="tstrand">		
		<xs:restriction base="xs:token">
			<xs:enumeration value="f"/>
			<xs:enumeration value="r"/>
		</xs:restriction>
	</xs:simpleType>
	
</xs:schema>

