This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to loop over several samples with QDNAseq

This might be a very basic R question..

QDNAseq creates 'readCounts' R object which holds all of the samples, yet I wish to create a chart for each sample at a time

e.g. isobarPlot(readCounts)

But how do I include only a single sample in the plot and not all?

Thanks,

r

You could do str(readCounts) to see the structure of the object. You could post the output of that which may help. Once you identify which part of readCounts contains each sample you should be able to isobarPlot(readCounts$<sample>)

Thanks, but the structure is not so simple and I'm not sure which are the parts that are required by the function to create the plot

 Formal class 'QDNAseqReadCounts' [package "QDNAseq"] with 7 slots
  ..@ assayData        :<environment: 0xdfe51e0> 
  ..@ phenoData        :Formal class 'AnnotatedDataFrame' [package "Biobase"] with 4 slots
  .. .. ..@ varMetadata      :'data.frame': 4 obs. of  1 variable:
  .. .. .. ..$ labelDescription: chr [1:4] NA NA NA NA
  .. .. ..@ data             :'data.frame': 73 obs. of  4 variables:
  .. .. .. ..$ name             : chr [1:73] "p001ii_.R1.fq.gz.sam.sorted" "p003jj_.R1.fq.gz.sam.sorted" "p006kk_.R1.fq.gz.sam.sorted" "p006r_.R1.fq.gz.sam.sorted" ...
  .. .. .. ..$ total.reads      : num [1:73] 6464628 5090209 5414391 6216836 3868858 ...
  .. .. .. ..$ used.reads       : num [1:73] 6117916 4809392 5117151 5876539 3661384 ...
  .. .. .. ..$ expected.variance: num [1:73] 0.00441 0.00562 0.00528 0.0046 0.00738 ...
  .. .. ..@ dimLabels        : chr [1:2] "sampleNames" "sampleColumns"
  .. .. ..@ .__classVersion__:Formal class 'Versions' [package "Biobase"] with 1 slot
  .. .. .. .. ..@ .Data:List of 1
  .. .. .. .. .. ..$ : int [1:3] 1 1 0
  ..@ featureData      :Formal class 'AnnotatedDataFrame' [package "Biobase"] with 4 slots
  .. .. ..@ varMetadata      :'data.frame': 9 obs. of  1 variable:
  .. .. .. ..$ labelDescription: chr [1:9] "Chromosome name" "Base pair start position" "Base pair end position" "Percentage of non-N nucleotides (of full bin size)" ...
  .. .. ..@ data             :'data.frame': 30970 obs. of  9 variables:
  .. .. .. ..$ chromosome : chr [1:30970] "1" "1" "1" "1" ...
  .. .. .. ..$ start      : num [1:30970] 1e+00 1e+05 2e+05 3e+05 4e+05 ...
  .. .. .. ..$ end        : num [1:30970] 1e+05 2e+05 3e+05 4e+05 5e+05 6e+05 7e+05 8e+05 9e+05 1e+06 ...
  .. .. .. ..$ bases      : num [1:30970] 90 77.4 40.3 82.3 71.4 ...
  .. .. .. ..$ gc         : num [1:30970] 42.5 43.6 39.1 40.2 45.4 ...
  .. .. .. ..$ mappability: num [1:30970] 22.14 7.56 9.17 9 11.77 ...
  .. .. .. ..$ blacklist  : num [1:30970] 0.979 0 0 0 0 ...
  .. .. .. ..$ residual   : num [1:30970] NA NA NA NA NA ...
  .. .. .. ..$ use        : logi [1:30970] TRUE TRUE TRUE TRUE TRUE TRUE ...
  .. .. ..@ dimLabels        : chr [1:2] "featureNames" "featureColumns"
  .. .. ..@ .__classVersion__:Formal class 'Versions' [package "Biobase"] with 1 slot
  .. .. .. .. ..@ .Data:List of 1
  .. .. .. .. .. ..$ : int [1:3] 1 1 0
  ..@ experimentData   :Formal class 'MIAME' [package "Biobase"] with 13 slots
  .. .. ..@ name             : chr ""
  .. .. ..@ lab              : chr ""
  .. .. ..@ contact          : chr ""
  .. .. ..@ title            : chr ""
  .. .. ..@ abstract         : chr ""
  .. .. ..@ url              : chr ""
  .. .. ..@ pubMedIds        : chr ""
  .. .. ..@ samples          : list()
  .. .. ..@ hybridizations   : list()
  .. .. ..@ normControls     : list()
  .. .. ..@ preprocessing    : list()
  .. .. ..@ other            : list()
  .. .. ..@ .__classVersion__:Formal class 'Versions' [package "Biobase"] with 1 slot
  .. .. .. .. ..@ .Data:List of 2
  .. .. .. .. .. ..$ : int [1:3] 1 0 0
  .. .. .. .. .. ..$ : int [1:3] 1 1 0
  ..@ annotation       : chr(0) 
  ..@ protocolData     :Formal class 'AnnotatedDataFrame' [package "Biobase"] with 4 slots
  .. .. ..@ varMetadata      :'data.frame': 0 obs. of  1 variable:
  .. .. .. ..$ labelDescription: chr(0) 
  .. .. ..@ data             :'data.frame': 73 obs. of  0 variables
  .. .. ..@ dimLabels        : chr [1:2] "sampleNames" "sampleColumns"
  .. .. ..@ .__classVersion__:Formal class 'Versions' [package "Biobase"] with 1 slot
  .. .. .. .. ..@ .Data:List of 1
  .. .. .. .. .. ..$ : int [1:3] 1 1 0
  ..@ .__classVersion__:Formal class 'Versions' [package "Biobase"] with 1 slot
  .. .. ..@ .Data:List of 4
  .. .. .. ..$ : int [1:3] 3 3 1
  .. .. .. ..$ : int [1:3] 2 34 0
  .. .. .. ..$ : int [1:3] 1 3 0
  .. .. .. ..$ : int [1:3] 1 10 0

P.S. I ended up simply creating a separate object for each sample :)

0 answers

No answers yet.

Log in to answer this question.