Example #1
0
 def __init__(self, *args, **kwargs):
     '''Initialize a patient with all his samples'''
     super(Patient, self).__init__(*args, **kwargs)
     from hivwholeseq.patients.samples import load_samples_sequenced
     samples = load_samples_sequenced(patients=[self.name])
     self.samples = samples
Example #2
0
                        type=int,
                        default=0,
                        help='Verbosity level [0-4]')
    parser.add_argument('--save',
                        action='store_true',
                        help='Save the allele counts to file')

    args = parser.parse_args()
    pnames = args.patients
    samplenames = args.samples
    VERBOSE = args.verbose
    use_save = args.save

    fragments = ['F' + str(i + 1) for i in xrange(6)]

    samples = load_samples_sequenced()
    if pnames is not None:
        samples = samples.loc[samples.patient.isin(pnames)]
    elif samplenames is not None:
        samples = samples.loc[samples.index.isin(samplenames)]

    for samplename, sample in samples.iterrows():
        sample = SamplePat(sample)
        if VERBOSE >= 1:
            print samplename

        dist_hists = []
        samples_seq = sample.get_sequenced_samples()
        samples_seq = samples_seq.loc[samples_seq.PCR == 1]
        for samplename_seq, sample_seq in samples_seq.iterrows():
            sample_seq = SampleSeq(sample_seq)
    pats_or_samples.add_argument('--samples', nargs='+',
                                 help='Samples to map')
    parser.add_argument('--verbose', type=int, default=0,
                        help='Verbosity level [0-4]')
    parser.add_argument('--save', action='store_true',
                        help='Save the allele counts to file')

    args = parser.parse_args()
    pnames = args.patients
    samplenames = args.samples
    VERBOSE = args.verbose
    use_save = args.save

    fragments = ['F'+str(i+1) for i in xrange(6)]

    samples = load_samples_sequenced()
    if pnames is not None:
        samples = samples.loc[samples.patient.isin(pnames)]
    elif samplenames is not None:
        samples = samples.loc[samples.index.isin(samplenames)]

    for samplename, sample in samples.iterrows():
        sample = SamplePat(sample)
        if VERBOSE >= 1:
            print samplename

        dist_hists = []
        samples_seq = sample.get_sequenced_samples()
        samples_seq = samples_seq.loc[samples_seq.PCR == 1]
        for samplename_seq, sample_seq in samples_seq.iterrows():
            sample_seq = SampleSeq(sample_seq)
Example #4
0
author:     Fabio Zanini
date:       18/05/15
content:    Get days since infection from dates.
'''
# Globals
import pandas as pd

from hivwholeseq.patients.patients import load_patients
from hivwholeseq.patients.samples import load_samples_sequenced, itersample



# Script
if __name__ == '__main__':


    samples = load_samples_sequenced(include_empty=True)
    patients = load_patients()

    dsi = []
    for samplename, sample in itersample(samples):
        t = sample.date
        t0 = patients.loc[sample.patient]['infect date best']
        dt = (t - t0).days
        dsi.append({'sample': samplename,
                    'dsi': dt,
                   })
    dsi = pd.DataFrame(dsi).set_index('sample')

    print dsi
Example #5
0
 def __init__(self, *args, **kwargs):
     '''Initialize a patient with all his samples'''
     super(Patient, self).__init__(*args, **kwargs)
     from hivwholeseq.patients.samples import load_samples_sequenced
     samples = load_samples_sequenced(patients=[self.name])
     self.samples = samples