This is meant for sorting alignments in the FragmentStore. You currently have to resort to an external tool for sorting SAM files without completely loading them into memory. *m ________________________________________ From: Bernd Jagla [bernd.jagla@pasteur.fr] Sent: Tuesday, April 10, 2012 3:01 PM To: seqan-dev@lists.fu-berlin.de Subject: [Seqan-dev] sorting sam file by SortReadID() Hi, I am trying to sort a sam/bam file by read-id and am using the following construct: sortAlignedReads(reader, SortReadId()); Unfortunately the compiler is complaining: In file included from /pasteur/solexa2/solexa_travail/PF2/programs/seqan/workspace/seqan/core/include/seqan/store.h:63: /pasteur/solexa2/solexa_travail/PF2/programs/seqan/workspace/seqan/core/include/seqan/store/store_align.h:369:13: error: member reference base type 'const char' is not a structure or union return a1.readId < a2.readId; ~~ ^ /usr/lib/gcc/x86_64-redhat-linux6E/4.4.4/../../../../include/c++/4.4.4/bits/stl_algo.h:2128:8: note: in instantiation of member function 'seqan::_LessAlignedRead<char, const seqan::Tag<seqan::SortReadId_> >::operator()' requested here if (__comp(__val, *__first)) ^ /usr/lib/gcc/x86_64-redhat-linux6E/4.4.4/../../../../include/c++/4.4.4/bits/stl_algo.h:3433:4: note: in instantiation of function template specialization 'std::__insertion_sort<char *, seqan::_LessAlignedRead<char, const seqan::Tag<seqan::SortReadId_> > >' requested here std::__insertion_sort(__first, __last, __comp); ^ /usr/lib/gcc/x86_64-redhat-linux6E/4.4.4/../../../../include/c++/4.4.4/bits/stl_algo.h:5468:2: note: in instantiation of function template specialization 'std::__inplace_stable_sort<char *, seqan::_LessAlignedRead<char, const seqan::Tag<seqan::SortReadId_> > >' requested here std::__inplace_stable_sort(__first, __last, __comp); ^ /pasteur/solexa2/solexa_travail/PF2/programs/seqan/workspace/seqan/core/include/seqan/store/store_align.h:433:2: note: in instantiation of function template specialization 'std::stable_sort<char *, seqan::_LessAlignedRead<char, const seqan::Tag<seqan::SortReadId_> > >' requested here std::stable_sort( ^ /pasteur/solexa2/solexa_travail/PF2/programs/seqan/workspace/seqan/sandbox/jagla/apps/sambamstat/sambamstat.h:286:5: note: in instantiation of function template specialization 'seqan::sortAlignedReads<seqan::Stream<Bgzf>, seqan::SortReadId_>' requested here sortAlignedReads(reader, SortReadId()); ^ /pasteur/solexa2/solexa_travail/PF2/programs/seqan/workspace/seqan/sandbox/jagla/apps/sambamstat/sambamstat.h:340:16: note: in instantiation of function template specialization 'doWork<seqan::Stream<Bgzf>, seqan::String<seqan::SimpleType<unsigned char, seqan::Dna5_>, seqan::Alloc<void> >, seqan::Owner<seqan::Tag<seqan::Default_> >, seqan::Tag<seqan::Bam_> >' requested here return doWork(bamStream, seqs, options, Bam()); ^ 4 warnings and 15 errors generated. make[2]: *** [sandbox/jagla/apps/sambamstat/CMakeFiles/sambamstat.dir/sambamstat.cpp.o] Error 1 make[1]: *** [sandbox/jagla/apps/sambamstat/CMakeFiles/sambamstat.dir/all] Error 2 make: *** [all] Error 2 I also attach the the cpp and .h files.. Thanks for having a look at this ... Bernd