Question: Rename sample names in g.vcf files fails [Error Segmentation fault (core dumped) ]
0
gravatar for ekwame001
8 weeks ago by
ekwame00120
USA/New York/Icahn School of Medicine at Mount Sinai
ekwame00120 wrote:

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.vcffile) 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)
bash snp bcftools gatk vcf • 137 views
ADD COMMENTlink modified 7 weeks ago • written 8 weeks ago by ekwame00120

How many files do you have? You may be running out of file descriptors on your system (i.e. too many files opened)

ADD REPLYlink written 8 weeks ago by Jean-Karim Heriche22k

@Jean-Karim Heriche, I have only 41 g.vf files

ADD REPLYlink written 7 weeks ago by ekwame00120

I tried this second approach but results are printed to the screen; I'm not really sure what I'm doing wrong?

gvcfs="/sc/hydra/projects/canan/colon_cancer10312019/joint_calling_colon/gvcfs/renamed_sm_gvcfs/*.hg38.g.vcf.gz"
for i in $gvcfs
    do
        sampleName=`basename -s .hg38.g.vcf.gz $i` ###grab basename of gvcf to use for replacement
        savedFileName=`echo "$sampleName" > ${sampleName}.txt`
        bcftools reheader --samples $savedFileName -o ${i}_edited.g.vcf.gz $i
    done
ADD REPLYlink modified 7 weeks ago • written 7 weeks ago by ekwame00120

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

ADD REPLYlink written 7 weeks ago by Jean-Karim Heriche22k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1987 users visited in the last hour