Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement proposal for gtf2featureAnnotation.R (GTF2GeneList tool) #209

Open
cgirardot opened this issue Nov 19, 2020 · 3 comments
Open

Comments

@cgirardot
Copy link

Hi,
I know the tool is for ensemble GTF and I am using it on mouse gencode GTF... It fails on line 141-143 of gtf2featureAnnotation.R when asking to flag Mitochondrial features.

if (opt$mito){
  anno$mito <- ucfirst(as.character(tolower(anno$gene_biotype) %in% cleanlist(opt$mito_biotypes) | tolower(anno$chromosome) %in% cleanlist(opt$mito_chr)))
}

this is because the script assumes gene_biotype is in the anno while other GTF may use gene_type or won't even provide this attribute.

You could make the script more universal with this replacement:

if ( as.logical(opt$mito) && ("gene_biotype" %in% colnames(anno)) ){
  anno$mito <- ucfirst(as.character(tolower(anno$gene_biotype) %in% cleanlist(opt$mito_biotypes) | tolower(anno$chromosome) %in% cleanlist(opt$mito_chr)))
} else if (as.logical(opt$mito)  && ("gene_type" %in% colnames(anno))  ){
  anno$mito <- ucfirst(as.character(tolower(anno$gene_type) %in% cleanlist(opt$mito_biotypes) | tolower(anno$chromosome) %in% cleanlist(opt$mito_chr)))
} else if (as.logical(opt$mito)){
  die('ERROR: gene_biotype or gene_type attributes are missing. Mitochondrial features will not be flagged ')
}

I just did it on my galaxy and it works nicely.
Cheers

@pinin4fjords
Copy link
Member

Thanks @cgirardot. I intend for this code to live at https://github.com/ebi-gene-expression-group/atlas-gene-annotation-manipulation in future- I just hadn't got round to switching the Galaxy wrapper to use it.

I think a neater solution will be to parameterise the type field with 'gene_biotype' as the default. Would you be able to raise a PR to that effect at the above? Otherwise I'll get to it when I can.

@cgirardot
Copy link
Author

I also thought about your solution but I only few minutes to fix this and went for this hack. I am not gonna have the time to make this better, sorry.

@pcm32
Copy link
Member

pcm32 commented Nov 19, 2020

Thanks for reporting it Charles, I'm glad to see that the tools are serving you guys, we will try to fix this soon and make a new release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants