Hi , i sent a job to my university cluster using R script:
library("R.utils")
library("vcfR")
library("stringr")
library("tidyverse")
library("dplyr")
gunzip("gnomad.exomes.r2.1.1.sites.Y.vcf.bgz","gnomad.exomes.r2.1.1.sites.Y.vcf")
vc=read.vcfR("gnomad.exomes.r2.1.1.sites.Y.vcf")
df=vc@fix
data=as.data.frame(df)
data_snp=data %>%
filter(str_length(ALT)==1 & str_length(REF)==1)#filtering for SNPs
data_snp$snp_id <- str_c("chrY","-", data_snp$POS)
data_snp$AF_total=str_extract(data_snp$INFO, "(?<=AF=)[^;]+")
data_snp$AF_latin=str_extract(data_snp$INFO, "(?<=AF_amr=)[^;]+")
data_snp$INFO=NULL
data_snp$key=str_c(data_snp$snp_id,"-",data_snp$ALT,"-",data_snp$REF)
df_for_filter=read.csv("merged_df.csv")
df_x=subset(df_for_filter,df_for_filter$CHROM=="chrY")
df_x$snp_id=str_c("chrY","-",df_x$POS)
df_x$key=str_c(df_x$snp_id,"-",df_x$ALT,"-",df_x$REF)
filter_df=data_snp %>% semi_join(df_x, by = "key")
results=read.csv("result_armitage_test.csv")
results$chrom=substr(results$snp_id,1,4)
results_y=subset(results,results$chrom=="chrY")
resuts_chr_y=merge(x = results_y, y =filter_df, by = "snp_id", all.x = TRUE)
resuts_chr_y$chrom=NULL
resuts_chr_y$QUAL=NULL
resuts_chr_y$FILTER=NULL
resuts_chr_y$key=NULL
resuts_chr_y$CHROM=NULL
resuts_chr_y$X=NULL
resuts_chr_y$POS=NULL
write.csv(resuts_chr_y,"result_chry.csv")
i created a sh file for the job:
#!/bin/bash
#SBATCH --time=01:00:00
#SBATCH --ntasks=2
#SBATCH --mem=2G
module load tensorflow/2.5.0
R4 /sci/home/elizarom/chr_y.R
but i dont get the csv file that i want insted i get : slurm-4707711.out
and when i open it on my PC as txt is says :var/spool/slurmd/job4707627/slurm_script: line 8: R4: command not found althogh it worked fine on my PC i also tried running my code in small chanks : send this job
library("R.utils")
library("vcfR")
library("stringr")
library("tidyverse")
library("dplyr")
gunzip("gnomad.exomes.r2.1.1.sites.Y.vcf.bgz","gnomad.exomes.r2.1.1.sites.Y.vcf")
vc=read.vcfR("gnomad.exomes.r2.1.1.sites.Y.vcf")
with just 7 lines of code
got the same error :/var/spool/slurmd/job4707828/slurm_script: line 8: R4: command not found which is very strange since i dont have line 8 in my code .... im cluless at this point:(
R4 is the versition of R that im using on my university cluster :module load R4, should i use R scrips in the sh file?instead of R4
thank you solved the problem :)
should be Rscript