Animate with position and orientation from txt file
It's very possible, and doesn't even sound difficult to do.

Make sure Object.rotation_mode is 'QUATERNION' (once for the object):

ob = bpy.context.object # active object, assuming there is one
ob.rotation_mode = 'QUATERNION'


Reading the file:

import bpy
from mathutils import Vector, Quaternion

file = open("input.txt", "r")
for line in file:
    x, y, z, q0, q1, q2, q3 = line.strip(" \t\r\n[]").split(",")
    loc = float(x), float(y), float(z)
    quat = float(q0), float(q1), float(q2), float(q3)

    # Or cast to Vector / Quaternion type if you need any methods of them later
    #loc = Vector(loc)
    #quat = Quaternion(quat)


I assume line 1 in the file is meant to be the first frame in Blender and so on. Let's keep track of the line number:

for i, line in enumerate(file, 1):
    ...


Assign the location and the rotation in our for-loop:

    ob.location = loc
    ob.rotation_quaternion = quat


and insert keyframes for frame i:

    ob.keyframe_insert('location', frame=i)
    ob.keyframe_insert('rotation_quaternion', frame=i)


Finally, we close the file:

file.close()


For a better performaning way to animate with python, see:

http://www.blender.org/documentation/blender_python_api_2_69_10/info_quickstart.html#animation