Deepak: I haven't been able to replicate the error. Are you sure you used a valid BED file, i.e. my_targets.bed is a 4-column BED file that you've preprocessed with "cnvkit.py target"? The error message suggests you might have given a 1-column list of chromosome IDs instead.
Unconfigured Ad
Collapse
X
-
DrWorm: The SEG parser handles 5- or 6-column tables like the one you've posted. I wonder if the ValueError is due to the "WARNING" message from R getting fed to the SEG parser in CNVkit, just before the start of the usual table. If so, maybe you could disable that message from R and therefore prevent the CNVkit error by prefixing your command line to reset or unset R_HOME:
R_HOME="" cnvkit.py 19987_main.cnr
Comment
-
-
Dear Eric,
Thank you for sparing your time. I tried the target and it gives a 4 field bed. But I gues the problem is coming when I use the BAM files.
###################
cnvkit.py batch /home/deepak/MM02-N_MM02-020200/colossus_analysis/BAM/MM02-020200_MarkDup.bam --normal /home/deepak/MM02-N_MM02-020200/colossus_analysis/BAM/MM02-N_MarkDup.bam --targets Agilent_b37_exome_covered.bed --split --annotate refFlatMod.txt --fasta /home/deepak/Ref/human_g1k_v37_decoy.fasta --access /home/deepak/src/cnvkit/data/access-5k-mappable.hg19.bed --output-reference my_reference.cnn --output-dir results/ --diagram --scatter
Processing reads in MM02-N_MarkDup.bam
Traceback (most recent call last):
File "/usr/local/bin/cnvkit.py", line 4, in <module>
__import__('pkg_resources').run_script('CNVkit==0.7.9.dev0', 'cnvkit.py')
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 726, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1491, in run_script
exec(script_code, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/CNVkit-0.7.9.dev0-py2.7.egg/EGG-INFO/scripts/cnvkit.py", line 11, in <module>
File "build/bdist.linux-x86_64/egg/cnvlib/commands.py", line 97, in _cmd_batch
File "build/bdist.linux-x86_64/egg/cnvlib/commands.py", line 172, in batch_make_reference
File "build/bdist.linux-x86_64/egg/cnvlib/parallel.py", line 14, in apply_async
File "build/bdist.linux-x86_64/egg/cnvlib/commands.py", line 193, in batch_write_coverage
File "build/bdist.linux-x86_64/egg/cnvlib/commands.py", line 457, in do_coverage
File "build/bdist.linux-x86_64/egg/cnvlib/coverage.py", line 37, in interval_coverages
File "build/bdist.linux-x86_64/egg/cnvlib/coverage.py", line 110, in interval_coverages_pileup
File "build/bdist.linux-x86_64/egg/cnvlib/coverage.py", line 143, in bedcov
RuntimeError: Bad line from bedcov:
1
#######################
But it does create two bed files.
$ head results/Agilent_b37_exome_covered.*
==> results/Agilent_b37_exome_covered.antitarget.bed <==
chr1 10500 93708 Background
chr1 93708 176917 Background
chr1 227917 267219 Background
chr1 318219 394543 Background
chr1 394543 470868 Background
chr1 521868 563949 Background
chr1 570871 671469 Background
chr1 671469 772067 Background
chr1 772067 872665 Background
chr1 872665 973263 Background
==> results/Agilent_b37_exome_covered.target.bed <==
1 65509 65625 -
1 65831 65973 -
1 69481 69600 OR4F5
1 721381 721519 -
1 721530 721806 -
1 721851 721942 -
1 752916 753035 FAM87B
1 762095 762275 LINC00115
1 762280 762414 LINC00115
1 762420 762565 LINC00115
I have no idea where it is going wrong.
Sorry for a messy and long mail.
Thank you.
Best,
Deepak
Comment
-
-
Deepak, I notice your antitarget BED chromosomes names start with "chr" but your target BED chromosome names do not. Which names are in your BAM file? (I'm guessing "chr", like hg19, based on the generated antitarget BED file.) Either way, there will be a mismatch between chromosome names in the BAM and BED files at some point. I recommend checking (try "samtools view -H"), and if the "chr" prefix is used in the BAM, then add "chr" to the input target BED file.
Comment
-
-
Hi Eric,
Thanks for the reply. I cross checked chr notations in bam and reference bed file. It is all without chr. But when it creates antitarget files it adds chr to the file and vice versa if I use a reference bed file with chr. I don't know why.
Best,
Deepak
Comment
-
-
The antitarget BED file has "chr" because "access-5k-mappable.hg19.bed" has chr. You could build an access file for GRCh37 using "cnvkit.py access", but it would probably be quicker for you to just copy the hg19 one and delete the "chr" prefixes from each line.
Comment
-
-
Dear Eric,
I tried all possible removal of chr as my BAM file is with just chromosome numbers.But still ended up getting same error as I mentioned above. Now the target and the anti target files have chromosome numbers without chr. I get this error now.
Wrote results/Agilent_b37_exome_covered.antitarget.bed with 54084 regions
Building a copy number reference from normal samples...
Processing reads in MM02-N_final.bam
Traceback (most recent call last):
File "/usr/local/bin/cnvkit.py", line 4, in <module>
__import__('pkg_resources').run_script('CNVkit==0.7.9.dev0', 'cnvkit.py')
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 726, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1491, in run_script
exec(script_code, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/CNVkit-0.7.9.dev0-py2.7.egg/EGG-INFO/scripts/cnvkit.py", line 11, in <module>
File "build/bdist.linux-x86_64/egg/cnvlib/commands.py", line 97, in _cmd_batch
File "build/bdist.linux-x86_64/egg/cnvlib/commands.py", line 172, in batch_make_reference
File "build/bdist.linux-x86_64/egg/cnvlib/parallel.py", line 14, in apply_async
File "build/bdist.linux-x86_64/egg/cnvlib/commands.py", line 193, in batch_write_coverage
File "build/bdist.linux-x86_64/egg/cnvlib/commands.py", line 457, in do_coverage
File "build/bdist.linux-x86_64/egg/cnvlib/coverage.py", line 37, in interval_coverages
File "build/bdist.linux-x86_64/egg/cnvlib/coverage.py", line 110, in interval_coverages_pileup
File "build/bdist.linux-x86_64/egg/cnvlib/coverage.py", line 143, in bedcov
RuntimeError: Bad line from bedcov:
1
Sorry for the trouble. I really need to make this work..
.
Best,
Deepak
Comment
-
-
You can skip bedcov with the -c/--count-reads option; it uses a different method to calculate read depths but should give similar results.
Also, if you've successfully built the target and antitarget BED files, you can use those as inputs to the "batch" command and drop some of the command line options:
cnvkit.py batch ~/MM02-N_MM02-020200/colossus_analysis/BAM/MM02-020200_MarkDup.bam --normal ~/MM02-N_MM02-020200/colossus_analysis/BAM/MM02-N_MarkDup.bam --targets results/Agilent_b37_exome_covered.target.bed --antitargets results/Agilent_b37_exome_covered.antitarget.bed --fasta ~/Ref/human_g1k_v37_decoy.fasta --output-reference my_reference.cnn --output-dir results/ --diagram --scatter --count-reads
Comment
-
-
Deepak, another user reported this issue and found that it was due to a bug in Pysam 0.9:
When I run cnvkit batch with pysam 0.9, I get the following error. On 0.8.4 things seem to run fine. Building a copy number reference from normal samples... Processing reads in sample.bam Traceback...
Your original command should work for you if you are able to remove Pysam 0.9 and install Pysam 0.8.4 instead.
Comment
-
-
Dear Eric,
CNVkit worked when I used the older version of pysam. Now I have a doubt regarding running CNVkit. I have 20 samples with matched tumor and normal. Do I make reference from all normal samples and run each tumor sample or run individually? Sorry about naive question.
Thank you.
Best,
Deepak
Comment
-
-
Hi Eric,
Sorry to flood you with questions. one more thing, my files have same naming for normals across samples and it is giving me an error saying Dupicate ID. The problem is the files are write protected and huge files, so I don't want to rename or move them. Is there any way around it?
Thank you for your patience.
Best,
Deepak
Comment
-
Latest Articles
Collapse
-
by SEQadmin2
Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
...-
Channel: Articles
07-09-2026, 11:10 AM -
-
by SEQadmin2
Cancer survival rates have significantly increased in the last few decades in the United States, reaching a combined 70% 5-year survival rate by 2021. Behind this number, there are years of research to find new therapies, drug targets, and early detection methods. But there is one core challenge that keeps slowing down these advances, and it’s about drug resistance.
There is no single reason why many patients don’t respond to treatment as expected. Cancer is...-
Channel: Articles
07-08-2026, 05:17 AM -
-
by GATTACATLove this - good data definitely starts from good input, and poor input can only give relatively poor data. I particularly like the mention of Nanodrop/absorbance based methods for quantification. It's such a toss up if you'll get an accurate reading or what amounts to a randomly generated number, and a lot of library/sequencing related issues can be traced back to poor quant.
-
Channel: Articles
07-01-2026, 11:43 AM -
ad_right_rmr
Collapse
News
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by SEQadmin2, Today, 10:26 AM
|
0 responses
11 views
0 reactions
|
Last Post
by SEQadmin2
Today, 10:26 AM
|
||
|
Started by SEQadmin2, 07-09-2026, 10:04 AM
|
0 responses
25 views
0 reactions
|
Last Post
by SEQadmin2
07-09-2026, 10:04 AM
|
||
|
Started by SEQadmin2, 07-08-2026, 10:08 AM
|
0 responses
16 views
0 reactions
|
Last Post
by SEQadmin2
07-08-2026, 10:08 AM
|
||
|
Started by SEQadmin2, 07-07-2026, 11:05 AM
|
0 responses
33 views
0 reactions
|
Last Post
by SEQadmin2
07-07-2026, 11:05 AM
|
Comment