aboutsummaryrefslogtreecommitdiff
path: root/wqflask/maintenance
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/maintenance')
-rw-r--r--wqflask/maintenance/convert_dryad_to_bimbam.py2
-rw-r--r--wqflask/maintenance/convert_geno_to_bimbam.py4
-rw-r--r--wqflask/maintenance/generate_kinship_from_bimbam.py8
-rw-r--r--wqflask/maintenance/geno_to_json.py34
4 files changed, 24 insertions, 24 deletions
diff --git a/wqflask/maintenance/convert_dryad_to_bimbam.py b/wqflask/maintenance/convert_dryad_to_bimbam.py
index e417c280..18fbb8a1 100644
--- a/wqflask/maintenance/convert_dryad_to_bimbam.py
+++ b/wqflask/maintenance/convert_dryad_to_bimbam.py
@@ -52,7 +52,7 @@ def read_dryad_file(filename):
# this_row.append(line.split(" ")[i+2])
# print("row: " + str(i))
# geno_rows.append(this_row)
- #
+ #
# return geno_rows
diff --git a/wqflask/maintenance/convert_geno_to_bimbam.py b/wqflask/maintenance/convert_geno_to_bimbam.py
index a2ede1f9..c5af1ca6 100644
--- a/wqflask/maintenance/convert_geno_to_bimbam.py
+++ b/wqflask/maintenance/convert_geno_to_bimbam.py
@@ -91,7 +91,7 @@ class ConvertGenoFile:
self.markers.append(this_marker.__dict__)
- self.write_to_bimbam()
+ self.write_to_bimbam()
def write_to_bimbam(self):
with open(self.output_files[0], "w") as geno_fh:
@@ -126,7 +126,7 @@ class ConvertGenoFile:
self.sample_list = row_contents[3:]
else:
self.sample_list = row_contents[2:]
-
+
def process_rows(self):
for self.latest_row_pos, row in enumerate(self.input_fh):
self.latest_row_value = row
diff --git a/wqflask/maintenance/generate_kinship_from_bimbam.py b/wqflask/maintenance/generate_kinship_from_bimbam.py
index bed634fa..cd39fceb 100644
--- a/wqflask/maintenance/generate_kinship_from_bimbam.py
+++ b/wqflask/maintenance/generate_kinship_from_bimbam.py
@@ -19,7 +19,7 @@ class GenerateKinshipMatrices:
self.group_name = group_name
self.geno_file = geno_file
self.pheno_file = pheno_file
-
+
def generate_kinship(self):
gemma_command = "/gnu/store/xhzgjr0jvakxv6h3blj8z496xjig69b0-profile/bin/gemma -g " + self.geno_file + \
" -p " + self.pheno_file + \
@@ -56,11 +56,11 @@ class GenerateKinshipMatrices:
print(" Column is:", convertob.latest_col_value)
print(" Row is:", convertob.latest_row_value)
break
-
-
+
+
if __name__ == "__main__":
Geno_Directory = """/export/local/home/zas1024/genotype_files/genotype/"""
Bimbam_Directory = """/export/local/home/zas1024/genotype_files/genotype/bimbam/"""
GenerateKinshipMatrices.process_all(Geno_Directory, Bimbam_Directory)
-
+
# ./gemma -g /home/zas1024/genotype_files/genotype/bimbam/BXD_geno.txt -p /home/zas1024/genotype_files/genotype/bimbam/BXD_pheno.txt -gk 1 -o BXD
diff --git a/wqflask/maintenance/geno_to_json.py b/wqflask/maintenance/geno_to_json.py
index 76a0fc98..27eb6553 100644
--- a/wqflask/maintenance/geno_to_json.py
+++ b/wqflask/maintenance/geno_to_json.py
@@ -29,7 +29,7 @@ from pprint import pformat as pf
class EmptyConfigurations(Exception):
pass
-
+
class Marker:
def __init__(self):
self.name = None
@@ -42,20 +42,20 @@ class Marker:
class ConvertGenoFile:
def __init__(self, input_file, output_file):
-
+
self.input_file = input_file
self.output_file = output_file
-
+
self.mb_exists = False
self.cm_exists = False
self.markers = []
-
+
self.latest_row_pos = None
self.latest_col_pos = None
-
+
self.latest_row_value = None
self.latest_col_value = None
-
+
def convert(self):
self.haplotype_notation = {
@@ -64,16 +64,16 @@ class ConvertGenoFile:
'@het': "0.5",
'@unk': "NA"
}
-
+
self.configurations = {}
#self.skipped_cols = 3
-
+
# if self.input_file.endswith(".geno.gz"):
# print("self.input_file: ", self.input_file)
# self.input_fh = gzip.open(self.input_file)
# else:
self.input_fh = open(self.input_file)
-
+
with open(self.output_file, "w") as self.output_fh:
# if self.file_type == "geno":
self.process_csv()
@@ -105,22 +105,22 @@ class ConvertGenoFile:
self.configurations[genotype.upper()])
else:
this_marker.genotypes.append("NA")
-
- #print("this_marker is:", pf(this_marker.__dict__))
+
+ #print("this_marker is:", pf(this_marker.__dict__))
# if this_marker.chr == "14":
self.markers.append(this_marker.__dict__)
with open(self.output_file, 'w') as fh:
json.dump(self.markers, fh, indent=" ", sort_keys=True)
-
+
# print('configurations:', str(configurations))
#self.latest_col_pos = item_count + self.skipped_cols
#self.latest_col_value = item
-
+
# if item_count != 0:
# self.output_fh.write(" ")
# self.output_fh.write(self.configurations[item.upper()])
-
+
# self.output_fh.write("\n")
def process_rows(self):
@@ -176,12 +176,12 @@ class ConvertGenoFile:
print(" Column is:", convertob.latest_col_value)
print(" Row is:", convertob.latest_row_value)
break
-
+
# def process_snps_file(cls, snps_file, new_directory):
# output_file = os.path.join(new_directory, "mouse_families.json")
# print("%s -> %s" % (snps_file, output_file))
# convertob = ConvertGenoFile(input_file, output_file)
-
+
if __name__ == "__main__":
Old_Geno_Directory = """/export/local/home/zas1024/gn2-zach/genotype_files/genotype"""
@@ -192,5 +192,5 @@ if __name__ == "__main__":
# convertob.convert()
ConvertGenoFile.process_all(Old_Geno_Directory, New_Geno_Directory)
# ConvertGenoFiles(Geno_Directory)
-
+
#process_csv(Input_File, Output_File)