Thread overview
Strange behaviour with mmfile
Jan 29, 2013
bioinfornatics
Jan 29, 2013
bioinfornatics
Jan 29, 2013
nazriel
Jan 29, 2013
H. S. Teoh
Jan 29, 2013
bioinfornatics
January 29, 2013
Dear,

Why when i try to read this file:

------------Input file-------------------------
$ cat little.fastq
@H8:C16L5ACXX:8:1101:1168:2103/1
TCTGAAGGCATGCTGCAATTGTGAATGGCAGAAATGT
+
?@@DD>DBDAFDF@4CFGICFHHECHEEBF;E@FFFG
@H8:C16L5ACXX:8:1101:1223:2104/1
CTCACTTTTGTACTTTAGACAAGCGCTTTTAGTAGTGCT
+
@@;DD;?DHFFHFG9FAFCEGFGBFE1EFFGFGGHG9D*
@H8:C16L5ACXX:8:1101:1166:2142/1
ATCTGGGAAGACGCCGCCGGGTTCAAATCACCTTGGTCGGCATCGTCGATCCGC
+
;=?DDDDD3C??)@:E1CDD)?B?B<99BB8=<8)8.=A88<8)56;9/>2=??


By using mmfile ubyte given do not corresponding to the letter. By example for @ i expect 64 but i got 127


---------------Result-----------------------
$ ./test_mmap little2.fastq
127 
69 E
76 L
70 F
2 
1 
1 
0
0
0
0
0
0
0
0
0
2 
0
62 >
0
… and that continue

Big thanks

Note i have try with both ldc and gdc

January 29, 2013
I missed to show the code

$ cat test_mmap.d
import std.stdio;
import std.mmfile;

void main(string[] args ){
    MmFile m = new MmFile( args[0] );
    foreach( ulong c; 0..m.length )
        writeln( m[c], " ", cast(dchar) m[c] );
}




January 29, 2013
On Tuesday, 29 January 2013 at 00:49:07 UTC, bioinfornatics wrote:
> I missed to show the code
>
> $ cat test_mmap.d
> import std.stdio;
> import std.mmfile;
>
> void main(string[] args ){
>     MmFile m = new MmFile( args[0] );
>     foreach( ulong c; 0..m.length )
>         writeln( m[c], " ", cast(dchar) m[c] );
> }

 MmFile m = new MmFile( args[0] ); ?
Didn't you mean args[1] or something?
Because now you are reading your binary file and output is correct, its spits out elf header info.

My guess is your are passing file with DNA (or whatever it is) via command line arguments
January 29, 2013
On Tue, Jan 29, 2013 at 05:46:49AM +0100, nazriel wrote:
> On Tuesday, 29 January 2013 at 00:49:07 UTC, bioinfornatics wrote:
> >I missed to show the code
> >
> >$ cat test_mmap.d
> >import std.stdio;
> >import std.mmfile;
> >
> >void main(string[] args ){
> >    MmFile m = new MmFile( args[0] );
> >    foreach( ulong c; 0..m.length )
> >        writeln( m[c], " ", cast(dchar) m[c] );
> >}
> 
>  MmFile m = new MmFile( args[0] ); ?
> Didn't you mean args[1] or something?
[...]

Good catch! I looked at the OP's code and didn't notice that. :)

In D, args[0] is the name of the program, and args[1] is the first argument, etc..


T

-- 
Nearly all men can stand adversity, but if you want to test a man's character, give him power. -- Abraham Lincoln
January 29, 2013
On Tuesday, 29 January 2013 at 06:37:11 UTC, H. S. Teoh wrote:
> On Tue, Jan 29, 2013 at 05:46:49AM +0100, nazriel wrote:
>> On Tuesday, 29 January 2013 at 00:49:07 UTC, bioinfornatics wrote:
>> >I missed to show the code
>> >
>> >$ cat test_mmap.d
>> >import std.stdio;
>> >import std.mmfile;
>> >
>> >void main(string[] args ){
>> >    MmFile m = new MmFile( args[0] );
>> >    foreach( ulong c; 0..m.length )
>> >        writeln( m[c], " ", cast(dchar) m[c] );
>> >}
>> 
>>  MmFile m = new MmFile( args[0] ); ?
>> Didn't you mean args[1] or something?
> [...]
>
> Good catch! I looked at the OP's code and didn't notice that. :)
>
> In D, args[0] is the name of the program, and args[1] is the first
> argument, etc..
>
>
> T

Oh yes stupid error thanks
LOL