change PlasMapper by cirdna EMBOSS
As commented in issue #3 (closed) , PlasMapper generates problems and can be replaced by cirdna, a program from EMBOSS.
The doc of cirdna is here.
I test it and see that commandline works fine without any prompt if I type:
cirdna -posblock Out -posticks Out -blocktype Outline -graphout png -ruler Y -infile input.txt -goutfile test
These points are promising:
- GPLv3 licence
- easy to use/implement
- easy to install (sudo apt install emboss)
- simple are therefore robust
The dev work will be to parse blast output into the appropriate text format to be passed as cirdna input.
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- Gael Yvert changed the description
changed the description
- Author Owner
Here are a number of blast parsers that I can consider:
- from kirill kryukov
- a complete solution is described on the bioperl site. It uses perl BlastResult objects
But calling blast with the appropriate output format option may be enough.
blastn -outfmt 6
This produces an output in tabular form:
mysequencethatilove t3 100.000 41 0 0 122 162 1 41 1.43e-19 76.8 mysequencethatilove t4 97.619 42 0 1 22 111 1 42 6.64e-18 71.3
with fields:
- Query sequence (mysequencethatilove)
- Subject name (t3)
- Percent Identity (100.000)
- Length of hit (41)
- xxx(0)
- Number of gaps (0)
- Start on query (122)
- End on query(162)
- Start on subject (1)
- End on subject (41)
- E value (1.43e-19)
- Score (76.8)
So, we need a routine that transforms this text in this format:
group label Block 122 162 3 t3 endlabel label Block 22 111 3 t4 endlabel endgroup
Note that the last digit (3) indicates the color, we will implement it later.
Edited by Gael Yvert I propose to address this issue with the following fonction :
stephane@berthollet:~$ nano -c blasttocirdna.php <?php /** * * This function allows you to import a blast outpout TXT file and export it into a new TXT file with cirdna input format * * @param string $file The file you want to import the data from * * @return $outfile The file you want to export the data to */ function transform_txt($file, $outfile) { // echo "je suis dans la fonction "."\n"; $newtxt = ''; if(!$input = fopen($file, "r")){ echo("Unable to open data file!"); exit; } if(!$output = fopen($outfile, "w")){ echo("Can't open file for writing!"); exit; } fwrite($output, $newtxt); $txt_string = file_get_contents($file); $txt_string = trim($txt_string, "\n"); // trim() function removes whitespace $lines = explode("\n", $txt_string); $newtxt = "group" . "\n" . "\n"; fwrite($output, $newtxt); // $array = array(); // For all the lines within the TXT foreach ($lines as $newline) { $line = explode("\t", $newline); // echo $line."\n"; // print_r($line); echo "Block". "\t" . $line["1"]. "\t" . $line["6"]. "\t" . $line["7"] . "\n"; $newtxt = "label" . "\n". "Block". "\t"; fwrite($output, $newtxt); $newtxt = $line["6"]. "\t" . $line["7"] . "\t" . "3" . "\n"; fwrite($output, $newtxt); $newtxt = $line["1"] . "\n"; fwrite($output, $newtxt); $newtxt = "endlabel" . "\n" ; fwrite($output, $newtxt); // echo $newtxt . "\n"; /* if(fwrite($output, $newtxt) === FALSE) { echo("Can't write to file!"); exit; } */ } $newtxt = "\n". "endgroup"; fwrite($output, $newtxt); // fwrite($output, $newtxt. "\n". "endgroup"); fclose($input); fclose($output); } $infile = 'blast/cequetuveux.txt'; // nom de mon fichier $newdate = date('Y-m-d_H:i:s'); //echo $newdate; $outfile = 'blast/inputcirdna_'.$newdate.'.txt'; echo $outfile . "\n"; transform_txt($infile,$outfile); //calling function ?>
to execute the script :
stephane@berthollet:~$ php blasttocirdna.php
- Gael Yvert mentioned in issue #3 (closed)
mentioned in issue #3 (closed)
- Gael Yvert mentioned in issue #87 (closed)
mentioned in issue #87 (closed)
- Gael Yvert mentioned in issue #75 (closed)
mentioned in issue #75 (closed)
- Gael Yvert mentioned in commit f4cdb445
mentioned in commit f4cdb445
- Gael Yvert mentioned in commit 030a0620
mentioned in commit 030a0620
- Gael Yvert mentioned in commit e0f89553
mentioned in commit e0f89553
- Gael Yvert mentioned in commit 0d41609a
mentioned in commit 0d41609a
- Gael Yvert mentioned in commit 9bafe542
mentioned in commit 9bafe542
- Author Owner
It works. We now need to:
- optimize the size of blocks and text
- deal with the fact that multiple users may write temporary files when browsing: create subdirs in storage/tmp/ with random long names so that each visitor writes there and only there. Then rm these dirs also.
- check that $seq is dna
- Handle block colors according to the type of features
- Make a controller+route to update dna features blastdb (from a button in the browse view of dna_features, as we used to do it for plasmapper)
- Gael Yvert mentioned in commit 18040735
mentioned in commit 18040735
- Author Owner
For random dirname, see this discussion
OK, tmpdir with random name is now created. We must remove it after usage: when, where to write this removal?
Edited by Gael Yvert - Gael Yvert mentioned in commit 95ef0348
mentioned in commit 95ef0348
- Gael Yvert mentioned in commit 3a033232
mentioned in commit 3a033232
- Author Owner
CHANGED:
Instead, I decide to create the following tmpdir:
storage/app/public/tmp/plasmidmaps/id
where id is the id of the plasmid.
This way, we don't need to remove the tmpdirs. They are simply updated at every visit of the read view.
- Author Owner
Regarding other points:
- Optimize size of blocks and text. This is now better in svg format.
- check that $seq is dna. I open new issue #105 for this.
- block color according to feature type. I open a new issue #106 (closed) for this.
- Make a controller+route to update dna features blastdb. I open new issue #107 (closed) for this.
And I close this issue.
- Gael Yvert closed
closed
- Gael Yvert changed milestone to %first upgrade of gylab production site
changed milestone to %first upgrade of gylab production site
- Gael Yvert mentioned in merge request !1 (merged)
mentioned in merge request !1 (merged)