2015-11-08 14:28:05 +01:00
|
|
|
#
|
|
|
|
# iff -> embl
|
|
|
|
#
|
|
|
|
|
|
|
|
function FromLoc(i, _local_, s) {
|
|
|
|
s = substr(Exon[i]["modif"], 1, 1) "" Exon[i]["from"]
|
|
|
|
gsub("=", "", s)
|
|
|
|
return s
|
|
|
|
}
|
|
|
|
|
|
|
|
function ToLoc(i, _local_, s) {
|
|
|
|
s = substr(Exon[i]["modif"], 2, 1) "" Exon[i]["to"]
|
|
|
|
gsub("=", "", s)
|
|
|
|
return s
|
|
|
|
}
|
|
|
|
|
|
|
|
function GeneLocation(_local_, d, s) {
|
|
|
|
d = Exon[1]["strand"]
|
|
|
|
if (d == "+")
|
|
|
|
s = FromLoc(1) ".." ToLoc(Nexon)
|
|
|
|
else
|
|
|
|
s = FromLoc(Nexon) ".." ToLoc(1)
|
|
|
|
if (d == "-") s = "complement(" s ")"
|
|
|
|
return s
|
|
|
|
}
|
|
|
|
|
|
|
|
function CdsLocation(_local_, d, i, s) {
|
|
|
|
d = Exon[1]["strand"]
|
|
|
|
if (d == "+") {
|
|
|
|
for (i = 1 ; i <= Nexon ; i++)
|
|
|
|
s = s "," FromLoc(i) ".." ToLoc(i)
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
for (i = Nexon ; i >= 1 ; i--)
|
|
|
|
s = s "," FromLoc(i) ".." ToLoc(i)
|
|
|
|
}
|
|
|
|
s = substr(s, 2)
|
|
|
|
if (Nexon > 1) s = "join(" s ")"
|
|
|
|
if (d == "-") s = "complement(" s ")"
|
|
|
|
return s
|
|
|
|
}
|
|
|
|
|
|
|
|
function ExonLocation(i, _local_, s) {
|
|
|
|
s = FromLoc(i) ".." ToLoc(i)
|
|
|
|
if (Exon[i]["strand"] == "-") s = "complement(" s ")"
|
|
|
|
return s
|
|
|
|
}
|
|
|
|
|
|
|
|
function Pad(s, len) {
|
|
|
|
while (length(s) < len)
|
|
|
|
s = s " "
|
|
|
|
return s
|
|
|
|
}
|
|
|
|
|
|
|
|
function Feature(feat, loc, _local_, s) {
|
|
|
|
s = Pad("FT " feat, 21)
|
|
|
|
print s "" loc
|
|
|
|
}
|
|
|
|
|
|
|
|
function SQualifier(qual, val, _local_, s) {
|
|
|
|
s = Pad("FT", 21)
|
|
|
|
print s "/" qual "=" val
|
|
|
|
}
|
|
|
|
|
|
|
|
function QQualifier(qual, val) {
|
2015-11-08 20:43:18 +01:00
|
|
|
gsub("\"", "''", val)
|
2015-11-08 14:28:05 +01:00
|
|
|
SQualifier(qual, "\"" val "\"")
|
|
|
|
}
|
|
|
|
|
2015-11-13 22:37:22 +01:00
|
|
|
function Unk(s) {
|
|
|
|
return (s =="" ? "none" : s)
|
|
|
|
}
|
|
|
|
|
2015-11-08 14:28:05 +01:00
|
|
|
#
|
|
|
|
# rules
|
|
|
|
#
|
|
|
|
|
2015-11-13 22:37:22 +01:00
|
|
|
/^c pass/ {
|
|
|
|
PassType = $3
|
|
|
|
PassInfo = $NF
|
|
|
|
next
|
|
|
|
}
|
|
|
|
|
2015-11-08 14:28:05 +01:00
|
|
|
/^c annot/ {
|
|
|
|
GeneName = $4
|
|
|
|
Product = $NF
|
|
|
|
gsub("_", " ", Product)
|
|
|
|
next
|
|
|
|
}
|
|
|
|
|
|
|
|
/^c nclust/ {
|
|
|
|
Ngene = $3
|
|
|
|
next
|
|
|
|
}
|
|
|
|
|
|
|
|
/^c begin_entry/ {
|
|
|
|
Nexon = 0
|
|
|
|
delete Exon
|
|
|
|
next
|
|
|
|
}
|
|
|
|
|
|
|
|
/^e exon/ {
|
|
|
|
Nexon++
|
|
|
|
Exon[Nexon]["from"] = $3
|
|
|
|
Exon[Nexon]["to"] = $4
|
|
|
|
Exon[Nexon]["strand"] = $6
|
|
|
|
Exon[Nexon]["indels"] = $9 "+" $12
|
|
|
|
modif = $15; gsub("\"", "", modif)
|
|
|
|
Exon[Nexon]["modif"] = modif
|
|
|
|
next
|
|
|
|
}
|
|
|
|
|
|
|
|
/^e similarity/ {
|
|
|
|
split($12, a, "@")
|
|
|
|
Simil = a[1] ":" a[2]
|
|
|
|
next
|
|
|
|
}
|
|
|
|
|
|
|
|
/^e translate/ {
|
|
|
|
Translat = $3
|
|
|
|
next
|
|
|
|
}
|
|
|
|
|
|
|
|
/^c end_entry/ {
|
|
|
|
|
2015-11-13 22:37:22 +01:00
|
|
|
GeneName = Unk(GeneName)
|
|
|
|
PassType = Unk(PassType)
|
|
|
|
|
2015-11-08 14:28:05 +01:00
|
|
|
gname = (Ngene == 1 ? GeneName : GeneName "_" ++Igene)
|
|
|
|
locus = ""
|
|
|
|
|
|
|
|
Feature("gene", GeneLocation())
|
|
|
|
QQualifier("gene", gname)
|
|
|
|
QQualifier("locus_tag", locus)
|
|
|
|
|
|
|
|
Feature("CDS", CdsLocation())
|
|
|
|
SQualifier("codon_start", 1)
|
|
|
|
SQualifier("transl_table", 11)
|
|
|
|
QQualifier("gene", gname)
|
|
|
|
QQualifier("locus_tag", locus)
|
2015-11-08 20:43:18 +01:00
|
|
|
QQualifier("product", Product)
|
2015-11-08 14:28:05 +01:00
|
|
|
QQualifier("inference", "similar to DNA sequence:" Simil)
|
2015-11-13 22:37:22 +01:00
|
|
|
QQualifier("inference", "detect pass:" PassType ":" PassInfo)
|
2015-11-08 14:28:05 +01:00
|
|
|
QQualifier("translation", Translat)
|
|
|
|
|
|
|
|
if (Nexon > 1) {
|
|
|
|
for (i = 1 ; i <= Nexon ; i++) {
|
|
|
|
Feature("exon", ExonLocation(i))
|
|
|
|
QQualifier("gene", gname)
|
|
|
|
QQualifier("locus_tag", locus)
|
|
|
|
SQualifier("number", Exon[1]["strand"] == "+" ? i : Nexon-i+1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|