-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from DanielFaulkner/extratesting
Updated tests and fixes where errors found in running the tests.
- Loading branch information
Showing
9 changed files
with
144 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/python3 | ||
|
||
# Small test program to call the annoatlas.py utility and add Human Protein Atlas columns to an annotation file. | ||
# For use with the linux operating system. May need modifiying to work with other operating system types. | ||
|
||
import subprocess | ||
import os | ||
import sys | ||
import zipfile | ||
|
||
# Variables | ||
annotationFile = "sampledata/atlasInput.bed" # Annotation file with a column of gene IDs | ||
outputFile1 = "CombinedOutput1.tsv" # Output filename | ||
outputFile2 = "CombinedOutput2.tsv" # Output filename | ||
AtlasName = "proteinatlas.tsv" | ||
AtlasPath = "https://www.proteinatlas.org/download/proteinatlas.tsv.zip" | ||
GeneCol = 6 # Column with gene names in the annotation file | ||
terms1 = "9,10,50,Chromosome" # Exact search terms or column numbers | ||
terms2 = "RNA" # Search terms using regular expression | ||
|
||
# Create test directory | ||
command = "mkdir atlasfiles" | ||
subprocess.call(command, shell=True) | ||
|
||
# Atlas file locator: | ||
print("Locating Human Protein Atlas file") | ||
if not os.path.exists(AtlasName): | ||
print("\nHuman Protein Atlas data file not found in this directory - "+AtlasName) | ||
print("\nIf you have previously downloaded the file please place a copy or link with the same filename in this directoy.") | ||
print("\nIf you do no have this file it can be downloaded from : "+AtlasPath) | ||
print("\nDownload Human Protein Atlas tsv data file (10mb) (Y) or exit (N)") | ||
usrin = input('(default N):') | ||
if usrin.upper()=="Y": | ||
command = "wget "+AtlasPath | ||
subprocess.call(command, shell=True) | ||
atlaszipped = zipfile.ZipFile("proteinatlas.tsv.zip") | ||
atlaszipped.extractall() | ||
else: | ||
sys.exit() | ||
|
||
# Combine columns (specified by number) | ||
command = "python3 ../annoatlas.py "+annotationFile+" "+AtlasName+" atlasfiles/"+outputFile1+" -c "+str(GeneCol)+" -a "+terms1 | ||
subprocess.call(command, shell=True) | ||
|
||
# Combine columns (specified by regular expression) | ||
command = "python3 ../annoatlas.py "+annotationFile+" "+AtlasName+" atlasfiles/"+outputFile2+" -c "+str(GeneCol)+" -a "+terms2+" -r" | ||
subprocess.call(command, shell=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/python3 | ||
|
||
# Small test program to call the annosort.py script and sort an annotation file. | ||
# For use with the linux operating system. May need modifiying to work with other operating system types. | ||
|
||
import subprocess | ||
import random | ||
|
||
# Variables | ||
inputfile = "GTF.gtf" | ||
unsortedfile = "unsorted.gtf" | ||
sortedfile = "sorted.gtf" | ||
|
||
# Create test directory | ||
command = "mkdir sortedfiles" | ||
subprocess.call(command, shell=True) | ||
|
||
# Scramble input file: (use with small files) | ||
print("Randomising input file") | ||
inputobj = open("sampledata/"+inputfile) | ||
outputobj = open("sortedfiles/"+unsortedfile,'w') | ||
line = inputobj.readline() | ||
while line[0]=="#": | ||
outputobj.write(line) | ||
line = inputobj.readline() | ||
linestore = [] | ||
while line: | ||
linestore.append(line) | ||
line = inputobj.readline() | ||
while len(linestore)>0: | ||
lineout = linestore.pop(random.randrange(len(linestore))) | ||
outputobj.write(lineout) | ||
outputobj.close() | ||
|
||
# Display the status of the unsorted file | ||
print("Unsorted file status:") | ||
command = "python3 ../annosort.py sortedfiles/"+unsortedfile+" -s" | ||
subprocess.call(command, shell=True) | ||
|
||
# Sort the unsorted file | ||
print("Sorting file") | ||
command = "python3 ../annosort.py sortedfiles/"+unsortedfile+" -o sortedfiles/"+sortedfile | ||
subprocess.call(command, shell=True) | ||
|
||
# Display the status of the sorted file | ||
print("Sorted file status:") | ||
command = "python3 ../annosort.py sortedfiles/"+sortedfile+" -s" | ||
subprocess.call(command, shell=True) |