From uappelt@clcbio.com Tue Sep 11 11:10:05 2012 Received: from relay1.zedat.fu-berlin.de ([130.133.4.67]) by list1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TBMTs-002m9v-2E>; Tue, 11 Sep 2012 11:10:04 +0200 Received: from clcbio.com ([195.69.130.220]) by relay1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TBMTr-00040u-Uu>; Tue, 11 Sep 2012 11:10:04 +0200 Received: from office.clcbio.com (office.clcbio.com [93.176.71.69]) by clcbio.com (Postfix) with ESMTP id 63704183136F for ; Tue, 11 Sep 2012 11:10:02 +0200 (CEST) Received: from [192.168.1.68] (laptop-68 [192.168.1.68]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: uappelt) by office.clcbio.com (Postfix) with ESMTPSA id AD24320754 for ; Tue, 11 Sep 2012 11:10:01 +0200 (CEST) Message-ID: <504EFFE8.5090506@clcbio.com> Date: Tue, 11 Sep 2012 11:10:00 +0200 From: Uwe Appelt User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120824 Thunderbird/15.0 MIME-Version: 1.0 To: SeqAn Development Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: 195.69.130.220 X-purgate: clean X-purgate-type: clean X-purgate-ID: 151147::1347354604-00000D73-17364B17/0-0/0-0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.020167, version=1.2.2 X-Spam-Flag: NO X-Spam-Status: No, score=0.0 required=5.0 tests=none X-Spam-Checker-Version: SpamAssassin 3.3.2 on Botsuana.ZEDAT.FU-Berlin.DE X-Spam-Level: Subject: [Seqan-dev] rabema_prepare_sam "File must be sorted by query name." X-BeenThere: seqan-dev@lists.fu-berlin.de X-Mailman-Version: 2.1.14 Precedence: list Reply-To: SeqAn Development List-Id: SeqAn Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Sep 2012 09:10:05 -0000 Hi guys, I've got a small problem in Rabema: I am preparing another gold standard for a Rabema benchmark and received the following error msg: ./razers3 -v -tc 32 -of sam -rr 100 -i 90 -m 1000000 -ds -o ./output0.sam ./hg19.fa ./input.fastq [load of outputs] ./rabema_prepare_sam ./output0.sam > ./output.sam ERROR: 16A7I:4:100 succeeds 16A7I:49:92 in SAM file. File must be sorted by query name. Seems like razers3 and rabema_prepare_sam are somehow out of sync with respect to their sorting code (maybe it's just the multi-threading in razers3 that sometimes results in slightly "unordered" output of mapping results)? The Trunk-checkout is, however, already a week old, so I might have to re-run everything. Before doing so, I wanted to ask for advice here, because re-running razers3 will take 4 days. Any ideas or suggestions? Thanks in advance, Uwe From manuel.holtgrewe@fu-berlin.de Tue Sep 11 16:15:01 2012 Received: from outpost1.zedat.fu-berlin.de ([130.133.4.66]) by list1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TBREy-002wrB-8o>; Tue, 11 Sep 2012 16:15:00 +0200 Received: from relay2.zedat.fu-berlin.de ([130.133.4.80]) by outpost1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TBREy-0001Iv-6C>; Tue, 11 Sep 2012 16:15:00 +0200 Received: from cas1.campus.fu-berlin.de ([130.133.170.201]) by relay2.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TBREx-0002KY-P0>; Tue, 11 Sep 2012 16:15:00 +0200 Received: from EX02A.campus.fu-berlin.de ([130.133.170.132]) by CAS1.campus.fu-berlin.de ([130.133.170.201]) with mapi id 14.02.0318.001; Tue, 11 Sep 2012 16:14:58 +0200 From: "Holtgrewe, Manuel" To: SeqAn Development Thread-Topic: [Seqan-dev] rabema_prepare_sam "File must be sorted by query name." Thread-Index: AQHNj/1B9mjbQb6OJkyx+o1K/zZWPJeFLGzv Date: Tue, 11 Sep 2012 14:14:57 +0000 Message-ID: References: <504EFFE8.5090506@clcbio.com> In-Reply-To: <504EFFE8.5090506@clcbio.com> Accept-Language: en-US, de-DE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Originating-IP: 130.133.170.201 X-purgate: clean X-purgate-type: clean X-purgate-ID: 151147::1347372900-00000D73-704D2C55/0-0/0-0 X-Bogosity: Unsure, tests=bogofilter, spamicity=0.469862, version=1.2.2 X-Spam-Flag: NO X-Spam-Status: No, score=-1.3 required=5.0 tests=ALL_TRUSTED,FU_BOGO_UNSURE X-Spam-Checker-Version: SpamAssassin 3.3.2 on Dschibuti.ZEDAT.FU-Berlin.DE X-Spam-Level: Subject: Re: [Seqan-dev] rabema_prepare_sam "File must be sorted by query name." X-BeenThere: seqan-dev@lists.fu-berlin.de X-Mailman-Version: 2.1.14 Precedence: list Reply-To: SeqAn Development List-Id: SeqAn Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Sep 2012 14:15:01 -0000 Hi Uwe,=0A= =0A= RazerS 3 will write out the reads in the same order as in the input. This i= s independent of multi-threading.=0A= =0A= The problem is that rabema_prepare_sam assumes that the reads are sorted by= their name with "Windows 7 Explorer File Sorting", i.e. zz100zz comes afte= r zz10zz. Thus this sorting is not lexicographically. This is also the sort= ing that "samtools sort" uses when sorting by query name. In rabema_prepare= _sam, this is only used as a sanity check.=0A= =0A= I have just added an option --dont-check-sorting to rabema_prepare_sam that= disables this check. I hope this fixes your issues.=0A= =0A= Sorry for any inconvenience.=0A= =0A= Cheers,=0A= Manuel=0A= ________________________________________=0A= From: Uwe Appelt [uappelt@clcbio.com]=0A= Sent: Tuesday, September 11, 2012 11:10 AM=0A= To: SeqAn Development=0A= Subject: [Seqan-dev] rabema_prepare_sam "File must be sorted by query name.= "=0A= =0A= Hi guys,=0A= =0A= I've got a small problem in Rabema: I am preparing another gold standard=0A= for a Rabema benchmark and received the following error msg:=0A= =0A= ./razers3 -v -tc 32 -of sam -rr 100 -i 90 -m 1000000 -ds -o=0A= ./output0.sam ./hg19.fa ./input.fastq=0A= [load of outputs]=0A= ./rabema_prepare_sam ./output0.sam > ./output.sam=0A= =0A= ERROR: 16A7I:4:100 succeeds 16A7I:49:92 in SAM file.=0A= File must be sorted by query name.=0A= =0A= Seems like razers3 and rabema_prepare_sam are somehow out of sync with=0A= respect to their sorting code (maybe it's just the multi-threading in=0A= razers3 that sometimes results in slightly "unordered" output of mapping=0A= results)? The Trunk-checkout is, however, already a week old, so I might=0A= have to re-run everything. Before doing so, I wanted to ask for advice=0A= here, because re-running razers3 will take 4 days. Any ideas or suggestions= ?=0A= =0A= Thanks in advance,=0A= Uwe=0A= =0A= _______________________________________________=0A= seqan-dev mailing list=0A= seqan-dev@lists.fu-berlin.de=0A= https://lists.fu-berlin.de/listinfo/seqan-dev=0A= From uappelt@clcbio.com Tue Sep 11 16:53:32 2012 Received: from relay1.zedat.fu-berlin.de ([130.133.4.67]) by list1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TBRqF-002yAo-Ix>; Tue, 11 Sep 2012 16:53:31 +0200 Received: from clcbio.com ([195.69.130.220]) by relay1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TBRqF-00012q-Ei>; Tue, 11 Sep 2012 16:53:31 +0200 Received: from office.clcbio.com (office.clcbio.com [93.176.71.69]) by clcbio.com (Postfix) with ESMTP id 967701831351 for ; Tue, 11 Sep 2012 16:53:29 +0200 (CEST) Received: from [192.168.1.68] (laptop-68 [192.168.1.68]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: uappelt) by office.clcbio.com (Postfix) with ESMTPSA id 8F53120754 for ; Tue, 11 Sep 2012 16:53:29 +0200 (CEST) Message-ID: <504F5069.9070108@clcbio.com> Date: Tue, 11 Sep 2012 16:53:29 +0200 From: Uwe Appelt User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: seqan-dev@lists.fu-berlin.de References: <504EFFE8.5090506@clcbio.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: 195.69.130.220 X-purgate: suspect X-purgate-type: suspect X-purgate-ID: 151147::1347375211-00000D73-9851F838/3655023060-0/0-1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000022, version=1.2.2 X-Spam-Flag: NO X-Spam-Status: No, score=1.0 required=5.0 tests=FU_XPURGATE_SUSP X-Spam-Checker-Version: SpamAssassin 3.3.2 on Burundi.ZEDAT.FU-Berlin.DE X-Spam-Level: x Subject: Re: [Seqan-dev] rabema_prepare_sam "File must be sorted by query name." X-BeenThere: seqan-dev@lists.fu-berlin.de X-Mailman-Version: 2.1.14 Precedence: list Reply-To: SeqAn Development List-Id: SeqAn Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Sep 2012 14:53:32 -0000 Thanks for clarifying, Manuel! It works now. Cheers, Uwe On 11/09/2012 16:14, Holtgrewe, Manuel wrote: > Hi Uwe, > > RazerS 3 will write out the reads in the same order as in the input. This is independent of multi-threading. > > The problem is that rabema_prepare_sam assumes that the reads are sorted by their name with "Windows 7 Explorer File Sorting", i.e. zz100zz comes after zz10zz. Thus this sorting is not lexicographically. This is also the sorting that "samtools sort" uses when sorting by query name. In rabema_prepare_sam, this is only used as a sanity check. > > I have just added an option --dont-check-sorting to rabema_prepare_sam that disables this check. I hope this fixes your issues. > > Sorry for any inconvenience. > > Cheers, > Manuel > ________________________________________ > From: Uwe Appelt [uappelt@clcbio.com] > Sent: Tuesday, September 11, 2012 11:10 AM > To: SeqAn Development > Subject: [Seqan-dev] rabema_prepare_sam "File must be sorted by query name." > > Hi guys, > > I've got a small problem in Rabema: I am preparing another gold standard > for a Rabema benchmark and received the following error msg: > > ./razers3 -v -tc 32 -of sam -rr 100 -i 90 -m 1000000 -ds -o > ./output0.sam ./hg19.fa ./input.fastq > [load of outputs] > ./rabema_prepare_sam ./output0.sam > ./output.sam > > ERROR: 16A7I:4:100 succeeds 16A7I:49:92 in SAM file. > File must be sorted by query name. > > Seems like razers3 and rabema_prepare_sam are somehow out of sync with > respect to their sorting code (maybe it's just the multi-threading in > razers3 that sometimes results in slightly "unordered" output of mapping > results)? The Trunk-checkout is, however, already a week old, so I might > have to re-run everything. Before doing so, I wanted to ask for advice > here, because re-running razers3 will take 4 days. Any ideas or suggestions? > > Thanks in advance, > Uwe > > _______________________________________________ > seqan-dev mailing list > seqan-dev@lists.fu-berlin.de > https://lists.fu-berlin.de/listinfo/seqan-dev > > _______________________________________________ > seqan-dev mailing list > seqan-dev@lists.fu-berlin.de > https://lists.fu-berlin.de/listinfo/seqan-dev From oliver.stolpe@fu-berlin.de Thu Sep 13 11:21:18 2012 Received: from outpost1.zedat.fu-berlin.de ([130.133.4.66]) by list1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TC5bp-00040H-Na>; Thu, 13 Sep 2012 11:21:17 +0200 Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TC5bp-00018P-Kt>; Thu, 13 Sep 2012 11:21:17 +0200 Received: from nat-wifi-autres.univ-rouen.fr ([193.52.161.170] helo=[10.0.182.159]) by inpost2.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtpsa (envelope-from ) id <1TC5bp-0003Op-Gc>; Thu, 13 Sep 2012 11:21:17 +0200 Message-ID: <5051A58C.30305@fu-berlin.de> Date: Thu, 13 Sep 2012 11:21:16 +0200 From: Oliver Stolpe User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0 MIME-Version: 1.0 To: seqan-dev@lists.fu-berlin.de Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: 193.52.161.170 X-purgate: clean X-purgate-type: clean X-purgate-ID: 151147::1347528077-00000D73-1DEF8A7E/0-0/0-0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.007057, version=1.2.2 X-Spam-Flag: NO X-Spam-Status: No, score=-2.8 required=5.0 tests=ALL_TRUSTED X-Spam-Checker-Version: SpamAssassin 3.3.2 on Burundi.ZEDAT.FU-Berlin.DE X-Spam-Level: Subject: [Seqan-dev] CharString as a key in an unordered_map X-BeenThere: seqan-dev@lists.fu-berlin.de X-Mailman-Version: 2.1.14 Precedence: list Reply-To: SeqAn Development List-Id: SeqAn Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Sep 2012 09:21:18 -0000 Hello list, I try to use a SeqAn CharString as a key in an unordered_map (C++11). It fails when he tries to link. The linker message is posted below. I think the CharString type is not hashable, therefore I probably need to provide my own hash function (see below). Am I heading in the right direction? Before I start doing this I wanted to know why a string is hashable by the default function but not a CharString? Is there a trick to easily get around this? Thanks, Oliver This is my map structure: unordered_map I assume I have to do something like this to provide a hash function (found at stackoverflow): template<> struct hash { size_t operator() (CharString const &key) { // calculate hash value } }; Linker message: Linking CXX executable fastq_reader CMakeFiles/fastq_reader.dir/fastq_reader.cpp.o: In function `std::_Hashtable >, std::pair > const, unsigned int>, std::allocator > const, unsigned int> >, std::_Select1st > const, unsigned int> >, std::equal_to > >, std::hash > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, false, false, true>::find(seqan::String > const&)': fastq_reader.cpp:(.text._ZNSt10_HashtableIN5seqan6StringIcNS0_5AllocIvEEEESt4pairIKS4_jESaIS7_ESt10_Select1stIS7_ESt8equal_toIS4_ESt4hashIS4_ENSt8__detail18_Mod_range_hashingENSF_20_Default_ranged_hashENSF_20_Prime_rehash_policyELb0ELb0ELb1EE4findERS6_[std::_Hashtable >, std::pair > const, unsigned int>, std::allocator > const, unsigned int> >, std::_Select1st > const, unsigned int> >, std::equal_to > >, std::hash > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, false, false, true>::find(seqan::String > const&)]+0x8a): undefined reference to `std::hash > >::operator()(seqan::String >) const' collect2: ld gab 1 als Ende-Status zurück From manuel.holtgrewe@fu-berlin.de Fri Sep 14 07:29:57 2012 Received: from outpost1.zedat.fu-berlin.de ([130.133.4.66]) by list1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TCOTU-000g8v-3i>; Fri, 14 Sep 2012 07:29:56 +0200 Received: from relay2.zedat.fu-berlin.de ([130.133.4.80]) by outpost1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TCOTT-00065x-Nn>; Fri, 14 Sep 2012 07:29:55 +0200 Received: from cas1.campus.fu-berlin.de ([130.133.170.201]) by relay2.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TCOTT-0005iQ-FN>; Fri, 14 Sep 2012 07:29:55 +0200 Received: from EX02A.campus.fu-berlin.de ([130.133.170.132]) by CAS1.campus.fu-berlin.de ([130.133.170.201]) with mapi id 14.02.0318.001; Fri, 14 Sep 2012 07:29:50 +0200 From: "Holtgrewe, Manuel" To: SeqAn Development Thread-Topic: [Seqan-dev] CharString as a key in an unordered_map Thread-Index: AQHNkZGJTpvv+ADB5Uu5DI0pSlEgJ5eJULkC Date: Fri, 14 Sep 2012 05:29:48 +0000 Message-ID: References: <5051A58C.30305@fu-berlin.de> In-Reply-To: <5051A58C.30305@fu-berlin.de> Accept-Language: en-US, de-DE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Originating-IP: 130.133.170.201 X-purgate: clean X-purgate-type: clean X-purgate-ID: 151147::1347600596-00000D73-4FC3D1A7/0-0/0-0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000280, version=1.2.2 X-Spam-Flag: NO X-Spam-Status: No, score=-2.8 required=5.0 tests=ALL_TRUSTED X-Spam-Checker-Version: SpamAssassin 3.3.2 on Benin.ZEDAT.FU-Berlin.DE X-Spam-Level: Subject: Re: [Seqan-dev] CharString as a key in an unordered_map X-BeenThere: seqan-dev@lists.fu-berlin.de X-Mailman-Version: 2.1.14 Precedence: list Reply-To: SeqAn Development List-Id: SeqAn Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Sep 2012 05:29:57 -0000 Hi Oliver,=0A= =0A= does one of these solutions work?=0A= =0A= http://en.wikipedia.org/wiki/Unordered_associative_containers_(C%2B%2B)#Cus= tom_hash_functions=0A= =0A= *m=0A= ________________________________________=0A= From: Oliver Stolpe [oliver.stolpe@fu-berlin.de]=0A= Sent: Thursday, September 13, 2012 11:21 AM=0A= To: seqan-dev@lists.fu-berlin.de=0A= Subject: [Seqan-dev] CharString as a key in an unordered_map=0A= =0A= Hello list,=0A= =0A= I try to use a SeqAn CharString as a key in an unordered_map (C++11). It=0A= fails when he tries to link. The linker message is posted below. I think=0A= the CharString type is not hashable, therefore I probably need to=0A= provide my own hash function (see below). Am I heading in the right=0A= direction? Before I start doing this I wanted to know why a string is=0A= hashable by the default function but not a CharString? Is there a trick=0A= to easily get around this?=0A= =0A= Thanks,=0A= Oliver=0A= =0A= =0A= This is my map structure:=0A= =0A= unordered_map=0A= =0A= I assume I have to do something like this to provide a hash function=0A= (found at stackoverflow):=0A= =0A= template<>=0A= struct hash {=0A= size_t operator() (CharString const &key) {=0A= // calculate hash value=0A= }=0A= };=0A= =0A= Linker message:=0A= =0A= Linking CXX executable fastq_reader=0A= CMakeFiles/fastq_reader.dir/fastq_reader.cpp.o: In function=0A= `std::_Hashtable >,=0A= std::pair > const, unsigned int>,=0A= std::allocator > const,=0A= unsigned int> >, std::_Select1st > const, unsigned int> >,=0A= std::equal_to > >,=0A= std::hash > >,=0A= std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash,=0A= std::__detail::_Prime_rehash_policy, false, false,=0A= true>::find(seqan::String > const&)':=0A= fastq_reader.cpp:(.text._ZNSt10_HashtableIN5seqan6StringIcNS0_5AllocIvEEEES= t4pairIKS4_jESaIS7_ESt10_Select1stIS7_ESt8equal_toIS4_ESt4hashIS4_ENSt8__de= tail18_Mod_range_hashingENSF_20_Default_ranged_hashENSF_20_Prime_rehash_pol= icyELb0ELb0ELb1EE4findERS6_[std::_Hashtable >, std::pair >=0A= const, unsigned int>, std::allocator > const, unsigned int> >,=0A= std::_Select1st >=0A= const, unsigned int> >, std::equal_to > >, std::hash=0A= > >, std::__detail::_Mod_range_hashing,=0A= std::__detail::_Default_ranged_hash,=0A= std::__detail::_Prime_rehash_policy, false, false,=0A= true>::find(seqan::String > const&)]+0x8a):=0A= undefined reference to `std::hash=0A= > >::operator()(seqan::String >) const'=0A= collect2: ld gab 1 als Ende-Status zur=FCck=0A= =0A= =0A= _______________________________________________=0A= seqan-dev mailing list=0A= seqan-dev@lists.fu-berlin.de=0A= https://lists.fu-berlin.de/listinfo/seqan-dev=0A= From oliver.stolpe@fu-berlin.de Fri Sep 14 17:31:47 2012 Received: from outpost1.zedat.fu-berlin.de ([130.133.4.66]) by list1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TCXru-000zq6-AA>; Fri, 14 Sep 2012 17:31:46 +0200 Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TCXru-0000is-7T>; Fri, 14 Sep 2012 17:31:46 +0200 Received: from nat-wifi-autres.univ-rouen.fr ([193.52.161.170] helo=[10.0.182.159]) by inpost2.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtpsa (envelope-from ) id <1TCXru-0007Bh-3n>; Fri, 14 Sep 2012 17:31:46 +0200 Message-ID: <50534DE1.9080909@fu-berlin.de> Date: Fri, 14 Sep 2012 17:31:45 +0200 From: Oliver Stolpe User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0 MIME-Version: 1.0 To: seqan-dev@lists.fu-berlin.de References: <5051A58C.30305@fu-berlin.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: 193.52.161.170 X-purgate: clean X-purgate-type: clean X-purgate-ID: 151147::1347636706-00000D73-6117D16E/0-0/0-0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000028, version=1.2.2 X-Spam-Flag: NO X-Spam-Status: No, score=-2.8 required=5.0 tests=ALL_TRUSTED X-Spam-Checker-Version: SpamAssassin 3.3.2 on Botsuana.ZEDAT.FU-Berlin.DE X-Spam-Level: Subject: Re: [Seqan-dev] CharString as a key in an unordered_map X-BeenThere: seqan-dev@lists.fu-berlin.de X-Mailman-Version: 2.1.14 Precedence: list Reply-To: SeqAn Development List-Id: SeqAn Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Sep 2012 15:31:47 -0000 Hello, I tried to build something like in the example from Wikipedia: struct hashCharString { size_t operator() (const CharString &key) { Iterator::Type CharIt; size_t h_value = 7; for (CharIt = begin(key); CharIt != end(key); goNext(CharIt)) { h_value ^= hash()(value(CharIt)); } return h_value; } }; The call is: unordered_map kmer; But it fails: /usr/include/c++/4.6/bits/hashtable_policy.h:753:25: Fehler: keine Übereinstimmung für Aufruf von »(const hashCharString) (const seqan::String >&)« I'm a bit lost here. Oliver Am 14.09.2012 07:29, schrieb Holtgrewe, Manuel: > Hi Oliver, > > does one of these solutions work? > > http://en.wikipedia.org/wiki/Unordered_associative_containers_(C%2B%2B)#Custom_hash_functions > > *m > ________________________________________ > From: Oliver Stolpe [oliver.stolpe@fu-berlin.de] > Sent: Thursday, September 13, 2012 11:21 AM > To: seqan-dev@lists.fu-berlin.de > Subject: [Seqan-dev] CharString as a key in an unordered_map > > Hello list, > > I try to use a SeqAn CharString as a key in an unordered_map (C++11). It > fails when he tries to link. The linker message is posted below. I think > the CharString type is not hashable, therefore I probably need to > provide my own hash function (see below). Am I heading in the right > direction? Before I start doing this I wanted to know why a string is > hashable by the default function but not a CharString? Is there a trick > to easily get around this? > > Thanks, > Oliver > > > This is my map structure: > > unordered_map > > I assume I have to do something like this to provide a hash function > (found at stackoverflow): > > template<> > struct hash { > size_t operator() (CharString const &key) { > // calculate hash value > } > }; > > Linker message: > > Linking CXX executable fastq_reader > CMakeFiles/fastq_reader.dir/fastq_reader.cpp.o: In function > `std::_Hashtable >, > std::pair > const, unsigned int>, > std::allocator > const, > unsigned int> >, std::_Select1st seqan::Alloc > const, unsigned int> >, > std::equal_to > >, > std::hash > >, > std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, > std::__detail::_Prime_rehash_policy, false, false, > true>::find(seqan::String > const&)': > fastq_reader.cpp:(.text._ZNSt10_HashtableIN5seqan6StringIcNS0_5AllocIvEEEESt4pairIKS4_jESaIS7_ESt10_Select1stIS7_ESt8equal_toIS4_ESt4hashIS4_ENSt8__detail18_Mod_range_hashingENSF_20_Default_ranged_hashENSF_20_Prime_rehash_policyELb0ELb0ELb1EE4findERS6_[std::_Hashtable seqan::Alloc >, std::pair > > const, unsigned int>, std::allocator seqan::Alloc > const, unsigned int> >, > std::_Select1st > > const, unsigned int> >, std::equal_to seqan::Alloc > >, std::hash > > >, std::__detail::_Mod_range_hashing, > std::__detail::_Default_ranged_hash, > std::__detail::_Prime_rehash_policy, false, false, > true>::find(seqan::String > const&)]+0x8a): > undefined reference to `std::hash > > >::operator()(seqan::String >) const' > collect2: ld gab 1 als Ende-Status zurück > > > _______________________________________________ > seqan-dev mailing list > seqan-dev@lists.fu-berlin.de > https://lists.fu-berlin.de/listinfo/seqan-dev > > _______________________________________________ > seqan-dev mailing list > seqan-dev@lists.fu-berlin.de > https://lists.fu-berlin.de/listinfo/seqan-dev From weese@campus.fu-berlin.de Fri Sep 14 18:15:46 2012 Received: from outpost1.zedat.fu-berlin.de ([130.133.4.66]) by list1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TCYYS-00111X-V7>; Fri, 14 Sep 2012 18:15:45 +0200 Received: from relay2.zedat.fu-berlin.de ([130.133.4.80]) by outpost1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TCYYS-0006f0-QZ>; Fri, 14 Sep 2012 18:15:44 +0200 Received: from cas1.campus.fu-berlin.de ([130.133.170.201]) by relay2.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TCYYS-00010o-It>; Fri, 14 Sep 2012 18:15:44 +0200 Received: from EX02A.campus.fu-berlin.de ([130.133.170.132]) by CAS1.campus.fu-berlin.de ([130.133.170.201]) with mapi id 14.02.0318.001; Fri, 14 Sep 2012 18:15:43 +0200 From: "Weese, David" To: SeqAn Development Thread-Topic: [Seqan-dev] CharString as a key in an unordered_map Thread-Index: AQHNkZErIsl/h2yPxU2h+H6HPoQcg5eJL0AAgACoLoCAAAxIAA== Date: Fri, 14 Sep 2012 16:15:42 +0000 Message-ID: <371A096EE781A3428A8C8B8A58E5C0491A5BF745@ex02a.campus.fu-berlin.de> References: <5051A58C.30305@fu-berlin.de> <50534DE1.9080909@fu-berlin.de> In-Reply-To: <50534DE1.9080909@fu-berlin.de> Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: multipart/alternative; boundary="_000_371A096EE781A3428A8C8B8A58E5C0491A5BF745ex02acampusfube_" MIME-Version: 1.0 X-Originating-IP: 130.133.170.201 X-ZEDAT-Hint: A X-purgate: suspect X-purgate-type: suspect X-purgate-ID: 151147::1347639344-00000D73-37A8559B/3657658028-0/0-1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.003792, version=1.2.2 X-Spam-Flag: NO X-Spam-Status: No, score=-1.8 required=5.0 tests=ALL_TRUSTED, FU_XPURGATE_SUSP, HTML_MESSAGE X-Spam-Checker-Version: SpamAssassin 3.3.2 on Benin.ZEDAT.FU-Berlin.DE X-Spam-Level: Subject: Re: [Seqan-dev] CharString as a key in an unordered_map X-BeenThere: seqan-dev@lists.fu-berlin.de X-Mailman-Version: 2.1.14 Precedence: list Reply-To: SeqAn Development List-Id: SeqAn Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Sep 2012 16:15:46 -0000 --_000_371A096EE781A3428A8C8B8A58E5C0491A5BF745ex02acampusfube_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I think the operator mustn't mutate the hash functor, i.e. change size_t operator() (const CharString &key) { into: size_t operator() (const CharString &key) const { Regards, David -- David Weese weese@inf.fu-berlin.de Freie Universit=E4t Berlin http://www.inf.fu-berlin.de/ Institut f=FCr Informatik Phone: +49 30 838 75137 Takustra=DFe 9 Algorithmic Bioinformatics 14195 Berlin Room 020 Am 14.09.2012 um 17:31 schrieb Oliver Stolpe >: Hello, I tried to build something like in the example from Wikipedia: struct hashCharString { size_t operator() (const CharString &key) { Iterator::Type CharIt; size_t h_value =3D 7; for (CharIt =3D begin(key); CharIt !=3D end(key); goNext(CharIt)) { h_value ^=3D hash()(value(CharIt)); } return h_value; } }; The call is: unordered_map kmer; But it fails: /usr/include/c++/4.6/bits/hashtable_policy.h:753:25: Fehler: keine =DCberei= nstimmung f=FCr Aufruf von =BB(const hashCharString) (const seqan::String >&)=AB I'm a bit lost here. Oliver Am 14.09.2012 07:29, schrieb Holtgrewe, Manuel: Hi Oliver, does one of these solutions work? http://en.wikipedia.org/wiki/Unordered_associative_containers_(C%2B%2B)#Cus= tom_hash_functions *m ________________________________________ From: Oliver Stolpe [oliver.stolpe@fu-berlin.de] Sent: Thursday, September 13, 2012 11:21 AM To: seqan-dev@lists.fu-berlin.de Subject: [Seqan-dev] CharString as a key in an unordered_map Hello list, I try to use a SeqAn CharString as a key in an unordered_map (C++11). It fails when he tries to link. The linker message is posted below. I think the CharString type is not hashable, therefore I probably need to provide my own hash function (see below). Am I heading in the right direction? Before I start doing this I wanted to know why a string is hashable by the default function but not a CharString? Is there a trick to easily get around this? Thanks, Oliver This is my map structure: unordered_map I assume I have to do something like this to provide a hash function (found at stackoverflow): template<> struct hash { size_t operator() (CharString const &key) { // calculate hash value } }; Linker message: Linking CXX executable fastq_reader CMakeFiles/fastq_reader.dir/fastq_reader.cpp.o: In function `std::_Hashtable >, std::pair > const, unsigned int>, std::allocator > const, unsigned int> >, std::_Select1st > const, unsigned int> >, std::equal_to > >, std::hash > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, false, false, true>::find(seqan::String > const&)': fastq_reader.cpp:(.text._ZNSt10_HashtableIN5seqan6StringIcNS0_5AllocIvEEEES= t4pairIKS4_jESaIS7_ESt10_Select1stIS7_ESt8equal_toIS4_ESt4hashIS4_ENSt8__de= tail18_Mod_range_hashingENSF_20_Default_ranged_hashENSF_20_Prime_rehash_pol= icyELb0ELb0ELb1EE4findERS6_[std::_Hashtable >, std::pair > const, unsigned int>, std::allocator > const, unsigned int> >, std::_Select1st > const, unsigned int> >, std::equal_to > >, std::hash > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, false, false, true>::find(seqan::String > const&)]+0x8a): undefined reference to `std::hash > >::operator()(seqan::String >) const' collect2: ld gab 1 als Ende-Status zur=FCck _______________________________________________ seqan-dev mailing list seqan-dev@lists.fu-berlin.de https://lists.fu-berlin.de/listinfo/seqan-dev _______________________________________________ seqan-dev mailing list seqan-dev@lists.fu-berlin.de https://lists.fu-berlin.de/listinfo/seqan-dev _______________________________________________ seqan-dev mailing list seqan-dev@lists.fu-berlin.de https://lists.fu-berlin.de/listinfo/seqan-dev --_000_371A096EE781A3428A8C8B8A58E5C0491A5BF745ex02acampusfube_ Content-Type: text/html; charset="iso-8859-1" Content-ID: Content-Transfer-Encoding: quoted-printable Hi,

I think the operator mustn't mutate the hash functor, i.e. change

 size_t operator() (const CharString &= amp;key) {

into:

 size_t operator() (const CharString &= amp;key) const {


Regards,
David

--
David Weese weese@inf.fu-berlin.de
Freie Universit=E4t Berlin http://www.inf.fu-berlin.de/
Institut f=FCr Informatik Phone: +49 30 838 75137
Takustra=DFe 9 = Algorithmic Bioinformatics
14195 Berlin Room 020 

Am 14.09.2012 um 17:31 schrieb Oliver Stolpe <oliver.stolpe@fu-berlin.de>:

Hello,

I tried to build something like in the example from Wikipedia:

struct hashCharString {
 size_t operator() (const CharString &key) {
   Iterator<CharString>::Type CharIt;
   size_t h_value =3D 7;

   for (CharIt =3D begin(key); CharIt !=3D end(key); goNext(= CharIt)) {
     h_value ^=3D hash<char>()(value(CharIt)= );
   }

   return h_value;
 }
};

The call is:

unordered_map<CharString, unsigned int, hashCharString> kmer;

But it fails:

/usr/include/c++/4.6/bits/hashtable_policy.h:753:25: Fehler: keine = =DCbereinstimmung f=FCr Aufruf von =BB(const hashCharString) (const seqan::= String<char, seqan::Alloc<> >&)=AB

I'm a bit lost here.

Oliver


Am 14.09.2012 07:29, schrieb Holtgrewe, Manuel:
Hi Oliver,

does one of these solutions work?

http://en.wikipedia.org/wiki/Unordered_assoc= iative_containers_(C%2B%2B)#Custom_hash_functions

*m
________________________________________
From: Oliver Stolpe [oliver.stolpe@fu-berlin.de]
Sent: Thursday, September 13, 2012 11:21 AM
To: seqan-dev@lists.fu-berlin.de
Subject: [Seqan-dev] CharString as a key in an unordered_map

Hello list,

I try to use a SeqAn CharString as a key in an unordered_map (C++11= ). It
fails when he tries to link. The linker message is posted below. I think the CharString type is not hashable, therefore I probably need to
provide my own hash function (see below). Am I heading in the right
direction? Before I start doing this I wanted to know why a string is
hashable by the default function but not a CharString? Is there a trick
to easily get around this?

Thanks,
Oliver


This is my map structure:

unordered_map<CharString, unsigned int>

I assume I have to do something like this to provide a hash function
(found at stackoverflow):

template<>
struct hash<typename CharString> {
   size_t operator() (CharString const &key) {
      // calculate hash value
   }
};

Linker message:

Linking CXX executable fastq_reader
CMakeFiles/fastq_reader.dir/fastq_reader.cpp.o: In function
`std::_Hashtable<seqan::String<char, seqan::Alloc<void> >, std::pair<seqan::String<char, seqan::Alloc<void> > const, un= signed int>,
std::allocator<std::pair<seqan::String<char, seqan::Alloc<void&= gt; > const,
unsigned int> >, std::_Select1st<std::pair<seqan::String<cha= r,
seqan::Alloc<void> > const, unsigned int> >,
std::equal_to<seqan::String<char, seqan::Alloc<void> > >,=
std::hash<seqan::String<char, seqan::Alloc<void> > >,
std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash,
std::__detail::_Prime_rehash_policy, false, false,
true>::find(seqan::String<char, seqan::Alloc<void> > const&a= mp;)':
fastq_reader.cpp:(.text._ZNSt10_HashtableIN5seqan6StringIcNS0_5AllocIvEEEES= t4pairIKS4_jESaIS7_ESt10_Select1stIS7_ESt8equal_toIS4_ESt4hashIS4_ENSt8__de= tail18_Mod_range_hashingENSF_20_Default_ranged_hashENSF_20_Prime_rehash_pol= icyELb0ELb0ELb1EE4findERS6_[std::_Hashtable<seqan::String<char,
seqan::Alloc<void> >, std::pair<seqan::String<char, seqan::A= lloc<void> >
const, unsigned int>, std::allocator<std::pair<seqan::String<ch= ar,
seqan::Alloc<void> > const, unsigned int> >,
std::_Select1st<std::pair<seqan::String<char, seqan::Alloc<void= > >
const, unsigned int> >, std::equal_to<seqan::String<char,
seqan::Alloc<void> > >, std::hash<seqan::String<char, seq= an::Alloc<void>
 > >, std::__detail::_Mod_range_hashing,
std::__detail::_Default_ranged_hash,
std::__detail::_Prime_rehash_policy, false, false,
true>::find(seqan::String<char, seqan::Alloc<void> > const&a= mp;)]+0x8a):
undefined reference to `std::hash<seqan::String<char, seqan::Alloc<= ;void>
 > >::operator()(seqan::String<char, seqan::Alloc<void>= >) const'
collect2: ld gab 1 als Ende-Status zur=FCck


_______________________________________________
seqan-dev mailing list
seqan-dev@lists.fu-berlin.de
https://lists.fu-berlin.de/listinfo/seqan-dev

_______________________________________________
seqan-dev mailing list
seqan-dev@lists.fu-berlin.de
https://lists.fu-berlin.de/listinfo/seqan-dev


_______________________________________________
seqan-dev mailing list
seqan-dev@lists.fu-berlin.d= e
https://lists.fu-berlin.de/listinfo/seqan-dev

--_000_371A096EE781A3428A8C8B8A58E5C0491A5BF745ex02acampusfube_-- From oliver.stolpe@fu-berlin.de Fri Sep 14 19:55:36 2012 Received: from outpost1.zedat.fu-berlin.de ([130.133.4.66]) by list1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TCa75-00146P-E3>; Fri, 14 Sep 2012 19:55:35 +0200 Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TCa75-0001Nx-Am>; Fri, 14 Sep 2012 19:55:35 +0200 Received: from nat-wifi-autres.univ-rouen.fr ([193.52.161.170] helo=[10.0.182.159]) by inpost2.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtpsa (envelope-from ) id <1TCa74-0006LR-Cs>; Fri, 14 Sep 2012 19:55:35 +0200 Message-ID: <50536F91.7060809@fu-berlin.de> Date: Fri, 14 Sep 2012 19:55:29 +0200 From: Oliver Stolpe User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0 MIME-Version: 1.0 To: seqan-dev@lists.fu-berlin.de References: <5051A58C.30305@fu-berlin.de> <50534DE1.9080909@fu-berlin.de> <371A096EE781A3428A8C8B8A58E5C0491A5BF745@ex02a.campus.fu-berlin.de> In-Reply-To: <371A096EE781A3428A8C8B8A58E5C0491A5BF745@ex02a.campus.fu-berlin.de> Content-Type: multipart/alternative; boundary="------------000606020701080706010802" X-Originating-IP: 193.52.161.170 X-purgate: clean X-purgate-type: clean X-purgate-ID: 151147::1347645335-00000D73-23522896/0-0/0-0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000960, version=1.2.2 X-Spam-Flag: NO X-Spam-Status: No, score=-2.8 required=5.0 tests=ALL_TRUSTED,HTML_MESSAGE X-Spam-Checker-Version: SpamAssassin 3.3.2 on Benin.ZEDAT.FU-Berlin.DE X-Spam-Level: Subject: Re: [Seqan-dev] CharString as a key in an unordered_map X-BeenThere: seqan-dev@lists.fu-berlin.de X-Mailman-Version: 2.1.14 Precedence: list Reply-To: SeqAn Development List-Id: SeqAn Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Sep 2012 17:55:36 -0000 This is a multi-part message in MIME format. --------------000606020701080706010802 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Good thinking, David. That solved the problem, thanks a lot. Cheers, Oliver Am 14.09.2012 18:15, schrieb Weese, David: > Hi, > > I think the operator mustn't mutate the hash functor, i.e. change > > size_t operator() (const CharString &key) { > > into: > > size_t operator() (const CharString &key) const { > > > Regards, > David > > -- > David Weese weese@inf.fu-berlin.de > Freie Universität Berlin http://www.inf.fu-berlin.de/ > Institut für Informatik Phone: +49 30 838 75137 > Takustraße 9 Algorithmic Bioinformatics > 14195 Berlin Room 020 > > Am 14.09.2012 um 17:31 schrieb Oliver Stolpe >: > > Hello, > > I tried to build something like in the example from Wikipedia: > > struct hashCharString { > size_t operator() (const CharString &key) { > Iterator::Type CharIt; > size_t h_value = 7; > > for (CharIt = begin(key); CharIt != end(key); goNext(CharIt)) { > h_value ^= hash()(value(CharIt)); > } > > return h_value; > } > }; > > The call is: > > unordered_map kmer; > > But it fails: > > /usr/include/c++/4.6/bits/hashtable_policy.h:753:25: Fehler: keine Übereinstimmung für Aufruf von »(const hashCharString) (const seqan::String >&)« > > I'm a bit lost here. > > Oliver > > > Am 14.09.2012 07:29, schrieb Holtgrewe, Manuel: > Hi Oliver, > > does one of these solutions work? > > http://en.wikipedia.org/wiki/Unordered_associative_containers_(C%2B%2B)#Custom_hash_functions > > *m > ________________________________________ > From: Oliver Stolpe [oliver.stolpe@fu-berlin.de] > Sent: Thursday, September 13, 2012 11:21 AM > To: seqan-dev@lists.fu-berlin.de > Subject: [Seqan-dev] CharString as a key in an unordered_map > > Hello list, > > I try to use a SeqAn CharString as a key in an unordered_map (C++11). It > fails when he tries to link. The linker message is posted below. I think > the CharString type is not hashable, therefore I probably need to > provide my own hash function (see below). Am I heading in the right > direction? Before I start doing this I wanted to know why a string is > hashable by the default function but not a CharString? Is there a trick > to easily get around this? > > Thanks, > Oliver > > > This is my map structure: > > unordered_map > > I assume I have to do something like this to provide a hash function > (found at stackoverflow): > > template<> > struct hash { > size_t operator() (CharString const &key) { > // calculate hash value > } > }; > > Linker message: > > Linking CXX executable fastq_reader > CMakeFiles/fastq_reader.dir/fastq_reader.cpp.o: In function > `std::_Hashtable >, > std::pair > const, unsigned int>, > std::allocator > const, > unsigned int> >, std::_Select1st seqan::Alloc > const, unsigned int> >, > std::equal_to > >, > std::hash > >, > std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, > std::__detail::_Prime_rehash_policy, false, false, > true>::find(seqan::String > const&)': > fastq_reader.cpp:(.text._ZNSt10_HashtableIN5seqan6StringIcNS0_5AllocIvEEEESt4pairIKS4_jESaIS7_ESt10_Select1stIS7_ESt8equal_toIS4_ESt4hashIS4_ENSt8__detail18_Mod_range_hashingENSF_20_Default_ranged_hashENSF_20_Prime_rehash_policyELb0ELb0ELb1EE4findERS6_[std::_Hashtable seqan::Alloc >, std::pair > > const, unsigned int>, std::allocator seqan::Alloc > const, unsigned int> >, > std::_Select1st > > const, unsigned int> >, std::equal_to seqan::Alloc > >, std::hash > > >, std::__detail::_Mod_range_hashing, > std::__detail::_Default_ranged_hash, > std::__detail::_Prime_rehash_policy, false, false, > true>::find(seqan::String > const&)]+0x8a): > undefined reference to `std::hash > > >::operator()(seqan::String >) const' > collect2: ld gab 1 als Ende-Status zurück > > > _______________________________________________ > seqan-dev mailing list > seqan-dev@lists.fu-berlin.de > https://lists.fu-berlin.de/listinfo/seqan-dev > > _______________________________________________ > seqan-dev mailing list > seqan-dev@lists.fu-berlin.de > https://lists.fu-berlin.de/listinfo/seqan-dev > > > _______________________________________________ > seqan-dev mailing list > seqan-dev@lists.fu-berlin.de > https://lists.fu-berlin.de/listinfo/seqan-dev > > > > > _______________________________________________ > seqan-dev mailing list > seqan-dev@lists.fu-berlin.de > https://lists.fu-berlin.de/listinfo/seqan-dev --------------000606020701080706010802 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
Good thinking, David. That solved the problem, thanks a lot.

Cheers,
Oliver


Am 14.09.2012 18:15, schrieb Weese, David:
Hi,

I think the operator mustn't mutate the hash functor, i.e. change

 size_t operator() (const CharString &key) {

into:

 size_t operator() (const CharString &key) const {


Regards,
David

--
David Weese weese@inf.fu-berlin.de<mailto:weese@inf.fu-berlin.de>
Freie Universität Berlin http://www.inf.fu-berlin.de/
Institut für Informatik Phone: +49 30 838 75137
Takustraße 9 Algorithmic Bioinformatics
14195 Berlin Room 020

Am 14.09.2012 um 17:31 schrieb Oliver Stolpe <oliver.stolpe@fu-berlin.de<mailto:oliver.stolpe@fu-berlin.de>>:

Hello,

I tried to build something like in the example from Wikipedia:

struct hashCharString {
 size_t operator() (const CharString &key) {
   Iterator<CharString>::Type CharIt;
   size_t h_value = 7;

   for (CharIt = begin(key); CharIt != end(key); goNext(CharIt)) {
     h_value ^= hash<char>()(value(CharIt));
   }

   return h_value;
 }
};

The call is:

unordered_map<CharString, unsigned int, hashCharString> kmer;

But it fails:

/usr/include/c++/4.6/bits/hashtable_policy.h:753:25: Fehler: keine Übereinstimmung für Aufruf von »(const hashCharString) (const seqan::String<char, seqan::Alloc<> >&)«

I'm a bit lost here.

Oliver


Am 14.09.2012 07:29, schrieb Holtgrewe, Manuel:
Hi Oliver,

does one of these solutions work?

http://en.wikipedia.org/wiki/Unordered_associative_containers_(C%2B%2B)#Custom_hash_functions

*m
________________________________________
From: Oliver Stolpe [oliver.stolpe@fu-berlin.de]
Sent: Thursday, September 13, 2012 11:21 AM
To: seqan-dev@lists.fu-berlin.de
Subject: [Seqan-dev] CharString as a key in an unordered_map

Hello list,

I try to use a SeqAn CharString as a key in an unordered_map (C++11). It
fails when he tries to link. The linker message is posted below. I think
the CharString type is not hashable, therefore I probably need to
provide my own hash function (see below). Am I heading in the right
direction? Before I start doing this I wanted to know why a string is
hashable by the default function but not a CharString? Is there a trick
to easily get around this?

Thanks,
Oliver


This is my map structure:

unordered_map<CharString, unsigned int>

I assume I have to do something like this to provide a hash function
(found at stackoverflow):

template<>
struct hash<typename CharString> {
   size_t operator() (CharString const &key) {
      // calculate hash value
   }
};

Linker message:

Linking CXX executable fastq_reader
CMakeFiles/fastq_reader.dir/fastq_reader.cpp.o: In function
`std::_Hashtable<seqan::String<char, seqan::Alloc<void> >,
std::pair<seqan::String<char, seqan::Alloc<void> > const, unsigned int>,
std::allocator<std::pair<seqan::String<char, seqan::Alloc<void> > const,
unsigned int> >, std::_Select1st<std::pair<seqan::String<char,
seqan::Alloc<void> > const, unsigned int> >,
std::equal_to<seqan::String<char, seqan::Alloc<void> > >,
std::hash<seqan::String<char, seqan::Alloc<void> > >,
std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash,
std::__detail::_Prime_rehash_policy, false, false,
true>::find(seqan::String<char, seqan::Alloc<void> > const&)':
fastq_reader.cpp:(.text._ZNSt10_HashtableIN5seqan6StringIcNS0_5AllocIvEEEESt4pairIKS4_jESaIS7_ESt10_Select1stIS7_ESt8equal_toIS4_ESt4hashIS4_ENSt8__detail18_Mod_range_hashingENSF_20_Default_ranged_hashENSF_20_Prime_rehash_policyELb0ELb0ELb1EE4findERS6_[std::_Hashtable<seqan::String<char,
seqan::Alloc<void> >, std::pair<seqan::String<char, seqan::Alloc<void> >
const, unsigned int>, std::allocator<std::pair<seqan::String<char,
seqan::Alloc<void> > const, unsigned int> >,
std::_Select1st<std::pair<seqan::String<char, seqan::Alloc<void> >
const, unsigned int> >, std::equal_to<seqan::String<char,
seqan::Alloc<void> > >, std::hash<seqan::String<char, seqan::Alloc<void>
 > >, std::__detail::_Mod_range_hashing,
std::__detail::_Default_ranged_hash,
std::__detail::_Prime_rehash_policy, false, false,
true>::find(seqan::String<char, seqan::Alloc<void> > const&)]+0x8a):
undefined reference to `std::hash<seqan::String<char, seqan::Alloc<void>
 > >::operator()(seqan::String<char, seqan::Alloc<void> >) const'
collect2: ld gab 1 als Ende-Status zurück


_______________________________________________
seqan-dev mailing list
seqan-dev@lists.fu-berlin.de
https://lists.fu-berlin.de/listinfo/seqan-dev

_______________________________________________
seqan-dev mailing list
seqan-dev@lists.fu-berlin.de
https://lists.fu-berlin.de/listinfo/seqan-dev


_______________________________________________
seqan-dev mailing list
seqan-dev@lists.fu-berlin.de<mailto:seqan-dev@lists.fu-berlin.de>
https://lists.fu-berlin.de/listinfo/seqan-dev




_______________________________________________
seqan-dev mailing list
seqan-dev@lists.fu-berlin.de
https://lists.fu-berlin.de/listinfo/seqan-dev

--------------000606020701080706010802-- From jakob.schulze@fu-berlin.de Tue Sep 18 10:49:59 2012 Received: from outpost1.zedat.fu-berlin.de ([130.133.4.66]) by list1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TDtVG-003kur-KZ>; Tue, 18 Sep 2012 10:49:59 +0200 Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TDtVG-0003g5-HE>; Tue, 18 Sep 2012 10:49:58 +0200 Received: from 91-65-217-254-dynip.superkabel.de ([91.65.217.254] helo=[192.168.2.101]) by inpost2.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtpsa (envelope-from ) id <1TDtVG-0008KZ-Cf>; Tue, 18 Sep 2012 10:49:58 +0200 Message-ID: <505835B1.8030201@fu-berlin.de> Date: Tue, 18 Sep 2012 10:49:53 +0200 From: Jakob Schulze User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20120724 Icedove/3.0.11 MIME-Version: 1.0 To: seqan-dev@lists.fu-berlin.de Content-Type: multipart/mixed; boundary="------------050608060705010502010604" X-Originating-IP: 91.65.217.254 X-purgate: clean X-purgate-type: clean X-purgate-ID: 151147::1347958198-00000D73-6DAA647E/0-0/0-0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.311720, version=1.2.2 X-Spam-Flag: NO X-Spam-Status: No, score=-2.8 required=5.0 tests=ALL_TRUSTED X-Spam-Checker-Version: SpamAssassin 3.3.2 on Algerien.ZEDAT.FU-Berlin.DE X-Spam-Level: Subject: [Seqan-dev] parseString funktion in a Trie X-BeenThere: seqan-dev@lists.fu-berlin.de X-Mailman-Version: 2.1.14 Precedence: list Reply-To: SeqAn Development List-Id: SeqAn Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Sep 2012 08:49:59 -0000 This is a multi-part message in MIME format. --------------050608060705010502010604 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, I constructed a Trie with createTrie and then I tried to call parseString. The following error message came up: seqan-trunk/core/include/seqan/graph_types/graph_impl_automaton.h:905 Assertion failed : idInUse(g.data_id_managerV, vertex) should be true but was 0 When I broke my program down, I saw that my parseString call does not work at all. (But the error message vanished mysteriously) It should store the final Vertex, but it doesn't. Regards, Jakob Here my little code example: (without error message) #include #include #include using namespace seqan; using namespace std; int main() { typedef Graph > TGraph; typedef VertexDescriptor::Type TVertexDescriptor; String > terminalStateMap; TGraph g; String sequenceList; appendValue(sequenceList, "aat"); appendValue(sequenceList, "aac"); createTrie(g, terminalStateMap, sequenceList); DnaString str; appendValue(str, 'c'); appendValue(str, 'a'); appendValue(str, 'a'); appendValue(str, 'c'); Iterator::Type itBegin = begin(str) + 1; Iterator::Type itEnd = end(str); TVertexDescriptor finalVertex = getRoot(g); parseString(g, finalVertex, itBegin, itEnd); cout << "finalVertex = " << finalVertex << endl; cout << "finalVertex == root" << "\t" << isRoot(g, finalVertex) << endl; return 0; } Output: finalVertex = 0 finalVertex == root 1 --------------050608060705010502010604 Content-Type: text/x-c++src; name="parseStringInTrie.cpp" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="parseStringInTrie.cpp" #include #include #include using namespace seqan; using namespace std; int main() { typedef Graph > TGraph; typedef VertexDescriptor::Type TVertexDescriptor; String > terminalStateMap; TGraph g; String sequenceList; appendValue(sequenceList, "aat"); appendValue(sequenceList, "aac"); createTrie(g, terminalStateMap, sequenceList); DnaString str; appendValue(str, 'c'); appendValue(str, 'a'); appendValue(str, 'a'); appendValue(str, 'c'); Iterator::Type itBegin = begin(str) + 1; Iterator::Type itEnd = end(str); TVertexDescriptor finalVertex = getRoot(g); parseString(g, finalVertex, itBegin, itEnd); cout << "finalVertex = " << finalVertex << endl; cout << "finalVertex == root" << "\t" << isRoot(g, finalVertex) << endl; return 0; } --------------050608060705010502010604-- From manuel.holtgrewe@fu-berlin.de Tue Sep 18 11:16:12 2012 Received: from outpost1.zedat.fu-berlin.de ([130.133.4.66]) by list1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TDtuc-003lib-QB>; Tue, 18 Sep 2012 11:16:10 +0200 Received: from relay2.zedat.fu-berlin.de ([130.133.4.80]) by outpost1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TDtuc-0001YD-Me>; Tue, 18 Sep 2012 11:16:10 +0200 Received: from cas2.campus.fu-berlin.de ([130.133.170.202]) by relay2.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TDtuc-0000HJ-Fd>; Tue, 18 Sep 2012 11:16:10 +0200 Received: from EX02A.campus.fu-berlin.de ([130.133.170.132]) by CAS2.campus.fu-berlin.de ([130.133.170.202]) with mapi id 14.02.0318.001; Tue, 18 Sep 2012 11:16:09 +0200 From: "Holtgrewe, Manuel" To: SeqAn Development Thread-Topic: [Seqan-dev] parseString funktion in a Trie Thread-Index: AQHNlXqbyH6KEu1XokulNAszMvH1uJePz2VF Date: Tue, 18 Sep 2012 09:16:08 +0000 Message-ID: References: <505835B1.8030201@fu-berlin.de> In-Reply-To: <505835B1.8030201@fu-berlin.de> Accept-Language: en-US, de-DE Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: Content-Type: multipart/mixed; boundary="_002_FCCAB9D80C3DAB47B5601C5B0E62872B19A33072ex02acampusfube_" MIME-Version: 1.0 X-Originating-IP: 130.133.170.202 X-ZEDAT-Hint: A X-purgate: clean X-purgate-type: clean X-purgate-ID: 151147::1347959770-00000D73-45C19A93/0-0/0-0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000017, version=1.2.2 X-Spam-Flag: NO X-Spam-Status: No, score=-2.8 required=5.0 tests=ALL_TRUSTED X-Spam-Checker-Version: SpamAssassin 3.3.2 on Burundi.ZEDAT.FU-Berlin.DE X-Spam-Level: Subject: Re: [Seqan-dev] parseString funktion in a Trie X-BeenThere: seqan-dev@lists.fu-berlin.de X-Mailman-Version: 2.1.14 Precedence: list Reply-To: SeqAn Development List-Id: SeqAn Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Sep 2012 09:16:12 -0000 --_002_FCCAB9D80C3DAB47B5601C5B0E62872B19A33072ex02acampusfube_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable As a side node: You can print your trie (and other graphs in SeqAn) in .dot= format using the following line. You can visualize the results using the g= raphviz package.=0A= =0A= write(cout, g, DotDrawing());=0A= =0A= What exactly is it that you want to achieve?=0A= =0A= The function parseString returns the target vertex descriptor:=0A= =0A= http://docs.seqan.de/seqan/dev/FUNCTION.parse_String.html=0A= =0A= Attached is a slightly modified version of your example:=0A= =0A= (1) The trie is printed to stdout using write().=0A= (2) The query string is built simply by assigment from a C-style string.=0A= (3) I use finalVertex =3D parseString(g, getRoot(g), itBegin, itEnd); since= this is probably what you want to do.=0A= =0A= HTH=0A= =0A= *m=0A= ________________________________________=0A= From: Jakob Schulze [jakob.schulze@fu-berlin.de]=0A= Sent: Tuesday, September 18, 2012 10:49 AM=0A= To: seqan-dev@lists.fu-berlin.de=0A= Subject: [Seqan-dev] parseString funktion in a Trie=0A= =0A= Hi,=0A= I constructed a Trie with createTrie and then I tried to call=0A= parseString. The following error message came up:=0A= seqan-trunk/core/include/seqan/graph_types/graph_impl_automaton.h:905=0A= Assertion failed : idInUse(g.data_id_managerV, vertex) should be true=0A= but was 0=0A= =0A= When I broke my program down, I saw that my parseString call does not=0A= work at all. (But the error message vanished mysteriously) It should=0A= store the final Vertex, but it doesn't.=0A= =0A= Regards,=0A= Jakob=0A= =0A= =0A= =0A= Here my little code example: (without error message)=0A= =0A= #include =0A= #include =0A= #include =0A= using namespace seqan;=0A= using namespace std;=0A= =0A= int main() {=0A= =0A= typedef Graph > TGraph;=0A= typedef VertexDescriptor::Type TVertexDescriptor;=0A= String > terminalStateMap;=0A= TGraph g;=0A= String sequenceList;=0A= =0A= appendValue(sequenceList, "aat");=0A= appendValue(sequenceList, "aac");=0A= createTrie(g, terminalStateMap, sequenceList);=0A= =0A= DnaString str;=0A= appendValue(str, 'c');=0A= appendValue(str, 'a');=0A= appendValue(str, 'a');=0A= appendValue(str, 'c');=0A= Iterator::Type itBegin =3D begin(str) + 1;=0A= Iterator::Type itEnd =3D end(str);=0A= TVertexDescriptor finalVertex =3D getRoot(g);=0A= =0A= parseString(g, finalVertex, itBegin, itEnd);=0A= cout << "finalVertex =3D " << finalVertex << endl;=0A= cout << "finalVertex =3D=3D root" << "\t" << isRoot(g, finalVertex) <<= =0A= endl;=0A= return 0;=0A= }=0A= =0A= Output:=0A= finalVertex =3D 0=0A= finalVertex =3D=3D root 1=0A= =0A= --_002_FCCAB9D80C3DAB47B5601C5B0E62872B19A33072ex02acampusfube_ Content-Type: text/x-c++src; name="parseStringInTrie.cpp" Content-Description: parseStringInTrie.cpp Content-Disposition: attachment; filename="parseStringInTrie.cpp"; size=895; creation-date="Tue, 18 Sep 2012 09:16:01 GMT"; modification-date="Tue, 18 Sep 2012 09:16:01 GMT" Content-Transfer-Encoding: base64 I2luY2x1ZGUgPGlvc3RyZWFtPg0KI2luY2x1ZGUgPHNlcWFuL2dyYXBoX2FsZ29yaXRobXMuaD4N CiNpbmNsdWRlIDxzZXFhbi9ncmFwaF90eXBlcy5oPg0KdXNpbmcgbmFtZXNwYWNlIHNlcWFuOw0K dXNpbmcgbmFtZXNwYWNlIHN0ZDsNCg0KaW50IG1haW4oKSB7DQoNCgl0eXBlZGVmIEdyYXBoPEF1 dG9tYXRvbjxEbmE+ID4gVEdyYXBoOw0KCXR5cGVkZWYgVmVydGV4RGVzY3JpcHRvcjxUR3JhcGg+ OjpUeXBlIFRWZXJ0ZXhEZXNjcmlwdG9yOw0KCVN0cmluZzxTdHJpbmc8dW5zaWduZWQgaW50PiA+ IHRlcm1pbmFsU3RhdGVNYXA7DQoJVEdyYXBoIGc7DQoJU3RyaW5nPENoYXJTdHJpbmc+IHNlcXVl bmNlTGlzdDsNCg0KCWFwcGVuZFZhbHVlKHNlcXVlbmNlTGlzdCwgImFhdCIpOw0KCWFwcGVuZFZh bHVlKHNlcXVlbmNlTGlzdCwgImFhYyIpOw0KCWNyZWF0ZVRyaWUoZywgdGVybWluYWxTdGF0ZU1h cCwgc2VxdWVuY2VMaXN0KTsNCg0KCURuYVN0cmluZyBzdHIgPSAiY2FhYyI7DQoJSXRlcmF0b3I8 RG5hPjo6VHlwZSBpdEJlZ2luID0gYmVnaW4oc3RyKSArIDE7DQoJSXRlcmF0b3I8RG5hPjo6VHlw ZSBpdEVuZCA9IGVuZChzdHIpOw0KCVRWZXJ0ZXhEZXNjcmlwdG9yIGZpbmFsVmVydGV4ID0gZ2V0 TmlsPFRWZXJ0ZXhEZXNjcmlwdG9yPigpOw0KDQoJZmluYWxWZXJ0ZXggPSBwYXJzZVN0cmluZyhn LCBnZXRSb290KGcpLCBpdEJlZ2luLCBpdEVuZCk7DQoJY291dCA8PCAiZmluYWxWZXJ0ZXggPSAi IDw8IGZpbmFsVmVydGV4IDw8IGVuZGw7DQoJY291dCA8PCAiZmluYWxWZXJ0ZXggPT0gcm9vdCIg PDwgIlx0IiA8PCBpc1Jvb3QoZywgZmluYWxWZXJ0ZXgpIDw8IGVuZGw7DQoJDQoJd3JpdGUoY291 dCwgZywgRG90RHJhd2luZygpKTsNCgkNCglyZXR1cm4gMDsNCn0NCg== --_002_FCCAB9D80C3DAB47B5601C5B0E62872B19A33072ex02acampusfube_-- From jakob.schulze@fu-berlin.de Tue Sep 18 11:34:00 2012 Received: from outpost1.zedat.fu-berlin.de ([130.133.4.66]) by list1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TDuBq-003mLW-H4>; Tue, 18 Sep 2012 11:33:58 +0200 Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TDuBq-0005Yf-DW>; Tue, 18 Sep 2012 11:33:58 +0200 Received: from 91-65-217-254-dynip.superkabel.de ([91.65.217.254] helo=[192.168.2.101]) by inpost2.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtpsa (envelope-from ) id <1TDuBq-00068T-6A>; Tue, 18 Sep 2012 11:33:58 +0200 Message-ID: <50583FFF.2000605@fu-berlin.de> Date: Tue, 18 Sep 2012 11:33:51 +0200 From: Jakob Schulze User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20120724 Icedove/3.0.11 MIME-Version: 1.0 To: seqan-dev@lists.fu-berlin.de References: <505835B1.8030201@fu-berlin.de> In-Reply-To: Content-Type: multipart/alternative; boundary="------------090703040700040908080305" X-Originating-IP: 91.65.217.254 X-purgate: clean X-purgate-type: clean X-purgate-ID: 151147::1347960838-00000D73-D274AD01/0-0/0-0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000160, version=1.2.2 X-Spam-Flag: NO X-Spam-Status: No, score=-2.8 required=5.0 tests=ALL_TRUSTED,HTML_MESSAGE X-Spam-Checker-Version: SpamAssassin 3.3.2 on Gabun.ZEDAT.FU-Berlin.DE X-Spam-Level: Subject: Re: [Seqan-dev] parseString funktion in a Trie X-BeenThere: seqan-dev@lists.fu-berlin.de X-Mailman-Version: 2.1.14 Precedence: list Reply-To: SeqAn Development List-Id: SeqAn Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Sep 2012 09:34:00 -0000 This is a multi-part message in MIME format. --------------090703040700040908080305 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Thanks that solved the problem so far. I got confused with the parameter and the return value, but it's clear now. Jakob > As a side node: You can print your trie (and other graphs in SeqAn) in .dot format using the following line. You can visualize the results using the graphviz package. > > write(cout, g, DotDrawing()); > > What exactly is it that you want to achieve? > > The function parseString returns the target vertex descriptor: > > http://docs.seqan.de/seqan/dev/FUNCTION.parse_String.html > > Attached is a slightly modified version of your example: > > (1) The trie is printed to stdout using write(). > (2) The query string is built simply by assigment from a C-style string. > (3) I use finalVertex = parseString(g, getRoot(g), itBegin, itEnd); since this is probably what you want to do. > > HTH > > *m > ________________________________________ > From: Jakob Schulze [jakob.schulze@fu-berlin.de] > Sent: Tuesday, September 18, 2012 10:49 AM > To:seqan-dev@lists.fu-berlin.de > Subject: [Seqan-dev] parseString funktion in a Trie > > Hi, > I constructed a Trie with createTrie and then I tried to call > parseString. The following error message came up: > seqan-trunk/core/include/seqan/graph_types/graph_impl_automaton.h:905 > Assertion failed : idInUse(g.data_id_managerV, vertex) should be true > but was 0 > > When I broke my program down, I saw that my parseString call does not > work at all. (But the error message vanished mysteriously) It should > store the final Vertex, but it doesn't. > > Regards, > Jakob > > > > Here my little code example: (without error message) > > #include > #include > #include > using namespace seqan; > using namespace std; > > int main() { > > typedef Graph > TGraph; > typedef VertexDescriptor::Type TVertexDescriptor; > String > terminalStateMap; > TGraph g; > String sequenceList; > > appendValue(sequenceList, "aat"); > appendValue(sequenceList, "aac"); > createTrie(g, terminalStateMap, sequenceList); > > DnaString str; > appendValue(str, 'c'); > appendValue(str, 'a'); > appendValue(str, 'a'); > appendValue(str, 'c'); > Iterator::Type itBegin = begin(str) + 1; > Iterator::Type itEnd = end(str); > TVertexDescriptor finalVertex = getRoot(g); > > parseString(g, finalVertex, itBegin, itEnd); > cout<< "finalVertex = "<< finalVertex<< endl; > cout<< "finalVertex == root"<< "\t"<< isRoot(g, finalVertex)<< > endl; > return 0; > } > > Output: > finalVertex = 0 > finalVertex == root 1 > > > parseStringInTrie.cpp > > > #include > #include > #include > using namespace seqan; > using namespace std; > > int main() { > > typedef Graph > TGraph; > typedef VertexDescriptor::Type TVertexDescriptor; > String > terminalStateMap; > TGraph g; > String sequenceList; > > appendValue(sequenceList, "aat"); > appendValue(sequenceList, "aac"); > createTrie(g, terminalStateMap, sequenceList); > > DnaString str = "caac"; > Iterator::Type itBegin = begin(str) + 1; > Iterator::Type itEnd = end(str); > TVertexDescriptor finalVertex = getNil(); > > finalVertex = parseString(g, getRoot(g), itBegin, itEnd); > cout<< "finalVertex = "<< finalVertex<< endl; > cout<< "finalVertex == root"<< "\t"<< isRoot(g, finalVertex)<< endl; > > write(cout, g, DotDrawing()); > > return 0; > } > > > > _______________________________________________ > seqan-dev mailing list > seqan-dev@lists.fu-berlin.de > https://lists.fu-berlin.de/listinfo/seqan-dev > --------------090703040700040908080305 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Thanks that solved the problem so far.
I got confused with the parameter and the return value, but it's clear now.

Jakob

As a side node: You can print your trie (and other graphs in SeqAn) in .dot format using the following line. You can visualize the results using the graphviz package.

	write(cout, g, DotDrawing());

What exactly is it that you want to achieve?

The function parseString returns the target vertex descriptor:

http://docs.seqan.de/seqan/dev/FUNCTION.parse_String.html

Attached is a slightly modified version of your example:

(1) The trie is printed to stdout using write().
(2) The query string is built simply by assigment from a C-style string.
(3) I use finalVertex = parseString(g, getRoot(g), itBegin, itEnd); since this is probably what you want to do.

HTH

*m
________________________________________
From: Jakob Schulze [jakob.schulze@fu-berlin.de]
Sent: Tuesday, September 18, 2012 10:49 AM
To: seqan-dev@lists.fu-berlin.de
Subject: [Seqan-dev] parseString funktion in a Trie

Hi,
I constructed a Trie with createTrie and then I tried to call
parseString. The following error message came up:
seqan-trunk/core/include/seqan/graph_types/graph_impl_automaton.h:905
Assertion failed : idInUse(g.data_id_managerV, vertex) should be true
but was 0

When I broke my program down, I saw that my parseString call does not
work at all. (But the error message vanished mysteriously) It should
store the final Vertex, but it doesn't.

Regards,
Jakob



Here my little code example: (without error message)

#include <iostream>
#include <seqan/graph_algorithms.h>
#include <seqan/graph_types.h>
using namespace seqan;
using namespace std;

int main() {

     typedef Graph<Automaton<Dna> > TGraph;
     typedef VertexDescriptor<TGraph>::Type TVertexDescriptor;
     String<String<unsigned int> > terminalStateMap;
     TGraph g;
     String<CharString> sequenceList;

     appendValue(sequenceList, "aat");
     appendValue(sequenceList, "aac");
     createTrie(g, terminalStateMap, sequenceList);

     DnaString str;
     appendValue(str, 'c');
     appendValue(str, 'a');
     appendValue(str, 'a');
     appendValue(str, 'c');
     Iterator<Dna>::Type itBegin = begin(str) + 1;
     Iterator<Dna>::Type itEnd = end(str);
     TVertexDescriptor finalVertex = getRoot(g);

     parseString(g, finalVertex, itBegin, itEnd);
     cout << "finalVertex = " << finalVertex << endl;
     cout << "finalVertex == root" << "\t" << isRoot(g, finalVertex) <<
endl;
     return 0;
}

Output:
finalVertex = 0
finalVertex == root    1

  
parseStringInTrie.cpp
#include <iostream> #include <seqan/graph_algorithms.h> #include <seqan/graph_types.h> using namespace seqan; using namespace std; int main() { typedef Graph<Automaton<Dna> > TGraph; typedef VertexDescriptor<TGraph>::Type TVertexDescriptor; String<String<unsigned int> > terminalStateMap; TGraph g; String<CharString> sequenceList; appendValue(sequenceList, "aat"); appendValue(sequenceList, "aac"); createTrie(g, terminalStateMap, sequenceList); DnaString str = "caac"; Iterator<Dna>::Type itBegin = begin(str) + 1; Iterator<Dna>::Type itEnd = end(str); TVertexDescriptor finalVertex = getNil<TVertexDescriptor>(); finalVertex = parseString(g, getRoot(g), itBegin, itEnd); cout << "finalVertex = " << finalVertex << endl; cout << "finalVertex == root" << "\t" << isRoot(g, finalVertex) << endl; write(cout, g, DotDrawing()); return 0; }
_______________________________________________ seqan-dev mailing list seqan-dev@lists.fu-berlin.de https://lists.fu-berlin.de/listinfo/seqan-dev
--------------090703040700040908080305-- From bakaric@evolbio.mpg.de Mon Sep 24 11:40:22 2012 Received: from relay1.zedat.fu-berlin.de ([130.133.4.67]) by list1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TG59J-003u9U-95>; Mon, 24 Sep 2012 11:40:21 +0200 Received: from zimbra.evolbio.mpg.de ([141.5.8.20]) by relay1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TG59J-0017ua-6s>; Mon, 24 Sep 2012 11:40:21 +0200 Received: from localhost (localhost [127.0.0.1]) by zimbra.evolbio.mpg.de (Postfix) with ESMTP id 3A37A2CFA76D for ; Mon, 24 Sep 2012 11:40:16 +0200 (CEST) Received: from zimbra.evolbio.mpg.de ([127.0.0.1]) by localhost (zimbra.evolbio.mpg.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hhnn+ctyPxhA for ; Mon, 24 Sep 2012 11:40:15 +0200 (CEST) Received: from [172.16.2.79] (evolgen079.evolbio.mpg.de [172.16.2.79]) by zimbra.evolbio.mpg.de (Postfix) with ESMTPSA id 99F882CFA761 for ; Mon, 24 Sep 2012 11:40:15 +0200 (CEST) Message-ID: <50602AA3.5020909@evolbio.mpg.de> Date: Mon, 24 Sep 2012 11:40:51 +0200 From: Robert Bakaric User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0 MIME-Version: 1.0 To: seqan-dev@lists.fu-berlin.de Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: 141.5.8.20 X-purgate: clean X-purgate-type: clean X-purgate-ID: 151147::1348479621-00000D73-0DA5CCC8/0-0/0-0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.004652, version=1.2.2 X-Spam-Flag: NO X-Spam-Status: No, score=0.0 required=5.0 tests=none X-Spam-Checker-Version: SpamAssassin 3.3.2 on Botsuana.ZEDAT.FU-Berlin.DE X-Spam-Level: Subject: [Seqan-dev] ESA computation X-BeenThere: seqan-dev@lists.fu-berlin.de X-Mailman-Version: 2.1.14 Precedence: list Reply-To: SeqAn Development List-Id: SeqAn Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 09:40:22 -0000 Hi, I have a very basic question and it relates to constructing suffix arrays. I know that i can construct and an SA by invoking : createSuffixArray(); function and if i want a specific algorithm i do this : createSuffixArray(SA, seq, BwtWalk()); Now, when i want to compute LCP i saw this example: indexRequire(myIndex, EsaLcp()); How do i specify that my SA in this case should be created with the same BWT algorithm as in the case above. concrete example: : seqan::String > mmapString; if (!open(mmapString, toCString(options.inputFileName), seqan::OPEN_RDONLY)) return 1; // Could not open file. // Create RecordReader. seqan::RecordReader >, seqan::DoublePass > reader(mmapString); // Read file in one pass. seqan::StringSet ids; seqan::StringSet seqs; if (read2(ids, seqs, reader, Fasta()) != 0) return 1; // Could not read file. typedef Index< StringSet > > TMyIndex; TMyIndex myIndex(seqs); indexRequire(myIndex, EsaLcp()); : Thank you From manuel.holtgrewe@fu-berlin.de Mon Sep 24 17:15:26 2012 Received: from outpost1.zedat.fu-berlin.de ([130.133.4.66]) by list1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TGANY-0045wt-VG>; Mon, 24 Sep 2012 17:15:25 +0200 Received: from relay2.zedat.fu-berlin.de ([130.133.4.80]) by outpost1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TGANY-003Y4Y-U2>; Mon, 24 Sep 2012 17:15:24 +0200 Received: from cas2.campus.fu-berlin.de ([130.133.170.202]) by relay2.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TGANY-003bQH-PT>; Mon, 24 Sep 2012 17:15:24 +0200 Received: from EX02A.campus.fu-berlin.de ([130.133.170.132]) by CAS2.campus.fu-berlin.de ([130.133.170.202]) with mapi id 14.02.0318.001; Mon, 24 Sep 2012 17:15:24 +0200 From: "Holtgrewe, Manuel" To: "seqan-dev@lists.fu-berlin.de" Thread-Topic: [ANN] SeqAn SVN Migration Thread-Index: Ac2aZwBdDPaRm9uNTdasGzmA2j/8PA== Date: Mon, 24 Sep 2012 15:15:22 +0000 Message-ID: Accept-Language: en-US, de-DE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Originating-IP: 130.133.170.202 X-purgate: clean X-purgate-type: clean X-purgate-ID: 151147::1348499724-00000D73-EA675F15/0-0/0-0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000522, version=1.2.2 X-Spam-Flag: NO X-Spam-Status: No, score=-2.8 required=5.0 tests=ALL_TRUSTED X-Spam-Checker-Version: SpamAssassin 3.3.2 on Burundi.ZEDAT.FU-Berlin.DE X-Spam-Level: Subject: [Seqan-dev] [ANN] SeqAn SVN Migration X-BeenThere: seqan-dev@lists.fu-berlin.de X-Mailman-Version: 2.1.14 Precedence: list Reply-To: SeqAn Development List-Id: SeqAn Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 15:15:26 -0000 Dear all,=0A= =0A= the URL of the SeqAn repository will change this week from http://svn.mi.fu= -berlin.de/seqan to http://svn.seqan.de/seqan. Furthermore, the hierarchy w= ill move one level up, i.e. from http://svn.mi.fu-berlin.de/seqan/trunk/seq= an to http://svn.seqan.de/seqan/trunk.=0A= =0A= We will freeze the Subversion repository on the current location on Wednesd= ay at 10am Berlin time and begin migrating the library over. After the migr= ation is complete, we will send around a description of how to switch over = to the new repository.=0A= =0A= If you have any questions or remarks then do not hesitate to send them to u= s.=0A= =0A= Cheers,=0A= Manuel= From bakaric@evolbio.mpg.de Mon Sep 24 17:55:59 2012 Received: from relay1.zedat.fu-berlin.de ([130.133.4.67]) by list1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TGB0n-0047Jq-EM>; Mon, 24 Sep 2012 17:55:57 +0200 Received: from zimbra.evolbio.mpg.de ([141.5.8.20]) by relay1.zedat.fu-berlin.de (Exim 4.69) for seqan-dev@lists.fu-berlin.de with esmtp (envelope-from ) id <1TGB0n-002Eor-AL>; Mon, 24 Sep 2012 17:55:57 +0200 Received: from localhost (localhost [127.0.0.1]) by zimbra.evolbio.mpg.de (Postfix) with ESMTP id D3D862CFA77E for ; Mon, 24 Sep 2012 17:55:51 +0200 (CEST) Received: from zimbra.evolbio.mpg.de ([127.0.0.1]) by localhost (zimbra.evolbio.mpg.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9jvJiCNT1j8R for ; Mon, 24 Sep 2012 17:55:51 +0200 (CEST) Received: from [172.16.2.79] (evolgen079.evolbio.mpg.de [172.16.2.79]) by zimbra.evolbio.mpg.de (Postfix) with ESMTPSA id F0F982CFA77A for ; Mon, 24 Sep 2012 17:55:50 +0200 (CEST) Message-ID: <506082AD.3050201@evolbio.mpg.de> Date: Mon, 24 Sep 2012 17:56:29 +0200 From: Robert Bakaric User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0 MIME-Version: 1.0 To: seqan-dev@lists.fu-berlin.de Content-Type: multipart/alternative; boundary="------------030000050909050405070503" X-Originating-IP: 141.5.8.20 X-ZEDAT-Hint: A X-purgate: clean X-purgate-type: clean X-purgate-ID: 151147::1348502157-00000D73-107198BF/0-0/0-0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.2 X-Spam-Flag: NO X-Spam-Status: No, score=0.0 required=5.0 tests=HTML_MESSAGE X-Spam-Checker-Version: SpamAssassin 3.3.2 on Benin.ZEDAT.FU-Berlin.DE X-Spam-Level: Subject: [Seqan-dev] LCP computation fail X-BeenThere: seqan-dev@lists.fu-berlin.de X-Mailman-Version: 2.1.14 Precedence: list Reply-To: SeqAn Development List-Id: SeqAn Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 15:55:59 -0000 This is a multi-part message in MIME format. --------------030000050909050405070503 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, Some more questions. First of all is this the right place to post a questions of the type i am asking below or is there some seqan-user mailing list, where i can ask questions about using seqan? Ok, the first question is why is this not working: 1) #include seqan::String concatSet= concat(seqs); // seqs - is my string set seqan::String sa; seqan::String lcp; resize(sa, i); // create SA - works like a charm createSuffixArray(sa, concatSet, seqan::BwtWalk()); resize(lcp, i); // create lcp table --- NOT working createLcpTable(lcp, concatSet, sa); ERROR: error: no matching function for call to 'createLcpTable(seqan::String >&, seqan::String, seqan::Alloc >&, seqan::String >&)' but this function is there, right ?? " Creates a lcp table from a given text and suffix array. createLcpTable(lcp, text, suffixArray[, algo_tag]) Include Headers seqan/index.h Parameters lcp The resulting lcp table. text A given text. suffixArray The suffix array of text. algo_tag A tag that identifies the algorithm which is used for creation. Remarks This function should not be called directly. Please use indexCreate or indexRequire . The size of lcp must be at least length(text) before calling this function. 2) "...This function should not be called directly... " Why is that so ??? How do you call it then? 3) "algo_tag" What kind of tag should be there ??? Does it refer to : Kasai, Manzini ... ?? thank you r --------------030000050909050405070503 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi,


Some more questions. First of all is this the right place to post a questions of the type i am asking below or is there some seqan-user mailing list, where i can ask questions about using seqan? 


Ok, the first question is why is this not working:

1)

#include <seqan/index.h>

seqan::String<Dna> concatSet= concat(seqs); // seqs -  is my string set
seqan::String<unsigned> sa;
seqan::String<unsigned> lcp;


resize(sa, i);
 
    // create SA - works like a charm
    createSuffixArray(sa, concatSet, seqan::BwtWalk<seqan::BwtWalkFast>());


resize(lcp, i); 
   
    // create lcp table --- NOT working
    createLcpTable(lcp, concatSet, sa);


ERROR:

error: no matching function for call to ‘createLcpTable(seqan::String<unsigned int, seqan::Alloc<void> >&, seqan::String<seqan::SimpleType<unsigned char, seqan::Dna_>, seqan::Alloc<void> >&, seqan::String<unsigned int, seqan::Alloc<void> >&)’


but this function is there, right ??

"
Creates a lcp table from a given text and suffix array.
createLcpTable(lcp, text, suffixArray[, algo_tag])
Include Headers
seqan/index.h
Parameters
lcp
The resulting lcp table.
text
A given text.
suffixArray
The suffix array of text.
algo_tag
A tag that identifies the algorithm which is used for creation.
Remarks
This function should not be called directly. Please use indexCreate or indexRequire. The size of lcp must be at least length(text) before calling this function.


2)

"...This function should not be called directly... "

Why is that so ??? How do you call it then?


3)

"algo_tag"

What kind of tag should be there ??? Does it refer to : Kasai, Manzini ... ??


thank you

r
--------------030000050909050405070503--