MantisBT - MEGA
View Issue Details
0000090MEGA[All Projects] Feedbackpublic2016-03-08 20:012016-03-08 20:01
guest 
 
normalminorhave not tried
newopen 
MEGA 11 (Graphical Interface version) 
 
Wei
Tong
tw7649116@gmail.com
tw7649116@gmail.com
0000090: MEGA7
Mege7 for widows64bit have problems in showing the trees. Trees can't show full with the right part missing.
No tags attached.
Issue History
2016-03-08 20:01guestNew Issue

Notes
(0000028)
gstecher   
1969-12-31 17:33   
Has this bug been fixed? I can\'t seem to reproduce the problem.
(0000030)
Nikita Vikhrev   
1969-12-31 17:33   
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
(0000034)
gstecher   
1969-12-31 17:33   
I fixed this bug already and noticed the same memory problem. Thanks for the suggestion.