Skip to content

Command_line_value_extraction

Eneritz edited this page Nov 11, 2020 · 4 revisions

Create the tab separated files for counting

Extract cell counts from Analysis files of CellProfiler-TotOLs

Create file, name Tot_OLsCount_tbl

  1. Counting total number of OLs
gcblab@OL:~$ sort -u Tot_OLsCount_tbl   | awk '{ if ( $1 !~ "ImageNumber" ) { print $1 }}' | cut -f 1 | sort | uniq -c | awk '{ if ( $2 >= 1 ) {print  $2"\t"$1} } ' | sort -gk1 > TotOLsCount
  1. Counting total number of Klk6+ OLs
gcblab@OL:~$ sort -u Tot_OLsCount_tbl   | awk '{ if ( $1 !~ "ImageNumber" ) { print $1"\t"$3"\t"$5 }}' | awk '{ if ( $2 > 0  || $3 > 0 ) { print $1"\t"$2"\t"$3 }}'  | awk '{print $1,($2>4)? "Count3" : $2,($3>12)? "Count5" : $3}' | awk '{ print $1"\t"$2"\t"$4 } '  | cut -f 1,2 | sort | uniq -c | egrep Count3 | awk '{ print $2"\t"$1 } ' > counts_Klk6OLs
  1. Counting total number of Ptgds+ OLs
gcblab@OL:~$  sort -u Tot_OLsCount_tbl   | awk '{ if ( $1 !~ "ImageNumber" ) { print $1"\t"$3"\t"$5 }}' | awk '{ if ( $2 > 0  || $3 > 0 ) { print $1"\t"$2"\t"$3 }}'  | awk '{print $1,($2>4)? "Count3" : $2,($3>12)? "Count5" : $3}' | awk '{ print $1"\t"$2"\t"$3 } '  | cut -f 1,3 | sort | uniq -c | egrep Count5 | awk '{ print $2"\t"$1 } ' > counts_PtgdsOLs

Sanity check

Count the number of lines on your output and in the original. They should have the same number.

gcblab@OL:~$  wc -l TotOLsCount counts_Klk6OLs counts_Klk6OLs

Extract cell counts from Analysis files of CellProfiler-TotNuclei

  1. Counting Tot Nuclei
gcblab@OL:~$   sort -u Tot_NucleiCount_tbl   | awk '{ if ( $1 !~ "ImageNumber" ) { print $1 }}' | cut -f 1 | sort | uniq -c | awk '{ if ( $2 >= 1 ) {print  $2"\t"$1} } ' | sort -gk1 > TotNucleiCount
  1. Counting Tot Klk6+ Nuclei
gcblab@OL:~$ sort -u Tot_NucleiCount_tbl   | awk '{ if ( $1 !~ "ImageNumber" ) { print $1"\t"$3"\t"$5 }}' | awk '{ if ( $2 > 0  || $3 > 0 ) { print $1"\t"$2"\t"$3 }}'  | awk '{print $1,($2>4)? "Count3" : $2,($3>12)? "Count5" : $3}' | awk '{ print $1"\t"$2"\t"$4 } '  | cut -f 1,2 | sort | uniq -c | egrep Count3  | awk '{ print $2"\t"$1 } ' >  Counts_Klk6Nuclei
  1. Counting Tot Ptgds+ Nuclei
gcblab@OL:~$ sort -u Tot_NucleiCount_tbl   | awk '{ if ( $1 !~ "ImageNumber" ) { print $1"\t"$3"\t"$5 }}' | awk '{ if ( $2 > 0  || $3 > 0 ) { print $1"\t"$2"\t"$3 }}'  | awk '{print $1,($2>4)? "Count3" : $2,($3>12)? "Count5" : $3}' | awk '{ print $1"\t"$2"\t"$3 } '  | cut -f 1,3 | sort | uniq -c | egrep Count5 | awk '{ print $2"\t"$1 } ' > Counts_PtgdsNuclei
Clone this wiki locally