MrTomRod / scoary-2

Calculate assocations between genes and traits
MIT License
19 stars 1 forks source link

Trait file not found #2

Closed jacordova closed 2 years ago

jacordova commented 2 years ago

Hi Tom,

I finally got around to working with Scoary-2.

I'm following your example command (using Docker on a Mac) in the tutorial but keep getting an error message stating that my traits file can't be found. The traits and genes files are in the working directory. Interestingly, and maybe this is on purpose, it seems that scoary looks for the traits file first; if I use a non-existent file name for the genes file, it will still call the traits file missing first. Below is the command that I used:

docker run --rm -v /Users/[Username]/Desktop/Scoary2/ troder/scoary-2 scoary --genes GeneCount_Scoary_Ecoli.tsv --gene-data-type 'gene-count:\t' --traits Ecoli_traits.tsv --trait-data-type 'gaussian:kmeans:\t' --outdir Output --n_permut 500 --n_cpus 1

Note that also tried the above command by adding "/Users/[Username]/Desktop/Scoary2/", "/Scoary2/", and "./". before the respective file names and output directory.

Below is the error code and I've also attached the files. Thanks in advance for your help!

Traceback (most recent call last):
  File "/usr/local/bin/scoary", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/scoary/scoary.py", line 283, in main
    fire.Fire(scoary)
  File "/usr/local/lib/python3.10/site-packages/fire/core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/usr/local/lib/python3.10/site-packages/fire/core.py", line 466, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "/usr/local/lib/python3.10/site-packages/fire/core.py", line 681, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/scoary/scoary.py", line 86, in scoary
    numeric_df, traits_df = load_traits(
  File "/usr/local/lib/python3.10/site-packages/scoary/load_traits.py", line 422, in load_traits
    numeric_df = load_numeric(
  File "/usr/local/lib/python3.10/site-packages/scoary/load_traits.py", line 85, in load_numeric
    numeric_df = pd.read_csv(traits, delimiter=delimiter, index_col=0, dtype=dtypes, na_values=STR_NA_VALUES)
  File "/usr/local/lib/python3.10/site-packages/pandas/util/_decorators.py", line 311, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 680, in read_csv
    return _read(filepath_or_buffer, kwds)
  File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 575, in _read
    parser = TextFileReader(filepath_or_buffer, **kwds)
  File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 934, in __init__
    self._engine = self._make_engine(f, self.engine)
  File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 1218, in _make_engine
    self.handles = get_handle(  # type: ignore[call-overload]
  File "/usr/local/lib/python3.10/site-packages/pandas/io/common.py", line 786, in get_handle
    handle = open(
FileNotFoundError: [Errno 2] No such file or directory: 'Ecoli_traits.tsv'

Ecoli_traits.txt GeneCount_Scoary_Ecoli.txt

MrTomRod commented 2 years ago

A few problems:

This should work:

docker run --rm \
    -v /Users/[Username]/Desktop/Scoary2:/data \
    troder/scoary-2:0.0.7 \
    scoary \
        --genes /data/GeneCount_Scoary_Ecoli.txt \
        --gene-data-type 'gene-count:\t' \
        --traits /data/Ecoli_traits.txt \
        --trait-data-type 'gaussian:kmeans:\t' \
        --outdir /data/Output \
        --n_permut 500 \
        --n_cpus 2

Ecoli_traits.txt GeneCount_Scoary_Ecoli.txt

jacordova commented 2 years ago

Hi Tom,

Gah, a bunch of dumb silly mistakes on my part. It ran perfectly and I'm looking through the output now.

I see an explainer for the output files on your "to do list," any ETA by chance?

Thank you so much for your help and for developing this!

MrTomRod commented 2 years ago

No worries, I hope you'll find it useful.

I don't have an firm ETA, but I'm hoping to work on it in the next 2 weeks.

If you want, I could help you via zoom (or similar) right now. If you'd like that, send me an invite via mail.