#!/usr/bin/perl -w
print "
sumnumN0 <- function(x) {
  numN0<-length(which(x==0))
    lenT<-length(x)
      content<-(lenT-numN0)/lenT*100
        return(content)
        }

";
@batch=("WT","pifq");
@data=("Cortex","Mesophyll2","Cortex2","Endo1","Endo2","Epidermis","GC","Mesophyll1","MMC","SAM","Seed.Coat","Vascular");
foreach $b (@batch){
print "$b<-subset(scWTandpif,subset==\"$b\")\n";
for $d (@data){
print "$d.reclust.$b<-subset($b,Anno==\"$d\")
$d.reclust.$b.counts<-data.frame($d.reclust.$b\@assays\$RNA\@data)
$d.$b.content<-apply($d.reclust.$b.counts,1,sumnumN0)
";
}
}
print "Anno.Content<-data.frame(";
for ($i=0;$i<$#data;$i++){
    $b=$data[$i];
 print "WT$b=$b.WT.content,pifq$b=$b.pifq.content,";
}
$b=$data[-1];
print "WT$b=$b.WT.content,pifq$b=$b.pifq.content)\n";


