Question: How to make a SRR download list
0
gravatar for linlinli99013
4.8 years ago by
linlinli990130 wrote:

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 • 1.4k views
ADD COMMENTlink modified 4.8 years ago by Matt Miossec350 • written 4.8 years ago by linlinli990130
2
gravatar for Matt Miossec
4.8 years ago by
Matt Miossec350
UK/Oxford/Wellcome Centre for human genetics
Matt Miossec350 wrote:

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 COMMENTlink modified 4.8 years ago • written 4.8 years ago by Matt Miossec350
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1004 users visited in the last hour
_