Skip to content

06_PROFILES

eolesin edited this page Mar 23, 2021 · 12 revisions

Step 1. Activate the Anvio environment

Step 2. Had to migrate the contig databases.

If you have started your analysis with Anvio7 you will not need to do this step. Since our analysis began with Anvio6-2 and we had to update to Anvio7 to continue with the pipeline, we must perform this step.

# cd into the 04_CONTIGS/ directory
# migrate the databases
anvi-migrate *.db --migrate-dbs-quickly

Step 3. Profiling of samples

Perform a nested loop as was done for the mapping step. Do not try to parallelize this! Anvio-profile gets confused if you try to start multiple processes for this at once.

conda activate anvio_emily

while read line;      
    do         
    SET=$(echo $line | cut -d" " -f1);          # Isolate Coassembly names
    samples=$(echo $line | cut -d" " -f2);      # Isolate Sample names
    delimiter=",";          
    declare -a Smparray=($(echo $samples | tr "$delimiter" " "));     # Create new delimiter in sample list    
    for samp in "${Smparray[@]}"; 
        do
            anvi-profile -c 04_CONTIGS/$SET-CONTIGS.db \    # Do the profiling
            -i 05_MAPPING/$samp.bam \
            --skip-SNV-profiling \
            --num-threads 40 \
            -o 06_PROFILES/$samp
        done;     
    done < samples_in_sets.txt

Step 3. Merge profiles for each co-assembly

while read line;           
    do              
    SET=$(echo $line | cut -d" " -f1);               
    samples=$(echo $line | cut -d" " -f2);               
    delimiter=",";               
    declare -a Smparray=($(echo $samples | tr "$delimiter" " ")); 
    prefix="05_MAPPING/"; suffix="/PROFILE.db";     # Need to add file names and path to each element
    declare -a newarray=();              # Create an empty array
    for samp in "${Smparray[@]}";          
        do 
        newarray+=($(echo ${prefix}${samp}${suffix}));    # Add each full filepath to the empty array
        done; 
    anvi-merge -c 04_CONTIGS/$SET-CONTIGS.db  ${newarray[@]} \  # Call the array with the adjusted filepaths
    -o MERGED_PROFILES/$SET-MERGED-PROFILE;         
    done < samples_in_sets.txt



Clone this wiki locally