extracting readings

  • Nobody/Anonymous

    I am new to staden and was wondering how, after finishing all of the editing and verification of a contig, I can get out all of the individual reads. I basically want to put them into fasta format and analyze this alignment in other programs. I would like, but do not need the chromatograms. I notice that the extract readings option is not available under the "file" in gap4. Can anyone offer me some advice?

    • James Bonfield

      James Bonfield - 2005-05-09

      Maybe it's only available in the expert mode (see Options -> Configure menus). Extract readings though doesn't really do what you want. It purely outputs the sequences as individual experiment files (close enough to EMBL format to work for many tools), but I'm guessing you want to use gap4 as a multiple alignment tool and actually gap sequences from base zero of the contig?

      That's not something available in the existing user interface (although it could be scripted if you wish to delve into Tcl).


    • Nobody/Anonymous

      Thanks for the input. I have actually just found a solution that works well for me. Once I have edited the contig to my satisfaction and I have all of the sequences I want in my "alignment" I simply go to "File>Save Consensus" and save this in fasta format. This gives just what I need (minus the chromoatograms, but I am finished editing at this point so all is well with the world). Hopefully this might be of help to others as well!

    • Andrew Warry

      Andrew Warry - 2005-05-13


      Just an extra thought: It is actually relatively simple to convert a contig dump text file (Gap4 contig editor window: Commands>>> Dump Contig to File) to an ordinary multiple sequence alignment e.g fasta/msf etc. I wrote a Perl script to do this a while ago
      (perhaps a Dump to MSF option could be added sometime in the future?)


    • James Bonfield

      James Bonfield - 2005-05-17

      That's a good point. It's not trivial to "script" the editor so it wouldn't allow for a non-interactive way to dump a gap4 database as MSF, but practically speaking it's easy enough for the user and as you point out the code is more or less done, just in another format.

    • dlavrov

      dlavrov - 2005-06-08

      Is it possible to dump all contigs to a file?  Does anybody has a script to do this?  Thanks in advance!


    • dlavrov

      dlavrov - 2005-06-08

      Is it possible to dump all contigs to a file?  Does anybody have a script to do this?  Thanks in advance!


    • James Bonfield

      James Bonfield - 2005-06-20

      Please see https://sourceforge.net/docman/display_doc.php?docid=28975&group_id=100316  for an example.

      I hope it works correctly!

      • dlavrov

        dlavrov - 2005-06-30

        Hello James,

        Thank you for your help.  Unfortunately I cannot read this (or any other) doment in the DOC section.  It says "document unavailable".

        Best wishes,

    • bsenf

      bsenf - 2005-06-20


      I have to change line 36 (dump_contig.tcl);
      maybe some tcl syntax errors ?

      if { $c {} } {

      if { [string equal {} $contigs] } {

      Now it works like expected.

    • James Bonfield

      James Bonfield - 2005-06-20

      The text I see when I go to "edit document" on the source forge admin bit definitely has "if {$contig == {}} {". I've tried editing it and whatever I do $contig== gets rewritten as $c. Very odd!

      That and the lack of any way for people to reply to documents means that maybe it's not the best way of implementing a user-based code snippet/script library.

      I've also got a tracker set up (like patches, bugs etc) which I may enable to do the same thing, or perhaps forums would work. So, as a test, let's see how this looks :-). I expect forums will display poorly due to proportional fonts and I should go for the heavy-weight tracker solution.


      #\ exec stash $0 ${@+"$@"}

      # Globals
      set line_width 50
      set name_width 15
      set prefix contig

      proc dump_contig {io cnum ed prefix} {
           global line_width name_width
           set c [io_read_contig $io $cnum]
           set clen [keylget c length]
           set cname [io_read_reading_name $io [keylget c left]]
           $ed dump_contig $prefix.$cname 1 $clen $line_width $name_width

      # Various setup stuff
      load_package gap
      wm withdraw .

      # Parse args & open the db
      if {"$argc" < 1 } {
          puts stderr "Usage: dump_contig database.version \          \[contig_identifier ...\]"
      foreach {name version} [split [lindex $argv 0] .] {}
      set io [open_db -name $name -version $version -access r]

      set contigs [lrange $argv 1 end]
      if {$contigs == {}} {
         set contigs [ListGet allcontigs]

      # Loop through contigs dumping the output
      foreach c $contigs {
          set w [edit_contig -io $io -contig $c]
          dump_contig $io [db_info get_contig_num $io $c] $w $prefix
          destroy $w   


    • James Bonfield

      James Bonfield - 2005-06-30

      Try looking in the tracker section:


      I tried the document section, but in the end I just gave up with it as even entering in HTML it had a knack of trying to "rewrite" portions and broke the scripts.


    • dlavrov

      dlavrov - 2005-07-01

      Thanks a lot!  I got the file.  Now when I try to use it I get the following error message:

      application-specific initialization failed: Can't find a usable init.tcl in the following
          /usr/local/lib/tcl8.4 /usr/local/staden/lib/tcl8.4 /usr/local/lib/tcl8.4 /usr/local/staden/library /usr/local/library /usr/local/tcl8.4.6/library /usr/tcl8.4.6/library /usr/loc

      This probably means that Tcl wasn't installed properly.

      can't read "0": no such variable
          while executing
      "exec stash $0 ${@+"$@"}  "

      What do I do wrong?

    • James Bonfield

      James Bonfield - 2005-07-04

      Not sure. It probably means that TCL_LIBRARY isn't setup, which normally gets done by the top-level scripts such as Gap4.

      Try setting it to be $STADENROOT/lib/tcl. I cannot really spend time supporting this stuff. The purpose of these code snippets are to provide examples to developers, not to act as supported programs for end-users to use.



Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks