Skip to content
Snippets Groups Projects
Commit 091411ba authored by Schneider Leo's avatar Schneider Leo
Browse files

fix : optimize imports

parent c83febd6
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,6 @@ import os ...@@ -3,7 +3,6 @@ import os
import pandas as pd import pandas as pd
import re import re
import numpy as np import numpy as np
from PIL import Image
import matplotlib.image as mpimg import matplotlib.image as mpimg
from build_image import build_image_ms1 from build_image import build_image_ms1
......
...@@ -32,12 +32,13 @@ def build_image_ms1(path, bin_mz): ...@@ -32,12 +32,13 @@ def build_image_ms1(path, bin_mz):
e = oms.MSExperiment() e = oms.MSExperiment()
oms.MzMLFile().load(path, e) oms.MzMLFile().load(path, e)
e.updateRanges() e.updateRanges()
id = e.getSpectra()[-1].getNativeID() id_spectra = e.getSpectra()[-1].getNativeID()
dico = dict(s.split('=', 1) for s in id.split()) dico = dict(s.split('=', 1) for s in id_spectra.split())
max_cycle = int(dico['cycle']) max_cycle = int(dico['cycle'])
list_cycle = [[] for _ in range(max_cycle)] list_cycle = [[] for _ in range(max_cycle)]
#get ms window size from first ms1 spectra (similar for all ms1 spectra) #get ms window size from first ms1 spectra (similar for all ms1 spectra)
ms1_start_mz,ms1_end_mz=None,None
for s in e: for s in e:
if s.getMSLevel() == 1: if s.getMSLevel() == 1:
ms1_start_mz = s.getInstrumentSettings().getScanWindows()[0].begin ms1_start_mz = s.getInstrumentSettings().getScanWindows()[0].begin
...@@ -50,8 +51,8 @@ def build_image_ms1(path, bin_mz): ...@@ -50,8 +51,8 @@ def build_image_ms1(path, bin_mz):
size_bin_ms1 = total_ms1_mz / n_bin_ms1 size_bin_ms1 = total_ms1_mz / n_bin_ms1
#organise sepctra by their MSlevel (only MS1 are kept) #organise sepctra by their MSlevel (only MS1 are kept)
for spec in e: # data structure for spec in e: # data structure
id = spec.getNativeID() id_spectra = spec.getNativeID()
dico = dict(s.split('=', 1) for s in id.split()) dico = dict(s.split('=', 1) for s in id_spectra.split())
if spec.getMSLevel() == 1: if spec.getMSLevel() == 1:
list_cycle[int(dico['cycle']) - 1].insert(0, spec) list_cycle[int(dico['cycle']) - 1].insert(0, spec)
......
import pandas as pd
import pyarrow.parquet as pq import pyarrow.parquet as pq
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np
from matplotlib_venn import venn2 from matplotlib_venn import venn2
......
import random import random
from cProfile import label
import numpy as np import numpy as np
import torch import torch
...@@ -9,10 +8,10 @@ import torch.utils.data as data ...@@ -9,10 +8,10 @@ import torch.utils.data as data
from PIL import Image from PIL import Image
import os import os
import os.path import os.path
from typing import Any, Callable, cast, Dict, List, Optional, Tuple, Union from typing import Callable, cast, Dict, List, Optional, Tuple, Union
from pathlib import Path from pathlib import Path
from collections import OrderedDict from collections import OrderedDict
from sklearn.model_selection import train_test_split
IMG_EXTENSIONS = ".npy" IMG_EXTENSIONS = ".npy"
class Threshold_noise: class Threshold_noise:
......
#TODO REFAIRE UN DATASET https://discuss.pytorch.org/t/upload-a-customize-data-set-for-multi-regression-task/43413?u=ptrblck
"""1er methode load 1 image pour 1 ref
2eme methode : load 1 image et toutes les refs : ok pour l'instant mais a voir comment est ce que cela scale avec l'augmentation du nb de classes
3eme methods 2 datasets différents : plus efficace en stockage mais pas facil a maintenir"""
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np import numpy as np
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment