parser.add_argument("--chassis", type=str, required=False, dest="ref_fasta", default=None, help="the chassis, i.e. the sequence into which TEs will be inserted; a fasta file")
parser.add_argument("--te-seqs", type=str, required=False, dest="te_fasta", default=None, help="TE sequences in a fasta file")
parser.add_argument("--pgd", type=str, required=True, dest="pgd_definition", default=None, help="the definition of the population genome")
parser.add_argument("--output", type=str, required=True, dest="output", default=None, help="the output file; will be multi-fasta file")

args = parser.parse_args()

# read TE sequences from file; if provided
tetuples=[]
if args.te_fasta is not None:
     tmp=FastaReader.readAllTuples(args.te_fasta)
     tetuples=[t[1] for t in tmp]
     print "Loading TE sequences; Found {0} in file {1}".format(len(tetuples),args.te_fasta)
sc=SequenceContainer(tetuples)

# read the PGD; must be provided
print "Loading population genome defintion"
pgdr=PopGenDefinitionReader(args.pgd_definition,sc)
tedeftuples=pgdr.read_transposed()
print "Found {0} TE defintions".format(sc.get_count_definitions())
print "Will simulate {0} TE insertion sites within a population having {1} haploid genomes".format(pgdr.insertions, pgdr.popsize)

# load chasis from the file; if provided otherwise from the PGD; not both though
chasis=""
if args.ref_fasta is not None:
     if pgdr.get_chasis() !="":