<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Hi Koen,<DIV><BR class="khtml-block-placeholder"></DIV><DIV>Both the GCK and the Strider files are inherited from the good old MacOS9 period. In those days you would identify files using a type/creator code, and that's what I check for in this code. You will never see these 4 character codes unless you use a program like resedit, and they are not the same as file extensions, in fact under MacOS9 you would never use file extensions unless you wanted your Windows buddies to open your word file as well. So NSHFSTypeOfFile is not the same as [filepath pathExtension]. </DIV><DIV>The problem is that both filetypes are in binary format compared to the other formats which are ASCII based. Trying to read in the file as a string with ascii encoding creates some garbage which is impossible to interpret, let alone determine the filetype from. So the options were to either read all files in as data and check if it would fit the header of either filetype, and try to make anything out of that (quite tricky!) or simply to the filetype check. As a result I changed the code to have it pass the filepath instead of the raw text to the reader class. It better isolates code (no more reading at all in the delegate class), but we sacrifice the possibility to work with remote files. Guess this could be easily added to through a readFileFromURL method.</DIV><DIV>Now that I think of it, perhaps we should also check for the file extensions that are added to GCK files if you create them on the windows platform. I'm not sure if in those files the creator/type codes are added, I could check that on monday...</DIV><DIV>Hope this clears things up?</DIV><DIV>Alex</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR><DIV><DIV>On 11-mrt-2006, at 2:41, Koen van der Drift wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Hi,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I am still a bit confused about the strider and gck formats. In his code, Alex uses the following snippet to determine if a file is one of both formats:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- (NSDictionary *)readFile:(NSString *)textFile</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">{</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">    </SPAN>NSMutableDictionary *theContents;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">    </SPAN>NSString *lineBreak;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><SPAN class="Apple-converted-space">    <SPAN class="Apple-tab-span" style="white-space:pre">   </SPAN></SPAN><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">       </SPAN>// BINARY</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">       </SPAN>// Strider?</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">    </SPAN>if([NSHFSTypeOfFile(textFile) isEqualToString: @"'xDNA'"]){</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">       </SPAN><SPAN class="Apple-tab-span" style="white-space:pre">    </SPAN>theContents =<SPAN class="Apple-converted-space">  </SPAN>(NSMutableDictionary*) [self readStriderFile:textFile];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>// GCK?</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>}else if([NSHFSTypeOfFile(textFile) isEqualToString: @"'GCKc'"] || [NSHFSTypeOfFile(textFile) isEqualToString: @"'GCKs'"]){</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><SPAN class="Apple-tab-span" style="white-space:pre">       </SPAN><SPAN class="Apple-tab-span" style="white-space:pre">    </SPAN><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">    </SPAN><SPAN class="Apple-tab-span" style="white-space:pre">    </SPAN>theContents =<SPAN class="Apple-converted-space">  </SPAN>(NSMutableDictionary*) [self readGCKFile:textFile];</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre">     </SPAN>// TEXT</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>}else {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><SPAN class="Apple-tab-span" style="white-space:pre">       </SPAN><SPAN class="Apple-tab-span" style="white-space:pre">    </SPAN><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">So it's based on the file type. However, looked on the net for some sample files to test the code, and found those, but almost none of them have the xDNA, GCKc, or GCKs extension. So those files will be skipped by the code.<SPAN class="Apple-converted-space">  </SPAN>For all other formats we use a recognition string within the file, eg > for fasta or HEADER for PDB's.<SPAN class="Apple-converted-space">  </SPAN>I think that is a better approach, since we are not dependent on file types but on file content.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Is there a typical recognition string for these data formats that we can use for file recognition? If not, is there another way we can make sure we catch all Strider and/or GCK files?</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">cheers,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">- Koen.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Biococoa-dev mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:Biococoa-dev@bioinformatics.org">Biococoa-dev@bioinformatics.org</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="https://bioinformatics.org/mailman/listinfo/biococoa-dev">https://bioinformatics.org/mailman/listinfo/biococoa-dev</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV> </BLOCKQUOTE></DIV><BR><DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">*********************************************************<SPAN class="Apple-converted-space"> </SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><SPAN class="Apple-converted-space">                    </SPAN>** Alexander Griekspoor **</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">*********************************************************<SPAN class="Apple-converted-space"> </SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><SPAN class="Apple-converted-space">              </SPAN>The Netherlands Cancer Institute</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><SPAN class="Apple-converted-space">              </SPAN>Department of Tumorbiology (H4)</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><SPAN class="Apple-converted-space">         </SPAN>Plesmanlaan 121, 1066 CX, Amsterdam</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><SPAN class="Apple-converted-space">                  </SPAN>Tel:<SPAN class="Apple-converted-space">  </SPAN>+ 31 20 - 512 2023</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><SPAN class="Apple-converted-space">                  </SPAN>Fax:<SPAN class="Apple-converted-space">  </SPAN>+ 31 20 - 512 2029</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><SPAN class="Apple-converted-space">                  </SPAN>AIM: <A href="mailto:mekentosj@mac.com">mekentosj@mac.com</A></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><SPAN class="Apple-converted-space">                  </SPAN>E-mail: <A href="mailto:a.griekspoor@nki.nl">a.griekspoor@nki.nl</A></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><SPAN class="Apple-converted-space">              </SPAN>Web: <A href="http://www.mekentosj.com">http://www.mekentosj.com</A></FONT></DIV><P style="margin: 0.0px 0.0px 0.0px 0.0px; min-height: 14.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><SPAN class="Apple-converted-space"> </SPAN></FONT><BR class="khtml-block-placeholder"></P><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><SPAN class="Apple-converted-space">                            </SPAN>iRNAi, do you?<SPAN class="Apple-converted-space"> </SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><SPAN class="Apple-converted-space">             </SPAN><A href="http://www.mekentosj.com/irnai">http://www.mekentosj.com/irnai</A></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica">*********************************************************</FONT></DIV>  </DIV><BR></DIV></BODY></HTML>