Spaces:
Sleeping
Sleeping
chore: Add debug logging
Browse files- predict_chromosome.py +9 -1
predict_chromosome.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import argparse
|
|
|
|
| 4 |
import pandas as pd
|
| 5 |
import numpy as np
|
| 6 |
import time
|
|
@@ -8,6 +9,8 @@ from tqdm import tqdm
|
|
| 8 |
from tensorflow.keras.models import model_from_json
|
| 9 |
from scipy.sparse import csr_matrix, triu
|
| 10 |
|
|
|
|
|
|
|
| 11 |
|
| 12 |
def anchor_list_to_dict(anchors):
|
| 13 |
anchor_dict = {}
|
|
@@ -133,6 +136,8 @@ def predict_and_write(
|
|
| 133 |
names=["chr", "start", "end", "anchor"],
|
| 134 |
) # read anchor list file
|
| 135 |
start_time = time.time()
|
|
|
|
|
|
|
| 136 |
chr_anchor_file = pd.read_csv(
|
| 137 |
os.path.join(full_matrix_dir, input_name),
|
| 138 |
delimiter="\t",
|
|
@@ -169,8 +174,11 @@ def predict_and_write(
|
|
| 169 |
cols = np.vectorize(anchor_to_locus(anchor_dict))(
|
| 170 |
chr_tile["anchor2"].values
|
| 171 |
) # convert anchor names to column indices
|
|
|
|
|
|
|
| 172 |
sparse_matrix = csr_matrix(
|
| 173 |
-
(chr_tile["ratio"], (rows, cols)),
|
|
|
|
| 174 |
) # construct sparse CSR matrix
|
| 175 |
|
| 176 |
sparse_denoised_tile = sparse_prediction_from_file(
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
import argparse
|
| 4 |
+
from logging import getLogger
|
| 5 |
import pandas as pd
|
| 6 |
import numpy as np
|
| 7 |
import time
|
|
|
|
| 9 |
from tensorflow.keras.models import model_from_json
|
| 10 |
from scipy.sparse import csr_matrix, triu
|
| 11 |
|
| 12 |
+
logger = getLogger(__name__)
|
| 13 |
+
|
| 14 |
|
| 15 |
def anchor_list_to_dict(anchors):
|
| 16 |
anchor_dict = {}
|
|
|
|
| 136 |
names=["chr", "start", "end", "anchor"],
|
| 137 |
) # read anchor list file
|
| 138 |
start_time = time.time()
|
| 139 |
+
print("anchor file")
|
| 140 |
+
print(os.path.join(full_matrix_dir, input_name))
|
| 141 |
chr_anchor_file = pd.read_csv(
|
| 142 |
os.path.join(full_matrix_dir, input_name),
|
| 143 |
delimiter="\t",
|
|
|
|
| 174 |
cols = np.vectorize(anchor_to_locus(anchor_dict))(
|
| 175 |
chr_tile["anchor2"].values
|
| 176 |
) # convert anchor names to column indices
|
| 177 |
+
print(chr_tile)
|
| 178 |
+
logger.debug(chr_tile)
|
| 179 |
sparse_matrix = csr_matrix(
|
| 180 |
+
(chr_tile["ratio"], (rows, cols)),
|
| 181 |
+
shape=(anchor_step, anchor_step),
|
| 182 |
) # construct sparse CSR matrix
|
| 183 |
|
| 184 |
sparse_denoised_tile = sparse_prediction_from_file(
|