plotMutationSpectrum in SomaticSignatures
2
0
Entering edit mode
Haiying.Kong ▴ 110
@haiyingkong-9254
Last seen 5.0 years ago
Germany

  I am trying to plot mutation spectrum:

 

##################################################################################################

# Construct mutational motif.

somatic.motif = mutationContext(VR, ref=BSgenome.Hsapiens.1000genomes.hs37d5)

 

  If I plot with full data:

plotMutationSpectrum(somatic.motif, group="sampleNames")

  it works.

 

  But if I get a subset of the rows, and try to plot it, it does not work.

  aster = somatic.motif[(somatic.motif@sampleNames %in% patients)]

  plotMutationSpectrum(aster, group="sampleNames")

 

  This gives error:

Error in colSums(y) : 'x' must be an array of at least two dimensions

 

  Both somatic.motif and aster are VRange objects.

 

  I tried to go inside of plotMutationSpectrum function, but I cannot figure out what went wrong.

 

  I have been struggling with this all day today.

 

  Could you please help me in your earliest convenience?

 

  Thank you very much in advance.

 

  Best regards,

 

  Haiying

software error • 703 views
ADD COMMENT
0
Entering edit mode
Haiying.Kong ▴ 110
@haiyingkong-9254
Last seen 5.0 years ago
Germany

After extracting a subset of mutations for 3 patients, the level of sample names stays same, somehow, and probably this was problem:

> idx = which(somatic.motif@sampleNames %in% pats[1:3])
> am = somatic.motif[idx]
>
> somatic.motif@sampleNames
factor-Rle of length 140289 with 85 runs
  Lengths:             790             451 ...            2690            1058
  Values :   B100327_T3398   B101681_T3462 ...    B88391_T2523    B99179_T3884
Levels(85): B100327_T3398 B101681_T3462 ... B88391_T2523 B99179_T3884
> am@sampleNames
factor-Rle of length 1718 with 3 runs
  Lengths:           790           451           477
  Values : B100327_T3398 B101681_T3462 B102360_T3495
Levels(85): B100327_T3398 B101681_T3462 ... B88391_T2523 B99179_T3884

 

But I donot know how to fix this.

ADD COMMENT
0
Entering edit mode
Haiying.Kong ▴ 110
@haiyingkong-9254
Last seen 5.0 years ago
Germany

I added one line after extracting subset:

aster@sampleNames = as.factor(as.character(aster@sampleNames))

and it is working now.

 

ADD COMMENT

Login before adding your answer.

Traffic: 488 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6