This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Problems In Viewing Alignment File...

Hello all,

What i want to do is view my alignment file on web. However when i do so using PHP the entire alignment file is read but the text aligns itself to left and leaves the alignment hard to interpret. this is my PHP code

$file = fopen("res.aln", "r") or exit("Select sequences to align!");
while(!feof($file))
{
    echo fgets($file). "<br />";
}
fclose($file);

Is there a way to read alignment files without incorporating any viewer. Also is it possible to directly open the alignment file like we do by double-clicking it???

alignment

Yes, sounds like you just need pre tags...

@michael Dondrup: Its a multiple sequence alignment file..

that shouldn't matter. keep in mind that it surely is a plain text file, so in terms of web serving it's like dealing with any other text. just echo a "

" tag before the while and a "
" just after it and it should do. I would though think carefully about how exactly I would want the users to interact with that file, as serving it as described may not be optimal.

@Michael Dondrup, Jorge Amigo : thankss for it!! it worked!!

1 answer

the .aln extension is typically from an alignment file, a result from a program like Clustal for instance. assuming that what you want is to display it as it is I see 2 simple options:

  1. you may directly put a link to the file. since it is a plain text file the user should see it perfectly displayed on the email browser.
  2. if you need to read it and display its results on a formatted web page of yours I would definitely go for Michael's suggestion of enclosing its contents into "pre" tags.

Log in to answer this question.