about std.csv and derived format
bioinfornatics
bioinfornatics at fedoraproject.org
Wed Feb 29 18:07:44 PST 2012
Le jeudi 01 mars 2012 à 01:52 +0100, bioinfornatics a écrit :
> Le mercredi 29 février 2012 à 13:23 +0100, Jesse Phillips a écrit :
> > On Wednesday, 29 February 2012 at 11:51:29 UTC, bioinfornatics
> > wrote:
> > > Le mercredi 29 février 2012 à 12:42 +0100, bioinfornatics a
> > > écrit :
> > >> Dear,
> > >>
> > >> I would like to parse this file:
> > >> http://genome.ucsc.edu/goldenPath/help/ItemRGBDemo.txt
> >
> > > My problem is:
> > > - need to parse data in csv format
> > > - how manage with optional field
> >
> > It looks like the data is tab delimited so separator is a tab.
> > There are no optional fields in CSV, but you can disable
> > exceptions.
> >
> > auto records = csvReader!(Bed,Malformed.ignore)(str,'\t');
>
> thanks jesse;
>
> how i can convert inputRange return type to Bed ?
> csvReader return a type that change dynamycally so if i use a template
> function the type is never same and i can't hard write a copy to Bed
> type.
> example if i use BedData3 or BedData4:
>
> -------------------------
> struct BedData3{
> string chrom; // 0
> size_t chromStart; // 1
> size_t chromEnd; // 2
> string name; // 3
> }
>
> struct BedData4{
> string chrom; // 0
> size_t chromStart; // 1
> size_t chromEnd; // 2
> string name; // 3
> size_t score; // 4
> }
> ------------------------
>
> i have try to deal with ReturnType but i fail.
>
> paste https://gist.github.com/1946288
>
> at line 294 bedReader take ane BedData3 tp 11
> then at line 338 how get an array of record and store this array into
> struct bed line 192
>
>
> thanks a lot
>
It is ok i have found a way maybe is not an efficient way but it works:
https://gist.github.com/1946669
a minor bug exist for parse track line will be fixed tomorrow. time to
bed
Big thanks to all
More information about the Digitalmars-d-learn
mailing list