Dear Biostars,
my aim is to rename sample_name of g.vcf
files (generated after gatk haplotype-caller
containig varints for each individual for each g.vcf
file)
but my script breaks with error Segmentation fault (core dumped)
Question: any suggestions how i could resolves this?
g.vcfs files are saved in directory /sc/hydra/projects/canan/colon_cancer10312019/joint_calling_colon/gvcfs/renamed_sm_gvcfs/
g.vcfs are saved as this CC_0001.hg38.g.vcf.gz
CC_0002.hg38.g.vcf.gz
CC_0003.hg38.g.vcf.gz
.......
CC_nnnn.hg38.g.vcf.gz
gvcfs="/sc/hydra/projects/canan/colon_cancer10312019/joint_calling_colon/gvcfs/renamed_sm_gvcfs/*.hg38.g.vcf.gz"
gvcfsSampleNames="/sc/hydra/projects/canan/colon_cancer10312019/joint_calling_colon/gvcfs/renamed_sm_gvcfs/sampleNames_dir/*.txt"
for i in $gvcfs
do
sampleName=`basename -s .hg38.g.vcf.gz $i` ###grab basename of gvcf to use for replacement
echo "$sampleName" > sampleNames_dir/$sampleName.txt ###same basename/name in a file to set as input for bcftools reheader --samples
for j in $gvcfsSampleNames; do
bcftools reheader --samples $j -o renamed_gvcfs2/renamed_SM.$i $i
done
done
error logs
Segmentation fault (core dumped)
Segmentation fault (core dumped)
Segmentation fault (core dumped)
Segmentation fault (core dumped)
Segmentation fault (core dumped)
renamed_gvcfs2/renamed_SM./sc/hydra/projects/canan/colon_cancer10312019/joint_calling_colon/gvcfs/renamed_sm_gvcfs/NEW_samples_CC10008_Germline_edited.hg38.g.vcf.gz: No such file or directory
renamed_gvcfs2/renamed_SM./sc/hydra/projects/canan/colon_cancer10312019/joint_calling_colon/gvcfs/renamed_sm_gvcfs/NEW_samples_CC10008_Germline_edited.hg38.g.vcf.gz: No such file or directory
renamed_gvcfs2/renamed_SM./sc/hydra/projects/canan/colon_cancer10312019/joint_calling_colon/gvcfs/renamed_sm_gvcfs/NEW_samples_CC10008_Germline_edited.hg38.g.vcf.gz: No such file or directory
renamed_gvcfs2/renamed_SM./sc/hydra/projects/canan/colon_cancer10312019/joint_calling_colon/gvcfs/renamed_sm_gvcfs/NEW_samples_CC10008_Germline_edited.hg38.g.vcf.gz: No such file or directory
renamed_gvcfs2/renamed_SM./sc/hydra/projects/canan/colon_cancer10312019/joint_calling_colon/gvcfs/renamed_sm_gvcfs/NEW_samples_CC10008_Germline_edited.hg38.g.vcf.gz: No such file or directory
Segmentation fault (core dumped)
Segmentation fault (core dumped)
Segmentation fault (core dumped)
Segmentation fault (core dumped)
Segmentation fault (core dumped)
renamed_gvcfs2/renamed_SM./sc/hydra/projects/canan/colon_cancer10312019/joint_calling_colon/gvcfs/renamed_sm_gvcfs/NEW_SM3_CC10008_Germline_edited.hg38.g.vcf.gz: No such file or directory
renamed_gvcfs2/renamed_SM./sc/hydra/projects/canan/colon_cancer10312019/joint_calling_colon/gvcfs/renamed_sm_gvcfs/NEW_SM3_CC10008_Germline_edited.hg38.g.vcf.gz: No such file or directory
renamed_gvcfs2/renamed_SM./sc/hydra/projects/canan/colon_cancer10312019/joint_calling_colon/gvcfs/renamed_sm_gvcfs/NEW_SM3_CC10008_Germline_edited.hg38.g.vcf.gz: No such file or directory
renamed_gvcfs2/renamed_SM./sc/hydra/projects/canan/colon_cancer10312019/joint_calling_colon/gvcfs/renamed_sm_gvcfs/NEW_SM3_CC10008_Germline_edited.hg38.g.vcf.gz: No such file or directory
renamed_gvcfs2/renamed_SM./sc/hydra/projects/canan/colon_cancer10312019/joint_calling_colon/gvcfs/renamed_sm_gvcfs/NEW_SM3_CC10008_Germline_edited.hg38.g.vcf.gz: No such file or directory
Segmentation fault (core dumped)
Segmentation fault (core dumped)
Segmentation fault (core dumped)
Segmentation fault (core dumped)
Segmentation fault (core dumped)
How many files do you have? You may be running out of file descriptors on your system (i.e. too many files opened)
@Jean-Karim Heriche, I have only 41 g.vf files
I tried this second approach but results are printed to the screen; I'm not really sure what I'm doing wrong?
What is this coded in? Bash? If you want the sample names to be in a file, you probably need to use the --samples-file option of bcftools, the --samples option takes a comma-separated list of names, in the later case, you could just do --samples $sampleName