It doesn't look like a method has been written to update the id slot,
direct access does work, I also think using renew() is nicer.

try(id(srq1) <- paste(id(srq1), 'tested'))
Error in id(srq1) <- paste(id(srq1), "tested") :
  could not find function "id<-"

## Direct injection -probably not recommended
srq1@id <- BStringSet( paste(id(srq1), 'tested'))

renew() also catches enforced structure between 'sread' and 'quality', e.g.

 try(renew(srq1, quality=FastqQuality(c("HH","H"))))
Error in validObject(.Object) :
  invalid class "ShortReadQ" object: some sread and quality widths differ

I have also had cause to update ids in a ShortReadQ object, in my case for
input into a Short read aligner, useful additional auxiliary information
can go into the QNAME field of a bam file.

cheers,

Marcus




On Tue, Oct 8, 2013 at 1:44 PM, Ivan Gregoretti <ivangreg@gmail.com> wrote:

> The renew() looks really handy. The direct use of the constructor is
> something that I tried but failed to me. I probably had one of those
> invisible typos.
>
> Thank you.
>
> Ivan
>
>
> Ivan Gregoretti, PhD
> Bioinformatics
> Cell Signaling Technology, Inc
> 3 Trask Lane
> Danvers, MA 01923. USA.
> Phone +1-978-867-2429
>
>
> On Mon, Oct 7, 2013 at 8:31 PM, Martin Morgan <mtmorgan@fhcrc.org> wrote:
> > On 10/07/2013 05:06 PM, Ivan Gregoretti wrote:
> >>
> >> Hello Martin,
> >>
> >> Great. So,
> >>
> >> srq1 <- ShortReadQ(DNAStringSet(c("ACGT", "GGGGACT")),
> >> FastqQuality(c("HHHH", "HHHHHHH")), BStringSet(c("read1", "read2")))
> >>
> >> gets me what I wanted. Now I have a part two to my question:
> >>
> >> How do I modify srq1's id?
> >>
> >> For instance, id(srq1) produces
> >>
> >>> id(srq1)
> >>
> >>    A BStringSet instance of length 2
> >>      width seq
> >> [1]     5 read1
> >> [2]     5 read2
> >>
> >> but I want to modify srq1's id so that it looks like this
> >>
> >>> BStringSet(paste(id(srq1), 'tested'))
> >>
> >>    A BStringSet instance of length 2
> >>      width seq
> >> [1]    12 read1 tested
> >> [2]    12 read2 tested
> >>
> >> Please note that I intend not to construct a new instance by passing
> >> FastqQuality(c("HHHH", "HHHHHHH")) and DNAStringSet(c("ACGT",
> >> "GGGGACT")). I intend to copy srq1 to srq2 and then modify srq2.
> >>
> >
> > ShortRead explored the notion of a 'renw'able instance, see ?renew and
> >
> >   srq2 = renew(srq1, id=BStringSet(paste(id(srq1), "tested")))
> >
> > this
> >
> >   ShortReadQ(sread(srq1), quality(srq1), BStringSet(paste(id(srq1),
> > "tested")))
> >
> > also works
> >
> > Martin
> >
> >
> >> Alternatively, may I construct a new instance by passing
> >> BStringSet(paste(id(srq1), 'tested')), sread(srq1) and quality(srq1)?
> >> I tried by the constructor complained vociferously when I passed
> >> quality=quality(srq1).
> >>
> >> Thank you,
> >>
> >> Ivan
> >>
> >>
> >>
> >>
> >> Ivan Gregoretti, PhD
> >> Bioinformatics
> >>
> >>
> >>
> >>
> >> On Mon, Oct 7, 2013 at 3:44 PM, Martin Morgan <mtmorgan@fhcrc.org>
> wrote:
> >>>
> >>> On 10/07/2013 12:28 PM, Ivan Gregoretti wrote:
> >>>>
> >>>>
> >>>> Hello,
> >>>>
> >>>> Could somebody show an example of constructing a ShortReadQ object
> >>>> instance? I can't find an example in the documentation.
> >>>>
> >>>>
> >>>> For example, lets say that I have two records with the following ids,
> >>>> sequences, and Phred qualities
> >>>>
> >>>> c("read1", "read2")
> >>>> c("ACGT", "GGGGACT")
> >>>> c("HHHH", "HHHHHHH")
> >>>>
> >>>> How would you now construct the ShortReadQ instance?
> >>>
> >>>
> >>>
> >>> Hi Ivan
> >>>
> >>> ShortReadQ(DNAStringSet(c("ACGT", "GGGGACT")),
> >>>      FastqQuality(c("HHHH", "HHHHHHH")),
> >>>      BStringSet(c("read1", "read2")))
> >>>
> >>> Martin
> >>>
> >>>>
> >>>> Thank you,
> >>>>
> >>>> Ivan
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> Ivan Gregoretti, PhD
> >>>> Bioinformatics
> >>>>
> >>>> _______________________________________________
> >>>> Bioconductor mailing list
> >>>> Bioconductor@r-project.org
> >>>> https://stat.ethz.ch/mailman/listinfo/bioconductor
> >>>> Search the archives:
> >>>> http://news.gmane.org/gmane.science.biology.informatics.conductor
> >>>>
> >>>
> >>>
> >>> --
> >>> Computational Biology / Fred Hutchinson Cancer Research Center
> >>> 1100 Fairview Ave. N.
> >>> PO Box 19024 Seattle, WA 98109
> >>>
> >>> Location: Arnold Building M1 B861
> >>> Phone: (206) 667-2793
> >
> >
> >
> > --
> > Computational Biology / Fred Hutchinson Cancer Research Center
> > 1100 Fairview Ave. N.
> > PO Box 19024 Seattle, WA 98109
> >
> > Location: Arnold Building M1 B861
> > Phone: (206) 667-2793
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor@r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>

	[[alternative HTML version deleted]]

