Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • mmmm
    Senior Member
    • Jul 2013
    • 131

    shuffleSequences_fastq.pl

    I am using the perl script (shuffleSequences_fastq.pl) to prepare the intervaled fastq file for velvet and I got the first read in read1 followed by the first read in read2 BUT then I got 3 different reads of reads 2 followed by their correspondence in read1 and so on- I was wondering if this ok or is this below script right?
    a read1
    a read2
    b read1
    b read2
    c read2
    d read2
    c read1
    d read1 and so on

    shuffleSequences_fastq.pl


    #!/usr/bin/perl

    if (!@ARGV) {
    print "Usage: $0 forward_reads.fa reverse_reaads.fa outfile.fa\n";
    print "\tforward_reads.fa / reverse_reads.fa : paired reads to be merged\n";
    print "\toutfile.fa : outfile to be created\n";
    system.exit(0);
    }

    $filenameA = $ARGV[0];
    $filenameB = $ARGV[1];
    $filenameOut = $ARGV[2];

    die "Could not open $filenameA" unless (-e $filenameA);
    die "Could not open $filenameB" unless (-e $filenameB);

    open FILEA, "< $filenameA";
    open FILEB, "< $filenameB";

    open OUTFILE, "> $filenameOut";

    my ($lineA, $lineB);

    $lineA = <FILEA>;
    $lineB = <FILEB>;

    while(defined $lineA) {
    print OUTFILE $lineA;
    $lineA = <FILEA>;
    while (defined $lineA && $lineA !~ m/>/) {
    print OUTFILE $lineA;
    $lineA = <FILEA>;
    }

    print OUTFILE $lineB;
    $lineB = <FILEB>;
    while (defined $lineB && $lineB !~ m/>/) {
    print OUTFILE $lineB;
    $lineB = <FILEB>;
    }
    }
  • mastal
    Senior Member
    • Mar 2009
    • 666

    #2
    If you use a recent version of velvet, you don't need to use the shuffleSequences scripts, you can leave the reads as 2 separate files and use the flag '-separate' when running velveth.

    I have used the shuffleSequences_fastq.pl script that comes with velvet in the past, and never had any problems.

    It is not OK if your files don't interleave properly, you will have problems with the assembly or alignment programs further downstream.

    Comment

    • mastal
      Senior Member
      • Mar 2009
      • 666

      #3
      Are you trying to interleave fasta files or fastq files?

      If it is fastq files, your script won't work because the header lines for each read should begin with '@'.

      Change the two lines with the regular expressions.

      Change:
      Code:
      while (defined $lineA && $lineA !~ m/>/) {
      to
      Code:
      while (defined $lineA && $lineA !~ m/^@/) {

      Comment

      • mmmm
        Senior Member
        • Jul 2013
        • 131

        #4
        thank you very much- also, I should change
        while (defined $lineB && $lineB !~ m/>/)
        to
        while (defined $lineB && $lineB !~ m/^@/)

        Comment

        • SES
          Senior Member
          • Mar 2010
          • 275

          #5
          Originally posted by mmmm View Post
          thank you very much- also, I should change
          while (defined $lineB && $lineB !~ m/>/)
          to
          while (defined $lineB && $lineB !~ m/^@/)
          I wouldn't edit the script for fasta files, instead just use the script designed for fastq. You can find the script on the velvet github site. This assumes 4 line fastq. You can try Pairfq (documentation) for a more flexible solution (reading multiline fasta/q, compressed/uncompressed), but you may want to start with trying the script distributed with velvet.
          Last edited by SES; 04-03-2014, 01:53 AM.

          Comment

          Latest Articles

          Collapse

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by SEQadmin2, 06-09-2026, 11:58 AM
          0 responses
          24 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 06-05-2026, 10:09 AM
          0 responses
          29 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 06-04-2026, 08:59 AM
          0 responses
          39 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 06-02-2026, 12:03 PM
          0 responses
          61 views
          0 reactions
          Last Post SEQadmin2  
          Working...