Compare commits

...

2 Commits

4 changed files with 78 additions and 7 deletions

View File

@ -74,28 +74,36 @@ object BioschemaModelConstants {
)
val PED_PREFIX: String = "ped_________"
val DISPROT_PREFIX: String = "disprot_____"
val resolvedURLPattern: Map[String, String] = Map(
"https://identifiers.org/pubmed:" -> "pubmed",
"http://purl.uniprot.org/uniprot/" -> "uniprot",
"https://identifiers.org/uniprot:" -> "uniprot"
"https://identifiers.org/uniprot:" -> "uniprot",
"https://identifiers.org/disprot:" -> "disprot"
)
//TODO create DatasourceId and update those value
val collectedFromMap: Map[String, KeyValue] = {
val PEDCollectedFrom: KeyValue = OafMapperUtils.keyValue(
//TODO create pedDatasourceId and update this value
"10|ped_________::pedDatasourceId",
"Protein Ensemble Database"
)
PEDCollectedFrom.setDataInfo(DATA_INFO)
val DISPROTCollectedFrom: KeyValue = OafMapperUtils.keyValue(
"10|disprot_____::disprotDatasourceId",
"DisProt, the database of intrinsically disordered proteins"
)
DISPROTCollectedFrom.setDataInfo(DATA_INFO)
Map(
"ped" -> PEDCollectedFrom
"ped" -> PEDCollectedFrom,
"disprot" -> DISPROTCollectedFrom
)
}
val datasourceKeyPrefix: Map[String, String] = Map(
"ped" -> PED_PREFIX
"ped" -> PED_PREFIX,
"disprot" -> DISPROT_PREFIX
)
val REL_TYPE_VALUE: String = "resultResult"

View File

@ -100,7 +100,9 @@ object BioschemaToOAFTransformation {
result.setDataInfo(dataInfo)
val titles: List[TitleType] = (json \\ "titles").extractOrElse[List[TitleType]](List())
if (titles.isEmpty) {
return List()
}
result.setTitle(
titles
.filter(t => t.title.nonEmpty)
@ -189,6 +191,9 @@ object BioschemaToOAFTransformation {
})
.asJava
)
if (instance.getUrl.isEmpty) {
return List()
}
instance.setCollectedfrom(collectedFromMap(datasourceKey))
instance.setPid(result.getPid)

View File

@ -0,0 +1,45 @@
{
"id": "DP01454",
"types": {
"resourceType": "Protein",
"resourceTypeGeneral": "Dataset"
},
"creators": [],
"identifiers": [
{
"identifier": "https://disprot.org/DP01454",
"identifierType": "URL"
}
],
"relatedIdentifiers": [
{
"relationType": "IsIdenticalTo",
"relatedIdentifier": "http://purl.uniprot.org/uniprot/P60006",
"relatedIdentifierType": "URL"
}
],
"alternateIdentifiers": [
{
"alternateIdentifier": "https://identifiers.org/disprot:DP01454"
}
],
"descriptions": [],
"titles": [
{
"title": "DP01454 - Anaphase-promoting complex subunit 15 "
}
],
"dates": [
{
"date": "2021-11-25T12:23:57",
"dateType": "Collected"
}
],
"subjects": [
{
"schemeURI": "https://disprot.org/assets/data/IDPO_v0.2.owl#IDPO:00076",
"value": "disorder",
"subjectScheme": "IDPO:00076"
}
]
}

View File

@ -62,7 +62,7 @@ class BioschemaDataciteToOAFTest {
}
@Test
def testMapping(): Unit = {
def testPEDMapping(): Unit = {
val record = Source
.fromInputStream(getClass.getResourceAsStream("/eu/dnetlib/dhp/bioschema/ped_record.json"))
.mkString
@ -73,4 +73,17 @@ class BioschemaDataciteToOAFTest {
println("----------------------------")
})
}
@Test
def testDISPROTMapping(): Unit = {
val record = Source
.fromInputStream(getClass.getResourceAsStream("/eu/dnetlib/dhp/bioschema/disprot_record.json"))
.mkString
val mapper = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT)
val res: List[Oaf] = BioschemaToOAFTransformation.generateOAF(record, true, "disprot", "protein")
res.foreach(r => {
println(mapper.writeValueAsString(r))
println("----------------------------")
})
}
}