Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • GenoMax
    Senior Member
    • Feb 2008
    • 7142

    sratoolkit v.2.3.1

    Has anyone tried the sratoolkit (v.2.3.1) that is currently available from NCBI SRA. The development kit user guide documentation seems to refer to *two* perl scripts (config-assistant.pl and reference-assistant.pl) but I can only see one (config-assistant.pl) in the download tarball for CentOS.

    I am trying to extract files from a recent SRA accession and the process is failing because reference files are not available.

    Main announcement on the SRA page seems to indicate that the process of downloading necessary data/reference files should be automatic. Anyone managed to get this to work?
  • GenoMax
    Senior Member
    • Feb 2008
    • 7142

    #2
    Update:

    I noticed after I posted the original thread that this page seems to have notes that one should run a java jar file (on linux and OS X) that will automatically set up the download environment. This java file seems to be present only in the pre-compiled tar (if one builds the toolkit from source then there is no corresponding jar file).

    Unfortunately neither (pre-compiled binary or built from source) seem to be working with SRA files (including this test dataset SRR390728) at the moment.

    Code:
    fastq-dump.2.3.1 err: manager not found while constructing path within virtual file system module - failed SRR390728.sra Written 0 spots total
    Odd thing is it is still making a fastq file (can't tell if it is complete).

    Time to contact "sra@ncbi". If they respond, I will update this thread.

    Comment

    • Richard Finney
      Senior Member
      • Feb 2009
      • 701

      #3
      Try building from source.

      There's always little nagging stuff with SRA.

      Comment

      • GenoMax
        Senior Member
        • Feb 2008
        • 7142

        #4
        Originally posted by Richard Finney View Post
        Try building from source.

        There's always little nagging stuff with SRA.
        Already tried that. No go.

        Comment

        • Richard Finney
          Senior Member
          • Feb 2009
          • 701

          #5
          I had a old bzip tar ball of sra_sdk-2.1.6 if you still need it


          -bash-3.00$ cat sra_sdk-2.1.6/reference-assistant.pl
          Code:
          
          #!/usr/local/bin/perl -w
          ################################################################################
          use strict;
          
          use File::Basename;
          use File::Spec;
          
          sub println { print @_; print "\n"; }
          
          my $MSWIN;
          ++$MSWIN if ($^O =~ /mswin/i);
          
          print "Checking refseq configuration... ";
          my $VDB_CONFIG = find_bin("vdb-config");
          die "not found" unless ($VDB_CONFIG);
          println "OK";
          
          print "Checking align-info... ";
          my $ALIGN_INFO = find_bin("align-info");
          die "not found" unless ($ALIGN_INFO);
          println "found";
          
          my $WGET;
          print "Checking wget... ";
          my $out = `wget -h 2>&1`;
          if ($? == 0) {
            println "found";
            $WGET = "wget -O";
          } else {
            println "not found";
          }
          unless ($WGET) {
            print "Checking curl...";
            $out = `curl -h 2>&1`;
            if ($? == 0) {
              println "found";
              $WGET = "curl -o";
            } else {
              println "not found";
            }
          }
          unless ($WGET) {
            print "Checking ./wget... ";
            my $cmd = dirname($0) ."/wget";
            $out = `$cmd -h 2>&1`;
            if ($? == 0) {
              println "found";
              $WGET = "$cmd -O";
            } else {
              println "not found.\nCannot continue.";
              exit 1;
            }
          }
          
          my $refseq_dir = simple_refseq_path();
          
          if ($#ARGV > -1) {
              foreach (@ARGV) {
                  load($_);
              }
          } else {
              while (1) {
                  my $f = ask("Enter cSRA file name (Press Enter to exit)");
                  last unless ($f);
                  load($f);
              }
          }
          
          sub ask {
              my ($prompt) = @_;
              print "$prompt: ";
              my $in = <STDIN>;
              chomp $in;
              return $in;
          }
          
          sub load {
              my ($f) = @_;
              println "Determining $f external dependencies...";
              my $cmd = "$ALIGN_INFO $f";
              my @info = `$cmd`;
              my $refs = 0;
              if ($?) {
                  println "$f: failed";
              } else {
                  my $ok = 0;
                  my $ko = 0;
                  foreach (@info) {
                      chomp;
                      my @r = split /,/;
                      if ($#r >= 3) {
                          my ($seqId, $remote) = ($r[0], $r[3]);
                          ++$refs;
                          if ($remote eq 'remote') {
                              print "Downloading $seqId... ";
                              my $cmd = "$WGET \"$refseq_dir/$seqId\""
                                  . " http://ftp-trace.ncbi.nlm.nih.gov/sra/refseq/$seqId"
                                  . " 2>&1";
                              `$cmd`;
                              if ($?) {
                                  println "failed";
                                  ++$ko;
                              }
                              else {
                                  println "OK";
                                  ++$ok;
                              }
                          }
                      }
                  }
                  print "All " . $refs . " references were checked (";
                  print "$ko failed, " if ($ko);
                  println "$ok downloaded)";
              }
          }
          
          sub simple_refseq_path {
              my %refseq;
              $refseq{s} = refseq_config('servers');
              $refseq{v} = refseq_config('volumes');
              $refseq{p} = refseq_config('paths');
          
              if (   ($refseq{s} && !$refseq{v})
                  || ($refseq{v} && !$refseq{s}))
              {   die "Invalid configuration"; }
          
              if ($refseq{s} && $refseq{v}) {
                  if ((index($refseq{s}, ":") != -1) || (index($refseq{v}, ":") != -1)) {
                      die "Unexpected '$refseq{s}/$refseq{v}'";
                  } else {
                      return "$refseq{s}/$refseq{v}";
                  }
              } elsif ($refseq{p}) {
                  return PATH_VDB2WIN($refseq{p});
              } else {
                  print "Cannot find configuration. Please run 'config-assistant.pl'\n";
                  exit 1;
              }
          }
          
          sub refseq_config {
              my ($nm) = @_;
              my $v = `$VDB_CONFIG refseq/$nm 2>&1`;
              if ($?) {
                  if ($v =~ /path not found while opening node/) {
                      $v = '';
                  } else {
                      die $!;
                  }
              } else {
                  $v =~ /<$nm>(.*)<\/$nm>/;
                  die "Invalid 'refseq/$nm' configuration" unless ($1);
                  $v = $1;
              }
              return $v;
          }
          
          sub find_bin {
            my ($name) = @_;
          
            my $basedir = dirname($0);
          
            # built from sources
            if (-e File::Spec->catfile($basedir, "Makefile")) {
              my $f = File::Spec->catfile($basedir, "build");
              $f = File::Spec->catfile($f, "Makefile.env");
              if (-e $f) {
                my $try = `make -s bindir -C $basedir 2>&1`;
                if ($? == 0) {
                  chomp $try;
                  $try = File::Spec->catfile($try, $name);
                  my $tmp = `$try -h 2>&1`;
                  if ($? == 0) {
                    return $try;
                  }
                }
              }
            }
          
            # try the same directory as the script
            my $try = File::Spec->catfile($basedir, $name);
            my $tmp = `$try -h 2>&1`;
            if ($? == 0) {
              return $try;
            }
          
            # check from PATH
            $try = "$name";
            $tmp = `$try -h 2>&1`;
            if ($? == 0) {
              return $try;
            }
          
            return 0;
          }
          
          sub WIN_TRANSLATE {
            ($_) = @_;
            return $_ unless($MSWIN);
            tr|/|\\|;
            return $_;
          }
          
          sub PATH_VDB2WIN {
            ($_) = @_;
            return $_ unless($MSWIN);
            $_ = WIN_TRANSLATE($_);
            s/^\\([a-zA-Z])\\/$1:\\/;
            return $_;
          }
          
          ################################################################################
          # EOF #
          The SRA documentation appears out of sync with the code.

          Comment

          • GenoMax
            Senior Member
            • Feb 2008
            • 7142

            #6
            After some communication with the SRA support here is the new protocol to be followed.

            Each user needs to run the "configuration-assistant.perl" that is present in the "bin" directory (if you compile from source) or you could use the Java jar found in the precompiled tarball (do one or the other).

            While you are running this perl script you will reach a point where the software asks you "Would you like to test SRA files for remote reference dependencies? [y/N]". Choose "Yes" (default answer is No) which will then prompt you to provide an SRA accession number a step or two down the road. Have a test SRA# handy (if you are not working with a specific one). If you have correctly setup everything then the script will "download" the reference files it needs on the fly and store them in a directory that you designate when you run the perl script first time. A group writable directory can be used for this purpose, if multiple people need to dump SRA data.

            PS: The SRA# that I was originally working with turned out to have a corrupt .sra file at source. SRA is going to fix that problem.
            Last edited by GenoMax; 03-28-2013, 12:19 PM.

            Comment

            • giorgifm
              Member
              • Aug 2011
              • 35

              #7
              Dear all, try using the ABSOLUTE PATH of that SRA file. The error means the file could not be found.

              Comment

              • student-t
                Member
                • Mar 2015
                • 16

                #8
                Yeah, using an absolute path works.

                Comment

                Latest Articles

                Collapse

                • mylaser
                  Reply to Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
                  by mylaser
                  Kheloyaar: The Complete Guide to Kheloyaar Loginand Kheloyaar ID
                  The online gaming industry has transformed the way people enjoy digital entertainment. As technology continues to improve, players are looking for platforms that offer convenience, security, and a seamless user experience. Kheloyaarhas gained attention among users who value an easy-to-use platform, quick account access, and a simple registration process.
                  Whether you're exploring Kheloyaar for the first time or want to understand...
                  Today, 09:27 PM
                • SEQadmin2
                  Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
                  by SEQadmin2



                  Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
                  ...
                  Today, 11:10 AM
                • SEQadmin2
                  Cancer Drug Resistance: The Lingering Barrier to Rising Survival
                  by SEQadmin2



                  Cancer survival rates have significantly increased in the last few decades in the United States, reaching a combined 70% 5-year survival rate by 2021. Behind this number, there are years of research to find new therapies, drug targets, and early detection methods. But there is one core challenge that keeps slowing down these advances, and it’s about drug resistance.

                  There is no single reason why many patients don’t respond to treatment as expected. Cancer is...
                  Yesterday, 05:17 AM

                ad_right_rmr

                Collapse

                News

                Collapse

                Topics Statistics Last Post
                Started by SEQadmin2, Today, 10:04 AM
                0 responses
                8 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, Yesterday, 10:08 AM
                0 responses
                7 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 07-07-2026, 11:05 AM
                0 responses
                9 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 07-02-2026, 11:08 AM
                0 responses
                31 views
                0 reactions
                Last Post SEQadmin2  
                Working...