This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Question About Mergesegment.Pl In Varscan 2

Hi there, I'm using Varscan2 CNV pipeline to deal with my exome data, it works fine until the last step which needed a perl script "mergeSegment.pl". my command is like:

perl mergeSegments.pl --ref-arm-sizes ./chr_arm_coordinate.txt ./blahblahblah.copynumber

The copynumber file was generated by R package DNAcopy, with 10 columns as mergeSegment.pl requires, here's the format:

ID    chrom    loc.start    loc.end    num.mark    seg.mean    bstat    pval    lcl    ucl
MetS6    1    762098    1635855    1040    -0.8484    7.868273154    6.30E-13    1635609    1646602
MetS6    1    1645759    1654150    11    -1.402    6.795998163    3.43E-10    1647851    1663751
MetS6    1    1663751    1690511    33    -0.8588    4.428916611    0.000268018    1688073    1721814

Then I got error below:

Use of uninitialized value $stats{"num_merged_events"} in array element at mergeSegments.pl line 182, <GEN1> line 3.
Use of uninitialized value in split at mergeSegments.pl line 255.
Use of uninitialized value $chrom_size in division (/) at mergeSegments.pl line 271.
Illegal division by zero at mergeSegments.pl line 271.

Any suggestions would be greatly appreciated, Thanks!

5 answers

It appears that your CBS output file differs slightly in structure from the output expected by mergeSegments.pl (see line 134):

my ($id, $sample, $chrom, $chr_start, $chr_stop, $num_mark, $seg_mean, $bstat, $p_value, $lcl, $ucl) = split(/\s+/, $line);

Your line does not appear to have both ID and sample columns. Thus if you remove one of those variables in the split command, it should work for you.

Does this solve your problem? Questions About Mergesegment.Pl

Thank you for your instant reply Chris, I actually used ref-arm-sizes file that post recommended, and got the error above.

I am getting the same error, so I simply added the sample column: Sample input:

ID sample chrom loc.start loc.end num.mark seg.mean bstat pval lcl ucl

Sample.1 ABC chr1 801880 1580650 192 23.6745 14.52182109 1.32E-45 1580650 1581021

But I still get the errors: Use of uninitialized value $stats{"num_merged_events"} in array element at ../../mergeSegments.pl line 182, <gen1> line 184. Use of uninitialized value in split at ../../mergeSegments.pl line 255. Use of uninitialized value $chrom_size in division (/) at ../../mergeSegments.pl line 271. Illegal division by zero at ../../mergeSegments.pl line 271.

The ----ref-arm-sizes file is in the format: chr1 0 125000000 p chr1 125000000 249250621 q

Any help is appreciated! ~Rini

I had the same problem, then i removed $sample from line 134 as he said, which initially looks like this
my ($id, $sample, $chrom, $chr_start, $chr_stop, $num_mark, $seg_mean, $bstat, $p_value, $lcl, $ucl) = split(/\s+/, $line);

Still gives this error
Use of uninitialized value $stats{"num_merged_events"} in array element at /home.../mergeSegments.pl line 182, <GEN1> line 3.
Also gives some results just below the error

You may want to see this post also, it is helpfull
http://sourceforge.net/p/varscan/discussion/1073558/thread/96c8dea8/?limit=25#3c10

Hi

I'm currently having the exact same problem with mergeSegments.pl

Use of uninitialized value $stats{"num_merged_events"} in array element at mergeSegments.pl line 182, <gen1> line 2. Use of uninitialized value in split at mergeSegments.pl line 255. Use of uninitialized value $chrom_size in division (/) at mergeSegments.pl line 271. Illegal division by zero at mergeSegments.pl line 271.

Did you resolve this problem? Also, I am right in thinking the input file should not have a header.

Best wishes

Log in to answer this question.