129 |
|
bool fullCDSonly=false; // starts with START, ends with STOP codon |
130 |
|
bool fullattr=false; |
131 |
|
//bool sortByLoc=false; // if the GFF output should be sorted by location |
132 |
< |
bool ensembl_convert=false; //-L, assisst in converting Ensembl GTF to GFF3 |
132 |
> |
bool ensembl_convert=false; //-L, assist in converting Ensembl GTF to GFF3 |
133 |
|
|
134 |
|
|
135 |
|
//GStr gseqpath; |
309 |
|
if (gname==NULL) gname=gffrec.getGeneID(); |
310 |
|
GStr defline(gffrec.getID()); |
311 |
|
if (f_out && !fmtGTF) { |
312 |
< |
const char* tn=NULL; |
313 |
< |
if ((tn=gffrec.getAttr("transcript_name"))!=NULL) { |
314 |
< |
gffrec.addAttr("Name", tn); |
312 |
> |
const char* tname=NULL; |
313 |
> |
if ((tname=gffrec.getAttr("transcript_name"))!=NULL) { |
314 |
> |
gffrec.addAttr("Name", tname); |
315 |
|
gffrec.removeAttr("transcript_name"); |
316 |
|
} |
317 |
|
} |
318 |
|
if (ensembl_convert && startsWith(gffrec.getID(), "ENS")) { |
319 |
< |
const char* tn=gffrec.getTrackName(); |
320 |
< |
gffrec.addAttr("type", tn); |
319 |
> |
const char* biotype=gffrec.getAttr("gene_biotype"); |
320 |
> |
if (biotype) { |
321 |
> |
gffrec.addAttr("type", biotype); |
322 |
> |
gffrec.removeAttr("gene_biotype"); |
323 |
> |
} |
324 |
> |
else { //old Ensembl files lacking gene_biotype |
325 |
> |
gffrec.addAttr("type", gffrec.getTrackName()); |
326 |
> |
} |
327 |
> |
|
328 |
|
//bool is_gene=false; |
329 |
|
bool is_pseudo=false; |
330 |
< |
if (strcmp(tn, "protein_coding")==0 || gffrec.hasCDS()) |
330 |
> |
if (strcmp(biotype, "protein_coding")==0 || gffrec.hasCDS()) |
331 |
|
gffrec.setFeatureName("mRNA"); |
332 |
|
else { |
333 |
< |
if (strcmp(tn, "processed_transcript")==0) |
333 |
> |
if (strcmp(biotype, "processed_transcript")==0) |
334 |
|
gffrec.setFeatureName("proc_RNA"); |
335 |
|
else { |
336 |
< |
//is_gene=endsWith(tn, "gene"); |
337 |
< |
is_pseudo=strifind(tn, "pseudo"); |
336 |
> |
//is_gene=endsWith(biotype, "gene"); |
337 |
> |
is_pseudo=strifind(biotype, "pseudo"); |
338 |
|
if (is_pseudo) { |
339 |
|
gffrec.setFeatureName("pseudo_RNA"); |
340 |
|
} |
341 |
< |
else if (endsWith(tn, "RNA")) { |
342 |
< |
gffrec.setFeatureName(tn); |
341 |
> |
else if (endsWith(biotype, "RNA")) { |
342 |
> |
gffrec.setFeatureName(biotype); |
343 |
|
} else gffrec.setFeatureName("misc_RNA"); |
344 |
|
} |
345 |
|
} |