FU Logo
  • Startseite
  • Kontakt
  • Impressum
  • Home
  • Listenauswahl
  • Anleitungen

Re: [Seqan-dev] conversion tà std::string

<-- thread -->
<-- date -->
  • From: Rahn, René <Rene.Rahn@fu-berlin.de>
  • To: SeqAn Development <seqan-dev@lists.fu-berlin.de>
  • Date: Wed, 21 Mar 2018 10:13:56 +0100
  • Subject: Re: [Seqan-dev] conversion tà std::string

Hi Sacha,

our sequence containers do not offer implicit or explicit conversion to STL containers.
At least not that I am aware of. 
Also the conversion by toCString does not imply a conversion to const char *.
It is merely a function to access the underlying data, like std::data, but with a kind of confusing naming. 
In your case, you can simply call  the range constructor of the std::string class:

std::string test1{begin(record.seq, Standard{}), end{record.seq, Standard{}}};

Also while doing this, you need to be sure, that whatever is stored in the seqan::String is also convertible to your target type. Converting a seqan alphabet to char implicitly is fine in SeqAn2.
But please be aware of the fact, that a seqan::String is more like a std::vector then the std::string. 

I would also like to ask you to file an issue on our issue tracker: https://github.com/seqan/seqan/issues in the future.

I hope this helps.

cheers,

René

On 16. Mar 2018, at 15:12, labsquare <sacha@labsquare.org> wrote:

I would like to convert seqan String to std::string or QString ... unsucessfully. 
could you help  me ?  I don't understand . seqan::toCString is supposed to return char *

with std : 
        seqan::readRecord(record, bamFileIn);        
        std::string test1 = seqan::toCString(record.seq);


with Qt : 

        QString test2 = QString::fromLocal8Bit(seqan::toCString(record.seq));

error : 
../bamviewer-poc/bamviewer.cpp:147:45: error: conversion from ‘seqan::SimpleType<unsigned char, seqan::Iupac_>*’ to non-scalar type ‘std::__cxx11::string {aka std::__cxx11::basic_string<char>}’ requested
std::string test1 = seqan::toCString(record.seq);

--
--
Dr Sacha Schutz
médecine / génétique moléculaire
Bioinformaticien
+33651571606
dridk.me
www.labsquare.org
Fork me on github


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

---

René Rahn
Ph.D. Student (de.NBI - CIBI)
--------------------------------
Tel:  (+49) 30 838 72974
Mail: rene.rahn@fu-berlin.de
--------------------------------
Institute of Computer Science
Algorithmic Bioinformatics (ABI)
--------------------------------
Freie Universität Berlin
Takustraße 9
14195 Berlin
--------------------------------

<-- thread -->
<-- date -->
  • References:
    • [Seqan-dev] conversion tà std::string
      • From: labsquare <sacha@labsquare.org>
  • seqan-dev - March 2018 - Archives indexes sorted by:
    [ thread ] [ subject ] [ author ] [ date ]
  • Complete archive of the seqan-dev mailing list
  • More info on this list...

Hilfe

  • FAQ
  • Dienstbeschreibung
  • ZEDAT Beratung
  • postmaster@lists.fu-berlin.de

Service-Navigation

  • Startseite
  • Listenauswahl

Einrichtung Mailingliste

  • ZEDAT-Portal
  • Mailinglisten Portal