Skip to content

Instantly share code, notes, and snippets.

@cgpu
Created April 28, 2020 10:30
Show Gist options
  • Save cgpu/255b0c948c41f97ccc66fa30bcce7ffe to your computer and use it in GitHub Desktop.
Save cgpu/255b0c948c41f97ccc66fa30bcce7ffe to your computer and use it in GitHub Desktop.
cat gencode.v33.primary_assembly.annotation.gtf | awk 'BEGIN{FS="\t"}{split($9,a,";"); if($3~"gene") print a[1]"\t"a[3]"\t"$1":"$4"-"$5"\t"a[2]"\t"$7}' |sed 's/gene_id "//' | sed 's/gene_id "//' | sed 's/gene_type "//'| sed 's/gene_name "//' | sed 's/"//g' | awk 'BEGIN{FS="\t"}{split($3,a,"[:-]"); print $1"\t"$2"\t"a[1]"\t"a[2]"\t"a[3]"\t"$4"\t"$5"\t"a[3]-a[2];}' | sed "1i\Geneid\tGeneSymbol\tChromosome\tStart\tEnd\tClass\tStrand\tLength" | less -S
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment