BCReader
readFile:
- (NSDictionary *)readFile:(NSString
*)textFile This method automatically detects the file format and passes textFile to the appropriate method. In most cases, this method will be the only one in this class that will be used directly. For an overview of the contents of the NSDictionary returned by this method, see the Overview section in the readNexusFile method comment.
readNexusFile:
- (NSDictionary *)readNexusFile:(NSString
*)textFile
This method reads a Nexus file. You need to pass it the entire Nexus file as a NSString and it will return a root NSDictionary that contains several objects. The most important of these is matrixDictionary, another NSDictionary with the item names as keys and the characters (sequence) in an NSString as the value object. Additionally, the root NSDictionary also contains a 'comments' key that returns the Nexus file's main comment, and a 'items' key that returns an array of items in the Nexus file.
Overview:
This method returns a root NSDictionary containing the following Keys and Objects:
| Key |
Value |
| matrix |
NSDictionary with item names as keys and characters as values |
| comments |
NSString containing the Nexus file's main comment |
| items |
NSArray containing all item names |
| trees |
NSArray containing all trees as Newick strings |
| lineBreak |
NSString containing the line break used in textFile |
| fileType |
NSString containing the fileType |
readNexusFileAndBlocks:
- (NSDictionary *)readNexusFileAndBlocks:(NSString *)textFile This method invokes the readNexusFile file method but it additionally returns an extra key in the root NSDictionary (see Overview). The extra key is called blocks and it points to an NSDictionary holding all Nexus blocks. The names of the blocks are used as the keys in this blocks dictionary. Overview:
This method returns a root NSDictionary containing the following Keys and Objects:
| Key |
Value |
| matrix |
NSDictionary with item names as keys and characters as values |
| comments |
NSString containing the Nexus file's main comment |
| items |
NSArray containing all item names |
| trees |
NSArray containing all trees as Newick strings |
| lineBreak |
NSString containing the line break used in textFile |
| blocks |
NSDictionary with Nexus block names as keys and their contents as values |
| fileType |
NSString containing the fileType |
readSwissProtFile:
- (NSDictionary *)readSwissProtFile:(NSString
*)textFile
This method reads a SwissProt file. You need to pass it the entire SwissProt file as a NSString and it will return a root NSDictionary that contains several objects. The most important of these is matrixDictionary, another NSDictionary with the item name as key and the sequence in an NSString as the value object. Additionally, the root NSDictionary also contains a 'comments' key that returns the SwissProt file's description, and organism key that returns the file's organism.
Overview:
This method returns a root NSDictionary containing the following Keys and Objects:
| Key |
Value |
| matrix |
NSDictionary with the ID-field as key and sequence (SQ-field) as value |
| comments |
NSString containing the SwissProt file's description (DE-field) |
| itemArray |
NSArray containing all item names (in this case only one ID-field) |
| organism |
NSString containing the file's organism (OS-field) |
| lineBreak |
NSString containing the line break used in textFile |
| fileType |
NSString containing the fileType |
readNCBIFile:
- (NSDictionary *)readSwissProtFile:(NSString
*)textFile
This method reads a NCBI file. You need to pass it the entire NCBI file as a NSString and it will return a root NSDictionary that contains several objects.
Overview:
This method returns a root NSDictionary containing the following Keys and Objects:
| Key |
Value |
| matrix |
NSDictionary with the locus as key and sequence as value |
| comments |
NSString containing the NCBI file's definition |
| itemArray |
NSArray containing all item names (in this case only one locus) |
| organism |
NSString containing the file's organism |
| lineBreak |
NSString containing the line break used in textFile |
| fileType |
NSString containing the fileType |
readPDBFile:
- (NSDictionary *)readSwissProtFile:(NSString
*)textFile
This method reads a PDB file. You need to pass it the entire PDB file as a NSString and it will return a root NSDictionary that contains several objects.
Overview:
This method returns a root NSDictionary containing the following Keys and Objects:
| Key |
Value |
| matrix |
NSDictionary with the header as key and sequence (three letter amino acid code) as value |
| comments |
NSString containing the file's title field |
| itemArray |
NSArray containing all item names (in this case only one header) |
| organism |
NSString containing the file's source-field |
| lineBreak |
NSString containing the line break used in textFile |
| fileType |
NSString containing the fileType |
readClustalFile:
- (NSDictionary *)readClustalFile:(NSString
*)textFile
This method returns a similar NSDictionary as with the readNexusFile method (see Overview). However, the comments and trees keys are not present since this file format does not support them.
readFastaFile:
- (NSDictionary *)readFastaFile:(NSString
*)textFile
This method returns a similar NSDictionary as with the readNexusFile method (see Overview). However, the comments and trees keys are not present since this file format does not support them.
readGDEFile:
- (NSDictionary *)readGDEFile:(NSString
*)textFile
This method returns a similar NSDictionary as with the readNexusFile method (see Overview). However, the comments and trees keys are not present since this file format does not support them.
readPirFile:
- (NSDictionary *)readPirFile:(NSString
*)textFile
This method returns a similar NSDictionary as with the readNexusFile method (see Overview). However, the comments and trees keys are not present since this file format does not support them.
readMSFFile:
- (NSDictionary *)readMSFFile:(NSString *)textFile
This method returns a similar NSDictionary as with the readNexusFile method (see Overview). However, the comments and trees keys are not present since this file format does not support them.
readHennigFile:
- (NSDictionary *)readHennigFile:(NSString
*)textFile
This method returns a similar NSDictionary as with the readNexusFile method (see Overview). However, the comments and trees keys are not present since this file format does not support them. This method is also used to read TNT files.
readRawFile:
- (NSDictionary *)readRawFile:(NSString
*)textFile
This method returns a similar NSDictionary as with the readNexusFile method (see Overview). However, the comments and trees keys are not present since this file format does not support them.
readNonaFile:
- (NSDictionary *)readNonaFile:(NSString
*)textFile
This method returns a similar NSDictionary as with the readNexusFile method (see Overview). However, the comments and trees keys are not present since this file format does not support them.
readPhylipFile:
- (NSDictionary *)readPhylipFile:(NSString
*)textFile
This method returns a similar NSDictionary as with the readNexusFile method (see Overview). However, the comments and trees keys are not present since this file format does not support them.
BCCreator
saveFile:
- (NSString *)saveFile:(NSDictionary *)matrix
This method will bring up a save dialog in which the user can select the format he wants to use to save the data. Once a file format is chosen, this method invokes the corresponding method below to actually save the file.
createClustalFile:
- (NSString *)createClustalFile:(NSDictionary *)matrix
Returns an NSString containing a Clustal file. Matrix is an NSDictionary with the taxa as keys and all characters (without spaces) as values. The sequences are automatically interleaved in rows of 100.
createFastaFile:
- (NSString *)createFastaFile:(NSDictionary *)matrix
Returns an NSString containing a Fasta file. Matrix is an NSDictionary with the taxa as keys and all characters (without spaces) as values.
createGDEFile:
- (NSString *)createGDEFile:(NSDictionary *)matrix
Returns an NSString containing a GDE file. Matrix is an NSDictionary with the taxa as keys and all characters (without spaces) as values.
createMSFFile:
- (NSString *)createMSFFile:(NSDictionary *)matrix
Returns an NSString containing a GCG-MSF file. Matrix is an NSDictionary with the taxa as keys and all characters (without spaces) as values.
createBeastFile:
- (NSString *)createBeastFile:(NSDictionary *)matrix
Returns an NSString containing a BEAST XML file. Matrix is an NSDictionary with the taxa as keys and all characters (without spaces) as values.
createHennigFile:
- (NSString *)createHennigFile:(NSDictionary *)matrix
Returns an NSString containing a Hennig86 file. Matrix is an NSDictionary with the taxa as keys and all characters (without spaces) as values.
createNonaFile:
- (NSString *)createNonaFile:(NSDictionary *)matrix
Returns an NSString containing a Nona file. Matrix is an NSDictionary with the taxa as keys and all characters (without spaces) as values.
createTNTFile:
- (NSString *)createTNTFile:(NSDictionary *)matrix
Returns an NSString containing a TNT file. Matrix is an NSDictionary with the taxa as keys and all characters (without spaces) as values.
createRawFile:
- (NSString *)createRawFile:(NSDictionary *)matrix
Returns an NSString containing a Plain/Raw file. Matrix is an NSDictionary with the taxa as keys and all characters (without spaces) as values.
createNexusFile:withComments:extraBlocks:
- (NSString *)createNexusFile:(NSDictionary *)matrix withComments:(NSString *)comments extraBlocks:(NSString *)eb
Returns an NSString containing a Nexus file. Matrix is an NSDictionary with the taxa as keys and all characters (without spaces) as values. Comments and extraBlocks are two optional parameters. Comments specifies the Nexus file comments this method should add to the Nexus file. With extraBlocks, one can add its own Nexus file blocks as an NSString.
createNexusFile:
- (NSString *)createNexusFile:(NSDictionary *)matrix
Invokes the createNexusFile:withComments:extraBlocks: method, using nil for both the comments and eb arguments.
createPhylipFile:
- (NSString *)createPhylipFile:(NSDictionary *)matrix
Returns an NSString containing a Phylip file. Matrix is an NSDictionary with the taxa as keys and all characters (without spaces) as values. Taxon names are automatically trimmed to 10 characters since Phylip can not handle longer taxon names
createPirFile:
- (NSString *)createPirFile:(NSDictionary *)matrix
Returns an NSString containing a Pir file. Matrix is an NSDictionary with the taxa as keys and all characters (without spaces) as values.
useLineBreakFromSource:
- (void)useLineBreakFromSource:(NSDictionary *)matrix
This method ensures cross-platform compatibility by offering the possbility to set the preferred line break to the line break used in the source file. This methods checks the lineBreak key in the matrix Dictionary (see the readNexusFile: method). This method needs to be called before using one of the saveFile / createFile methods.
useUnixLineBreak
- (void)useUnixLineBreak This method ensures cross-platform compatibility by offering the possbility to set the preferred line break to Unix: @"\n". This methods needs to be called before using one of the saveFile / createFile methods.
useWindowsLineBreak
- (void)useWindowsLineBreak
This method ensures cross-platform compatibility by offering the possbility to set the preferred line break to Windows: @"\r\n". This methods needs to be called before using one of the saveFile / createFile methods.
lineBreak
- (NSString *)lineBreak
Returns the line break currently in use.
|