
Former-commit-id: 93fac7a70052d06c2a12bf8af59820c653edd31b Former-commit-id: 0869fdad0f550941a0f78f1e4c57f4fcdb3f6076
40 lines
658 B
Awk
40 lines
658 B
Awk
#
|
|
# translate CDSs from iff file
|
|
#
|
|
|
|
BEGIN {
|
|
Seq = ReadFasta(FASTA)
|
|
}
|
|
|
|
/^c end_entry/ {
|
|
if (RevStrand) Cds = RevComplement(Cds)
|
|
Prot = Translate(substr(Cds, 1, length(Cds)-3))
|
|
if (Modif == "=")
|
|
Prot = "M" substr(Prot, 2)
|
|
print "e translate " Prot
|
|
}
|
|
|
|
{
|
|
print $0
|
|
}
|
|
|
|
/^c begin_entry/ {
|
|
Cds = ""
|
|
Iexon = 0
|
|
next
|
|
}
|
|
|
|
/^e exon/ {
|
|
RevStrand = ($6 == "-")
|
|
if (++Iexon == 1) { # first is exon with start (even on - strand)
|
|
Modif = $15
|
|
gsub("\"", "", Modif)
|
|
Modif = (RevStrand ? substr(Modif, 2, 1) : substr(Modif, 1, 1))
|
|
}
|
|
if (RevStrand)
|
|
Cds = SubSeq(Seq, $3, $4) "" Cds
|
|
else
|
|
Cds = Cds "" SubSeq(Seq, $3, $4)
|
|
next
|
|
}
|