Skip to content

Commit 53064c6

Browse files
committed
Merge branch 'release/v1.3' into develop
2 parents e7555f6 + 66c1731 commit 53064c6

2 files changed

Lines changed: 51 additions & 40 deletions

File tree

README.md

Lines changed: 50 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
A small tool for parsing files in the [pedigree (.ped) format](http://pngu.mgh.harvard.edu/~purcell/plink/data.shtml#ped).
55
The parser will create a family object for each family found in the pedigree file and a individual object for each individual found.
66
The tool can be used to access information from ped files or convert the data to [madeline2](http://eyegene.ophthy.med.umich.edu/madeline/index.php) format for drawing pedigree trees.
7+
Also it is possible to create family objects and individual object and print the in ped and madeline formats.
78

89
## General ##
910

10-
1111
Parse a file with family info, this can be a .ped file, a .fam, a .txt(alternative ped style)
1212
file or another ped based alternative.
1313

@@ -66,7 +66,7 @@ In this case use:
6666

6767
ped_parser infile.ped --family_type alt
6868

69-
## Madeline2 conversion ##
69+
### Madeline2 conversion ###
7070

7171

7272
[Madeline2](http://eyegene.ophthy.med.umich.edu/madeline/index.php) is an excellent tool to draw pedigrees but they use there own input formats. ped_parser can now produce madeline2 input files from ped files by using
@@ -80,40 +80,51 @@ The following columns will be added to the madeline file:
8080
Since only the first six of these columns are the standard ped format columns ped parser allows for alternative pedigree files with the following rules:
8181

8282

83-
##Methods##
84-
85-
my_parser.get_json()
86-
87-
returns the families in a list of dictionaries that can be made to json object. Looks like:
88-
89-
````
90-
[
91-
{'family_id': '1',
92-
'individuals': [
93-
{'father': '0',
94-
'individual_id': 'mother',
95-
'mother': '0',
96-
'phenotype': 1,
97-
'sex:': 2
98-
},
99-
{'father': 'father',
100-
'individual_id': 'daughter',
101-
'mother': 'mother',
102-
'phenotype': 2,
103-
'sex:': 1
104-
},
105-
{'father': '0',
106-
'individual_id': 'father',
107-
'mother': '0',
108-
'phenotype': 1,
109-
'sex:': 1
110-
},
111-
{'father': 'father',
112-
'individual_id': 'proband',
113-
'mother': 'mother',
114-
'phenotype': 2,
115-
'sex:': 1
116-
}
117-
]
118-
}
119-
]```
83+
### json conversion ###
84+
85+
86+
87+
ped_parser input.ped --to_json [-o output.txt]
88+
89+
This is a list with lists that represents families, families have
90+
dictionaries that represents individuals like
91+
92+
```json
93+
[
94+
[
95+
{
96+
'family_id:family_id',
97+
'id':individual_id,
98+
'sex':gender_code,
99+
'phenotype': phenotype_code,
100+
'mother': mother_id,
101+
'father': father_id
102+
},
103+
{
104+
...
105+
}
106+
],
107+
[
108+
109+
]
110+
]
111+
```
112+
113+
### Create ped like objects ###
114+
115+
Ped like objects can be created from within a python program and convert them to ped, json or madeline output like this
116+
117+
```python
118+
119+
>from ped_parser import Individual, Family
120+
121+
>my_individuals = []
122+
>my_individuals.append(Individual('proband', family='1', mother='mother', father='father',sex='1',phenotype='2'))
123+
>my_individuals.append(Individual('mother', family='1', mother='0', father='0',sex='2',phenotype='1'))
124+
>my_individuals.append(Individual('father', family='1', mother='0', father='0',sex='1',phenotype='1'))
125+
>my_family = Family(family_id='1')
126+
>for individual in my_individuals:
127+
my_family.add_individual(individual)
128+
>my_family.to_ped(outfile)
129+
130+
```

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
long_description = 'A pedigree parser.'
77

88
setup(name="ped_parser",
9-
version="1.2.4",
9+
version="1.3",
1010
description="A ped file parser.",
1111
author="Mans Magnusson",
1212
author_email="mans.magnusson@scilifelab.se",

0 commit comments

Comments
 (0)