Skip to content

Issue with QDNAseq Segmentation Output Formatting #134

Open

Description

@jihen-lau

Description:
I encountered an issue while running QDNAseq in R and generating .seg files. To be exact, some of the files did not follow the expected structure. Instead of having six column headers followed by data entries, these files were formatted incorrectly, appearing as six rows with a single column where the header is labeled as 'x'.

Expected .seg Format:

SAMPLE_NAME	CHROMOSOME	START	STOP	DATAPOINTS	LOG2_RATIO_MEAN
Sample1    3    56200001    69000000    28    0.55

Observed Incorrect Format:

x
sample1.seg
3
56200001
69000000
28
0.55

Even when running only these problematic files individually, the outcome remains the same (i.e., six rows with a single column header labeled as 'x').

Additional Observations:

To manually verify the issue, I exported the call number and compared it to the number of data points in the .seg file. Based on this comparison:

  • 6 out of the 7 affected files having only 1 segment.
  • 1 affected file should have recorded 3 segments but instead only recorded 1, in the incorrect format.

My Script:

library(QDNAseq)
library(QDNAseq.hg19)

bins <- getBinAnnotations(binSize=100)

setwd("/my_Dir/") 
readCounts <- binReadCounts(bins)

readCountsFiltered <- applyFilters(readCounts, residual=TRUE, blacklist=TRUE)
readCountsFiltered <- estimateCorrection(readCountsFiltered)
copyNumbers <- correctBins(readCountsFiltered)
copyNumbersNormalized <- normalizeBins(copyNumbers)
copyNumbersSmooth <- smoothOutlierBins(copyNumbersNormalized)

# more limit
options(future.globals.maxSize = 1024^3)

# set seeds
set.seed(1)

copyNumbersSegmented <- segmentBins(copyNumbersSmooth, transformFun="sqrt")
copyNumbersSegmented <- normalizeSegmentedBins(copyNumbersSegmented)
copyNumbersCalled <- callBins(copyNumbersSegmented)

exportBins(copyNumbersCalled,file="%s.seg", format="seg")

System Information:

  • QDNAseq Version: ‘1.38.0’
  • R Version: R version 4.3.3
  • Operating System: AWS EC2 Ubuntu 22.04, m6a.2xlarge

Any insights or guidance on how to resolve this issue would be greatly appreciated!

Activity

  1. jihen-lau commented on Apr 8, 2025

    @jihen-lau
    Author

    Update:

    Regarding the issue I mentioned where one affected file should have recorded 3 segments but instead recorded only 1 in the incorrect format:

    I realized that when I run all of my 228 BAM files at once, this particular bam file always records only one call. However, if I run this this BAM file individually, it shows all 3 calls as expected.

    Could running all files at once versus running a single BAM file individually affect the results? Or is this behavior indicative of a bug?

    To provide more context, I checked the calls using copyNumbersCalled@assayData[["calls"]], and from the output, I expect to see three different calls (or segments) with their respective number of data points. However, when running all 228 BAM files at once, I observe only 1 call being recorded in the .seg file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions