Question: Anyone used BAMSurgeon to spike in 1KB insertions/deletions?
gravatar for sichan
4.2 years ago by
sichan80 wrote:

Hi Everyone,

I'm interested in using BAMSurgeon ( to spike in structural variants up to 1KB in length to my BAM.

Here's my command:
python -v SVs.bed -f Input_BAM -r hg19.fa -o Output_BAM > out.txt 2>error.txt

Where SVs.bed contains the following:
20    8189474    8190474    DEL    1.0
20    8771681    8772777    DEL    1.0
20    8823637    8823638    INS    myseq210.fa
20    11753526    11753527    INS    myseq731.fa

The last two entries are insertions and the myseq*.fa are fasta files and each contain a 1KB randomly generated nucleotide sequence.

Within my error.txt file, I see the following for each of the four SVs I'm attempting to spike-in:

encountered error in mutation spikein: 20    11753526    11753527    INS    myseq731.fa

Traceback (most recent call last):
  File "../", line 435, in makemut
    maxcontig, refseq, alignstats, refstart, refend, qrystart, qryend, tgtstart, tgtend = trim_contig(mutid, chrom, start, end, maxcontig, reffile)
ValueError: need more than 2 values to unpack

My out.txt file ends with the following
INFO    2015-09-21 14:07:35.645967    no succesful [sic] mutations

So, none of the mutations were spiked-in successfully and no output BAM is created.  I can share both files if necessary, but has anyone encountered these errors?

Also, if anyone knows of other tools to spike SNVs/Indels/SVs into BAMs, please let me know.




svs bamsurgeon bam genome • 2.2k views
ADD COMMENTlink modified 2.8 years ago by lzy20 • written 4.2 years ago by sichan80

Hi Sichan,

Could you tell me how get the correct BAM Alignment input file ? As I use the follow command lines:

  1. bwa mem -t 2 -M hg19.fa NA12878_R1.fastq NA12878_R2.fastq > NA12878.sam
  2. samtools view -bS NA12878.sam > NA12878.bam
  3. java -jar SortSam.jar INPUT= NA12878.bam OUTPUT= NA12878.sort.bam SORT_ORDER=coordinate TMP_DIR=tmp_picard
  4. java -jar AddOrReplaceReadGroups.jar I=NA12878.sort.bam O= NA12878_fixed.bam RGID=4 RGLB=lib1 RGPL=illumina RGPU=unit1 RGSM=20 (Then ValidateSamFile.jar shows No err found)
  5. samtools index NA12878_fixed.bam

I do not know whether it is right. Do I need to re-align reads to the reference? If so, how to do this re-align ?


ADD REPLYlink modified 26 days ago by RamRS25k • written 2.8 years ago by lzy20
gravatar for Adam Ewing
4.2 years ago by
Adam Ewing60
Adam Ewing60 wrote:

Hi Simon,

Could you double check that you have the latest from the repository (git pull) and see if you can get the test (test/ to run?

Also, if you like, please send command lines / full error output to me ( and I'd be happy to have a look.

ADD COMMENTlink written 4.2 years ago by Adam Ewing60

Thanks for your response, Adam. I just sent you an email.

ADD REPLYlink modified 26 days ago by RamRS25k • written 4.2 years ago by sichan80
Please log in to add an answer.


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