Question: How to merge multiple CNV results of CNVnator
gravatar for ChrisJ
2.4 years ago by
ChrisJ0 wrote:

Hello everyone: There is a problem puzzled me recently,I have got every individual CNV output by the tool of CNVnator,and next I want to merge all outputs to a file(if two CNVs have overlap >0.5 can be considered to a common one), but I don't know how to merge these files.I have tried the VCFtools( CNVnator has a perl script which can switch the out to VCF format),bcftools,bedtools ,but there is no a tool can really solve my question(some tool would discard these no-overlap CNVs),so who can give me some suggestions to solve this hard trouble? this is my output:

  # chr       start            end           type
  chr1    7967601     7984800     deletion
  chr1    9441201     9447200     duplication
  chr1    10546001   10553200    deletion
  chr1    10822001    10830400   deletion
cnv cnvnator ngs • 1.4k views
ADD COMMENTlink modified 8 months ago by hzaujsxu0 • written 2.4 years ago by ChrisJ0

I met the same problem. Have you solve it?

ADD REPLYlink written 8 months ago by hzaujsxu0

hi, I also met the same problem ...

ADD REPLYlink written 7 months ago by 26046175510
gravatar for Pierre Lindenbaum
2.4 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum126k wrote:

a 'stupid' solution using javascript ?

// following array is generated with awk '{printf("{\"chrom\":\"%s\",\"start\":%s,\"end\":%s,\"type\":\"%s\"},\n",$1,$2,$3,$4);}' your.bed
var segments=[

var done=false;
    var i=0;
    while(done && i + 1< segments.length)
        var j = i+1;
        while(j < segments.length)
            var segi = segments[i];
            var segj = segments[j];
            if( segi.chrom != segj.chrom) {++j; continue;}
            if( segi.type != segj.type) {++j; continue;}
            if( segj.end <= segi.start)  {++j; continue;}
            if( segj.start >= segi.end)  {++j; continue;}
            var overlap_len = 1.0 * ( Math.min(segi.end,segj.end) - Math.max(segi.start,segj.start) );
            var leni =  1.0* (segi.end - segi.start);
            if( overlap_len / leni < 0.5)  {++j; continue;}
            var lenj =  1.0* (segj.end - segj.start);
            if( overlap_len / lenj < 0.5)  {++j; continue;}
                "start": Math.min(segi.start,segj.start),
                "end": Math.max(segi.end,segj.end),

for(var i in segments)
    var segi = segments[i];

invoke with jjs or in a firefox scratchad

$ jjs script.js
chr1    7967601 7984810 duplication
chr1    7967602 7967603 duplication
chr1    1   100 duplication
chr1    10546001    10553200    deletion
ADD COMMENTlink written 2.4 years ago by Pierre Lindenbaum126k
gravatar for ChrisJ
2.4 years ago by
ChrisJ0 wrote:

ok,thank you very much .and I will try it .

ADD COMMENTlink written 2.4 years ago by ChrisJ0
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: 1027 users visited in the last hour