ShortReadQ constructor
1
0
Entering edit mode
@ivan-gregoretti-3975
Last seen 10.2 years ago
Canada
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? Thank you, Ivan Ivan Gregoretti, PhD Bioinformatics
• 1.4k views
ADD COMMENT
0
Entering edit mode
@martin-morgan-1513
Last seen 4 months ago
United States
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 at 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
ADD COMMENT
0
Entering edit mode
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. 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 at="" 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 at 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
ADD REPLY
0
Entering edit mode
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 at="" 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 at 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
ADD REPLY
0
Entering edit mode
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 at="" 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 at="" 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 at 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
ADD REPLY
0
Entering edit mode
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]]
ADD REPLY
0
Entering edit mode
Hi Marcus, Actually, I originally tried using the method (if it existed) to update the ids but got the error that you show above. By the way, going through my records I found that indeed I had a typo. I meant to write ShortReadQ() but I wrote ShortRead(). No wonder it complained about not having a slot for quality. Thank you, Ivan Ivan Gregoretti, PhD Bioinformatics On Mon, Oct 7, 2013 at 11:24 PM, Marcus Davy <mdavy86 at="" gmail.com=""> wrote: > 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 at 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 at="" 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 at="" 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 at="" 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 at 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 at r-project.org >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: >> http://news.gmane.org/gmane.science.biology.informatics.conductor > >
ADD REPLY

Login before adding your answer.

Traffic: 941 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