コード例 #1
0
	public function add( IdStack $idPath, $record )  {
		$objectId = $this->objectIdFetcher->fetch( $idPath->getKeyStack() );
		$linkAttributeId = $this->determineAttributeId( $idPath, "URL", $record->linkAttribute );
		$linkValue = $record->link;
		$label = $linkValue->linkLabel;
		$url = $linkValue->linkURL;
		
		if ( $linkAttributeId != 0 && $url != "" ) {
			addLinkAttributeValue( $objectId, $linkAttributeId, $this->validateURL( $url ), $label );
		}
	}
コード例 #2
0
	protected function addComments( SwissProtEntry $entry, $definedMeaningId, $proteinMeaningId, $organismSpeciesMeaningId ) {
		foreach ( $entry->comments as $key => $comment ) {
			$commentType = strtoupper( $comment->type );
			$comment->text = trim( $comment->text );
			
			// f.) Information in the attribute 'caution' is imported but it many times doesn’t
			// make sense due to the fact it refers to References (in the SP entry) that are
			// not shown in wikiproteins, therefore it should NOT be imported presently.
			if ( $commentType == "CAUTION" )
				continue; // ignore

			// create definedMeaning for SP comment type			
			$attributeMeaningId = $this->getOrCreateAttributeMeaningId( $comment->type );
			
			// initialize text value
			$textValue = "";
			$normalProcessing = true;
			
			// link comments with the appropriate definedMeaning(defined by Chrisi and Erik)
			// we have to create relation between comment and its aspect
			// all comments have the relation 'has aspect' 
			switch ( $commentType ) {
				
			// j.) the comments with the topic, SUBCELLULAR LOCATION and TISSUE SPECIFICITY
			// need to be tagged with the attribute 'Localization Aspects'			
			case "SUBCELLULAR LOCATION":
			case "TISSUE SPECIFICITY":
				break;
			// k.) the comments with the topic, CATALYTIC ACTIVITY, COFACTOR, FUNCTION, DISEASE,   
			// ENZYME REGULATION, INDUCTION, INTERACTION, PATHWAY, RNA EDITING, and 
			// DEVELOPMENTAL STAGE need to be tagged with the attribute 'Functional Aspects'
			case "CATALYTIC ACTIVITY":
			case "COFACTOR":
			case "FUNCTION":
			case "DISEASE":
			case "ENZYME REGULATION":
			case "INDUCTION":
			case "INTERACTION":
			case "PATHWAY":
			case "RNA EDITING":
				// add INTERACTION comment parameters
				if ( $commentType == "INTERACTION" && count( $comment->children ) == 2 ) {
					if ( $comment->children[0]->att_intactId == $comment->children[1]->att_intactId ) {
						$textValue .= "with Self (accepted by Swiss-Prot);";
						// build URL
						$comment->url = "http://www.ebi.ac.uk/intact/search/do/search?binary=" .
						$comment->children[0]->att_intactId . "," .
						$comment->children[0]->att_intactId;
					}
					else {
						if ( $comment->children[1]->label == "" )
							$textValue .= "with -";
						else
							$textValue .= "with " . $comment->children[1]->label;
						
						$textValue .= " (accepted by Swiss-Prot);";
						$comment->url = "http://www.ebi.ac.uk/intact/search/do/search?binary=" .
						$comment->children[0]->att_intactId . "," .
						$comment->children[1]->att_intactId;
					}
				}
				// ignore other parameters of INTERACTION comment
				if ( $commentType == "INTERACTION" )
					$comment->text = "";
				break;
			// l.)	the comments with the topic, ALTERNATIVE PRODUCTS, DOMAIN, PTM, 
			// POLYMORPHISM, SIMILARITY,  MASS SPECTROMETRY, and SUBUNIT  need to be tagged
			// with the attribute 'Structural Aspects'
			case "ALTERNATIVE PRODUCTS":
				foreach ( $comment->isoforms as $isoform ) {
					$isoformId = $this->addIsoform( $entry, $definedMeaningId, $proteinMeaningId, $organismSpeciesMeaningId, $isoform );
					addRelation( $definedMeaningId, $this->alternativeProductId, $isoformId );
				}
				break;
			case "SIMILARITY":
				if ( startsWith( $comment->text, "Belongs to the " ) ) {
					$family = trim( substr( $comment->text, strlen( "Belongs to the " ) ) );
					$familyId = $this->addSimilarityFamily( $family );
					
					addRelation( $definedMeaningId, $this->conceptualPartOfId, $familyId );
					$normalProcessing = false;
				}
				else if ( startsWith( $comment->text, "Contains " ) ) {
					$domain = trim( substr( $comment->text, strlen( "Contains " ) ) );
					
					while ( $domain[0] >= "0" && $domain[0] <= "9" )
						$domain = substr( $domain, 1 );
					
					$domain = trim( $domain );
					$domainId = $this->addSimilarityFamily( $domain );
					
					addRelation( $definedMeaningId, $this->consistsOfId, $domainId );
					$normalProcessing = false;
				}
				
				break;
			case "DOMAIN":
			case "PTM":
			case "POLYMORPHISM":
			case "MASS SPECTROMETRY":
			case "SUBUNIT":
				// add mass SPECTROMETRY to text value
				if ( $comment->mass != "" )
					$textValue .= $comment->mass . " is the determined molecular weight; ";
				// add method of MASS SPECTROMETRY to text value
				if ( $comment->method != "" ) {
					$textValue .= $comment->method . " is the ionization method; ";
				}
				// add error of MASS SPECTROMETRY to text value
				if ( $comment->error != "" ) {
					$textValue .= $comment->error . " is the accuracy or error range of the MW measurement; ";
				}
				// add position of MASS SPECTROMETRY to text value				
				if ( $commentType == "MASS SPECTROMETRY" && count( $comment->children ) > 0 )
					$textValue .= $comment->children[0]->position . " is the part of the protein sequence entry that corresponds to the molecular weight;";
				
				// ignore note of MASS SPECTROMETRY comment
				if ( $commentType == "MASS SPECTROMETRY" )
					$comment->text = "";
				break;
			// m.) the comments with the topic, ALLERGEN, PHARMACEUTICAL, BIOTECHNOLOGY, 
			// TOXIC DOSE, and BIOPHYSICOCHEMICAL PROPERTIES need to be tagged with the 
			// attribute 'Pharmaceutical Aspects'
			case "ALLERGEN":
			case "PHARMACEUTICAL":
			case "BIOTECHNOLOGY":
			case "TOXIC DOSE":
			case "BIOPHYSICOCHEMICAL PROPERTIES":
				if ( $commentType == "BIOPHYSICOCHEMICAL PROPERTIES" ) {
					// add Kinetic parameters to text value	
					if ( count( $comment->children ) > 0 ) {
						$textValue .= "Kinetic parameters:(";
						if ( $comment->children[0]->km != "" )
							$textValue .= "KM=" . $comment->children[0]->km . "; ";
						if ( $comment->children[0]->vMax != "" )
							$textValue .= "Vmax=" . $comment->children[0]->vMax;
						$textValue .= "); ";
					}
					// add phDependence parameter
					if ( $comment->phDependence != "" )
						$textValue .= "pH dependence: " . $comment->phDependence . "; ";
					// add temperatureDependence parameter
					if ( $comment->temperatureDependence != "" )
						$textValue .= "temperature dependence: " . $comment->temperatureDependence . ";";
				}
				break;
			// o.) the comments with the topic, WEB RESOURCE or ONLINE INFORMATION needs to 
			// be tagged with the attribute 'External Information'
			case "ONLINE INFORMATION":
				// add comment name to text value
				$label = "";
				
				if ( $comment->name != "" )
					$label .= $comment->name;
				
				// add 'NOTE' child text to link label
				if ( $comment->note != "" ) {
					if ( $label != "" )
						$label .= ", ";
					
					$label .= $comment->note;
				}
				
				if ( $comment->text != "" ) {
					$textValue = $comment->text;
					
					if ( $comment->status != "" )
						$textValue .= " (" . $comment->status . ")";
					
					$idToAddLinkTo = addTextAttributeValue( $definedMeaningId, $attributeMeaningId, $textValue );
				}
				else
					$idToAddLinkTo = $definedMeaningId;
				
				addLinkAttributeValue( $idToAddLinkTo, $this->onlineInformationId, $comment->url, $label );
				$normalProcessing = false;
				break;
			// n.) the comments with the topic, MISCELLANEOUS and CAUTION need to be tagged
			// with the attribute 'Other Aspects'
			case "DEVELOPMENTAL STAGE":
			case "MISCELLANEOUS":
			case "CAUTION":
			default:
				break;
			}
			
			if ( $normalProcessing ) {
				// add comment text to text value			
				if ( $textValue != "" && ( $comment->text != "" || $comment->status != "" ) )
					$textValue .= " TEXT=";
				
				if  ( $comment->text != "" )
					$textValue .= $comment->text;
				
				// add comment status to text value
				if ( $comment->status != "" )
					$textValue .= " (" . $comment->status . ")";
	
				if ( $textValue != "" ) {
					// add the comment fields as text attributes to the entry	
					$textAttributeValueId = addTextAttributeValue( $definedMeaningId, $attributeMeaningId, $textValue );
					
					// add the comment URL as URL attribute to the entry and link URL attribute with text attribute
					if ( $comment->url != "" )
						addLinkAttributeValue( $textAttributeValueId, $this->onlineInformationId, $comment->url );
				}
			}
		}
	}