<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- XML Schema for The Human Protein Atlas -->
<!--
Changes between 2.0 and 2.1 (HPA13):
- Add protein classes (proteinClasses structure)
- Add proteinEvidence structure
- Change verification tag to always use Supportive or Uncertain
- Add restriction on verification values in the schema
- Add gene ontology (GO) id's on subcellular location
- minor edits on element type's
- Add tag for new IHC score
-->
<xs:schema version="2.1" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

	<!-- Definition of the content of the root element The Human Protein Atlas -->
	<xs:element name="proteinAtlas">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="entry" type="entry-type" maxOccurs="unbounded"/>
				<xs:element name="copyright" type="xs:string" minOccurs="0"/>
			</xs:sequence>
		<!-- schemaVersion of the XML -->
		<xs:attribute name="schemaVersion" type="xs:decimal" use="required" />
		</xs:complexType>
	</xs:element>

	<!-- Definition of Entry (Ensembl gene) element -->
	<xs:complexType name="entry-type">
		<xs:sequence>
			<xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/>
			<xs:element name="synonym" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element name="identifier" type="identifier-type" minOccurs="1" maxOccurs="unbounded"/>
			<xs:element name="proteinClasses" type="proteinclass-type" minOccurs="1" maxOccurs="1"/>
			<xs:element name="proteinEvidence" type="proteinEvidence-type" minOccurs="1" maxOccurs="1"/>
			<xs:element name="tissueExpression" type="tissueExpression-type" minOccurs="0" maxOccurs="3"/>
			<xs:element name="subcellularLocation" type="subcellularLocation-type" minOccurs="0" maxOccurs="1"/>
			<xs:element name="rnaExpression" type="rnaExpression-type" minOccurs="0" maxOccurs="1"/>
			<xs:element name="antibody" type="antibody-type" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
		<!-- The Human Protein Atlas version and url to entry in The Human Protein Atlas  -->
		<xs:attribute name="version" type="xs:string" use="required"/>
		<xs:attribute name="url" type="xs:anyURI" use="required"/>
	</xs:complexType>

	<!-- Gene identifier  -->
	<xs:complexType name="identifier-type">
		<xs:sequence>
			<xs:element name="xref" type="xref-type" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
		<!-- Ensembl gene identifier, database name (Ensembl) and Ensembl database version -->
		<xs:attribute name="id" type="ensg" use="required"/>
		<xs:attribute name="db" type="xs:string" use="required"/>
		<xs:attribute name="version" type="xs:string" use="required"/>
	</xs:complexType>
	
	<xs:simpleType name="ensg">
		<xs:restriction base="xs:string">
			<xs:pattern value="ENSG[0-9]{11}"/>
		</xs:restriction>
	</xs:simpleType>
	
	<!-- Ensembl crossreferences (referenced database accession id and referenced database name, such as Uniprot/SWISS-PROT) -->
	<xs:complexType name="xref-type">
		<xs:attribute name="id" type="xs:string" use="required"/>
		<xs:attribute name="db" type="xs:string" use="required"/>
	</xs:complexType>
	
	<xs:complexType name="proteinclass-type">
		<xs:sequence>
			<xs:element name="proteinClass" minOccurs="0" maxOccurs="unbounded">
				<xs:complexType>
					<xs:attribute name="id" type="xs:string" use="required" />
					<xs:attribute name="parent_id" type="xs:string" use="required" />
					<xs:attribute name="name" type="xs:string" use="required" />
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	
	<xs:complexType name="proteinEvidence-type">
		<xs:sequence>
			<xs:element name="evidence" minOccurs="3" maxOccurs="3">
				<xs:complexType>
					<xs:attribute name="source" type="xs:string" use="required">
					</xs:attribute>
					<xs:attribute name="evidence" type="xs:string" use="required"/>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="evidence" type="xs:string" use="required"/>
	</xs:complexType>
	
	<xs:simpleType name="evidence-values">
		<xs:restriction base="xs:string">
			<xs:enumeration value="HPA" />
			<xs:enumeration value="MS" />
			<xs:enumeration value="UniProt" />
		</xs:restriction>
	</xs:simpleType>


	<!-- Antibody element -->
	<xs:complexType name="antibody-type">
		<xs:sequence>
			<!-- antigenSequence (amino acid for the protein epitope sequence tag, PrEST), only available for antibodies with id HPANNNNNN (not for CABNNNNNN antibodies) -->
			<xs:element name="antigenSequence" type="xs:string" minOccurs="0" maxOccurs="1"/>
			<xs:element name="tissueExpression" type="tissueExpression-type" minOccurs="0" maxOccurs="3"/>
			<xs:element name="subcellularLocation" type="subcellularLocation-type" minOccurs="0" maxOccurs="1"/>
			<xs:element name="westernBlot" type="westernBlot-type" minOccurs="0" maxOccurs="1"/>
			<xs:element name="proteinArray" type="proteinArray-type" minOccurs="0" maxOccurs="1"/>
		</xs:sequence>
		<!-- Antibody identifier, version of the Human Protein Atlas in which the antibody data was first released and date when the antibody data was first released -->
		<xs:attribute name="id" type="xs:string" use="required"/>
		<xs:attribute name="releaseVersion" type="xs:float" use="required"/>
		<xs:attribute name="releaseDate" type="xs:date" use="required"/>
	</xs:complexType>

	<!-- tissue expression type, three possible types exist: tissue, cancer and cell -->
	<xs:complexType name="tissueExpression-type">
		<xs:sequence>
			<!-- All except assayType="cell" have summary -->
			<xs:element name="summary" type="summary-type" minOccurs="0" maxOccurs="1"/>
			<!-- Cancer does not have verification -->
			<xs:element name="verification" type="verification-type" minOccurs="0" maxOccurs="1"/>
			<xs:element name="validation" type="validation-ih-type" minOccurs="0" maxOccurs="2"/>
			<xs:element name="image" type="image-type" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element name="data" type="data-type" minOccurs="1" maxOccurs="unbounded"/>
		</xs:sequence>
		<!-- Technology used to assess protein expression, and type (protein expression data based on one antibody (single) or knowledge based (APE), not relevant for antibody element (only on gene level)) -->
		<xs:attribute name="technology" type="technology-type" use="required"/>
		<xs:attribute name="type" type="ape-type" use="optional"/>
		<xs:attribute name="assayType" type="assayType-type" use="required"/>
	</xs:complexType>
	
	<!-- Allowed assay types for tissueExpression -->
	<xs:simpleType name="assayType-type">
		<xs:restriction base="xs:string">
			<xs:enumeration value="tissue"/>
			<xs:enumeration value="cancer"/>
			<xs:enumeration value="cell"/>
		</xs:restriction>
	</xs:simpleType>

	<!-- subcellular location type -->
	<xs:complexType name="subcellularLocation-type">
		<xs:choice maxOccurs="1">
			<!-- Antibody level -->
			<xs:sequence>
				<xs:element name="subAssay" type="subAssay-type" minOccurs="0" maxOccurs="unbounded"/>
			</xs:sequence>
			<!-- Gene level-->
			<xs:sequence>
				<xs:element name="summary" type="xs:string" minOccurs="0" maxOccurs="1"/>
				<xs:element name="verification" type="verification-type" minOccurs="1" maxOccurs="1"/>
				<xs:element name="image" type="image-type" minOccurs="1" maxOccurs="1"/>
				<xs:element name="data" type="data-type" minOccurs="0" maxOccurs="unbounded"/>
			</xs:sequence>
		</xs:choice>
		<!-- Technology used to assess protein subcellular location, and type (protein subcellular location data based on one antibody (single), the antibody with highest IF validation score (selected) or knowledge based (APE)). Not relevant for antibody element (only on gene level). -->
		<xs:attribute name="technology" type="technology-type" use="required"/>
		<xs:attribute name="type" type="ape-type" use="optional"/>
	</xs:complexType>
	
	<!-- Subcell, assay is currently divided into subassay based on cell species origin -->
	<xs:complexType name="subAssay-type">
		<xs:sequence>
			<xs:element name="verification" type="verification-type" minOccurs="1" maxOccurs="1"/>
			<xs:element name="image" type="image-type" minOccurs="1" maxOccurs="1"/>
			<xs:element name="data" type="data-type" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="type" type="subAssayType" use="optional"/>
	</xs:complexType>
	
	<!-- Available subassays for subcellularLocation -->
	<xs:simpleType name="subAssayType">
		<xs:restriction base="xs:string">
			<xs:enumeration value="human"/>
			<xs:enumeration value="mouse"/>
		</xs:restriction>
	</xs:simpleType>

	<!-- RNA expression type, includes data from both cell line and tissues -->
	<xs:complexType name="rnaExpression-type">
		<xs:sequence>
			<xs:element name="data" type="data-type" minOccurs="1" maxOccurs="unbounded"/>
		</xs:sequence>
		<!-- Technology used to assess RNA expression -->
		<xs:attribute name="technology" type="technology-type" use="required"/>
	</xs:complexType>
	
	<!-- Western blot type -->
	<xs:complexType name="westernBlot-type">
		<xs:sequence>
			<xs:element name="summary" type="xs:string" minOccurs="0" maxOccurs="1"/>
			<xs:element name="verification" type="verification-type" minOccurs="1" maxOccurs="1"/>
		</xs:sequence>
		<!-- Technology used to assess protein molecular weight -->
		<xs:attribute name="technology" type="technology-type" use="required"/>
	</xs:complexType>
	
	<!-- protein array type -->
	<xs:complexType name="proteinArray-type">
		<xs:sequence>
			<xs:element name="summary" type="xs:string" minOccurs="0" maxOccurs="1"/>
			<xs:element name="verification" type="verification-type" minOccurs="1" maxOccurs="1"/>
		</xs:sequence>
		<!-- Technology used to assess antibody specificity profile -->
		<xs:attribute name="technology" type="technology-type" use="required"/>
	</xs:complexType>

	<!-- Data type -->
	<xs:complexType name="data-type">
		<xs:sequence>
			<xs:choice minOccurs="0" maxOccurs="1">
				<!-- tissueExpression assayType=cancer,tissue have this -->
				<xs:sequence>
					<xs:element name="tissue" type="tissue-type"/>
					<xs:element name="tissueCell" type="tissueCell-type" minOccurs="0" maxOccurs="unbounded"/>
					<xs:element name="patient" type="patient-type" minOccurs="0" maxOccurs="unbounded"/>
				</xs:sequence>
				<!-- tissueExpression assayType = cell -->
				<xs:sequence>
					<xs:element name="cellLine" type="xs:string" minOccurs="0" maxOccurs="1"/>
					<xs:element name="cellType" type="xs:string" minOccurs="0" maxOccurs="1"/>
					<xs:element name="cellSample" type="cellSample-type" minOccurs="0" maxOccurs="unbounded"/>
				</xs:sequence>
				<!-- subcellularLocation have some of these -->
				<xs:sequence>
					<xs:element name="cellLine" type="xs:string" minOccurs="0" maxOccurs="1"/>
					<xs:element name="verification" type="verification-type" minOccurs="0" maxOccurs="1"/>
					<xs:element name="cellType" type="xs:string" minOccurs="0" maxOccurs="1"/>
					<xs:element name="level" type="level-type" minOccurs="0" maxOccurs="4"/>
					<xs:element name="location" type="location-type" minOccurs="0" maxOccurs="unbounded"/>
					<xs:element name="assayImage" type="assayImage-type" minOccurs="0" maxOccurs="unbounded"/>
				</xs:sequence>
				<!-- rnaExpression -->
				<xs:sequence>
					<xs:choice minOccurs="1" maxOccurs="1">
						<xs:element name="cellLine" type="xs:string" minOccurs="1" maxOccurs="1"/>
						<xs:element name="tissue" type="xs:string" minOccurs="1" maxOccurs="1"/>
					</xs:choice>
					<xs:element name="level" type="level-type" minOccurs="0" maxOccurs="4"/>
				</xs:sequence>
			</xs:choice>
		</xs:sequence>
	</xs:complexType>
	
	<!-- Sample specific data for tissueExpression Cell-->
	<xs:complexType name="cellSample-type">
		<xs:sequence>
			<xs:element name="numberOfCells" type="xs:integer" minOccurs="1" maxOccurs="1"/>
			<xs:element name="percentageStainedCells" type="xs:decimal" minOccurs="1" maxOccurs="1"/>
			<xs:element name="level" type="level-type" minOccurs="2" maxOccurs="2"/>
			<xs:element name="assayImage" type="assayImage-type" minOccurs="1" maxOccurs="2"/>
		 </xs:sequence>
	</xs:complexType>

	<!-- Group of Celltype-specific data for the corresponding tissue -->
	<xs:complexType name="tissueCell-type">
		<xs:sequence>
			<xs:element name="cellType" type="xs:string" minOccurs="0" maxOccurs="1"/>
			<xs:element name="level" type="level-type" minOccurs="0" maxOccurs="4"/>
			<!-- Quantity and Location for IH Tissue here -->
			<xs:element name="quantity" type="xs:string" minOccurs="0" maxOccurs="1"/>
			<xs:element name="location" type="location-type" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>

	
	<xs:complexType name="patient-type">
		<xs:sequence>
			<xs:element name="sex" type="xs:string" minOccurs="1" maxOccurs="1"/>
			<xs:element name="age" type="xs:integer" minOccurs="0" maxOccurs="1"/>
			<xs:element name="patientId" type="xs:integer" minOccurs="1" maxOccurs="1"/>
			<!-- Level, Quantity And Location exist here for IH cancer, for IH tissue it's on tissueCell due to different way of annotating the samples -->
			<xs:element name="level" type="level-type" minOccurs="0" maxOccurs="4"/>
			<xs:element name="quantity" type="xs:string" minOccurs="0" maxOccurs="1"/>
			<xs:element name="location" type="location-type" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element name="sample" type="sample-type" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!-- Sample specific data for tissueExpression -->
	<xs:complexType name="sample-type">
		<xs:sequence>
			<xs:element name="snomedParameters" type="snomedParameters-type" minOccurs="0" maxOccurs="1"/>
			<xs:element name="assayImage" type="assayImage-type" minOccurs="0" maxOccurs="unbounded"/>
		 </xs:sequence>
	</xs:complexType>
	
	<xs:complexType name="snomedParameters-type">
		<xs:sequence>
			<xs:element name="snomed" minOccurs="0" maxOccurs="unbounded">
				<xs:complexType>
					<xs:attribute name="tissueDescription" type="xs:string"></xs:attribute>
					<xs:attribute name="snomedCode" type="xs:string"></xs:attribute>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	
	<!-- Contains multiple images from the same sample or origin -->
	<xs:complexType name="assayImage-type">
		<xs:sequence>
			<xs:element name="image" type="image-type" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>

	<!-- Summary type, expression summary -->
	<xs:complexType name="summary-type">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="type" use="optional">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<!-- expression summary for tissue or cancer atlas, see http://www.proteinatlas.org/about/assays+annotation#ih -->
							<xs:enumeration value="tissue"/>
							<xs:enumeration value="cancer"/>
							<xs:enumeration value="cell"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:attribute>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	
	<!-- Technology type, IH = immunohistochemistry, see http://www.proteinatlas.org/about/assays+annotation#ih, IF = immunofluorescent confocal microscopy, see http://www.proteinatlas.org/about/assays+annotation#if, RNAseq = RNA sequencing, see http://www.proteinatlas.org/about/assays+annotation#rna, WB = Western blot, see http://www.proteinatlas.org/about/assays+annotation#wb, PA = Proteinarray, see http://www.proteinatlas.org/about/assays+annotation#pa -->
	<xs:simpleType name="technology-type">
		<xs:restriction base="xs:string">
			<xs:enumeration value="IH"/>
			<xs:enumeration value="IF"/>
			<xs:enumeration value="RNAseq"/>
			<xs:enumeration value="WB"/>
			<xs:enumeration value="PA"/>
		</xs:restriction>
	</xs:simpleType>
	
	<!-- ape type, not relevant for antibody element. APE = annotated protein expression, see http://www.proteinatlas.org/about/assays+annotation#ihk or http://www.proteinatlas.org/about/assays+annotation#ifk, selected (antibody with highest validation score, see http://www.proteinatlas.org/about/quality+scoring#ifv), single (only one antibody available) -->
	<xs:simpleType name="ape-type">
		<xs:restriction base="xs:string">
			<xs:enumeration value="APE"/>
			<xs:enumeration value="selected"/>
			<xs:enumeration value="single"/>
		</xs:restriction>
	</xs:simpleType>
	
	<!-- Tissue type, status tissue or cancer atlas, see also http://www.proteinatlas.org/about/assays+annotation#ih -->
	<xs:complexType name="tissue-type">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="status" use="optional">
					<xs:simpleType>
						<xs:restriction base="xs:string">
							<xs:enumeration value="tissue"/>
							<xs:enumeration value="cancer"/>
							<xs:enumeration value="cell"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:attribute>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>

	<!-- Level type [want to limit values] -->
	<xs:complexType name="level-type">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="type" use="required">
					<xs:simpleType>
						<!-- abundance for RNA-Seq data, see http://www.proteinatlas.org/about/assays+annotation#rna, intensity for immunofluorescence data, see http://www.proteinatlas.org/about/assays+annotation#if, expression for APE data, see http://www.proteinatlas.org/about/assays+annotation#ihk, staining for immunohistochemistry data, see http://www.proteinatlas.org/about/assays+annotation#ih -->
						<xs:restriction base="xs:string">
							<xs:enumeration value="abundance"/>
							<xs:enumeration value="intensity"/>
							<xs:enumeration value="expression"/>
							<xs:enumeration value="staining"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:attribute>
				<!-- fpkm (fragments per kilobase of transcript per million fragments mapped) estimation of RNA expression for RNA-Seq data, count for cell line samples (number of samples at each level) -->
				<xs:attribute name="fpkm" type="xs:float" use="optional"/>
				<xs:attribute name="count" type="xs:integer" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>

	<!-- Location type, for immunoflourescence based location data, see http://www.proteinatlas.org/about/assays+annotation#if -->
	<xs:complexType name="location-type">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="status" use="optional">
					<xs:simpleType>
						<!-- Main location or additional location, where additional locations are characterized by either a markedly lower staining intensity than the main location, or that it was only observed in a subset of the cell lines. -->
						<xs:restriction base="xs:string">
							<xs:enumeration value="main"/>
							<xs:enumeration value="additional"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:attribute>
				<!-- GO ids: GO:0000000 -->
				<xs:attribute name="GOId" use="optional" type="xs:string" />
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	
	
    <!-- Location type, for immunoflourescence based location data, see http://www.proteinatlas.org/about/assays+annotation#if -->
	<xs:complexType name="image-type">
		<xs:sequence>
			<xs:element name="tissue" type="tissue-type" minOccurs="0" maxOccurs="1"/>
			<xs:element name="channel" type="channel-type" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element name="imageUrl" type="imageUrl-type" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="imageType" type="imageType-type"/>
	</xs:complexType>
	
	<!-- imageURL holds an URL and size-info (large, medium) -->
	<xs:complexType name="imageUrl-type">
		<xs:simpleContent>
			<xs:extension base="xs:anyURI">
				<xs:attribute name="size" type="xs:string"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	
	<!-- Channels used in immunofluorescence imaging -->
	<xs:simpleType name="channel-type">
		<xs:restriction base="xs:string">
			<xs:enumeration value="antibody"/>
			<xs:enumeration value="microtubuli"/>
			<xs:enumeration value="nucleus"/>
			<xs:enumeration value="endoplasmatic reticulum"/>
			<xs:enumeration value="intensity"/>
		</xs:restriction>
	</xs:simpleType>

	<!-- Types of images used -->
	<xs:simpleType name="imageType-type">
		<xs:restriction base="xs:string">
			<xs:enumeration value="selected"/>
			<xs:enumeration value="selectedNormal"/>
			<xs:enumeration value="sampleImage"/>
			<xs:enumeration value="assay"/>
			<xs:enumeration value="area"/>
			<xs:enumeration value="cells"/>
		</xs:restriction>
	</xs:simpleType>
	

	<!-- Verification type [want to limit values], data quality assurance -->
	<xs:complexType name="verification-type">
		<xs:simpleContent>
			<xs:extension base="verification-values">
				<xs:attribute name="type" use="required">
					<xs:simpleType>
						<!-- Data quality assessed by validation (Supportive/Uncertain/Non-supportive), see http://www.proteinatlas.org/about/quality+scoring -->
						<xs:restriction base="xs:string">
							<xs:enumeration value="validation"/>
							<xs:enumeration value="reliability"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:attribute>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	
	<xs:simpleType name="verification-values">
		<xs:restriction base="xs:string">
			<xs:enumeration value="supportive"/>
			<xs:enumeration value="uncertain"/>
			<xs:enumeration value="non-supportive"/>
		</xs:restriction>
	</xs:simpleType>

	<xs:complexType name="validation-ih-type">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="type" use="required">
					<xs:simpleType>
						<!-- Antibody Validation, see http://fredric.dev.proteinatlas.org/about/quality+scoring#ihcv -->
						<xs:restriction base="xs:string">
							<xs:enumeration value="literatureConformity"/>
							<xs:enumeration value="RNAConsistency"/>
						</xs:restriction>
					</xs:simpleType>
				</xs:attribute>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
</xs:schema> 