function seq = pdbreadSeqFun(pdb)

count = 1;

seqTemp(count).resSeq       = pdb.Model.Atom(1).resSeq;
seqTemp(count).resName      = pdb.Model.Atom(1).resName;

count = count + 1;

for i = 2 : length(pdb.Model.Atom)
    if i < length(pdb.Model.Atom)
        if pdb.Model.Atom(i).resSeq ~= pdb.Model.Atom(i + 1).resSeq
            seqTemp(count).resSeq  = pdb.Model.Atom(i + 1).resSeq;
            seqTemp(count).resName = pdb.Model.Atom(i + 1).resName;
            count = count + 1; 
        end
    end
end


if seqTemp(1).resSeq > 1
    
    shift = seqTemp(1).resSeq;
    
    for s = 1:length(seqTemp)
        
        seq(shift) = seqTemp(s);
        shift = shift + 1;
        
    end
    
elseif seqTemp(1).resSeq == 1
    
    seq = seqTemp;
    
end