Skip to content

Instantly share code, notes, and snippets.

@deto
Created April 24, 2015 04:06
Show Gist options
  • Save deto/9a5a75ec42a46d0e74e6 to your computer and use it in GitHub Desktop.
Save deto/9a5a75ec42a46d0e74e6 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