args = commandArgs();
input_file=args[4];
av=as.numeric(args[5]);
sd=as.numeric(args[6]);
nu=as.numeric(args[7]);


data=read.table(input_file);

col=4;
x=data[,col];
pup=pnorm(x, mean=av, sd=sd, lower.tail = FALSE);
adpup=p.adjust(pup,method="fdr");
pdn=pnorm(x, mean=av, sd=sd, lower.tail = TRUE);
adpdn=p.adjust(pdn,method="fdr");

p=pup;

size = length(x);

for (i in 1:size)
{
	if(x[i]<0) 
	{
		p[i]=pdn[i];
	}
}
write(p, file=paste(input_file,"p",sep="."),ncolumns=1);

