mgalardini / pyseer

SEER, reimplemented in python 🐍🔮
http://pyseer.readthedocs.io
Apache License 2.0
104 stars 25 forks source link

Abricate compatibility issue #244

Closed chunmn826 closed 9 months ago

chunmn826 commented 9 months ago

Hi, I am trying to use the output files from Abricate in my enet analysis. Is there a way to reformat the summary tables from Abricate so I can use them as the genotype file in Pyseer?

stefanogg commented 9 months ago

Hi @chunmn826, Pyseer requires genotype files to be in a Roary gene presence/absence format, that is isolates are columns and genes are rows. You can simply transpose the summary table from Abricate. This can easily be done in R otherwise this one liner should work csvtk transpose -t -C '$' <abricate-file> | grep -v NUM_FOUND | sed 's/\.\t/0\t/g' | sed -E 's/[0-9]+\.[0-9]+/1/g'

chunmn826 commented 9 months ago

Hi @stefanogg I replaced the path to my abricate summary file, but my output was empty. Can you provide further clarification.

Command: csvtk transpose -t -C '$' Pool1_megares_canu_summary.csv | grep -v NUM_FOUND | sed 's/.\t/0\t/g' | sed -E 's/[0-9]+.[0-9]+/1/g' > new_table

chunmn826 commented 9 months ago

I successfully used. The following code to transform the table. What should by delimiter be in order to become a .Rtab?

csvtk transpose -C '$' "Pool1_ncbi_canu_summary.csv" | grep -v NUM_FOUND | sed '1s/.fasta//g' | sed -E 's/[0-9]+.[0-9]+/1/g' | sed 's/./0/g' > ncbi.csv

Considering, I have already successfully used the following command to run the .Rtab files from roary in pyseer

antimicrobials=("Penicillin_G" "Tetracycline" "Ampicillin" "Gentamicin" "Tildipirosin" "Tylosin" "Tilmicosin" "Neomycin" "Tulathromycin" "Enrofloxacin" "Clindamycin" "Danofloxacin" "Ceftiofur" "Gamithromycin" "Sulfadimethoxime" "Florfenicol" "Spectinomycin" "Trimethoprim_sulfamethoxazole") for i in "${!antimicrobials[@]}";do antimicrobial="${antimicrobials[i]}" echo ${antimicrobial} pyseer --wg enet --pres /scratch/user/chunmn26/roary/canu/canu_results/gene_presence_absence.Rtab --phenotypes /scratch/user/chunmn26/Pyseer_traits/Salmonella_Pyseer_canu_P1_trait_file.tsv --phenotype-column ${antimicrobial} > "/scratch/user/chunmn26/pyseer_outputs/canu/${antimicrobial}" done

Thanks.