Skip to content

Instantly share code, notes, and snippets.

@ag1805x
Created September 18, 2019 07:44
Show Gist options
  • Save ag1805x/63007cf0ba20b078d6d3c849064a1bff to your computer and use it in GitHub Desktop.
Save ag1805x/63007cf0ba20b078d6d3c849064a1bff to your computer and use it in GitHub Desktop.
Code to generate tx2gene from reference transcriptome for use with tximport() in R
# Code to generate tx2gene from reference transcriptome for use with tximport() in R
# Reference transcriptome: wget ftp://ftp.ensembl.org/pub/release-97/fasta/homo_sapiens/cdna/Homo_sapiens.GRCh38.cdna.all.fa.gz
zcat Homo_sapiens.GRCh38.cdna.all.fa.gz | grep '>' | cut -d ' ' -f1,4,7 > temp
paste <(cut -d '>' -f2 temp | cut -d ' ' -f1) <(cut -d ' ' -f2 temp | cut -d ':' -f2) <(cut -d ' ' -f3 temp | cut -d ':' -f2) >> tx2gene.txt
rm temp
@BunnyBoss
Copy link

It would be great if you could post the output files here itself..

@ag1805x
Copy link
Author

ag1805x commented Jun 22, 2021

It would be great if you could post the output files here itself..

I think the file was too big to be uploaded to Git. That is why I have put the link to download the reference genome as well. This way you could do it for any version of the Ensembl genome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment