Пример #1
0
    "Read the whole document (each column). Default is only the first column.",
    action="store_true")
parser.add_argument("--skip", help="Skip the every nth column", default=0)

args = parser.parse_args()

theoretical_name = args.theoretical
observed_name = args.observed
output_name = args.output_csv
is_separate = args.separate_species
tolerance = float(args.tolerance)
order = args.order
whole = args.whole
skip = int(args.skip)

species = sr.json_to_species(theoretical_name)
ions = [mol for mol in species if mol.category == "Ion"]
adducts = [mol for mol in species if mol.category == "Adduct"]
modifications = [mol for mol in species if mol.category == "Modification"]
print(len(ions), "ions,", len(adducts), "adducts,", len(modifications),
      "modifications.")

theoretical_spectrum = TheoreticalSpectrum(ions, adducts, modifications)

with open(observed_name) as csv_file:
    csv_reader = csv.reader(csv_file, delimiter=";")
    observed_spectrum = []
    for row in csv_reader:
        if whole:
            observed_spectrum.append([process_cell(cell) for cell in row])
        else:
Пример #2
0
 def test_json_to_species(self):
     species = sr.json_to_species("data/species_rule.json")
     print([s.species() for s in species])