Skip to content

Instantly share code, notes, and snippets.

@sahilseth
Created November 3, 2015 18:28
Show Gist options
  • Select an option

  • Save sahilseth/f91553f6f617f91363e7 to your computer and use it in GitHub Desktop.

Select an option

Save sahilseth/f91553f6f617f91363e7 to your computer and use it in GitHub Desktop.
Adding chr to a GTF file
awk '{ if($1 !~ /^#/){print "chr"$0} else{print $0} }' Homo_sapiens.GRCh37.75.gtf
@aseetharam

Copy link
Copy Markdown

X and Y would be excluded with that. Instead, you can use this:

awk '{ if($1 ~ /^[0-9]+$/ || $1 ~ /^(X|Y)$/){print "chr"$0} else{print $0} }' yourfile.gtf

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