Announcement

Collapse
No announcement yet.

CNVkit: Copy number detection and visualization for targeted sequencing using off-tar

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #31
    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.

    Comment


    • #32
      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


      • #33
        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


        • #34
          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


          • #35
            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


            • #36
              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


              • #37
                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


                • #38
                  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


                  • #39
                    Deepak, another user reported this issue and found that it was due to a bug in Pysam 0.9:
                    https://github.com/etal/cnvkit/issues/86

                    Your original command should work for you if you are able to remove Pysam 0.9 and install Pysam 0.8.4 instead.

                    Comment


                    • #40
                      Thank you Eric. I will try and let you know.

                      Best,
                      Deepak

                      Comment


                      • #41
                        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


                        • #42
                          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

                          Working...
                          X