Skip to content

Commit

Permalink
Merge pull request #88 from mja/format_target_pgen_cols
Browse files Browse the repository at this point in the history
Remove extra columns from pvar when extracting variants from target.
  • Loading branch information
opain authored Apr 18, 2024
2 parents 5d12216 + 437aa16 commit c001b29
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Scripts/format_target/format_target.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,16 @@ write.table(ref_target$SNP.y, paste0(tmp_dir,'/extract_list_2.txt'), col.names =

# First extract variants based on original ID
if(opt$format == 'plink1'){
system(paste0(opt$plink2,' --bfile ',opt$target, ' --extract ', tmp_dir,'/extract_list_1.txt --make-pgen --memory 5000 --threads 1 --out ', tmp_dir,'/subset'))
system(paste0(opt$plink2," --bfile ",opt$target, " --extract ", tmp_dir,"/extract_list_1.txt --make-pgen 'pvar-cols=' --memory 5000 --threads 1 --out ", tmp_dir,"/subset"))
}
if(opt$format == 'plink2'){
system(paste0(opt$plink2,' --pfile ',opt$target, ' --extract ', tmp_dir,'/extract_list_1.txt --make-pgen --memory 5000 --threads 1 --out ', tmp_dir,'/subset'))
system(paste0(opt$plink2," --pfile ",opt$target, " --extract ", tmp_dir,"/extract_list_1.txt --make-pgen 'pvar-cols=' --memory 5000 --threads 1 --out ", tmp_dir,"/subset"))
}
if(opt$format == 'bgen'){
system(paste0(opt$plink2,' --bgen ',opt$target,'.bgen ref-last --sample ',gsub('.chr.*','',opt$target),'.sample --extract ', tmp_dir,'/extract_list_1.txt --make-pgen --memory 5000 --threads 1 --out ', tmp_dir,'/subset'))
system(paste0(opt$plink2," --bgen ",opt$target,".bgen ref-last --sample ",gsub(".chr.*","",opt$target),".sample --extract ", tmp_dir,"/extract_list_1.txt --make-pgen 'pvar-cols=' --memory 5000 --threads 1 --out ", tmp_dir,"/subset"))
}
if(opt$format == 'vcf'){
system(paste0(opt$plink2,' --vcf ',opt$target,'.vcf.gz --extract ', tmp_dir,'/extract_list_1.txt --make-pgen --memory 5000 --threads 1 --out ', tmp_dir,'/subset'))
system(paste0(opt$plink2," --vcf ",opt$target,".vcf.gz --extract ", tmp_dir,"/extract_list_1.txt --make-pgen 'pvar-cols=' --memory 5000 --threads 1 --out ", tmp_dir,"/subset"))
}

# Ensure both FID and IID are present in the .psam file
Expand Down

0 comments on commit c001b29

Please sign in to comment.