Hi again,

I have two questions using the similarity matrix in single_snp:

1) Which format do I have to provide if I use the npz format? My npz matrix throws the error below.

2) If I don't provide K0, how is the similarity matrix calculated and is it possible to store the matrix for other runs?

Thanks a lot
Stefanie

Error:
Traceback (most recent call last):
  File "C:/Users//PycharmProjects/BCC_Experiments/lmm/lmm01.py", line 27, in <module>
    results_df = single_snp(bed_fn, pheno_fn, K0=k)
  File "C:\Users\\AppData\Local\Continuum\anaconda3\envs\gwas_flow\lib\site-packages\fastlmm\association\single_snp.py", line 246, in single_snp
    runner = runner)
  File "C:\Users\\AppData\Local\Continuum\anaconda3\envs\gwas_flow\lib\site-packages\pysnptools\util\mapreduce1\mapreduce.py", line 202, in map_reduce
    result = runner.run(dist)
  File "C:\Users\\AppData\Local\Continuum\anaconda3\envs\gwas_flow\lib\site-packages\pysnptools\util\mapreduce1\runner\local.py", line 48, in run
    result = _run_all_in_memory(distributable)
  File "C:\Users\\AppData\Local\Continuum\anaconda3\envs\gwas_flow\lib\site-packages\pysnptools\util\mapreduce1\runner\__init__.py", line 30, in _run_all_in_memory
    return work.reduce(result_sequence)
  File "C:\Users\\AppData\Local\Continuum\anaconda3\envs\gwas_flow\lib\site-packages\pysnptools\util\mapreduce1\mapreduce.py", line 77, in reduce
    return self.reducer(output_seq)
  File "C:\Users\\AppData\Local\Continuum\anaconda3\envs\gwas_flow\lib\site-packages\fastlmm\association\single_snp.py", line 228, in reducer_closure
    frame = pd.concat(frame_sequence)
  File "C:\Users\\AppData\Local\Continuum\anaconda3\envs\gwas_flow\lib\site-packages\pandas\core\reshape\concat.py", line 295, in concat
    sort=sort,
  File "C:\Users\\AppData\Local\Continuum\anaconda3\envs\gwas_flow\lib\site-packages\pandas\core\reshape\concat.py", line 339, in __init__
    objs = list(objs)
  File "C:\Users\\AppData\Local\Continuum\anaconda3\envs\gwas_flow\lib\site-packages\pysnptools\util\mapreduce1\runner\__init__.py", line 14, in work_sequence_to_result_sequence
    result = work()
  File "C:\Users\\AppData\Local\Continuum\anaconda3\envs\gwas_flow\lib\site-packages\pysnptools\util\mapreduce1\mapreduce.py", line 65, in <lambda>
    yield lambda i=i, input_arg=input_arg: self.dowork(i, input_arg)  # the 'i=i',etc is need to get around a strangeness in Python
  File "C:\Users\\AppData\Local\Continuum\anaconda3\envs\gwas_flow\lib\site-packages\pysnptools\util\mapreduce1\mapreduce.py", line 92, in dowork
    result = _run_all_in_memory(work)
  File "C:\Users\\AppData\Local\Continuum\anaconda3\envs\gwas_flow\lib\site-packages\pysnptools\util\mapreduce1\runner\__init__.py", line 25, in _run_all_in_memory
    return work()
  File "C:\Users\\AppData\Local\Continuum\anaconda3\envs\gwas_flow\lib\site-packages\pysnptools\util\mapreduce1\mapreduce.py", line 91, in <lambda>
    work = lambda : self.mapper(input_arg)
  File "C:\Users\\AppData\Local\Continuum\anaconda3\envs\gwas_flow\lib\site-packages\fastlmm\association\single_snp.py", line 211, in nested_closure
    K0_chrom = _K_per_chrom(K0 or G0 or test_snps, chrom, test_snps.iid)
  File "C:\Users\\AppData\Local\Continuum\anaconda3\envs\gwas_flow\lib\site-packages\fastlmm\association\single_snp.py", line 301, in _K_per_chrom
    return SnpKernel(K_all.snpreader[:,K_all.pos[:,0] != chrom],K_all.standardizer)
  File "C:\Users\\AppData\Local\Continuum\anaconda3\envs\gwas_flow\lib\site-packages\pysnptools\kernelreader\snpkernel.py", line 150, in pos
    return self.snpreader.pos
  File "C:\Users\\AppData\Local\Continuum\anaconda3\envs\gwas_flow\lib\site-packages\pysnptools\snpreader\snpreader.py", line 404, in pos
    return self.col_property
  File "C:\Users\\AppData\Local\Continuum\anaconda3\envs\gwas_flow\lib\site-packages\pysnptools\pstreader\pstnpz.py", line 67, in col_property
    self._run_once()
  File "C:\Users\\AppData\Local\Continuum\anaconda3\envs\gwas_flow\lib\site-packages\pysnptools\pstreader\pstnpz.py", line 82, in _run_once
    self._row = data['row']
  File "C:\Users\\AppData\Local\Continuum\anaconda3\envs\gwas_flow\lib\site-packages\numpy\lib\npyio.py", line 259, in __getitem__
    raise KeyError("%s is not a file in the archive" % key)
KeyError: 'row is not a file in the archive'

Process finished with exit code 1