Skip to content

Instantly share code, notes, and snippets.

@ianyfchang
Created May 17, 2014 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianyfchang/308acd7e9e6f9a9d2dc2 to your computer and use it in GitHub Desktop.
Save ianyfchang/308acd7e9e6f9a9d2dc2 to your computer and use it in GitHub Desktop.
Labeling HMR direction
awk -F "\t" –v S=”Sample” -v OFS="\t" '{
if($12=="-" && $25=="-" && $36=="-" && $13==0 && $26==0 && $37==0) print $4,$5,$6,"-",S,$10,$12,$13,$23,$25,$26,$34,$36,$37,$NF;
else if($12=="-" && $25=="-" && $13==0 && $26==0 && $37!=0) print $4,$5,$6,"-",S,$10,$12,$13,$23,$25,$26,$34,$36,$37,$NF;
else if($12=="-" && $36=="-" && $13==0 && $26!=0 && $37==0) print $4,$5,$6,"-",S,$10,$12,$13,$23,$25,$26,$34,$36,$37,$NF;
else if($12=="-" && $13==0 && $26!=0 && $37!=0) print $4,$5,$6,"-",S,$10,$12,$13,$23,$25,$26,$34,$36,$37,$NF;
else if( $25=="-" && $36=="-" && $13!=0 && $26==0 && $37==0) print $4,$5,$6,"-",S,$10,$12,$13,$23,$25,$26,$34,$36,$37,$NF;
else if( $25=="-" && $13!=0 && $26==0 && $37!=0) print $4,$5,$6,"-",S,$10,$12,$13,$23,$25,$26,$34,$36,$37,$NF;
else if( $36=="-" && $13!=0 && $26!=0 && $37==0) print $4,$5,$6,"-",S,$10,$12,$13,$23,$25,$26,$34,$36,$37,$NF;
else print $4,$5,$6,"+",S,$10,$12,$13,$23,$25,$26,$34,$36,$37,$NF;
}' snippet.hmr.bed.5prime.3prime.cloestKnownGFeneTSS1000 > snippet.hmr.overlap.tss.cpgisland
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment