Skip to content

Instantly share code, notes, and snippets.

@jodyphelan
Created June 17, 2019 12:05
Show Gist options
  • Save jodyphelan/761a9158469585dd509134ec1755c752 to your computer and use it in GitHub Desktop.
Save jodyphelan/761a9158469585dd509134ec1755c752 to your computer and use it in GitHub Desktop.
#! /usr/bin/perl
use warnings;
use strict;
if (scalar @ARGV !=1){print "\nebiDownload <acc_list>\n\n"; exit;}
open F, $ARGV[0] or die;
while(<F>){
chomp;
my $sample = $_;
if (length($sample) == 9){
my $dir1 = substr($sample,0,6);
print "ftp://ftp.sra.ebi.ac.uk/vol1/fastq/$dir1/$sample/${sample}_1.fastq.gz\n"; #SRR833/SRR833067/SRR833067_1.fastq.gz
print "ftp://ftp.sra.ebi.ac.uk/vol1/fastq/$dir1/$sample/${sample}_2.fastq.gz\n";
} elsif (length($sample) == 10){
my $dir1 = substr($sample,0,6);
my $dir2 = "00".substr($sample,9,1);
print "ftp://ftp.sra.ebi.ac.uk/vol1/fastq/$dir1/$dir2/$sample/${sample}_1.fastq.gz\n";
print "ftp://ftp.sra.ebi.ac.uk/vol1/fastq/$dir1/$dir2/$sample/${sample}_2.fastq.gz\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment