Skip to content

Commit

Permalink
schematron validator updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Juha Muilu committed Mar 12, 2013
1 parent f6983cd commit 665f352
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 6 deletions.
67 changes: 63 additions & 4 deletions src/java/misc/idbase/src/varioml/parsers/IDBase.scala
Expand Up @@ -967,6 +967,9 @@ object IDBase {
}
def toXML(batch: DataBatch): Lsdb = {

val hOut = new java.io.PrintWriter(new File("test.tab"))
hOut.println("")

val lsdb = new Lsdb()
val source = new org.varioml.jaxb.Source()
val contact = new Contact()
Expand Down Expand Up @@ -1004,6 +1007,7 @@ object IDBase {
val sexStr = rec.get(Sex)
val gender = new Gender()


if (sexStr != null) {
if (sexStr.equals("XX")) {
gender.setCode(2)
Expand Down Expand Up @@ -1045,6 +1049,9 @@ object IDBase {

}


}

val pop = rec.get(EthnicOrigin)
if (pop != null) {
val population = new Population()
Expand All @@ -1054,8 +1061,6 @@ object IDBase {
inv.addPopulation(population)
}

}

val sysName = rec.get(SystematicName)
//get systematic names and try to find corresonding feature table entry
// like: Feature dna; 1
Expand Down Expand Up @@ -1233,6 +1238,29 @@ object IDBase {
gene.setAccession(batch.getHeader(Gene))
vari.setGene(gene)
lsdb.addIndividual(inv)

var ix = 7
systematicNames._1.sorted.foreach ((n)=>{
ix = ix - 1
assert(ix>0)
hOut.print(n.replaceAll("\\s*;\\s*$","").trim()+"\t")
})
for( i <- ix to 0 by -1) {
hOut.print("\t")
}
ix = 7
systematicNames._2.sorted.foreach ((n)=>{
ix = ix - 1
assert(ix>0)
hOut.print(n.replaceAll("\\s*;\\s*$","").trim()+"\t")
})
for( i <- ix to 0 by -1) {
hOut.print("\t")
}

hOut.println(rec.get(Accession)+"\t"+sexStr+"\t"+rec.get(Diagnosis)+
"\t"+rec.get(EthnicOrigin)+"\t"+rec.get(Relative)+"\t"+rec.get(RefCrossRef)+
"\t"+rec.get(RefAuthors)+"\t"+rec.get(RefTitle))

}

Expand Down Expand Up @@ -1329,11 +1357,13 @@ object IDBase {
})
})

val cMap = HashMap("Norway" -> "Norwegian",
val cMap = HashMap("Norway" -> "Norwegian","Finland"->"Finnish",
"Slovenia" -> "Slovenian", "Russia" -> "Russian", "Italy" -> "Italian",
"Hungary" -> "Hungarian", "Egypt" -> "Egyptian", "USA" -> "American", "Korea" -> "Korean",
"Japan" -> "Japanise", "Sicily" -> "Sicilian", "India" -> "Indian",
"Britain" -> "British", "Poland" -> "Polish", "Allele 1:Korea; Allele 2:Japan" -> "Korean/Japanise")

prt.println("mutation\thomozyg\tpopulation\tcombined\tgenome\tRNA\tAA\tdisease")
map.keySet foreach (k => {
prt.print(k + "\t")

Expand All @@ -1349,8 +1379,19 @@ object IDBase {
""
}
})).distinct


val disease = (distincts flatMap ((i: Individual) => {
val phenoList = i.getPhenotypeList()
if (phenoList != null) {
phenoList.filter(_.getType() == "diagnose").map(_.getTerm())
} else {
""
}
})).distinct

val pops = pops1.map(p => if (cMap.get(p) != null) { cMap.get(p) } else { p })
prt.print(homo + "\t" + (indivs.size - homo) + "\t" + pops.mkString(";"))
prt.print(homo + "\t" + (indivs.size - homo) + "\t" + pops.mkString(";")+"\t")

var test = List[VmlVariantEvent]()
distincts foreach (l => {
Expand All @@ -1369,6 +1410,7 @@ object IDBase {
}
})
})

assert(test.size > 0, " Alias mismatch " + k + " " + test.size)
val head = test.head
val tail = test.tail
Expand All @@ -1389,6 +1431,23 @@ object IDBase {
Console.err.println("CHK HIS " + l.getId())
}
})
val ge = test.head.getName().getString()
val sq1 = test.head.getSeqChanges()
var rna=""
var aa = ""
if ( sq1 != null && sq1.getVariantList() != null) {
rna = sq1.getVariantList().get(0).getName().getString()
val sq2 = sq1.getVariantList().get(0).getSeqChanges()
if ( sq2 != null && sq2.getVariantList() != null) {
aa = sq2.getVariantList().get(0).getName().getString()
}
}
if ( rna.startsWith("p.")) {
assert(aa.isEmpty(),"check name "+rna)
prt.print(ge+"\t"+""+"\t"+rna+"\t"+disease.mkString(";"))
} else {
prt.print(ge+"\t"+rna+"\t"+aa+"\t"+disease.mkString(";"))
}
prt.println()
})
})
Expand Down
5 changes: 3 additions & 2 deletions xml/cafe_variome/validator/cafe_variome_validator.sch
Expand Up @@ -3,7 +3,7 @@
xmlns="http://purl.oclc.org/dsdl/schematron"
xmlns:iso="http://purl.oclc.org/dsdl/schematron"
xmlns:vml="http://varioml.org/xml/1.0"
queryBinding='xslt1'
queryBinding='xslt2'
schemaVersion='ISO19757-3'>
<iso:title>ISO schematron validation rules for the Cafe Variome data submissions</iso:title>
<iso:ns prefix='vml' uri='http://varioml.org/xml/1.0'/>
Expand Down Expand Up @@ -37,6 +37,7 @@
<iso:rule context="vml:cafe_variome/vml:source/vml:contact">
<iso:assert
test="vml:name or vml:email">Contact name or email is missing</iso:assert>
<iso:assert test="not(@role) or @role='curator' or @role='producer' or @role='submitter'">Role of contact is not recognized</iso:assert>
<iso:report
test="vml:name or vml:email">Contact ok</iso:report>
</iso:rule>
Expand Down Expand Up @@ -214,4 +215,4 @@

</iso:pattern>

</iso:schema>
</iso:schema>

0 comments on commit 665f352

Please sign in to comment.