Skip to content

Instantly share code, notes, and snippets.

@bluegenes
Created December 14, 2018 00:56
Show Gist options
  • Save bluegenes/a84c2f5e7eaeb34dda0e8c275ecd26aa to your computer and use it in GitHub Desktop.
Save bluegenes/a84c2f5e7eaeb34dda0e8c275ecd26aa to your computer and use it in GitHub Desktop.
import os
from snakemake.remote import FTP
FTP = FTP.RemoteProvider()
data_dir='data_subset'
targets = []
with open('SRA_accessions.txt', 'r') as f:
for line in f:
targ = line.strip() + '.fq.gz'
targets+=[os.path.join(data_dir, targ)]
rule all:
input: targets
rule get_fq:
input: lambda wildcards: FTP.remote(f"ftp.sra.ebi.ac.uk/vol1/fastq/{wildcards.accession[:6]}/{wildcards.accession}/{wildcards.accession}.fastq.gz", static=True, keep_local=True, immediate_close=True) output: os.path.join(data_dir,"{accession}.fq.gz")
shell: "mv {input} {output}"
@bluegenes
Copy link
Author

Can also use HTTP.RemoteProvider(), same link. Potentially faster?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment