Skip to content

Instantly share code, notes, and snippets.

@skurscheid
Forked from deto/isPairedSRA.py
Created March 29, 2020 23:30
Show Gist options
  • Save skurscheid/6d97ccbc77e6462f74a9ff5ff2bf33eb to your computer and use it in GitHub Desktop.
Save skurscheid/6d97ccbc77e6462f74a9ff5ff2bf33eb to your computer and use it in GitHub Desktop.
Function to determine if an SRA file has paired or single-ended reads
def isPairedSRA(filename):
filename = os.path.abspath(filename);
try:
contents = sp.check_output(["fastq-dump","-X","1","-Z","--split-spot", filename]);
except sp.CalledProcessError, e:
raise Exception("Error running fastq-dump on",filename);
if(contents.count("\n") == 4):
return False;
elif(contents.count("\n") == 8):
return True:
else:
raise Exception("Unexpected output from fast-dump on ", filename);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment