comparison report_clonality/RScript.r @ 30:b50965edac24 draft

Uploaded
author davidvanzessen
date Thu, 09 Mar 2017 10:48:14 -0500
parents 1f83e14f173b
children 7c33029fd63d
comparison
equal deleted inserted replaced
29:1f83e14f173b 30:b50965edac24
825 write.table(newData, "junctionAnalysisProd_mean_nD.txt" , sep="\t",quote=F,na="-",row.names=F,col.names=F) 825 write.table(newData, "junctionAnalysisProd_mean_nD.txt" , sep="\t",quote=F,na="-",row.names=F,col.names=F)
826 826
827 newData = data.frame(data.table(PRODF.no.D)[,list(unique=.N, 827 newData = data.frame(data.table(PRODF.no.D)[,list(unique=.N,
828 VH.DEL=num_median(.SD$X3V.REGION.trimmed.nt.nb, na.rm=T), 828 VH.DEL=num_median(.SD$X3V.REGION.trimmed.nt.nb, na.rm=T),
829 P1=num_median(.SD$P3V.nt.nb, na.rm=T), 829 P1=num_median(.SD$P3V.nt.nb, na.rm=T),
830 N1=median(.SD$N.REGION.nt.nb, na.rm=T), 830 N1=num_median(.SD$N.REGION.nt.nb, na.rm=T),
831 P2=num_median(.SD$P5J.nt.nb, na.rm=T), 831 P2=num_median(.SD$P5J.nt.nb, na.rm=T),
832 DEL.JH=num_median(.SD$X5J.REGION.trimmed.nt.nb, na.rm=T), 832 DEL.JH=num_median(.SD$X5J.REGION.trimmed.nt.nb, na.rm=T),
833 Total.Del=num_median(rowSums(.SD[,c("X3V.REGION.trimmed.nt.nb", "X5J.REGION.trimmed.nt.nb"), with=F], na.rm=T)), 833 Total.Del=num_median(rowSums(.SD[,c("X3V.REGION.trimmed.nt.nb", "X5J.REGION.trimmed.nt.nb"), with=F], na.rm=T)),
834 Total.N=median(.SD$N.REGION.nt.nb, na.rm=T), 834 Total.N=num_median(.SD$N.REGION.nt.nb, na.rm=T),
835 Total.P=num_median(rowSums(.SD[,c("P3V.nt.nb", "P5J.nt.nb"), with=F], na.rm=T)), 835 Total.P=num_median(rowSums(.SD[,c("P3V.nt.nb", "P5J.nt.nb"), with=F], na.rm=T)),
836 Median.CDR3.l=as.double(as.numeric(median(.SD$CDR3.Length, na.rm=T)))), 836 Median.CDR3.l=as.double(as.numeric(median(.SD$CDR3.Length, na.rm=T)))),
837 by=c("Sample")]) 837 by=c("Sample")])
838 newData[,sapply(newData, is.numeric)] = round(newData[,sapply(newData, is.numeric)],1) 838 newData[,sapply(newData, is.numeric)] = round(newData[,sapply(newData, is.numeric)],1)
839 write.table(newData, "junctionAnalysisProd_median_nD.txt" , sep="\t",quote=F,na="-",row.names=F,col.names=F) 839 write.table(newData, "junctionAnalysisProd_median_nD.txt" , sep="\t",quote=F,na="-",row.names=F,col.names=F)
857 print(paste("median N:", num_median(UNPROD.no.D$N.REGION.nt.nb, na.rm=T))) 857 print(paste("median N:", num_median(UNPROD.no.D$N.REGION.nt.nb, na.rm=T)))
858 858
859 newData = data.frame(data.table(UNPROD.no.D)[,list(unique=.N, 859 newData = data.frame(data.table(UNPROD.no.D)[,list(unique=.N,
860 VH.DEL=num_median(.SD$X3V.REGION.trimmed.nt.nb, na.rm=T), 860 VH.DEL=num_median(.SD$X3V.REGION.trimmed.nt.nb, na.rm=T),
861 P1=num_median(.SD$P3V.nt.nb, na.rm=T), 861 P1=num_median(.SD$P3V.nt.nb, na.rm=T),
862 N1=median(.SD$N.REGION.nt.nb, na.rm=T), 862 N1=num_median(.SD$N.REGION.nt.nb, na.rm=T),
863 P2=num_median(.SD$P5J.nt.nb, na.rm=T), 863 P2=num_median(.SD$P5J.nt.nb, na.rm=T),
864 DEL.JH=num_median(.SD$X5J.REGION.trimmed.nt.nb, na.rm=T), 864 DEL.JH=num_median(.SD$X5J.REGION.trimmed.nt.nb, na.rm=T),
865 Total.Del=num_median(rowSums(.SD[,c("X3V.REGION.trimmed.nt.nb", "X5J.REGION.trimmed.nt.nb"), with=F], na.rm=T)), 865 Total.Del=num_median(rowSums(.SD[,c("X3V.REGION.trimmed.nt.nb", "X5J.REGION.trimmed.nt.nb"), with=F], na.rm=T)),
866 Total.N=median(.SD$N.REGION.nt.nb, na.rm=T), 866 Total.N=num_median(.SD$N.REGION.nt.nb, na.rm=T),
867 Total.P=num_median(rowSums(.SD[,c("P3V.nt.nb", "P5J.nt.nb"), with=F], na.rm=T)), 867 Total.P=num_median(rowSums(.SD[,c("P3V.nt.nb", "P5J.nt.nb"), with=F], na.rm=T)),
868 Median.CDR3.l=as.double(as.numeric(median(.SD$CDR3.Length, na.rm=T)))), 868 Median.CDR3.l=as.double(as.numeric(median(.SD$CDR3.Length, na.rm=T)))),
869 by=c("Sample")]) 869 by=c("Sample")])
870 newData[,sapply(newData, is.numeric)] = round(newData[,sapply(newData, is.numeric)],1) 870 newData[,sapply(newData, is.numeric)] = round(newData[,sapply(newData, is.numeric)],1)
871 write.table(newData, "junctionAnalysisUnProd_median_nD.txt" , sep="\t",quote=F,na="-",row.names=F,col.names=F) 871 write.table(newData, "junctionAnalysisUnProd_median_nD.txt" , sep="\t",quote=F,na="-",row.names=F,col.names=F)