<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Description
Step1:  Init
Step2:  Selecting genomes based on GC
need a example of low, mid, & high GC genomes
Calc genome GC for all genomes in dataset
Step3:  Copying genomes
Step4:  Indexing genomes
Needed for in-silico PCR
<ASSISTANT_TASK:>
Python Code:
workDir = '/home/nick/notebook/SIPSim/dev/bac_genome3/'
SIPSimExe = '/home/nick/notebook/SIPSim/SIPSim'
genomeDir = '/home/nick/notebook/SIPSim/dev/bac_genome1210/genomes/'
#genomeTable = '/var/seq_data/ncbi_db/genome/prok-bac_filt_rand.txt'
Explanation: Description:
Simulating bacterial communities using all of the bacterial genomes available.
Workflow:
symlink all genomes
index all genomes
Setting variables
End of explanation
import os,sys
import numpy as np
import pandas as pd
from ggplot import *
import matplotlib.pyplot as plt
%load_ext rpy2.ipython
%matplotlib inline
%%R
library(ggplot2)
library(dplyr)
library(tidyr)
library(gridExtra)
if not os.path.isdir(workDir):
    os.mkdir(workDir)
workDirGenome = os.path.join(workDir, 'genomes')
if not os.path.isdir(workDirGenome):
    os.mkdir(workDirGenome)
Explanation: Init
End of explanation
%%bash -s "$genomeDir"
cd $1
find . -name "*fasta" | \
    perl -pe 's/\.fasta//' | \
    xargs -P 24 -I % bash -c \
    "seq_tools GC_content < %.fasta > %_GC.txt"
%%bash -s "$genomeDir"
cd $1
cat ./Clostridium_ljungdahlii_DSM_13528_GC.txt
cat ./Escherichia_coli_1303_GC.txt
cat ./Streptomyces_pratensis_ATCC_33331_GC.txt
Explanation: Selecting genomes based on GC
need a example of low, mid, & high GC genomes
Calc genome GC for all genomes in dataset
End of explanation
%%bash -s "$genomeDir" "$workDirGenome"
cp $1/Clostridium_ljungdahlii_DSM_13528.fasta $2
cp $1/Escherichia_coli_1303.fasta $2
cp $1/Streptomyces_pratensis_ATCC_33331.fasta $2
Explanation: Copying genomes
End of explanation
!cd $workDirGenome; \
printf "Clostridium_ljungdahlii_DSM_13528 Clostridium_ljungdahlii_DSM_13528.fasta\n\
Escherichia_coli_1303 Escherichia_coli_1303.fasta\n\
Streptomyces_pratensis_ATCC_33331 Streptomyces_pratensis_ATCC_33331.fasta" > genome_index.txt
!cd $workDirGenome; \
    perl -pi -e 's/ /\t/' genome_index.txt
!cd $workDir; \
    $SIPSimExe genome_index genomes/genome_index.txt \
    --fp ./genomes/ --np 30 > genomes/index_log.txt
Explanation: Indexing genomes
Needed for in-silico PCR
End of explanation
<END_TASK>