How to make a SRR download list
1
0
Entering edit mode
7.9 years ago

I tried to make a download list by reading a txt file. The python script can generation a list below. I don't know how to fix the problem that it printed one item in 3 lines. I want one item in one line. Please advice. Thanks a lot.

srr.txt

SRR3468015

SRR3468016

SRR3468017

python lines

f=open("srr.txt")

line=f.readline()

while line:

    print "ftp://ftp.sra.ebi.ac.uk/vol1/fastq/"+line[0:6]+"/00"+line[9:]+"/"+line+"/"+line+"_1.fastq.gz"

    line=f.readline()


f.close()

actual result

ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR346/005
/SRR3468015
/SRR3468015
_1.fastq.gz
ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR346/006
/SRR3468016
/SRR3468016
_1.fastq.gz
ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR346/007
/SRR3468017
/SRR3468017
_1.fastq.gz

the result I want

ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR346/005/SRR3468015/SRR3468015_1.fastq.gz

ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR346/006/SRR3468016/SRR3468016_1.fastq.gz

ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR346/007/SRR3468017/SRR3468017_1.fastq.gz

next-gen • 2.0k views
ADD COMMENT
2
Entering edit mode
7.9 years ago

When you copy either the end of your input or the full input, you're also copying the newline character. Before printing your string, apply rstrip(). That should fix it.

ADD COMMENT

Login before adding your answer.

Traffic: 2725 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6