|
This happens only when reading a long sequence. The problem is in TFormatConvertToMega.convert_from_fasta because of a memory allocation deficiency of Delphi. Here is my version of the fix.
//==================================================================
procedure TFormatConvertToMega.convert_from_fasta;
//==================================================================
Var
NextPos : integer;
NewStr, AStr, CurKey : String;
i,CurSize, SeqStart : integer;
procedure SetSeqDataHash;
var
CurSeq: string;
CurPos,j,k: integer;
begin
if (CurKey = \'\') or (CurSize = 0) then
exit;
SetLength(CurSeq, CurSize);
CurPos := 0;
for j := SeqStart to BStrList.Count-1 do
begin
for k := 1 to Length(BStrList[j]) do
CurSeq[k+CurPos] := BStrList[j][k];
inc(CurPos, Length(BStrList[j]));
end;
SeqDataHash.Values[CurKey] := CurSeq;
end;
begin
CurKey := \'\';
CurSize := 0;
for i := 0 to AStrList.Count-1 do
begin
AStr := Trim(AStrList[i]);
if Astr <> \'\' then
begin
if AStr[1] = \'>\' then // Retrieves Name of Sequence
begin
SetSeqDataHash;
// Check for >P1; type formatting and delete to ;
if Pos(\';\', AStr) > 0 then
begin
// We have a semicolon but is it
end;
NextPos := Pos(\' \', AStr);
Delete (AStr, NextPos, (Length(AStr) - NextPos + 1));
Delete (Astr, 1, 1);
CurKey := AStr;
NewStr := \'#\';
BStrList.Add( NewStr+Astr );
CurSize := 0;
SeqStart := BStrList.Count;
end
else
begin // Retrieves Sequence Data
BStrList.Add( Astr );
CurSize := CurSize +Length(Astr);
{
if (SeqDataHash.IndexOfName(CurKey) = -1) then
SeqDataHash.Values[CurKey] := Astr
else
SeqDataHash.Values[CurKey] := SeqDataHash.Values[CurKey] + Astr;
}
end;
end;
end;
SetSeqDataHash;
end;
edited on: 10-14 20:00 |
|