---
# System prepended metadata

title: Instalando MetaMobilePicker

---

## Instalando MetaMobilePicker 

### Instalando Mamba 

Instalando [miniforge](https://github.com/conda-forge/miniforge#mambaforge) 

```
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-$(uname)-$(uname -m).sh
```

Luego puse 

```
conda init 
eval "$(/home/lauramarcos/miniforge3/bin/conda shell.bash hook)

```
:::danger
Como ahora tengo Mamba y Conda hay envs en uno y otro lado... :scream: 
:::


### MetaMobilePicker 

```
conda create --name metamobilepicker python=3.10
conda activate metamobilepicker
conda install -c conda-forge mamba
mamba install -c bioconda metamobilepicker
conda install -c bioconda biopython

```

Probando la instalación 

```
metamobilepicker run --test --dryrun
```

Me sale un error. Creo que falta Snakemake. 

### Instalando snakemake

```
mamba create -c conda-forge -c bioconda -n snakemake snakemake
```

El error creo qu esque falta Singularity... Ya que hay un pequeño e imperceptible comentari oque dice: *"Note: For running the pipeline, you will need Singularity (v3.8 or later) installed on your system."*

### Instalando Singularuty 

Conseguí este [tutorial](https://singularity-tutorial.github.io/01-installation/). 

```
sudo apt-get install -y build-essential libssl-dev uuid-dev libgpgme11-dev \
    squashfs-tools libseccomp-dev wget pkg-config git cryptsetup debootstrap
       
```

Se tiene que instalar Go 

```
 wget https://dl.google.com/go/go1.16.12.linux-amd64.tar.gz

 sudo tar --directory=/usr/local -xzvf go1.16.12.linux-amd64.tar.gz

 export PATH=/usr/local/go/bin:$PATH
```

Ahora si, he puesto la version v3.8.7

```
wget https://github.com/singularityware/singularity/releases/download/v3.8.7/singularity-3.8.7.tar.gz
tar -xzvf singularity-3.8.7.tar.gz 
```

:memo: Tuve un error y es poque había instalado una versión de Go antigua (go1.13) necesitaba la go1.16.12 así que la actualicé. Ya está arreglado el codigo con la version necesaria. 

```bash
cd singularity-3.8.7

./mconfig

cd builddir

make

sudo make install
```

Lo conseguí :smile: 
```
 ____________________________________
/ You tread upon my patience.        \
|                                    |
\ -- William Shakespeare, "Henry IV" /
 ------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
```

**Seguimos con MetaMobilePicker**

```bash
metamobilepicker run --test --dryrun
```

Sin erroreeees :hamster: 

```bash
metamobilepicker run --test
```

Me salió este comentario mientras: 

> Your conda installation is not configured to use strict channel priorities. This is however crucial for having robust and correct environments (for details, see https://conda-forge.org/docs/user/tipsandtricks.html). Please consider to configure strict priorities by executing 'conda config --set channel_priority strict'.

Lo arreglaré cuando termine de correr (No modificarlo xD)

:warning: ERROR
```
Activating conda environment: .snakemake/conda/06b220d26a41a458692266b4e3a75986
ERROR: This cross-compiler package contains no program /home/lauramarcos/anaconda3/envs/metamobilepicker/lib/python3.10/site-packages/MetaMobilePicker/.snakemake/conda/06b220d26a41a458692266b4e3a75986/bin/x86_64-conda_cos6-linux-gnu-gfortran
INFO: activate-gfortran_linux-64.sh made the following environmental changes:
+HOST=x86_64-conda_cos6-linux-gnu
-HOST=x86_64-conda-linux-gnu
[Tue Apr  2 12:50:50 2024]
Error in rule simplify_names:
    jobid: 18
    output: test/mmp_test/test/test_anvio/test_MGEs_simplified.fasta, test/mmp_test/test/test_anvio/test_MGEs_simplified.names
    log: test/mmp_test/test/log/anvio/test_simplify_fasta_error.txt, test/mmp_test/test/log/anvio/test_simplify_fasta_out.txt (check log file(s) for error message)
    conda-env: /home/lauramarcos/anaconda3/envs/metamobilepicker/lib/python3.10/site-packages/MetaMobilePicker/.snakemake/conda/06b220d26a41a458692266b4e3a75986
    shell:
        
        anvi-script-reformat-fasta test/mmp_test/test/test_MGEs/test_MetaMobilePicker.fasta -o test/mmp_test/test/test_anvio/test_MGEs_simplified.fasta -l 0 --simplify-names --report-file test/mmp_test/test/test_anvio/test_MGEs_simplified.names 1> test/mmp_test/test/log/anvio/test_simplify_fasta_out.txt 2> test/mmp_test/test/log/anvio/test_simplify_fasta_error.txt

        
        (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)

Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Workflow finished with errors.
[2024-04-02 12:50 CRITICAL] Command 'snakemake --use-conda --snakefile /home/lauramarcos/anaconda3/envs/metamobilepicker/lib/python3.10/site-packages/MetaMobilePicker/Snakefile --cores 16         --configfile /home/lauramarcos/anaconda3/envs/metamobilepicker/lib/python3.10/site-packages/MetaMobilePicker/config/test.yaml --rerun-incomplete  --nolock --latency-wait 60 --directory /home/lauramarcos/anaconda3/envs/metamobilepicker/lib/python3.10/site-packages/MetaMobilePicker --use-singularity        --singularity-prefix /home/lauramarcos/anaconda3/envs/metamobilepicker/lib/python3.10/site-packages/MetaMobilePicker/.snakemake --singularity-args '--home $PWD/.. --bind $TMPDIR,$PWD/..'' returned non-zero exit status 13.
```

:clown_face: Tuve que abrir un comentario en el foro de metamobile. Aquí está la [solución](https://gitlab.com/jkerkvliet/metamobilepicker/-/issues/28#note_1909293068). Funcionó para ejecutar test sin errores. 

### Prueba con muestras

pasar los archivos test a una carpeta 

`/home/lauramarcos/metamobile/mmp_data `

Crear un archivo de texto, separado pro comas indicando la ubicacion de los archivos: 

`testsample,mmp_data/test_reads_10k_R1.fastq,mmp_data/test_reads_10k_R2.fastq`

Configurar archivo yaml 

`metamobilepicker config --samples samples.txt --output config.yaml --outdir mmp_test_output`
 
 Me pone estos Warnings: 
>  WARNING: a host sequence file wasn't specified. I'll use a mock sequence file, but consider adding a real host file!
> WARNING: No output file was specified, it will be written to config.yaml. Please make sure that's okay!
 
 Se crea archivo config.yaml 
 
**Ejecutar prueba:**

`metamobilepicker run -c config.yaml --dryrun`

No da errores. Probar sin dryrun 

:warning: Me está dando un error de Atlas_QC

```
Error in rule atlasQC:
    jobid: 6
    output: test/mmp_test/test/test_ATLAS/test_atlas.txt, test/mmp_test/test/test_processed_reads/test_QC_R1.fastq.gz, test/mmp_test/test/test_processed_reads/test_QC_R2.fastq.gz
    log: test/mmp_test/test/log/QC/test_QC_error.txt, test/mmp_test/test/log/QC/test_QC_out.txt (check log file(s) for error message)
    conda-env: /home/lauramarcos/miniforge3/envs/metamobilepicker/lib/python3.10/site-packages/MetaMobilePicker/.snakemake/conda/08ade8b6a970379f2cd205ca0ae8ad7f
    shell:
        
        # Gets sample name with - in stead of _ (Atlas preference)
        sample=$(echo test | sed 's/_/-/g')
        # Runs the QC module of Metagenome-Atlas
        atlas run qc --config-file test/mmp_test/test/test_ATLAS/config_modified.yaml --working-dir test/mmp_test/test/test_ATLAS --jobs 6 --resources mem=8 java_mem=8 --conda-prefix /home/lauramarcos/miniforge3/envs/metamobilepicker/lib/python3.10/site-packages/snakemake 1>test/mmp_test/test/log/QC/test_QC_out.txt 2>test/mmp_test/test/log/QC/test_QC_error.txt
        touch test/mmp_test/test/test_ATLAS/test_atlas.txt
        echo "Finished QC, copying reads" >> test/mmp_test/test/log/QC/test_QC_out.txt
        # Copies the QC'ed reads to the output directory
        mv test/mmp_test/test/test_ATLAS/${sample}/sequence_quality_control/${sample}_QC_R1.fastq.gz test/mmp_test/test/test_processed_reads/test_QC_R1.fastq.gz
        mv test/mmp_test/test/test_ATLAS/${sample}/sequence_quality_control/${sample}_QC_R2.fastq.gz test/mmp_test/test/test_processed_reads/test_QC_R2.fastq.gz
        echo "Finished QC step" >> test/mmp_test/test/log/QC/test_QC_out.txt
        
        (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)
```
El log del error en snakemake: 

```
este es el log del error: 
[Mon May 20 11:24:09 2024]
localrule write_read_counts:
    input: test/sequence_quality_control/read_stats/raw_read_counts.tsv, test/sequence_quality_control/read_stats/deduplicated_read_counts.tsv, test/sequence_quality_control/read_stats/filtered_read_counts.tsv, test/sequence_quality_control/read_stats/clean_read_counts.tsv, test/sequence_quality_control/read_stats/QC_read_counts.tsv
    output: test/sequence_quality_control/read_stats/read_counts.tsv
    jobid: 17
    wildcards: sample=test
    resources: tmpdir=/tmp, mem=8, mem_mb=60000, time=5

[32m[Mon May 20 11:24:10 2024][0m
[31mError in rule write_read_counts:[0m
[31m    jobid: 0[0m
[31m    output: test/sequence_quality_control/read_stats/read_counts.tsv[0m
[31m[0m
[31mRuleException:
AttributeError in line 730 of /home/lauramarcos/miniforge3/envs/metamobilepicker/lib/python3.10/site-packages/MetaMobilePicker/.snakemake/conda/08ade8b6a970379f2cd205ca0ae8ad7f/lib/python3.8/site-packages/atlas/rules/qc.smk:
'DataFrame' object has no attribute 'append'
  File "/home/lauramarcos/miniforge3/envs/metamobilepicker/lib/python3.10/site-packages/MetaMobilePicker/.snakemake/conda/08ade8b6a970379f2cd205ca0ae8ad7f/lib/python3.8/site-packages/atlas/rules/qc.smk", line 730, in __rule_write_read_counts
  File "/home/lauramarcos/.local/lib/python3.8/site-packages/pandas/core/generic.py", line 5989, in __getattr__
  File "/home/lauramarcos/miniforge3/envs/metamobilepicker/lib/python3.10/site-packages/MetaMobilePicker/.snakemake/conda/08ade8b6a970379f2cd205ca0ae8ad7f/lib/python3.8/concurrent/futures/thread.py", line 57, in run[0m
[31mExiting because a job execution failed. Look above for error message[0m
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Complete log: /home/lauramarcos/miniforge3/envs/metamobilepicker/lib/python3.10/site-packages/MetaMobilePicker/test/mmp_test/test/test_ATLAS/.snakemake/log/2024-05-20T112200.873202.snakemake.log
[2024-05-20 11:24 CRITICAL] Command 'snakemake --snakefile /home/lauramarcos/miniforge3/envs/metamobilepicker/lib/python3.10/site-packages/MetaMobilePicker/.snakemake/conda/08ade8b6a970379f2cd205ca0ae8ad7f/lib/python3.8/site-packages/atlas/Snakefile --directory /home/lauramarcos/miniforge3/envs/metamobilepicker/lib/python3.10/site-packages/MetaMobilePicker/test/mmp_test/test/test_ATLAS --jobs 6 --rerun-incomplete --configfile '/home/lauramarcos/miniforge3/envs/metamobilepicker/lib/python3.10/site-packages/MetaMobilePicker/test/mmp_test/test/test_ATLAS/config_modified.yaml' --nolock   --use-conda --conda-prefix /home/lauramarcos/miniforge3/envs/metamobilepicker/lib/python3.10/site-packages/MetaMobilePicker/test/mmp_test/test/test_ATLAS/test_databases/conda_envs   --scheduler greedy  qc  --resources mem=8 java_mem=8 --conda-prefix /home/lauramarcos/miniforge3/envs/metamobilepicker/lib/python3.10/site-packages/snakemake ' returned non-zero exit status 1.
```

### Muestras reales 

:warning: Actualización Julio 25: conda activate metamobilepicker 

:nerd_face: Lo repito con muestras reales. Uso la muestras V1_783_R1 y V1_783_R2. 


Crear un archivo de texto (`samples.txt`), separado por comas indicando la ubicacion de los archivos:

`V1_783,data/V1_783_R1.fastq,data/V1_783_R2.fastq`

Configurar archivo yaml

```
metamobilepicker config --samples samples.txt --output V1_783config.yaml --outdir output
```

Ejecuto: 

```
metamobilepicker run -c V1_783config.yaml 
```

Mismo error 

:::spoiler
```
[Mon May 20 16:41:04 2024]
Error in rule atlasQC:
    jobid: 6
    output: /home/lauramarcos/metamobile/results/V1783/V1783_ATLAS/V1783_atlas.txt, /home/lauramarcos/metamobile/results/V1783/V1783_processed_reads/V1783_QC_R1.fastq.gz, /home/lauramarcos/metamobile/results/V1783/V1783_processed_reads/V1783_QC_R2.fastq.gz
    log: /home/lauramarcos/metamobile/results/V1783/log/QC/V1783_QC_error.txt, /home/lauramarcos/metamobile/results/V1783/log/QC/V1783_QC_out.txt (check log file(s) for error message)
    conda-env: /home/lauramarcos/anaconda3/envs/metamobilepicker/lib/python3.10/site-packages/MetaMobilePicker/.snakemake/conda/cd9fc1fe765bf2e3f5a276243a16e9e8
    shell:
        
        # Gets sample name with - in stead of _ (Atlas preference)
        sample=$(echo V1783 | sed 's/_/-/g')
        # Runs the QC module of Metagenome-Atlas
        atlas run qc --config-file /home/lauramarcos/metamobile/results/V1783/V1783_ATLAS/config_modified.yaml --working-dir /home/lauramarcos/metamobile/results/V1783/V1783_ATLAS --jobs 6 --resources mem=8 java_mem=8 --conda-prefix /home/lauramarcos/anaconda3/envs/metamobilepicker/lib/python3.10/site-packages/snakemake 1>/home/lauramarcos/metamobile/results/V1783/log/QC/V1783_QC_out.txt 2>/home/lauramarcos/metamobile/results/V1783/log/QC/V1783_QC_error.txt
        touch /home/lauramarcos/metamobile/results/V1783/V1783_ATLAS/V1783_atlas.txt
        echo "Finished QC, copying reads" >> /home/lauramarcos/metamobile/results/V1783/log/QC/V1783_QC_out.txt
        # Copies the QC'ed reads to the output directory
        mv /home/lauramarcos/metamobile/results/V1783/V1783_ATLAS/${sample}/sequence_quality_control/${sample}_QC_R1.fastq.gz /home/lauramarcos/metamobile/results/V1783/V1783_processed_reads/V1783_QC_R1.fastq.gz
        mv /home/lauramarcos/metamobile/results/V1783/V1783_ATLAS/${sample}/sequence_quality_control/${sample}_QC_R2.fastq.gz /home/lauramarcos/metamobile/results/V1783/V1783_processed_reads/V1783_QC_R2.fastq.gz
        echo "Finished QC step" >> /home/lauramarcos/metamobile/results/V1783/log/QC/V1783_QC_out.txt
        
        (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)

Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Workflow finished with errors.
[2024-05-20 16:41 CRITICAL] Command 'snakemake --use-conda --snakefile /home/lauramarcos/anaconda3/envs/metamobilepicker/lib/python3.10/site-packages/MetaMobilePicker/Snakefile --cores 16         --configfile V1783_config.yaml --rerun-incomplete  --nolock --latency-wait 60 --directory /home/lauramarcos/anaconda3/envs/metamobilepicker/lib/python3.10/site-packages/MetaMobilePicker --use-singularity        --singularity-prefix /home/lauramarcos/anaconda3/envs/metamobilepicker/lib/python3.10/site-packages/MetaMobilePicker/.snakemake --singularity-args '--home $PWD/.. --bind $TMPDIR,$PWD/..'' returned non-zero exit status 13.
```
:::

:upside_down_face: Creo que es por el nombre de las muestras. Pruebo quitando los guiones bajos del nombre y renombro a `V1783R1.fastq` y `V1783R2.fastq` y repito `metamobilepicker run -c V1783config.yaml `
:warning: Sigue el mismo error, parece que es algo del script *qm.sqk*, me he envalentonado y lo he cambiado. 

He modificado el script qm.smk tal que asi: 

```python=716
rule write_read_counts:
    input:
        read_count_files=expand(
            "{{sample}}/sequence_quality_control/read_stats/{step}_read_counts.tsv",
            step=PROCESSED_STEPS,
        ),
    output:
        read_stats="{sample}/sequence_quality_control/read_stats/read_counts.tsv",
    run:
        import pandas as pd

        all_read_counts = []
        
        for read_stats_file in input.read_count_files:
            d = pd.read_csv(read_stats_file, index_col=[0, 1], sep="\t")
            all_read_counts.append(d)
        all_read_counts_df = pd.concat(all_read_counts)
        all_read_counts_df.to_csv(output.read_stats, sep="\t")


rule combine_read_counts:
    input:
        expand(
            "{sample}/sequence_quality_control/read_stats/read_counts.tsv",
            sample=SAMPLES,
        ),
    output:
        "stats/read_counts.tsv",
    run:
        import pandas as pd

        all_read_counts = []

        for f in input:
            d = pd.read_csv(f, index_col=[0, 1], sep="\t")
            all_read_counts.append(d)

        all_read_counts_df = pd.concat(all_read_counts)
        all_read_counts_df.to_csv(output[0], sep="\t")
```

:::spoiler
Aquí el script original: 

```pyhtonh=711
localrules:
    combine_read_counts,
    write_read_counts,


rule write_read_counts:
    input:
        read_count_files=expand(
            "{{sample}}/sequence_quality_control/read_stats/{step}_read_counts.tsv",
            step=PROCESSED_STEPS,
        ),
    output:
        read_stats="{sample}/sequence_quality_control/read_stats/read_counts.tsv",
    run:
        import pandas as pd

        all_read_counts = pd.DataFrame()
        for read_stats_file in input.read_count_files:
            d = pd.read_csv(read_stats_file, index_col=[0, 1], sep="\t")
            all_read_counts = all_read_counts.append(d)
        all_read_counts.to_csv(output.read_stats, sep="\t")
        
        
        rule combine_read_counts:
    input:
        expand(
            "{sample}/sequence_quality_control/read_stats/read_counts.tsv",
            sample=SAMPLES,
        ),
    output:
        "stats/read_counts.tsv",
    run:
        import pandas as pd

        stats = pd.DataFrame()

        for f in input:
            d = pd.read_csv(f, index_col=[0, 1], sep="\t")
            stats = stats.append(d)

        stats.to_csv(output[0], sep="\t")
        
```
:::

Por ahora está ejecutando y va más lejos que antes.... Pasó del Job 6. :nerd_face: 

**LO CONSEGUI!!!! Ahora tengo que entender los resultados... Se tardó como 10horas una muestra.** Pero creo que más no podría por espacio. Necesito usar el cluster. 

:helicopter: Escribir en el foro con la solución. 

## Probar en cluster UAM:
Script test metamobilepicker: 

```bash=1
#!/bin/bash
#SBATCH -p bioinfo                      #partition/queue name
#SBATCH --job-name=metamobilepicker_test                #Job name
#SBATCH -n 20                   #Run one thread
#SBATCH -t 20:00:00             #Time limit hrs:min:sec
#SBATCH --output=/home/proyectos/imdeaalim/ljmarcos/metamobile/log-%j.o #Log de salida
#SBATCH --error=/home/proyectos/imdeaalim/ljmarcos/metamobile/log-%j.e #Log de errores
#SBATCH --mail-user=judith.marcos@imdea.org
#SBATCH --mail-type=ALL
#SBATCH --mem=300G              # Memory per CPU

module load metamobilepicker/0.7.2
metamobilepicker run --test

```

Ejecutar 

`sbatch -A imdeaalim_serv -p bioinfo metamobile_test.sh `

ERROR


Prueba test de nuevo: 

```bash=1
#!/bin/bash
#SBATCH -p bioinfo                      #partition/queue name
#SBATCH --job-name=metamobilepicker_test                #Job name
#SBATCH -N  1
#SBATCH -n 16                   #16 cores es el default de metamobile
#SBATCH -t 5:00:00             #Time limit hrs:min:sec
#SBATCH --output=/home/ljmarcos/metamobile/test/log-%j.o #Log de salida
#SBATCH --error=/home/ljmarcos/metamobile/test/log-%j.e #Log de errores
#SBATCH --mail-user=judith.marcos@imdea.org
#SBATCH --mail-type=ALL

module load metamobilepicker/0.7.2
metamobilepicker run --test
```

ERROR: Parece cosa de permisos. 

```
Loading metamobilepicker/0.7.2
  Loading requirement: go/1.20.2 singularity/3.11.1
Traceback (most recent call last):
  File "/usr/local/metamobilepicker/0.7.2/bin/snakemake", line 10, in <module>
    sys.exit(main())
  File "/usr/local/metamobilepicker/0.7.2/lib/python3.10/site-packages/snakemake/__init__.py", line 2828, in main
    success = snakemake(
  File "/usr/local/metamobilepicker/0.7.2/lib/python3.10/site-packages/snakemake/__init__.py", line 534, in snakemake
    logger.setup_logfile()
  File "/usr/local/metamobilepicker/0.7.2/lib/python3.10/site-packages/snakemake/logging.py", line 316, in setup_logfile
    self.logfile_handler = _logging.FileHandler(self.logfile)
  File "/usr/local/metamobilepicker/0.7.2/lib/python3.10/logging/__init__.py", line 1169, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/local/metamobilepicker/0.7.2/lib/python3.10/logging/__init__.py", line 1201, in _open
    return open_func(self.baseFilename, self.mode,
PermissionError: [Errno 13] Permission denied: '/lustre/local/metamobilepicker/0.7.2/lib/python3.10/site-packages/MetaMobilePicker/.snakemake/log/2024-05-13T155842.992691.snakemake.log'
[2024-05-13 15:58 CRITICAL] Command 'snakemake --use-conda --snakefile /lustre/local/metamobilepicker/0.7.2/lib/python3.10/site-packages/MetaMobilePicker/Snakefile --cores 16         --configfile /lustre/local/metamobilepicker/0.7.2/lib/python3.10/site-packages/MetaMobilePicker/config/test.yaml --rerun-incomplete  --nolock --latency-wait 60 --directory /lustre/local/metamobilepicker/0.7.2/lib/python3.10/site-packages/MetaMobilePicker --use-singularity        --singularity-prefix /lustre/local/metamobilepicker/0.7.2/lib/python3.10/site-packages/MetaMobilePicker/.snakemake --singularity-args '--home $PWD/.. --bind $TMPDIR,$PWD/..'' returned non-zero exit status 1.
```
:nerd_face: **Escribo al UCC**

:::spoiler
>Buenas tardes, 
>
>Escribo porque estoy teniendo problemas para ejecutar metamobilepicker y creo que es por tema de permisos. El programa tiene una serie de scripts con snakemake y no puede escribir el el directorio
>
>/lustre/local/metamobilepicker/0.7.2/lib/python3.10/site-packages/MetaMobilePicker/.snakemake/log/
>
>No sé si podriais otorgarme permiso de escritura para ese directorio o si podemos instalar el programa en un directorio donde si tenga permisos. 
>
>Adjunto el log de error, para que verifiquen que el problema es el que creo y en caso que no sea así si me podeis ayudar a resolverlo. 
>
>Gracias de antemano, 
>
>Laura
:::

PENDIENTE: Intentar con muestras: 

```bash=1
#!/bin/bash
#SBATCH -p bioinfo                      #partition/queue name
#SBATCH --job-name=woltka                #Job name
#SBATCH -N 1                   #Un nodo
#SBATCH -n 40                   #Veinte cores
#SBATCH -t 8:00:00             #Time limit hrs:min:sec
#SBATCH --output=/home/ljmarcos/woltka/log-%j.o #Log de salida
#SBATCH --error=/home/ljmarcos/woltka/log-%j.e #Log de errores
#SBATCH --mail-user=judith.marcos@imdea.org
#SBATCH --mail-type=END,FAIL

module load metamobilepicker/0.7.2
metamobilepicker config --samples sample_meta.txt --output V1_783_config.yaml --outdir out_meta
metamobilepicker run -c V1_783_config.yaml

```

Creo que va a petar porque puse 40 cores y usa solo 16, debo indicar con-C en metamobile 


### Prueba script implementando archivos temp para evitar problemas de espacio 

```bash=1
#!/bin/bash
#SBATCH -p bioinfo                      #partition/queue name
#SBATCH --job-name=metamobile1                #Job name
#SBATCH -N 1                   #Un nodo
#SBATCH -n 16                   #Lo que tiene por default metamobile
#SBATCH -t 20:00:00             #Time limit hrs:min:sec
#SBATCH --output=/home/ljmarcos/metamobile/log-%j.o #Log de salida
#SBATCH --error=/home/ljmarcos/metamobile/log-%j.e #Log de errores
#SBATCH --mail-user=judith.marcos@alimentacion.imdea.org
#SBATCH --mail-type=END,FAIL

# Copiar a temporal los ficheros de entrada necesarios para metamobile
mkdir  /temporal/$SLURM_JOB_USER/$SLURM_JOB_ID
cp -r clean_data  /temporal/$SLURM_JOB_USER/$SLURM_JOB_ID
cd   /temporal/$SLURM_JOB_USER/$SLURM_JOB_ID
mkdir  /temporal/$SLURM_JOB_USER/$SLURM_JOB_ID/output

# Ejecutar el comando Metamobile 
metamobilepicker config --samples clean_data/samples.txt --output V1_783config.yaml --outdir /temporal/$SLURM_JOB_USER/$SLURM_JOB_ID/output
metamobilepicker run -c V1_783config.yaml

# Mover a imdeaalim los resultados del cálculo.
mv -r /temporal/$SLURM_JOB_USER/$SLURM_JOB_ID/output
 /lustre/NodoBIO/imdeaalim/ljmarcos/output

```


#!/bin/bash
#SBATCH -p bioinfo                      #partition/queue name
#SBATCH --job-name=metamobile1                #Job name
#SBATCH -N 1                   #Un nodo
#SBATCH -n 4                   #Lo que tiene por default metamobile
#SBATCH -t 1:00:00             #Time limit hrs:min:sec
#SBATCH --output=/home/ljmarcos/metamobile/log-%j.o #Log de salida
#SBATCH --error=/home/ljmarcos/metamobile/log-%j.e #Log de errores
#SBATCH --mail-user=judith.marcos@alimentacion.imdea.org
#SBATCH --mail-type=END,FAIL

git clone https://github.com/Microbial-Ecology-Group/AMRplusplus.git






Esto funcionó: 

```
#!/bin/bash
#SBATCH -p bioinfo                      #partition/queue name
#SBATCH --job-name=metamobile1                #Job name
#SBATCH -N 1                   #Un nodo
#SBATCH -n 16                   #Lo que tiene por default metamobile
#SBATCH -t 20:00:00             #Time limit hrs:min:sec
#SBATCH --output=/home/ljmarcos/metamobile/log-%j.o #Log de salida
#SBATCH --error=/home/ljmarcos/metamobile/log-%j.e #Log de errores
#SBATCH --mail-user=judith.marcos@alimentacion.imdea.org
#SBATCH --mail-type=END,FAIL

# Copiar a temporal los ficheros de entrada necesarios para metamobile
mkdir  /temporal/$SLURM_JOB_USER/$SLURM_JOB_ID
cp -r data /temporal/$SLURM_JOB_USER/$SLURM_JOB_ID
cd   /temporal/$SLURM_JOB_USER/$SLURM_JOB_ID
mkdir  output

# Ejecutar el comando Metamobile
module load metamobilepicker/0.7.2
metamobilepicker config --samples data/sample.txt --output V1_783config.yaml --outdir output
metamobilepicker run -c V1_783config.yaml

# Mover a imdeaalim los resultados del cálculo.
mv output /lustre/NodoBIO/imdeaalim/ljmarcos/output
```

