basicase: an r-statistics package to detect significant ... · uptec x 12 013. date of issue...

53
UPTEC X 12 013 Examensarbete 30 hp Juni 2012 basicASE: an R-statistics package to detect significant allelic imbalance in RNA-seq data Jesper Gådin

Upload: others

Post on 08-Mar-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

UPTEC X 12 013

Examensarbete 30 hpJuni 2012

basicASE: an R-statistics package to detect significant allelic imbalance in RNA-seq data

Jesper Gådin

Page 2: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

 

Page 3: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

Bioinformatics Engineering Program Uppsala University School of Engineering

UPTEC X 12 013 Date of issue 2012-06

Author

Jesper Gådin

Title (English)

basicASE: an R-statistics package to detect significant allelic imbalance in RNA-seq data Title (Swedish)

Abstract Investigation of allelic imbalance expression QTLs (aeQTLs) in RNA-seq data can increase the accuracy in the hunt for candidate genes susceptible as drug targets. The Bioconductor project has recently developed research tools to handle the massive amounts of data that come with next generation sequencing. The basicASE package has been developed to carry out aeQTL analyses in that environment. Many technical issues concerning a user friendly import, statistical testing and visualization of data are facilitated through the package, which also has a central design to accommodate integration of new functions and development.

Keywords BasicASE, allelic imbalance, aeQTL, R, Bioconductor, NGS, RNA-seq

Supervisor

Lasse Folkersen The Center for Molecular Medicine at Karolinska Institute

Scientific reviewer

Mikael Thollesson Department of Organismal Biology at Uppsala University

Project name

Sponsors

Language

English

Security Secret until 2013-10

ISSN 1401-2138

Classification

Supplementary bibliographical information Pages

49

Biology Education Centre Biomedical Center Husargatan 3 Uppsala

Box 592 S-75124 Uppsala Tel +46 (0)18 4710000 Fax +46 (0)18 471 4687

Page 4: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

 

Page 5: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

basicASE: an R-statistics package to detect significant allelic imbalance in

RNA-seq data

Jesper Gådin

2012-06

Populärvetenskaplig sammanfattning

Med dagens teknik kan man avkoda allt DNA eller RNA i ett prov från en människa på mindre

tid än ett dygn. Detta har medfört att väldigt mycket data har blivit tillgängligt för analys. För att

kunna hantera detta har det utvecklats många bioinformatiska program som effektivt kan hitta

intressanta spår från eller orsaker till sjukdom.

BasicASE är ett sådant program och det används för att hitta tänkbara sjukdomsgener. Det

fungerar så att man mäter om det sker lika mycket uttryck från mammans som pappans gener.

Om så inte är fallet kan man misstänka att den gen som har en obalans av uttryck är orsaken till

sjukdom. Vanligen har man sedan tidigare kända DNA-variationer kopplade till specifika

sjukdomar som undersöks, men det går också att titta igenom hela genomet för att hitta obalanser.

BasicASE innehåller verktyg för att statistiskt avgöra om funna obalanser är orsakade av

slumpen eller av regulatoriska element som påverkar genen av intresse. Den genen blir i sådana

fall föremål för en större undersökning för att hitta vad exakt som är orsaken, och hur detta

påverkar resten av kroppen.

Examensarbete 30 hp Civilingenjörsprogrammet Bioinformatik

Uppsala Universitet, Juni 2012

Page 6: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

 

Page 7: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

��������

� ���������� �

� � ������� �

��� ���� �������� ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ ������ � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ �������� ������� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ ������� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

��� ��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���� �!"#� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ���$ ������� ��%������ � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �

� � ��� � �� ������� �

��� "�������� &���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ '� "! � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ �( �� )�( � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ������ *+' � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �����$ )+' �� )�,' � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � $

��� &�-�� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � $����� ����� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � $����� )�� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � $����� ������������ ��.������ � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � $

��� � ���/���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 0����� %����� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 0����� 1������ � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 0����� )������� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 0����$ ������������ � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 0����0 ������� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 2

��$ ������� �� �3 ��������� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 2��$�� % �3 � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 2��$�� ���(�� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 2��$�� �444 ������ �5��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 2��$�$ ������� �� ����.�6 ��7 � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 2

� ������� �

$�� "�� %����� � ���/��� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 8$�� 9���������� �� (����� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 8$�� *������� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��$�$ %����� � ���� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��$�0 *��:����� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��$�2 �������� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ��

� ������� ��

0�� "�� ������� (����� ��������� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �00�� ������ � ��% �� � ������ ������ � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �00�� ����;������ � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �00�$ *��:����� ��&����� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �00�0 ������� �������� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �20�2 %����� � ��������.� ����� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �20�8 +����� ����� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �20�< ��� ��� � �� ��� ����������� �������� ��= � � � � � � � � � � � � � � � � � � � � � � � � � � � � �2

� �������� ��

Page 8: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

� ������ ��

� �� ����������� ��

� ��������� ��

������� ��������

������� � ������ ��

������� � ��� ������ !�

������� " � ������ � � �� ���#� ������� !$

�����������

��%&' ������� ������ �� ��� ����� ��������� � �� �����

�� �� � ������� � �� �� ��

��� �� � � �� ��� �� ��

��� ���� �� ������� �������

�(� ���� ����� ����!�" !���� ���������� "������ #���

�%&' ��� ����� ��������� � �� �����

�)&% ��� $�� ������� %��# &����� ��� ���� � �� ��&���� ' �#� '(��������� � �)���

�& ���� � ��� " ������

*+) *���� +��� ��������� !������

'���� � ���������� ������

',- ���� ,� -��� �.�������

� �� ��� � � "�� � ����� ���

(��. ����� ���� �� ������#����� ��� ����

(*) ���� *�� ��� !�&�����

�'/ '� ����# ������

�(0��1 �#� '�� ��&����� ���#��

)� !�&���� ������� � �� �� ��

)( !���� ���������� "����� �#���

)� !�&���� '�� � �#���

)���2� �#� ! ����� %���� ��� ����

��� �� ��� �� ��

21

Page 9: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

� ����������

�� ��� ����� � �� ��� ��� ���� �� ������� ��� ���� ���� � ��� ���� ���� ��������� ������� ��������� ���� ��������� ����� ���� ������ ���� ��� �� ����� ��� ���� ! "##$� ��������� � ������ ������������ ���� ����� � ���� ���% �&'� ��������� ���� �������� ����� "##$ � � ��� ! ���% �&'� ��� ���� ��������� ��� ��� � � �� � �� ����������� �� � ��%� ��� ��(� ���� �� �� � �� ��� ��� ���� �� �� �)*+����� �� ��� ���� ����� � � �������� �,&� �(������� � ���% �&'�� ��� ���� �� � ������ ���� �� ��� ��� ��� �� ! ��� � -./� * ������ �� �)*+ ����� �� �� � ��� ��� ��� ��� ! ��� �(������� ���� ����������� �� � � ��� ����� ���!��� ������ ���� �� ������� �)*+ -"/� * �� ���� 0� � �� ���� ����1 !� ���� � ���(������� �� �� � ���� ������ � ,&� �������� ����� ����� �� � ��� ��!������ � ��� �(��������� ! ��� ������� ���� � � � ��� �������� � � ���������� � �� ��������� � �� ����������������� ���� ����� ��� �&'�� 0,1 �� � �� ������ �� �� � ���� �� � ���������� ���� ��� ����� ������������ �!����� ��� ���� � ����� �� � ����� -2/� * ��� ��� ,������������ ,&����� ��� � � �� ���� ������ � ���� ������ � ��� ���� !��� ��� ��3����*��� ��3��� �% � ��� �� ��� 4����� !� 5 ��� �� 5��������455�� � ���� ! 6�� ���%� ���������� �����%� �� 7�� +���� 8 %����� �� ��%� �� � ������ �� 455 ��� ���� ���������� ��� ��3����

� � �������

*��� ��3��� ���� �� ��� �9�� ��� ������ ����� !� ��� �������� ���� ��� ��������� ! ��)*+ ��� ,&����� ����� ��� !��� ����� �� ��� ���� ���� � �� , ���%� �� �� �(� ������ ! �������� �������� ���� ����)*+ ��� ,&����� �� �� ������ �� ���� �������

��� ���� �������� ���

:��� �! ���� ��� ���� � ��3��� ���� ,&���� ����� ���� ���� ���� �� �(� ������ ! ��� ����� !������� !��� ������ ���� ��������� ����������� �� ���������� ���� � �� ������ ���� ����!������� ��� ����������� �� ;� �� � �� � � -</� *�� �� ����� ����� ! ��� ���� �� �� ���� � � ���� �� ��������� "�.�"�*�� ��������� "�.�2 �� ���� ,&���� ��� �� ����� � ��� �� � � -=/�

����� ������

>� � ���� ���� ���� �� � � ����� ! � �� � ����� ! �� ���� ����� ���� !�� � ��� ������ !���� ��� *�� ��� ���� ��������� !� �� � ���� ���� ������ ��� ���� ����������� ?���� ���������� ��� ���� ���:� 4��:� 5'�� -=/�

����� ���� ��� ����������

:(������� ���������� �������� ��� �� ����� �,&� ��� � ������ � ���� �� :(������� ��� � !� ��������! ���� !�� � � �� ��� � ��� ! ��� �(�������� ��� �� �������� � ���� �(������� ���������� ��!�� �� ��� �@������( ����4���� *��� ��� ���� ��� � ���� ��� ����������� ��� ��� ��������������� !�� ��� ��� �� ����� 4�� �������� ������� ��� ���� "= ���� ����� � ��� ����� ���� ������ �� ������ �������� � ������ !� ��@����� �A������ � ��@����� ����� ! ��� ��� �������� ��� ��� ��� ��� �� ����������� ������ ����� � �� �@������( ����4���� *���� ��� ������ ��A�� ���� ������������� ������������ ����� ��� � �� ����������� >��� �� � ��� ! �����

• ?��� �� ������� ���� ��� ���������

• ���� �� �� ����� � �� � ��� ����� �� � �� ������� � �� �� ��� !������

• 4�����������9����� ������ � ��� ��� ��� ���

• &��� ! ���� �9���� ������� �(��������� -=/�

*���� ��� ��� !��������� ��A�� ���� ���� ��� ���� �� �� ��� ��� �� �� ��� ���� ! ��������� �����

.

Page 10: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

����� �����

��� �������� �� ��� �������� �� ��� ���� ������ ���� ������� ��� ������ ��� ���� � ��� ��� ���� ��� ��� ����� �� ��������� ��� �� ���� ���������� ��� �� �� �� ���� � ������� ��� ��������������� �� ����� �� �� ��� �� �� ��� ���� ��!� ����������� ���� �� � �� � �"������� #� ���$����� ��� � �� � �� ��� ��"� ���� ����� �������� ��%& ��������� �� � !� � ����� �� ���� ���� � �� ������ ������ &��� ������ ������ '��� ������ � � ����� ����' ()*�

• �� ���� �� $��' ��� ������� ������ �� ��� � ����� ������������

• �� ���$� ��� �����

• +��'����� �� ��� �"��� ����� �� �"� ���� �� ���� ��� ��������

• #� ����� ��������� ������ ��� ���� � ���� �������� ��� ��'� ��� �������� � � ����

������ ������" ���������� ������ � ��' �� ������ ��� ��� � ��� ����� � �"� ����� '���� � � ���� ���� �� ���� ������ �������� ������ � �� ���� ��������� '��� ��� �� ��� ��� �� ��������� ��� ���� ��� ��� ������ � ����� �� �������� ������� ������ ����� � ������ �,� ���� ����� ������� �������������� ��' �� ������ ��� ��� �� ����� �� ���� (-*���� � � � ��'��� ��� ��� ������� �� ������� #��'��� ����� ��� � � ���� � ���� �� �� ����.������ ������������ ���� ��� ��$� ������� ��/���� &� �� �� �� ���� �� � &�0 � ���� � ��� ���� ���������� '�� � ������ '��� ��� ��� ������ ���� � ��� ��� ���� ������ ���� � � ������� ��������� (1*�

��� ����

&���� ��� 2������� � � 3�� 3��� �� 3��� ��� �2�333 ���� 4551 ��� ��� ��� (6*� ��� � ������ �� � ����� �� ��� %2�& � � '� �� ��� �,� � � ���� ��� � ���� �� ��� ���� ��� ��� �"�������4555 ���� �������� �� ����� �� ���� �� ���� � ��� �"������ �"� ���� ��������� �� �� ���� ����������������� �� 74-5 �������� 8��� � ����� �������� ���� ��� ��' ����� �� ������ � ����� ��� � � ���������� ���� ��� ��������� �� �� ���� � �� ��� �� �� %2�& ��� ���� ������� � � �������� � �$ ����� ����������� �� ������ ������ ��� ������� ������ ����� ���� ��� � ��� �� ���� �������� ��� ������ 794- 555 ������� � � ���� ���������� ��� �� � ������� ���� �� �� � ���� ��� ������ ������������� � ��� ���� ������ ��� ����� � ������� �� ��� �� � �� %2�& ������ ��� �� ��� ������������������������ �� �,� ����� �������� ���� ���� ���� ��������� �� � ����� ����'�� ��� ���� ����������������� &�������� '��� ��� ����' �� ��� ��������� �� � � �� ���� ���� �� ��� ���� ������ �� �������� ��� �� �� (:*�

��� ���

;� � ��������� <�= ������� ���$��� ������� ���� �� ��� ��������� �� ������� ����� '���� � � ��������'��� ���������� �� ������ '����� � ��������� (95*� >��� ���� �"� ���� ���� � ����������� � ��� ����� ����� ������ �<�= (99*� �� �<�= � '��� � ������� �� ���� �,��� ��� � ��� ��� ����� �� � �������� �������� �� ��� �� ���� ���� �� ���� ���� � �� �'�� � �� ��� ���� �� ������� ?��� �� ��� ���� �������� � � �,����� �� �� ������ �� �'��� ��� ���� �� ���� �� �� � ������ ��� � ��� ��� � ���� ������ ��� � ����� ������ �� ������ ���� � ���� ��� �� ���� ����� ��� � ������������ ����� '��� ����� ��������� =��$��� ���� �� ���� �� ���� �"� ���� �� ��� '�� �� ��� ��������� ���� �� � �� $��'������� ��� ���� ������ � ������� #� ��� ��������� ������ ���� �� ���� �� ��� ���� ������� ��� ���������� �� �������� �� ��� ����� (94*�

�� ������� ���������

�� ��$� ��� �<�= ������ ��� ��� � ��� � ������ ���� ��� ����� ��� ������ ������ �"� ���� ��,� �����;� ��� � ��� ��� ����� � �� � ���� �.����� ���� ��' � ��������� � �� � 9 �� 9 ���� �� ��$� ��� ���� �� ��� ��������� (94*�������� ��������� �� ��,� ��� ������� �� ��,� ��� �����"�� ��� �� ���� � ������� ��������� �� �"� ��������������� � ��� ��� ���<�= � ;� �� ��<�= ��� ���� ����� �� �'� ��,� ��� ������ ���� ���� ������ ��

4

Page 11: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

����� �� �� ���������� ������� ������� ��� ������� �� � ������������ ����� �� �� � ������� ��� �� ������ ������������� �� ������� �� ����� ����� ��� �� � ���������� ��������� ������������� ��� ���� �������� �� ������������ ������� �� ���� ����� ���� �� ��������� �� ��������� �� ���� ������� ���� �� ���� ������ ���������� ������!������� "� ����� �������� ������ ���� ����� #$%� �� ������� ����� ����� ��� ����� ������� ��� � ������� ���� ����� �� ������ ��� ������� � ������� �� ��� �� � ��� �� � ����� " ����� ����������� ��� ������� � ������� �� ���� �� ��� ���� �� �������� �� ����� ���� ������������ &'(�� �� �� ���� ������ ���������� ��)������ "�� �� ��� �� ��� ������� �� �� ������ �������� �� ���� ���� � �� �� �� ������������ ��� � ������� ����� ����� �� ������ ��� ��������� ���� � ���� �� ���� ������ ��� ������� ������� ���� ���� *+(+,- ��� �� � ����� ���� ������� ���� .'"���/ ����� �� �� ��� ������� ���� ������� ��� �� ���� �� ��� ��������� ���� � ���� ����� ���� ��� ��������� �������� � ����� ������� � ������������ ��� ����� �� ��� �� �� �������� � ������� ��� ������� ��������� ���� � ����� ���������� �������� 0�+�*1�2�$- �������� ���� ��� ���������� ������� ������� � ���� ����� ��� � ������ ���� #3%�"������ � ������� ��� ���� ��� ��� �� ���� ���� �� �� ������ �� �� �������� �� ��� �� ��� �� ��� ������������ � �� ��� ������ ����� ��� ���� �� 4'" �� �� ������� � �������� ��� ��� ����� �������� �� �� ���� ���������������� *�50- ��� ��� �� ��� �������� *6'7-� �50 ��� ����� ��� ������� ��������� ���� ��� ��������8�������� ������ �������8�������� ������ ���� �������� ��� ���� ��� ������ #91%� 6'7 ��������� ��� �� ��� �� ����� �� �� ������ �� � ��!�� �� �������� ��� ���� ������� �� � ������� �� ���������������� �� �� ��� �� ����� ��� ���� ����������� ���� � ������� ��� ������ �� ������������ �� ������� �� 6'7 ����� ��� ��� !������ ���� ,��� �50 ��� 6'7 ��� ������ �������� �� ��� � ��� ���� �������� ������� #92%� :���� �� �� ���� � ���� ������������� �� ������� � ������� ����� �� � ���� ���� �� ���� ����� ������������� �� ����������� �������� ���� ��8��� ���� ����� ���� ��� ������

� �������� � �����

���� ������� �������� �� ��� ���� �������� ��� ����������� �� ����������� �� ��� �����"&; �������

��� ������� � ����

���� ������� ��������� � ������ ��� ��� ���� ��� ���� �� ��� �����"&; �������

����� �����

��� <"&�� ��� �� ��� ���� � � �������� ��� ����������� ��/����� ����� ��� ������������� ��� <"&����� �� ��� �� ����� ��!������� 4�)����� ������� �� <"&�� ��� ���� �� ������ ��� ��)��� �� �� ��� ���(0.;4 ����� �� ����������� (0.;4 �� � /������ ������ ��� ���� ����� ��� ��� �� ��������� ���� ������������ ����� "� �� �� �� ��� &����� �������� ��� � (0.;4 ����� ������� = ��� >=� ��� &����?��������� ��� ��� � (0.;4 ����� ������� �@ ��� A=� 6�� ������ ������� ������� �� ��� <"&�� ��� �� �� ���� �8�� ����� � � �� ��������� �� ������ ���� ����� ���� �� ��� �� ��� �� �� �������� ����� �������������� #9@%�

���� �� �� ��

��� &�/����� "���� ���?+� ��� �� *&"+- �� � ������� ����� ��� ��� ��� ���� ����� ��� ���� ������ �������� ��� ������ ����� ��� 99 �������� !���� ��� ����� ��� ��� ��������� ��/����� ����� ������ "�� ������ ����� �� ������� � ������� �� ��� �� !���� ��� ������� �� ���� ����� ������ ��� ������ ����� ���? ���� �� *,"+- �� ��� &"+ ��� ��� ������ �/�� ����� ��� �������� ����� ���� ����� ���������� ���� ����� � ����� ������ 0� ��� � ,"+ ��� �� !�� ������ �� ������� ���� �� ������� �� ����� ���� ����������������� ���� ����!� ������� �� ��� ���� �� ������� ������� ��� ����� !�� ���� � ���� " ,"+ !�� �������� ���� �� �������� ����� ��� ���� ��� �� ���� "� �� �� ����� ��� �� 99$B� �� ���� ��� B" ��������� ��/���� ���� 99AB, �� ���� ���� #9A%�

����� ���

��� ������ ���� ��� �� *76<- �� � ������� ��� �� ��� ������� ��� ����� ����� ��� �������������� ����� ������ ������� �� ����� ������� ��� ��������� �� �� ��� �� ��� �� � !��� ����� ��� ����� ��������

1

Page 12: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

����� ��� ���� ��� �� ��������� ������� �� � ���� ���� ��� ���������� �������� ������� �� ���������� �� � �������� �� �� ���� ���� ���� �� �� ���� � !������ �� �� ������� �� ��� !��"���� �������� ������ �� ������ � ����� ����� ���� #$%&�

����� ��� � ����

��� ��� � ��� ��� ���� ���� ����� �� �!����� ������� �� � ' � ��� �� �� ����( ��� ��� � �) ��� ����� �� ' �� ����( �*�������� �� �� ' � �� ) � ��� �� �� ��� ���� �( �� ����� ������ �������� ��)+,� ������ � ��� ������ ��� �� ��� �� ���� ��� �(!�� �� ��)-���� ���� ����� .������ ����� �� ������� ����( ��� �� ���� ������� #$/&�

��� ������

��� ������� ��������� � !����� ������� ����� �� �� ���� �( �� ������� ��� �� �����01 !�2���

�� �� ��������

0 ����� �� �������� ���� �� ���� ��������� ��*����� ��� �� �� ������� ������� ������ ���� ������ ��� ���� �� ���� ���� ����� 0 ����� ��� � !����! �������� � �� 3 !����!4� ��� �� !����� � 0�5 ��� �� ��� ������ �� �� ��� ��� ���� �� �� !�� � !�� ����� ���� ��� ������ ��� ��� ���2-�!� #$6&� �� ���!�� ��� 0 ����� !����! �������� �� ' � ���� ��� �� �� ��������( !�������� ����������� �� ��� ����( �*������� ) � ����� )�������� )������� �� ������� ����������� ������� ���� ������ � !�� �� �� � ����� ����� #$7&�

�� � ���

)8� �� ������� ���� ��� ������� ���� �� ��� �9����� ������ ����� ����� �� )������-8������������ �)8��� :����( ���� ��� ������� ��� �� ���� �� ����� ����� �� ��������� ���� �� �� ! �� ���� �� ���� �� �������� ��� � ���� ���( � ��( �� ����� �� ���� !!���� )(������ ����� �� )8� �� ��2��� ���� �� !����� ��� � �� �����( ��������� )8� ��!����� �!!�� ���� ��� ������� �� ���� �� �!� ��� ������ �� !���� ��� !!��� �� ���� ���� ����� � �� � � ���� �� �� � �� 0�; ��� � � ������ ���!�� #<=&�

�� �� ������������ ��������

�� . ������� ��� �� �!��-������ �� ����( ��!������ �� ����������� ����������( ������� �� ������!�� �(�������� ��������� ��������� �( �� ���������� ������ ���� ���� ������� !��� �!�� ������ !��"���� �������������� ���� ��� �� ���� �����>����� �� ����� �� ���������� �������� � �� � � �� � � ������� ��!��"��� ������� ;�( �!�� ������ !��"���� ��� � 5��� �� ?���� �� ������!�� �( �������� ��! ������������ . � ���� �� �� �������� �� ���� <= ���������� �������� �� ���� ��������������� �� 2��! ����������� �� . �������� ��� 2�� . �� !������( ����!������ �����>����� ��� �� ��������� ���( �� !�2�� �(��� ������� ���������� �� ������! ���� ��� !�2�� ������ �( ���!���� ��� ��. ���� �� � )�� �!�� ���! ��� �� �� 2�( ���������� �� �� . ���� �� ����� ��������( � �� ��!��"��� � ����� �� ����� �� ���2 ���� 2������ �( �� ���� #<$&� 0� ��� �� �� �� ��� �� . � ����! ������� ����� �� !��� �� ��������� !�2��� ��2� 0��� 0�0 �� 0500� )�� ���������� �� . ��� ������ �� ����� !���� ��� ������ �� ����� �� ���� �� ������ �� �� �( �(!� �� ��(��� ����������� ��� �� !�� �� ���-���������-����� ����������� �� 0�� 2�� �� ����� �� ����� ��� ��� �� ����� !������������� 0�0 ����� �� ���� ����� ��� ������ ��� ��� �� �����( �������( �� . ��� �� �� �� ����!���� �� �� !����� �� . �� 0500 !�2�� �� �� ��!�������� � ��@������� ���� ��������� �������� !�������� ����9����� !���� ��� ������ . �� ������!�� �( ����������� ��� � �!�������� � �(���� !���� ��� ������� ��� �� !������ !��������� *����( ��!���� ��� 2�� �� ���� ������� ��������� ������ �� ��� ��� ���� �� ��� !������ �� �� �� ��������� �� ����(� �� �� ����� ��� �� !���������� �� ������ ������ ����� ��� �� �� ������ ��� ��A����� ��������� �������� ������ �� ��� 0�� �� . � !�������� ���� ������� ��� �� $� . ���2� �� 8������� ;������� ?������ :���� �� �� �� �����( �� ���� ������� ��A����� !����� � #<<&�

B

Page 13: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

������ � � ��� �� ��� ����� � ������� ������ � ���� �� ��� �������� �� ������ �������� ��� � �� ������ ���� ���� �� ��� �� ������ � ���� �� ���� ��� �!������� �� ���� ������� � �

��� � ������

��� ���������� ������ �� �� � �� ����� ���� �� �� ������� ���� ������ ��� �������� ����� ��� ����������� �� �������� � ����� �� ����� ������� ��� � �������� �� ��� � ����� ����� ���� � !"�

����� �����

������� �� �� ��������� �� ���#��� ��� ���� ������$�� �� ���� �����������% ������� �� ��� �� �&' ������������� ��� ������ � �� ����� ���� ��� ���#��� ������� ���� �� ��$��������� ������ �� �$�� ��� ��(����� � )% *"� +� ����� �� �������� ��� ������� � ����� ��� ������ ��� ����� ,������� ���� ������������ ��������� ��� ����������� �� ��������� � ��� ������ ��� �� ����� �� ���� �$��- ���� � ���$������ �� ��� .�� �� �������% �� ��� �� �$�������� ���� ��� �������� ���������� �� ������ �� ��� ���#�������������� ��� �� �� ������� �� �����- � /"�

����� �� ���

� ������ ���� � ����� �� �� ������ ��,����� �� � ����� �� ������ ���� ����� �� ��� % �� �������� ����� �� ����� �����$��� � ��� ������� ����� ��� �� ��� �� ������ ������� ������ 0�1�2 �� ��$� �����-%����� �� ��� ���� ����������� �� ������% � 3"�

����� ������ ��

� ������ ���� � ����� �� ����� ������ �� ������������ �� +&� �� �&� ��,�����% �� �������� �� �4����$��-������ �� ���� ���� ����� �� ������������ � 5"�

����� �� ����� ���

��� 6������������ ����� ��� ������ ��� �������� ��� &6� ��� ������ ��� ���������� ������% �� �� ���������� ��� ����� ������� �� ������ ��� &6�% ���� ������� �� ����������� ����� ��� � ������� ��,��������� ���������� �� ������� �����������% �� ������� ������������ �� �(��� ��� 6������������ ������

*

Page 14: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

��� ���� ���������� � ��� ������ ��������� ������� ������ �� ��� �� ������� ����������� ��� ��� � ��� ������� ��� ���������� ������� �����

����� ������

�������� ���� ������ �� �� ������ �� !�� �� �� �� ��� ��� ������ ����� !� ������ ��� �� ��� "#� �������� ��� �������� �� ����� ��� ���$��� � ��� �������� �������� �� ��� �� �������� ������� ��% &�' ���%��� ������ �� � �()�

��� ����� �� ��� ����������

*+��� ���� ������������ ��� �� � ����� �������� ��� ���$ ��� ����� ������������ � ��� ���� ���� ������ ����� �����,'- ��������

����� ����

��'&. �� � ����� �������� ��%�������� �������� ������ �% ��� &������ "����� �� ����������% /� ��������� 0&" /1� ��� �� � ������ ���������% �� ������� ���������� ����� � ��� ����������� �� &" /� '&.��� ��� ��'&. ��� ���������� �� ����� �� �������� �������� �� ��� &" / ����$���� ��� �� ��� ���� �(2��3���� ��� ���� ���� ���������� ���� ��'&.� �� � �)2)� ��'&. ��� 2��� �� � ��� �������� '&.' ������������� ��� ��� �������� �� � �������� �(���

����� ������

3�� 4��5�� ������� ���� �� ������ % ������� �������� ������ ��� ���� ������� ��� �� '&.�� , ���� ������������� ���� ��� ������ �� ��� �������� $�� ����� ����677$$$������������ 3���� ��� ����������� ���� ��$������ ��$���� � �����!� ��� � ������� �� ���� ��� ������ ���$��� �((�� �)2) ����� $��� �����2) ����� ������� �������� ������!�� �% ��� 4��5�� ������� �������� $��� 3�� 4��� ������ .������ ������ '&. ��������� �(8��

����� ���� ������ ������

3�� ���� ��� � ��� 2))) ������� ������� �� �� �9���� ��� �����%�� �� �������� � :&, ��%���������� ���� ��������� � �������� ������ �% ���� ������������� ��;������ ������������ , ���� ��������� �� ��� ��� ������� �� ����% ������� ��� ��� ������� $������ 0����677$$$� 2)))�����������1�3� ������<� ��� ������ ���� ��� ���� ��� �� ���� ���� ������� :&, $�� ���� /� ��� ���� ���$����� ��� ���� �������% � ��� '&.� $��� �����% ������� �� ��'&.� ,�� ��� ��������� $��� ���� ��$%���������� '&.� ��� � ����� �������% �(=��

����� �������� ��� ���� !�"��#$

/�����% '�, $�� ���$� �� ��� ����� ���� ������� �� ������ � ��� ��� ����� ��$ ������� �% ������������� ��;������ ������;��� �� ��� ������� ��� ���� �� ��� ��;���� ���� �������� ,9����% ���� ���������� ������ �� ��� '�, ������� ��� ����� ��� ���� �� ������� �� ��� >'�, 3�����? �� ����� $�������(@� (A��

� �������

3�� ������ � ���� ������� $�� � �� �$��� ����� �����,'- $��� ������������� ������������ �� ���������� ���� �������� ;������� ��� �&,���; ����� � '� �$��� ������������ ��� �� ���������� ������������� ��������� �� ��������� � ��������� 3�� �������� �� ���������� �������� $��� ��� ������� ���������� ��$ ���� ��$ �� �� � ������� ��� �� $��� ����������3�� ������� ��� ���� �������� �� � ������ ���� ��� �� ����� ����� �����������% �� ����������� ���������� ������ � ����� ,� �9���� � ��$ �� ���� �������� ������� $���B�$ �� ���$� �� !� �� 3������ $���B�$ ��� �� ��� �� ��� �����,'- �������� �����%� � '&.� � �������� ��� ������� ���

@

Page 15: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to
Page 16: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

� � ���� � ������� � � ���� � ������� � � � ���� ���������� �� � � �� �� !""�#��#� $ % & � ' � $ (�) � � � �� �� !""�#��#� $ % & � ' � $ (�) � � � ��

� � ���� �������#�� �� � � ��� �� !""�#��#� $ % & � ' � $ (�) * � � ��� �� !""�#��#� $ % & � ' � $ (�) � � � ���

�� � � ���� ���������� ��� � � ��� �� !""�#��#� $ % & � ' � $ (�) � � � #�� �� !""�#��#� $ % & � ' � $ (�) � � � ���

� � � ���� ���������� �� � � ��� �� !""�#��#� $ % & � ' � $ (�) � �# � ��� �� !""�#��#� $ % & � ' � $ (�) � � � ���

�� � � ���� ���������� ��� � � ��� �� !""�#��#� $ % & � ' � $ (�) � � � ���� �� !""�#��#� $ % & � ' � $ (�) � � � ���

� � � ���� ���������� �� � � ��� �� !""�#��#� $ % & � ' � $ (�) � � � �*�� �� !""�#��#� $ % & � ' � $ (�) � � � ��

������ � � �� ������ � � � ������������ ���� ���������� � � � ���� �� � � ���� ��� �������� � ��� ������ ������ �� � �� ������ ����� !!"#$%#%�&'(��)��* �� � � ����� ���� ��� � � (����� � � � ��� � � �������)���� )������ � � ���� ��*�*+*�*,*�*-* �� �� �����(� ����

Page 17: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

� � �����������

� � � � �� � �� � � � � �����

� ���� ���������� � � �� � ������������������� � ���� ��

� ���� ���������� � � �� � ������������������ � ��

� ����� ��������� � �� � �� ������������������� � ��

� ����� ��������� �� � �� � ������������������ � �� ��

� ����� ��������� � �� � � ������������������� ���������������� ��

� ����� ��������� � � �� � ������������������� ���������������� ��

����� ��������� � �� �� � ������������������� ���������������� ��

� ����� ��������� � ��� � ��� ������������������� ���������������� ���

�� ����� ��������� � �� � ��� ������������������ ���������������� ���

�� ����� ��������� � �� � �� ������������������ ���������������� ��

�� ����� ��������� ��� � ��� � ������������������ ���������������� ���

�� ����� ��������� ��� � ��� � ������������������ ���������������� ���

�� ����� ��������� � � ��� ��� �������������������� ���������������� ���

�� ���� ���������� �� �� � � ������������������� ���������������� ��

�� ���� ���������� �� �� �� � �������������������� ���������������� ��

�� ����� ��� ���

� ���� ���������� � �

� ���� ���������� � �

�� ����� ��������� �� � �

�� ����� ��������� �� �

�� ����� ��������� � � �

�� ����� ��������� � �

�� ����� ��������� �� �

�� ����� ��������� ��� � �

�� ����� ��������� �� � �

�� ����� ��������� �� � �

� ����� ��������� ��� �

� ����� ��������� ��� �

�� ����� ��������� ��� �

�� ���� ���������� �� � �

�� ���� ���������� �� �

������ � � �� ������ � � � �������� ���� ��� � �������� ������ �������� ������������ ���� ���������� ���

�� ������� � � ������ ��������� ��� � ���������� �� �� ����

Page 18: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

� ������������� ���� � � � � � �������� ���� � � � � � � ����� ��� �� � � � � � � �� � � � � � � � � � �� ������ � � � � � � � � � � � � ��� � � � � � � � � � �� � ���� ������� �� � � � � �� ���������� �� �� ������ �������� �� !���" � # ���������� # $������ % &�!'(��

������������ � ����!���" � ��&�� � � � � � $ � �� � � � � ��� � � � � � � � � ����� � �� ��� � � � � � ��� � ���� ���������� ��� ���������� ������� �� � � � � � ���� ����� � � ��� � �� �� � � � � � � � � � � ��� � ���� $������ �� �� � � �� � ����� $������%&�!'� � $ � � � � � � � � � � �������� ��� �� ���� � �� ���

� ��� ��� � � � � � � � � �������� ���� ��� � � � � ��� )�� � � � � � � � � � � ��� ��� �� ��� � �� ���� ������ #

� � � �� �� ����� * �� ��� * � � �� � � � � � � ��� � $���� ��� ������������� ��� � � �� �� � � ���� �������� �� �� � � � � ��� ��� � � � � � � � � � � � ���

� � � � � � � � �+��� ����,�-� ���� ���� ���� � )�� � � � � � � � � � � �� �� .� $� ���� � ������ #� ����* �� ��� ���� * � � � � � �

�� ����� ��� &� ���- �� �� � � � � � � � � � �� � � � $� ��� ������� ������ � � � �����( � � &�� ��/� � �� � � � � �

���� � � � � ����������� �� � � � � *���� �� �� ���� � ����� �� � � � � * �� �������������� ��� ��� ��� � ����� ���0� ����� � �� ������ � �� ���� �� � � � � � � � � � � ������-� ���� ��� �� � � ������������ ���/ � � � � �����∗ � ��� � �� � � � � ���� ��� � � � �� �����!���" � � �

�� ���

�� � � � � � � � � �� ���� �� � � - �������� ������� � ������ � 1���� �� ���� ��/����� ��� 2"������ ����������� ����������3−������ � ��)����� % � 4 ���5 4 # 4 ���56 4 # 4 ���6 4 ( #�� ������ % ������� �� � 5789:6586 #:;:666;< #65<66:5<=( #�� � 5788>7:;= #:;<7;5=> #65<=7798:( #�� (�� (��

�� 2���� � $ � �� � � � � ����� ���&�0 ��� 3− ������ � � � � 4 �/����� 4 # ��-���%4��� ���'4 (�

� 2 ������ ����� 3−������� �� ���&�0 ��� # ���������� (�� ��� �-��*���� ��� ��� �-��*���� ����� �

������ � � �� ������ � � � �� �� �����

��

Page 19: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

� � � � � � � � � � ��� ��� � �� �� ��������� ��� ��� ����������������� ��� ��� �� � ������ � � � � � ��

� �������� � �� � ! �"� �#$���%%#� &���� �������� � � � � � � � ' (�������( )�

&*����� �� ���������� ����������−+������ '�� ��,����� # � ' ( ���- ( ! ( ���-. ( ! ( ���. ( ) !�� ������ # /������ '�� � '-0123.-1. !343...45 !.-5..3-56) !�� � '-01170346 !34504-67 !.-5600213) !�� )�� )��

��

� &��� 8��� �� ��� ��� �� � ������ � � � � �� &����$� � ��� �− ������ � � � � � '( ������� ( ! �������#(������� ()��

�� &�������� &9��+�: �−9��/��+�:��� ' ����$� ���� ! ��������� )�� &9��+�: �−9��/��+�:��� ' ����$� ���� ! ��������� )��

�� &�������� � �� � � �� ��� &��� :��� �− ��� :���9�� '9��+�:!9��+�:)�� ���� ' ��� :��� )� ��� $��;� �− ����� :��� ' ��� :��� )� ��� $��;� �− ����, $��;� ' ��� $��;� )�� ��� $��;� ��� �−� � ��*�� $��;� ' ��� $��;� ! 0 � 0 3 )�� ��� $��;� ����� <

������ � � ������� �� ��� ����������� ��� ������������ ��� ������� � � ���� �� ����� ����

��� ������

��������� ��� ��� ���� � ��� ����� ����� � � � ������� � ��� �������� ��� ��� ���� � ������

���� ����� ��� ������ � �� ��� �������� � � ������ ���� � ���� ������� � �� � ���� ��� ��

� ��� �������� ��� ��� ���� � ������ � ��� � � �� ����� ����� �� ��� �� �������� ��� �� � ������

������ �� ���� � ������������ ���� ��� ��� ���� !"#� ��� ���� ���� � �� � ��� � � �� ����� � ����

��� � ��� �� �� ������ ����� ����� ��� � � ������ ��� � ����� ��� $� � ���� ��� �� � ��

��� ������ � � �� ��� � ��� �������� ��� �� ��� ����� ���� ���� ��� ��� ���� ��� � ��� ��� ����

����� � ����������� % ������� � �� � ���� ��� � ��� � ����� ��� ��� ��� ��� ���� � � �� ��

�� � � �� &�

��� ��� ��� ����

��� ������� �� ��� ������ �� �� ���� ������� ������ �� ��� ��� ��� � ���������� ���� �������� �����

�� �� �� � �� ' � � �� (� ��� �� ' ��� � ��� � ��� ������ ������ �� �� � �� � �)!� )������ �����

���� �� �� �� ������ ���� �� ��� ��� � ���� �� � ���� � ����� � ��� ��� ��� �� ������ ��

�� ��� ��� �� �� �� �� ����� �������� � � ��� � ����� � �� ��� ��������� � ������ � ��� �����

��� �� ( ��� �� ��� ���� � � ��������� �� ���� �� ����� �� � �� � �)! � � ���� � ���������

����� � ����� �)! ��� � ������ � � � ���� �� � ���*�� ��������

��� ����� ����

% ���� ���� ��� �� ����� ��� � �� � � � �)! ������ � ��� ������� ����� � � � � �� ���� ��

�� ���� � ��� � ���� � ��� �� ��������� ����� ��� � ��� � ��� ������ � �� ������� ���� ���� ��

++

Page 20: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

● ● ●

● ● ●● ● ● ●

●●

● ●

● ● ●

●●

● ● ●

●●

●●

● ● ● ●

● ●

● ●

chr1

.109

8653

08

chr1

.109

8678

92

chr1

2.57

5502

85

chr1

2.57

5550

78

chr1

2.57

5601

88

chr1

2.57

5604

45

chr1

2.57

5793

46

chr1

2.57

5851

44

chr1

2.57

5878

39

chr1

2.57

5925

57

chr1

2.57

5931

01

chr1

2.57

6026

32

chr1

2.57

6028

15

chr2

.216

2494

30

chr2

.216

2996

29

024

4974

122

172

220

Allele Count Distribution

Rea

d C

ount

ATGC

������ � � ���� �� ��� ����� ����� �� ���������� �� ��� �� ��� ��� �� �������� ������������ ������

�����

chr1

.109

8653

08

chr1

.109

8678

92

chr1

2.57

5502

85

chr1

2.57

5550

78

chr1

2.57

5601

88

chr1

2.57

5604

45

chr1

2.57

5793

46

chr1

2.57

5851

44

chr1

2.57

5878

39

chr1

2.57

5925

57

chr1

2.57

5931

01

chr1

2.57

6026

32

chr1

2.57

6028

15

chr2

.216

2494

30

chr2

.216

2996

29

Allele Frequency Ratio

Rat

io

0

1

2

3

4

0.00

3

0.01

0.01

0.01

0.00

4

2e−0

4

0.00

7

0.00

2

0.01

0.00

2

0.02

0.02

2e−0

4

0.00

3

9e−0

4

With the most frequent allele as numerator

������ � � � ���� ���!� � � ��� ��"�� ��� ��� �#�� �� ���!�� ��� �!� #��� �"������ ������ ��

���� ��� � ��� "�"��� $ ��� �� ��� �������� ������� � � ������ �� ������ � ���� �� ��� ��� ���

��

Page 21: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

������ � � ���� �� ���� ��� ������� ��� �� ������� ��� ����� �� � �� �� � ���� ��� ����� ��

� ������

��� � � � � ��� ������ ��� ��� �������� ������� ��� ������� ������ �� ��� �������� �� ����������

� �� ���

�������� �������� ����� �� ������� �������

���� �� � �� ����� ��� �� ���� �� ���� �� ����

����� � �� ���� � �� ���������

���� �������� !������"# �� ����� ��� �� ���� ����� � �� ���� � �� ���������

���$ %����� ���������� � ���� �� ���� ���!� ��� ����&�� ������� ���� �������� '��� ���� ��� ���� � � ������ � ���� ������� �� �� ��� � ���� ����(����

������ �� ������)*+ ,����� - ���'� ��� ����� � ��� � �� �� ��� ������ ����� '��� ����� �� ���!���� � ���� ���� ��� ���� ��� � ��� � ������+ &�� ��� ����� ���'� ��� ����� �� ��� �������� " .�������#+ �� ���' � ��� ������� ���� ��!�� ��� ������� ����� �� ���� !���� � ����+

��� �������

/��� �� ���� � � ������)* ��� ���� � � �� �� � ������� ����� ����� �� � ������ ���� ������� ��+��� � � �� ���� �� !��� �������� � ��� ��� ��� ���� ��� + &�� �� ���� ����� � ��,0������"# �� ���� � �� � ��� � ��� ��� �����1��� '��� � ������ �� ����� '��� ��� ��� � �� )2�� ���� ��� ��� �� !��������+ &�� ��� ������ � ����� � ��� �������� ��� ������� �� �����(��� � 3�� �4+ &�� ���!� ��������� ��� ��� ������� �� ������ ��� ��� ��������� � ���� !����������� � ������� ���� ������� ���� ��� � �� ����� �+ &�� �� ����� ��� ������� ��� ���� �� ���� � ��� ���(����� �� '���� ��� ��� � !��������+ &�� �������� !������"# �� ���� '�� � !�������� � ���'� � ��� ����!�� � �!�� �������� ��������� ����� 3� ��+ � ����� �������� � �� ���� '�� ��� �� �� '���� ������� ������ ��� ����������� !������"#+ )�� ����� � ��� � �!��!��' �!�� ��� ��������� ����� �� � ������� � ���������� �� ��� � ��,0������"# �� ���� + 5 ���$ ��� !����� ���������� '�� ���!� �� ���!� ��� ���� ��� ���� � ��� ��������� � '�� ��� �������� '��� ��� �� � �� ���� + &�� !����������� ������!��� ����!� ��������� �� ��� � � ��� ����+

�$

Page 22: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

� �������� �����

� ���� ��� � ���� ��� ��� � � � � � � � ���� �� �� � � � � � � ��� �� � �� � � � � � ���� � �

� � � � � � � � � � � � � � � � �������� �

� ���� ���� � � � ��� � ���

� �� � � � � � ���� ��� � � � � ������� �

� � � � � � � � � � � �� �� �� � � ������ ! ��� � ��� � � � � � �� �� ���� �

� "��# �� ���� ��� � � � � � � � � ��� ���� � � ��� � � � � � �

� $��� ��� � � � �� �� � � �� � � � � � � � � � � � � � � % � � � �

���� � � �� � �� � � � � � � � � � �

&��� ���� � � � � '

� (���� � � � �� �� �� � � ��� � � � � �� � �� � � � � '

� (���� � )�� ������ ! ���� � �� � � � ��� �� � � � � � � � ��� � � � � � � ����� '

� (���� � )&* ������ ! ���� � �� � � � ��� � � � � � � � � � � � � � ��� � � � � � � ����� '

� *� �� � � � � � � � �� � ��� � )�� �� � � � � '

� �� ���� ��� � � � � ��� �� �� )�� �� � � � �

� �� ���� � � � � �� � � ��� )&* ��� � � �

� +�� � ������ � � ��� � �� ��� � � � � � � )&* �� � � � � ���� � �� ���� �� � � � � � '

�� � � ������ � � , ���

�� �-� � � � � � � � '

�� .���

�� �- � � � � � � � ��� � � � � � � ���� �� � � � � � '

�� ���� ��� ���� � � ���� ��� �� � � '

�� � � � � ��� � � � � �� � ������ ��� �� � � ���� � �� ��� �� � ��� � �� �� �� �� ���

�� � � � � '

��

�� $��� � �� �� �� � � ��� �� � � � � '

� &��� ���� � '

������ �� � ������� �� ������� ��� � �������� �������������� �

������ �� � �� � ������� ��� ������� �� � ��� �� � �� �� ��!� � ���� �� �� ��" �� � � ������� � #$ �% �� � ��� & � � �� �� ����'�������

��

Page 23: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

� ����������

�� ������� �������� ������� �� ���� � ���� ������� ���� ����� �������� ���� �������� ����������� �������

�� ��� ������� �� ����� ��� ������� ������ �� ���� �������� ��� �� ���� ����� ������ �� ��� ������

���������� ��� ����������� �� ����� ��� �������� ������ �� ����������� ��������� �������� ���� !��"

��������� �� � ����� ���� ���� � ��������� ��� ������� ���� ����� ��������� ��� ������# ������� ���� ���

���� ��������� �� ������� ��� �������� �� ��� $��� �� ������� �������� ����� ��"�� �����

��� ��� ����� ��������� �����������

����� �� ����� � ����������� ������ ��"�� ��� ���������� ���� ������ ���������� ������ �� ���� ����

���������� ������� �� ����� ����� %���� ���������� �� ����� ��������� ���� ������ �� ��� �������� ������

��� ����� ��� ����������� ���� ����� ����� �� ��� �������� ����� ����� �� ������� ���� ��� �&�����

������ �������� ��� ��"�� �������� �� ��� ��� �������� ������ �� ��� ���������� ����� �� ������� ��

�&�������� �������� '� ������� �&��������� ��� ������ ����� ������ �������� ��� ��"�� �� �� �

��������� ��� �&�������� �������� � ������� �� ���������� �� ����� ��"�� ���� ����� � ��� �������

������� �� ���� ���������� '� �������� �&��������� �� ������� ���� ��� � ����� ������� �� ����������� ������

(����� ��"�� ���� ��� � ������� � ��� �� �� �� ����� � ����� ��� ��������� ������ �� ����������

��������� �� ��� �� ������� ��� ����"����� ������ !�� ��� ��������� �� ������ ������ �� � ���� ��� �� �������

������������ �������� ����� ������� �� ���� ��� ������ ��� ����� ����� ����� � ������������� ��"��

��� � ����� ���������� �� ��)��� �� ��������� �&��������� ���� �����"������ �������*����� �&�������� !��

��� ������� �������� ������ ����� ���� ����� ���� �� ��� �����"������ �������*������ �������� ����������

������$������ ������

��� ������� �� ������ � ������� �������

+�����& �������� ���� �� ��� �������� �������� �� ������ ����� ������ ���������� �� � �&�������� ����

�� ��� �� ��� �������� �� �,��� �� ������ ��� ���� �������� �� ��� ����� ������ ���� ��������� �� ��������

��� ���� ���� �������� �������� ��� ������ �� �� ���� �� � ���� �&���������� ��� ����������� �� ������

�����$� �&�������� ��� ������� � $�� ������� ������ �� ����������� �� �&����� �������� #��� ������� ��� ����

����������������� �������� ����������� ���� ���� �� ���� ��� ���� ������� ����� �-�.�

�� ��� ���� ����� �� ��� ������� �� �� ������� �� ��� ��� ������� �������� ����������� �� �� ��-�.

�������� �� �� ����� ������� ���� ��� ���� �� ��������� �� ����� ����� ��� ���� ��/ �� ���������� ������� ��

��� �������� ����� �� ���� � ������� ���� ��0���� �� �� ����� ��� ������� �������� ������������ 1�� �����

���� ��� ������ �� ��� ������ �����$� ������ ��������� ��� ��������� ������� �)����� ��� ���������� ��������

��"�� �������� ���� ��� ���� ���"������ ����� ���� ��� � � ������ �� ������� �������� ����� �� $�� ����

�����$���� ���� ��������

��� ������ �!�����

(�����*���� ����� ��� �� ���� � �� �������� �� � ��� �� ���� ��-�.�� ��� �� $�� �������� ���� ��� �����

������� ��� � � ������� ����"����� � ����� ����� �� ������� ��� � �&�������� �� �� ���� �� �� �����

���� �� ����� �� ���� �������� ����� �������� ��� ���� 2����� ��-�.� �� ����*���� ������ ����� ����

��� �&����� � 3��������� ���� �� � �������� �� ��� �� ����� !�� ���� ����� � ���������� ��0����� ��

��� ���������� ���� ������������ �� �� ����� ����� ������ � ��� �� ���� ������ ���� � �&������� ����� '�

������ ������� ��� ������� �� ������� ������ ���� ������� ���� ������� ����� ��� ��� ���� �� ���� ���

������� ����� �����

��" #���$������ ��%������

�� ������ �� ����� ��� ���� ������ ������� ���� ���� ����� � ���� ��� �� 455 ����� ������ ��� �� ������

���� � ����� ���� ����� �������� ���� �� ����� ��� ���� ������ �� ������ ���� ����� �� ��� ������# ��������

'������ ����� ������ �������� ��������� ��� ����� �� ���� ������ ��� ����� ����� � ��� �� ���� ��

��������� ���������� ��� �������� '����������� ��� ����� �� ���� ����� ��������� ���� ����� 4 ������� �����

�������� �� 65 �������� ������ /���� ��� ��� �� ���� ��� ���� ��� ������ �� ������ ��� ���������

67

Page 24: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

������ �� � ��� ��� ���� � � �� �� � ����� �� ��� �� ������ ��� ������� � ��� � ������ ��������� � � ����� ��� � ��� � �� ����� ��� � ����� ���� ����� � ������� �� � ����� � �������� ��� �� ������� ���� � � ���� � ��� � ��! �� ���� �� �������� ���� �� ��� � �� � �" �������� ��� ������ �#������ $��� ����� ��� � �� ���� �� �� � �����! �� ��� �� �� � ����� "����� � ���� �� ��%&'�

��� ������� � ������

&�� ���� ���� �� �������� ��� ���� � ������ � �� "��� ���� �(�� �������� ��� ������! "������� �(���� ��� ��)� ��� ������ � � ��� ���� ������� ���� � ���� � � � ��*����� &�� ��� ��������� ���� � ���� � �� ��� �� ��� ���� ������� ���� � ���� � �� ��� � &�� ������+�� ���,- �������"� �#������ � �� � � �.������ ���� ��� /��/! "���� � �� 0 � � ������������ ���� ���� � � ���1�����0���� ���)���� ��� ��� �#�������� ��� �� ������ � ��� ������+�� ���,- ������� ���������� ���� ��� �����(� �� ���� ��� �� �� � ��� ���� ��� �� �� ���� �� ��� �� � �� ��� ����� � ���������2�� �� ������ � � ���� �� ���� ��� �� �� � �� � ��� � 2�� �� � ��������� � �� �#�� ��� ���� ��� � ����� ���� �(�� ��! "��� � ��� � ���� ��� �� �����(�� ������� � �#� ������ ��� ������ ��� ��������� ������������� � �� ��� ���� ��� �� �� � �� � �� � ����� "���� ��� � ����� � ��� � �� ��� ���� "�������� ������+�� ���,- �������� &�� � ���� �� ������� � �� ����������� � � ����� �� ��� ���� ��

��� �������� � ������� �����

&�� ������$ ���)��� � ���� �� �� ���! ���)��� � � ���������� �������� ��� �� � �� ���� � ���������� "��� ������3�� ��� �� ���� �! ��)��� �� ��� � ����� ��� ��� ��� ��������� ���)��� "���� ���� ��� ���� �� � ��� �� � 4� ��� ��� ������� � � ������ �! ��� �� ��� �������� � ��� � ��� ����56 ��� � � ������ � ����� 6& 3 ���� ���

��� ������� ������

&�� �0� � � ����� � �2����� ����! ��� � � ��� � �� � ����� � � ��� ���� �� ����� � � ��� 6& !���� ��� �0� &�)��� &�� ���� ����� � 7��� �� � ���� � ������ � � ���� 6& ��� �! �� �������0���� ���� ��� ��� ��� �56 ��� ������ � ���� "������ &�� � ���� ��� ��������� ��� ���� ����� � ��� � � ������ "��� �� � ���� ������ � ����� �����

��� �� ��� � �� � �������� � ������ ����

&�� � � � ��"� � � ��������� ������ ��)� � ��! ��� ��� �����! ��� � ���� �� ����� �� �� ���� � �����# "��� 41� � � � 8�#���� ��"� � � ������� 0 ���� �� ���� 8�#���� ��"� �! ���������� � ����� � � � ������� ��������! �� � ��� � ����� ���� ������� � ��� ����� ��� � ������� )� ����� ��� � ��� ���� ���� ���� ����� ��� ��� � ��� � ��! � �� �� ��� � ��� � � ) ��� ������ � ��" ��� ������� &�� ���� �� � �� �#������� �� ��� ��� � ��� ������ � �� ���)���! "�������� ��� �� ��� �� ���� ����� � � ���� � ������� ���������� ������ � � )��� ��� 0 ��� ��������� ����� ��"� � ���� ��� �� ��� � ������� �� �������� �� ��� ���)� ��� � ������ 9:;<���� �������� ��� � � � *���� �� � ��������� ���� �� ���� �� 0 ��� ������� ��� ��� ���� �� ��������� ��� =��� ��� ��� � �� ���� ������ "� �������� �� ������� ��� 0 �� ���������� ��� ��� �� � �����.� �� ��� ��� � �� � ���� ��.� ��� ���� � ����������� ������ � �� ��� � ��! "���� ��� 0�� ��� � ��� � ��� ��"� � � �� ���� =� ��� � � � ���� � ����� ���� "��� ���� �� ��������� "����� ������ �� ��! ���� 0 "��� �� � �� ������

� ���������

04�3�2 � �� � � ���! ��� � � ���3��" �� � � ��� �������� ���� ����� �� ���� �������� ����������� ��� �������� � ����3�� ������ ����� ������$ "��� �� ��� 03������� ����� ���� �� � ���������� ��� ������� ��������� 2����� � � 04�3�2 �����

�>

Page 25: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

� ������

��� ��� ���� ����� �� ������ ��� �������� ��� ������� �� ����� ��� ��� � ��� ������ ���� � ������ ������� �� ����� ��� � ��� �� ������� � �����!�������� �� ������ ����� "�� ��� "#� �����$�!����������� $���� ��� ��� ���� �� ��� �� ������ ��� � ������ %������������ ���� ��������& �� ��' ���( ����� ����� �� � ��� �� ���)� �� ���� �� ��������� ��� ��*� �� ����� ��� ��� ���( ���������� �������� ��� ��� ��� ���� �� ��+����� �� ������ $���� � ��� ���� ��� ���� ������ �� ����� ������( ����� �������� ���� ������������ ������ �� �� ���������� ��� � '( ��� ����� ����������� ���� �� ��� �������� ���������� ���)������ ��������� ����� ��� ��������� ���� � �� �������� �� ������*� �( �� ����� ��� � �� ������� �� ���)�� �� ������ ��� �������� �� ��� ���������� �� ���"�

� ��� ����������

���� �� ��� � ���� �� ����* ,�� ���*���� ��� �� ��������� ���-���( ��� ��� �� ��������� ��������$���* �� ��*��� $������� � � -��� ������� ��� ��� ��� ���� ���� ��*� .��� ����* �� ��� ��������� �� �� /������*� ��������� ��� #�� ��� ��� ��� ����� �� ������������ ������ ��� �� ��� ������ ��*� �� ����* ��� ���*�� ��� �+���� � ���0!������ ������� �� �� ������� �����

� ���������

123 #�4� .����� ��� /�,� ����*�� ������ ��� ��� ������ ��� ����� ���� ����� �����!���� ���������������( #��� 5��� ,������� 6726 ���869:6;<=>!279( 6726�

163 ���� #����� ���( � ����� ���? /����( "��� �����( 4� "���( ��� "� /������ #�������� =�62��� �������� ���� �������� ����� ��������� ��������� ���� ��'�, ��������� ���� ������(@:A;<�2777>==( ����� 6727�

193 ' 0��������� #��� $���� � � �������� ��� ���������� ��� �������� ��������� ' ������������� ���������� #������� ( B�����( ������( 6722� ��"� 9!=777C2!7D!7�

1A3 /��� "� ����( /�'� #��� �( ��� 4��� ������ �� ������������ �� �� �!����� ���� ����������������� ��� �� ��� � �������� � ����� !�" #��$ ���%���� &������' ������ ())*� +,--� ( 677@�

1C3 E� .�� ( �� F������( ��� �� ������� '��!��G< � ������������ ���� ��� �������������� !�����

����"� ������( 27:2;<CDH@9( 677=�

1@3 /� ����� ����( $�E� 4��( ���� ���( ��� I��� I��� 0� ���� '�� �G������ ������?� �G�����!��������� �� ��� �����)������ ���� ���� ������?�� �� ��!�������� ������� ��������� �� �.� !������

�����' �� �����( 4������ 6726�

1D3 4� '�?��*�( �� � �?�( 4� .�� ( �� ���( 0� '���( �� ��������( 4� ,�� ( '� "-�����( J� /�� (�� /��� �����( �� "������-( �� '� ��( �� ������( ��� �� F������� ��������G< ������ �� ������!����)� �������� ��� ����� �� � ������* ��������*� �������� �'����� /����'( D( �� �� 6722�

1>3 F�����!���� ��������� ���� �� 2A(777 ��� �� ��� ������ ����� ��� 9(777 ����� ��������!�����( AAD:D2AC;<@@2H@D>( 4��� 677D�

1=3 ���� B�����( ���� "����( ���� ��#�����( ��� 4� J�� � ��� J��� �� F.�� 0������� �� 0 1��

�����( =7:2;<DH6A( 4������ 6726�

1273 "� ��������( �� ,��*( �� "�����( 4��� '����*�( ��� "� ,�� F�����!���� �������� G���������� ��������� :�K$,; ������ �� ���?�� /�� ������( 26:2;<99@( 6722�

1223 ,� ���*����( �� � �����( �� #����� � ��( ���� � ����( F�/� �����( L� �����( 4� ,�*�( ��!#�������( F� ������!"����( �� ������!#�������( �� ������( �� F� ������( �� ���*��( ��� �� ����� �� ��� "�/� ��� ���� ���� ����� ��������� �� ������ ��* ������ ���� �������� ���������� ��� ������)� ���� ������ ����� ��� ��� ������������ ������ �������� ������������������( 9:A;<9@CH9D9( 4��� 6727�

2D

Page 26: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

���� �� ���� �� �� ������� �� � ������ �� �� ������ �� ������ �� ������ �� ������ �� � ���� �� !����� "����� #� $�%��� "� &���� �� � �� '��� (� ����� � �� )� �� �� � ���* �� +� �� *��,�-�(+����� ��� ��� ����� �+ ��% ���� ������ ������� � .�/��0� �1�1�

��2� �� ���� �����,3��� ������ �+ � � �� ��0� ��� ���� ���� (.�� �� ����,����� �.� � ���������� �� ������ �14567���89��2:� ����� �111�

��;� <� !��� �� !�� $� (��� �� �� ���� �� �� &��%� ��=#��7 �+� �� ��*� ��0� /� ���� �� � � ����0� ��� ���� (.� � ��� �� ��� ���* �� ��=�� 3�� � ��� �� �� ���� ���� >4867��1?1?� "���1�1�

��>� ��"��� ���%� ��"� ��� ��� .� ���� ��!� #��� � �� ���� ����� &�� ���� ��(&@ A � +� �� +� ��B����� 3�� B�� �� ��� ��� �� �� (� �=�C) ���� ��(&@ /� ���� �1�1�

��8� #� !�� �� #����%� � �� -���%� � &� ��� � "� ���� .� #��� � �� �� �� �� �0������� �� �� 0��� � � &�� ��B���� � ����C��* +� �� �� (���� �� ���������� � �>4�867�1:59�1:?� �11?�

��:� �� �����%� �� ���� �� �0������� ���� � 0� �� D� ��%�� ���� ��� ���� ��D� #����%� � �� !�� ���&� �� �� (�&� (�� �� � � � &�� /� �� �� +� �� �� $���� �� ���������� � �:4�>67��>89��>5��1���

��5� #� !�� &�0�=7 +�� � ��/� �+ ��B���� +��� �� + �� ��� �� &��,�� ����� A ��� ���������� ��:4>67:�59:�?� �1���

��?� ����� ���� E�!7 �*7CC����� ����� ��+� ����C����� ����� � ���� �� ��/��7 �1,"�,�1���

��1� #� !� �� �� �� 0�� ����+� �����,�11?,!�,�:>;,81�*�+� ��� �11?�

���� "� ��=� ��*��� �+ �� ����� � ������� �� �F��� � �+ �� * �F��� ��� � �������� �4�67>9�2��11?�

���� �� �� �� � � ��/� � ������� ���%����7����� � � ������ �*� ��0� � 4$� ��� ��1������� ���� �� � ��*7 E�!� �������� ���� ��� �� /����� &������ ��*� �� �118�

��2� ��������� � E�!7 �*7CC333�0�������� �� �C� ���� �� ��/��7 �1,"�,�1���

��;� ����� � E�!7 �*7CC333�0���� �� �C� ���� �� ��/��7 �1,"�,�1���

��>� (� �� ��%� '� �� ���� �� G��* ��%� (� ��/��� �� �� ��� � �� � ����� �� -� #�0� � ����� ��0�������� 7 � *�3� +� �% 0�3�� 0�� ����� ���0���� �� ��� �� �� ��� �� ����� ���������� ���4�8672;2?92;;1� �11>�

��8� (� �� ��%� ��&� (*� ��� D� �� ��� �� -� #�0� � ��**�� ����A� � +� �� ��� ��� �+ ������������ 3�� �� �C��������� *��%��� 0������ ������ �������� � ;4567��5;9��?�� "� � �11?�

��:� #� ������ �� �0����� �� �� !�3 ���� ������ � ����� �������� ��� ���������� ������� �� � !����� � � *��%��� /� ��� ���>�;�

��5� #� ������ �� �0����� �� �� ���� �� (� ��0���� �� ���� � ����� �"#��� ����� ����� "������� �!����� $ �� ������� �������� � � *��%��� /� ��� ���>���

��?� �� �0����� #� ������ �� �� !�3 ���� ����������� � ����� ������� �� ���������� �� ������������� � � *��%��� /� ��� ��?�:�

�21� �� �� �� �� �� ���H�� � ������ � ����% �������� &�'()$ ������ ���� &�*+)$ �� ��", -�� ����� �� *��%��� /� ��� ��:�;1�

�2�� (�&� (�� �� ��#� -� �� �� G�� ���/� "� ��%� � !� ���� D��� (����� �%�� �� G� (� �%�� �0(.�7�� .��) ���0��� �+ ����� /� ����� ������ '� �� ������ �?4�6721592��� "��� � �11��

�5

Page 27: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

���� �� ����� � ���� ������� ������ ������� �� ������ �� � ����� �� ��!�"� #� ���� �� � ��$����$��� � %������ &�'() � ��� *�'+ ���*�� �, $�� �� ����� � �����,� �� �� ���$��,� ���� �� ����� ��������� �-&-)./010�� �2-2�

���� ���� 3��� ��� ��"� � ��� �� !� ����� �� ��(� ��� �� � ���4 �� � �� ��� ������� ���$ ���������5��� 6�* ��� �� ���������������������������������������������������������������������� ����� ��������� !"#��"$! $� �227�

��8� (��� �$���$��� #��� � **� �� +�$������ 9� (�� �:�; � ���� ����%���� �� <�� +�9� =������ +�>��� � =�;;��� +� (�$��;�� ��=� ��*� �$� #� �6 $$ �� �� ����� �� >���,�� ?� � �� �� +�$�� �� �� +��; ��+� �� ���;��� !� ������ �� ��6�� ��#� ��6 � <� #��� (� ����$��� (� ��� � ��:�,� �� =�����!� (��@ � � �� ���$�� ���� !���� !� !� � ����� �� ���� ���� �������$$� �� '���� �� !� ������=� ��������,� �� +�$$��;� ���� +� ��� '� �����:�� �� ���:���A������� � �$;� �� +� ��� "� ���� $���� =�� ���� ���� (�$,� �� ��$ �� �� ��"���� �� ���� ���� �� '��,��� B� C����� ����#� ���� �#� ��� �� � �� �������� �� 3�;���� � ��#� ������ >� ��$,�;����� 9�=� ��������� +��� ��*�� ����� � �*��6�� ���� ������ (�#� ��� ��� �� � � � �� �� �� � �� ������ +��� �����$$� >� ���� ��(� '����� "� D�� ����� (� #� ,� ��'� #�� � ��(� #�,�$� #�#� ������ �� C���� ��(� =���;� �� ��9� ��96��� >������� �� ���� �� ���� ����� � @�� �� �� � @��� ���� ����$�� ��� %������8/0&0�--).7�17E� �����*�� �2-2�

��7� (��� �$���$��� 9��� ��� ��� �� �*��� �� 3� =$��� !� � *�$; � 3��� �����$$� ��=� ��*� �$� (�=� ��%��9� ���F��� ���� ������:� �� �$� � �� �G ���� ����� @�� �� �� G�� ����$�� �� ��$� ������ ���%������ 8/0&0�-H).-2/-1-20�� �2-2�

��/� (��� ����$��� 3� =������� (��� =����� ���� =�,���� !� ������ "� ����@��� �� (��� ������� �� ( ���A� �� #� 9 ���� �� �� ������ �� �$� (���*�� ������� �G ��� ��� ���$ ������ G�� * �������$��, �G���� ���%������ ����� ��������� �/&���$ -).(-�1(�-� �22E�

��0� �������� ��� ���� @�.'�=>I'��I'>�� J#�. ����.II666���* ��$�� ����@I3����I��I� +��� #�A�� �@� . -2A���A�2-��

��E� �� �� ��� �6��@�� ,�� � ������� �� �G ��� � ��$ ������ � �� $ ������ ��� ���$, � &������� �� '�������( ��� )�������������(������������ *��������� ���������� )���� )������ ������������ +" !� !, � -" !.! )���� -������ � ����� %�� /0� �22��

��H� ��3��=� ������� ,� !�! 1$! !�2� 3�� �������; >���� '�� �;� ���������� �2-2�

-H

Page 28: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

��

Page 29: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

basicASE

Jesper [email protected]

Lasse [email protected]

June 9, 2012

1 Abbrevations

ASE Allele spcific expression.

SNP An allele variant from a single nucleotide polymorphism.

BAM A binary file format for storing read alignment data.

BCF A binary file format for storing allele variants as SNPs.

2 basicASE

The basicASE package contains functions for investigating allelic imbalance fromRNA-sequencing data in a subset of the genome. The package handles one ormore samples(individuals) and provides neccessary plot functions for a basicanalysis. All infrastructure used in this package are built with the aim to haveas much data as easily accessible as possible. Accessibility is managed froman intermediate data.frame containing the most important information for aspecific analysis, while the large amount of information is stored in the Genom-icRanges objects. So it’s easy for users to add a specific function on their own,or as a contribution to the package if they believes it also could be used byothers. The structure of an intermediate data frame can be found under the”An introductory example” section.

3 SNP sources

There are several sources where to find interesting SNPs, which is demonstratedby the SNP Source flowchart below, fig 1.There are possibilities for a high-throughput approach or a study of a selection of interesting SNPs or both.

4 Allelic imbalance testing on RNA-seq data

Compared to microarray data, RNA-seq data provides much more informationlike read counts and the exact sequence for every read. And these features areexactly where the basicASE package gets the advantage from. The example Rcode below merges all individual data to one pool, and calculates their unitedimbalance significance by a chi-square test. See also fig 2 for a schematic pictureover the workflow.

1 (21)

Appendix A Vignette

Page 30: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

Figure 1: A flowchart over where to obtain interesting SNPs. data

Figure 2: Extension of fig 1, showing the workflow of an allelic imbalance testing

2 (22)

Page 31: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

5 Collecting data

There are two essential input data for this package, RNA-sequencing data andsnp data. RNA-sequencing data could be from an user provided experiment orfrom a public project as the 1000 Genomes project http://www.1000genomes.org/. Snp data, can be imported from several different sources. The most prefer-able way would be to use a snp-calling method on the same RNA-sequencingdata that will be used. And import both the reads and the snps found in thesereads.

6 An introductory example

Use the basicASE bam and bcf system files.

> #load package

> library("basicASE")

> #Construct SearchArea

> searchArea<-GRanges(

+ seqnames = c("chr1","chr12","chr2"),

+ ranges = IRanges(

+ c(109852192,57522276,216225163),

+ c(109940573,57607134,216300895),

+ )

+ )

> #Set Path to bam and bcf system files

> #pathToFiles <- system.file("extdata", package="basicASE")

>

> #import

> #BamGRL <-BamImpGRList(pathToFiles,searchArea)

> #BcfGRL <-BcfImpGRList(pathToFiles,searchArea)

>

> #preparation steps

> #snpAFList <- snpAFListBcf(BamGRL,BcfGRL)

> data(snpAFList)

> snpAFTotDf <- mergeAFList(snpAFList)

> chiAFTotDf <- chisqAFTotDf(snpAFTotDf)

> chiAFTotDfFilt <-filtChiAFTotDf(chiAFTotDf,0.05)

> head(chiAFTotDfFilt)

A T G C chisq ratio count1 count2

chr1.109865308 0 8 25 2 0.00308318609090795 3.125 25 8

chr1.109867892 1 5 18 6 0.0143058784354296 3 18 6

chr12.57550285 0 20 2 40 0.00982327450751926 2 40 20

chr12.57555078 10 0 25 0 0.0112298866529167 2.5 25 10

chr12.57560188 9 26 0 0 0.00405919636555506 2.88888888888889 26 9

chr12.57560445 6 0 28 0 0.00016131642030862 4.66666666666667 28 6

ch1 ch2

chr1.109865308 G T

chr1.109867892 G C

chr12.57550285 C T

3 (23)

Page 32: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

chr12.57555078 G A

chr12.57560188 T A

chr12.57560445 G A

A simple plot of the allele frequency can then be built.

> plotAFTotDf(chiAFTotDfFilt)

● ● ●

● ● ●● ● ● ●

●●

● ●

● ● ●

●●

● ● ●

●●

●●

● ● ● ●

● ●

● ●

chr1

.109

8653

08

chr1

.109

8678

92

chr1

2.57

5502

85

chr1

2.57

5550

78

chr1

2.57

5601

88

chr1

2.57

5604

45

chr1

2.57

5793

46

chr1

2.57

5851

44

chr1

2.57

5878

39

chr1

2.57

5925

57

chr1

2.57

5931

01

chr1

2.57

6026

32

chr1

2.57

6028

15

chr2

.216

2494

30

chr2

.216

2996

29

024

4974

122

172

220

Allele Count Distribution

Rea

d C

ount

ATGC

> ratioplotAfDf(chiAFTotDfFilt)

4 (24)

Page 33: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

chr1

.109

8653

08

chr1

.109

8678

92

chr1

2.57

5502

85

chr1

2.57

5550

78

chr1

2.57

5601

88

chr1

2.57

5604

45

chr1

2.57

5793

46

chr1

2.57

5851

44

chr1

2.57

5878

39

chr1

2.57

5925

57

chr1

2.57

5931

01

chr1

2.57

6026

32

chr1

2.57

6028

15

chr2

.216

2494

30

chr2

.216

2996

29

Allele Frequency Ratio

Rat

io

0

1

2

3

4

0.00

3

0.01

0.01

0.01

0.00

4

2e−0

4

0.00

7

0.00

2

0.01

0.00

2

0.02

0.02

2e−0

4

0.00

3

9e−0

4

With the most frequent allele as numerator

7 Get going - a small but extensive tutorial

To get a feeling for RNA-sequencing data it’s important to know all steps in-volved in the process. So here will be provided a small tutorial on how to takeyour analysis from raw sequencing data fastq.gz files into R, further process thedata and produce some plots. A small warning has to be anounced for the firstpart of this tutorial. Make sure that a computer with enough memory is used,RNA-seq data files can be very big. And preferably also to gain some speed itcould be wise too execute the code on a multicore computer.

7.1 PART ONE

Here the BWA and samtools software will be used. BWA is an alignment algo-ritm and samtools an alignment file convert and processing tool. For more exten-sive information the reader is directed to http://samtools.sourceforge.net/and http://bio-bwa.sourceforge.net/. To avoid confusion all the followingsteps are taken in the same directory.

#Move or copy all paired RNA-seq data to an empty directory.

sapmle1_1.filt.fastq.gz

sample1_2.filt.fastq.gz

sample1.filt.fastq.gz

sample2_1.filt.fastq.gz

sample2_2.filt.fastq.gz

5 (25)

Page 34: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

sample2.filt.fastq.gz

#Download Reference genome and create index for bwa.

wget http://hgdownload.cse.ucsc.edu/goldenPath/hg19/bigZips/chromFa.tar.gz

tar -zxvf chromFa.tar.gz

cat chr?.fa chr??.fa >reference_genome_merged.fa

bwa index -a bwtsw reference_genome_merged.fa

#Align data with bwa

##sample1

bwa samse hg19_reference_merged.fa sample1.aln.sai sample1.filt.fastq

-f SE_sample1.sam

bwa sampe hg19_reference_merged.fa sample1_1.aln.sai sample1_2.aln.sai sample1_1.filt.fastq

##sample2

bwa samse hg19_reference_merged.fa sample2.aln.sai sample2.filt.fastq

-f SE_sample2.sam

bwa sampe hg19_reference_merged.fa sample2_1.aln.sai sample2_2.aln.sai sample2_1.filt.fastq

#Process with Samtools to get bam files, that we want to import to R later.

##sample1

samtools view -uS SE_sample1.sam | samtools sort - SE_sample1_aln_sorted

samtools view -uS PE_sample1.sam | samtools sort - PE_sample1_aln_sorted

samtools merge ALL_sample1.bam SE_sample1_aln_sorted.bam

PE_sample1_aln_sorted.bam

samtools index ALL_sample2.bam

samtools view -b -F 4 -q 10 ALL_sample2.bam >ALL_sample2.Fqfilt.bam

##sample2

samtools view -uS SE_sample2.sam | samtools sort - SE_sample2_aln_sorted

samtools view -uS PE_sample2.sam | samtools sort - PE_sample2_aln_sorted

samtools merge ALL_sample2.bam SE_sample2_aln_sorted.bam

PE_sample2_aln_sorted.bam

samtools index ALL_sample2.bam

samtools view -b -F 4 -q 10 ALL_sample2.bam >ALL_sample2.Fqfilt.bam

#pileupp using samtools and bcftools (which is a part of samtools).

##sample1

samtools mpileup -guEf hg19_reference_merged.fa ALL_sample1.Fqfilt.bam |

bcftools view -Ibvcg - > ALL_sample1.Fqfilt.bcf

bcftools index ALL_sample1.Fqfilt.bcf

##sample2

samtools mpileup -guEf hg19_reference_merged.fa ALL_sample2.Fqfilt.bam |

bcftools view -Ibvcg - > ALL_sample2.Fqfilt.bcf

bcftools index ALL_sample2.Fqfilt.bcf

6 (26)

Page 35: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

#REMOVE or move files ending in bam to another folder, except ALL_sample1.

Fqfilt.bam and ALL_sample2.Fqfilt.bam. To not confuse the import function

in R what files we want to use.

Part 1 done.

7.2 PART TWO

Import and analyze using R and the basicASE package.

#If you havent installed the package, use R CMD INSTALL.

bash> R CMD INSTALL basicASE

#Start R

bash> R

> #From within R

> library("basicASE")

> searchArea <-getAreaOfGene(c("LRP1","DAP2IP","FN1","SORT1"))

> #Set Path to bam and bcf files

> pathToFiles <- system.file("extdata", package="basicASE")

> #import

> BamGRL <-BamImpGRList(".",searchArea)

> BcfGRL <-BcfImpGRList(".",searchArea)

> #preparation steps

> snpAFList <- snpAFListBcf(BamGRL,BcfGRL)

> snpAFTotDf <- mergeAFList(snpAFList)

> chiAFTotDf <- chisqAFTotDf(snpAFTotDf)

> chiAFTotDfFilt <-filtChiAFTotDf(chiAFTotDf,0.05)

> #choose one of the plot functions

> ratioplotAfDf(chiAFTotDfFilt)

Congratulations all steps in the tutorial are done. This has shown how tohandle next generation data from RNA-sequencing and complete a basic ASEanalysis.

8 Session Info

> sessionInfo()

R Under development (unstable) (2012-02-22 r58458)

Platform: x86_64-unknown-linux-gnu (64-bit)

locale:

[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C

[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8

[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8

[7] LC_PAPER=C LC_NAME=C

[9] LC_ADDRESS=C LC_TELEPHONE=C

[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

7 (27)

Page 36: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

attached base packages:

[1] stats graphics grDevices utils datasets methods base

other attached packages:

[1] basicASE_1.0 zlibbioc_1.1.1 limma_3.13.0

[4] Rsamtools_1.7.40 GenomicRanges_1.9.7 Biostrings_2.25.2

[7] IRanges_1.15.4 BiocGenerics_0.3.0

loaded via a namespace (and not attached):

[1] bitops_1.0-4.1 stats4_2.15.0 tools_2.15.0

>

8 (28)

Page 37: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

Package ‘basicASE’August 24, 2012

Type Package

Title A basic tool for exploring allele specific expression (ASE)

Version 1.0

Date 2012-05-08

Author Jesper Gadin

Maintainer Jesper Gadin <[email protected]>

DescriptionThis package has functions for importing high-throughput bam and bcf-format data files into Ge-nomicRangesList objects. GenomicRanges has become the standard infrastructure for high-throughput data, and this package has numerous of functions to easily make an ASE Analysis.

License GPL-3

Depends Biostrings,IRanges,GenomicRanges,Rsamtools,BiocGenerics,limma,zlibbioc,R (>= 2.15.0)

R topics documented:basicASE-package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2BamImpGRList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3BcfImpGRList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4chisqAFTotDf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5filtChiAFTotDf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6getAreaOfGene . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7mergeAFList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7plotAFTotDf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8ratioplotAfDf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9snpAFList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9snpAFListBcf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

Index 11

1 (29)

Appendix B Manual

Page 38: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

2 basicASE-package

basicASE-package A package meant to provide all basic functions for high-throughputallele specific expression analysis

Description

Package basicASE has functions for importing, filtering and plotting high-throughput data tomake an allele specific expression analysis. One of the big aims of this package has been to providefunctions to collect as much information as possible from regions of choice, to be able to explorethat region in detail.

Details

Package: basicASEType: PackageVersion: 1.0Date: 2012-05-08License: GPL-3

Overview-standard procedure

Start out creating a GRange object containing the region of interest. This can also be done usinggetAreaOfGene providing gene names as arguments. Use BamImpGRList and BcfImpGRListto import neccesary information from reads and snps. Then subset an allele frequency table objectusing snpAFListBcf. To make a ratio plot execute the functions mergeAFList, chisqAFTotDf,filtChiAFTotDf and ratioplotAFDf.

Author(s)

Author: Jesper Gadin Author: Lasse Folkersen

Maintainer: Jesper Gadin <[email protected]>

Examples

#Declare search AreasearchArea <-getAreaOfGene(c("LRP1","DAP2IP","FN1","SORT1"))

#Set Path to bam and bcf filespathToFiles <- system.file("extdata", package="basicASE")

#importBamGRL <-BamImpGRList(pathToFiles,searchArea)BcfGRL <-BcfImpGRList(pathToFiles,searchArea)

(30)

Page 39: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

BamImpGRList 3

## Not run:#preparation stepssnpAFList <- snpAFListBcf(BamGRL,BcfGRL)snpAFTotDf <- mergeAFList(snpAFList)chiAFTotDf <- chisqAFTotDf(snpAFTotDf)chiAFTotDfFilt <-filtChiAFTotDf(chiAFTotDf,0.05)

#choose one of the plot functionsplotAFTotDf(chiAFTotDfFilt) # Also snpAFTotDf and chiAFTotDf works aswellratioplotAfDf(chiAFTotDfFilt)

## End(Not run)

BamImpGRList Import Bam Selection

Description

Imports a selection of a bam file specified by a GenomicRanges object as searchArea.

Usage

BamImpGRList(UserDir, searchArea, verbose = TRUE)

Arguments

UserDir The relative or full path of folder containing bam files.searchArea A GenomicRanges object that contains the regions of interestverbose Setting verbose=TRUE gives details of procedure during function run.

Details

Important that bam files are quality filtered and has no gaps. In near future, including reads withgaps will be possible

Value

BamImpGRList returns a GenomicRangesList object.

Warning

Make sure your data is quality filtered so no NA values in ranges, otherwise the import will fail

Note

To look at object structure give the command str(BamGRL). The next step after import of aBamGRL object would be to import a BcfGRL object with BcfImpGRL and the use snpAFListBcfto subset information of interest. Also make sure there is a complementary index file *.bam.baifor each bam file in UserDir.

(31)

Page 40: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

4 BcfImpGRList

Author(s)

Jesper Gadin

See Also

BcfImpGRList

Examples

#Declare searchAreasearchArea<-GRanges(

seqnames = c("chr1","chr12","chr2"),ranges = IRanges(

c(109852192,57522276,216225163),c(109940573,57607134,216300895),

))

#Relative or full pathpathToFiles <- system.file("extdata", package="basicASE")

#importBamGRL <-BamImpGRList(pathToFiles,searchArea)

BcfImpGRList Import Bcf Selection

Description

Imports a selection of a bcf file specified by a GenomicRanges object as searchArea.

Usage

BcfImpGRList(UserDir, searchArea, verbose = TRUE)

Arguments

UserDir The relative or full path of folder containing bam files.

searchArea A GenomicRanges object that contains the regions of interest

verbose Setting verbose=TRUE gives details of procedure during function run.

Details

This is one way of importing snps, another would be to download from HapMap project.

Value

BcfImpGRList returns a GenomicRangesList object.

(32)

Page 41: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

chisqAFTotDf 5

Note

Make sure there is a complementary index file *.bcf.bci for each bcf file in UserDir.

Author(s)

Jesper Gadin

References

http://hapmap.ncbi.nlm.nih.gov/

See Also

BamImpGRL

Examples

#Declare searchAreasearchArea<-GRanges(

seqnames = c("chr1","chr12","chr2"),ranges = IRanges(

c(109852192,57522276,216225163),c(109940573,57607134,216300895),

))

#Relative or full pathpathToFiles <- system.file("extdata", package="basicASE")

#importBamGRL <-BcfImpGRList(pathToFiles,searchArea)

chisqAFTotDf Add Chi-square to AFtable

Description

Adds information about chi-square, Ratio and additional count data to provided table.

Usage

#snpAFTotDf comes from the mergeAFList functionchisqAFTotDf(snpAFTotDf, limit = 5)

Arguments

snpAFTotDf A Data Frame of AF, see snpAFListBcf and mergeAFListBcf

limit How few observations are allowed in a single element in the contingency tableused to calculate chi-square

(33)

Page 42: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

6 filtChiAFTotDf

Value

chisqAFTotDf returns a single Data Frame with added chi-square, Ratio and count values.

Note

Next version of this package will have this function working for the snpAFList function as well, tocalculate individual tests

Author(s)

Jesper Gadin

filtChiAFTotDf Filter chi-square AFtable

Description

Removes rows with too low Chi-square p-values

Usage

filtChiAFTotDf(chiAFTotDf, filter = 0.05)

Arguments

chiAFTotDf An object provided by chisqAFTotDf function

filter What value to filter Chi-square p-values on

Value

filtChiAFTotDf returns the same object as input object, except having beeing row-filtered onp-values.

Author(s)

Jesper Gadin

See Also

chisqAFTotDf

(34)

Page 43: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

getAreaOfGene 7

getAreaOfGene Region from gene names

Description

From a vector of gene-names this function connects to BiomaRt and returns a genomic region

Usage

getAreaOfGene(GeneVec, verbose = TRUE)

Arguments

GeneVec A vector of typec("LRP1","DAP2IP","FN1","SORT1").

verbose Setting verbose=TRUE gives details of procedure during function run.

Details

This function requires an working internet connection. If not, you can always specify gene regionsof interest on your own in a GRange object. This region is supposed to be an argument in theBamImpGRList and BcfImpGRList functions.

Value

getAreaOfGene returns a GRange object

Author(s)

Lasse Folkersen

mergeAFList merge AFList

Description

Takes the output from snpAFListBcf as argument, and merges all samples so there are no indi-vidiual samples anymore.

Usage

mergeAFList(snpAFList)

Arguments

snpAFList

(35)

Page 44: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

8 plotAFTotDf

Value

mergeAFList returns a single Data Frame.

Author(s)

Jesper Gadin

Examples

#use object provided from the snpAFList function.## Not run:

snpAFTotDf <- mergeAFList(snpAFList)

## End(Not run)

plotAFTotDf basic plot of AF distribution

Description

Makes a basic plot over the allele frequency distribution to explore the data.

Usage

plotAFTotDf(snpAFTotDf)plotAFTotDf(chiAFTotDf)plotAFTotDf(chiAFTotDfFilt)

Arguments

snpAFTotDf Output from the snpAFListBcf function, or as loaded system data

chiAFTotDf Output from the chiAFTotDf functinochiAFTotDfFilt

Output from the chiAFTotDfFilt functino

Value

returns an allele frequency dot-plot.

Author(s)

Jesper Gadin

See Also

snpAFListBcf,chiAFTotDf, and chiAFTotDfFilt

(36)

Page 45: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

ratioplotAfDf 9

Examples

#Get data from Package repositorydata(snpAFList)#processsnpAFTotDf <- mergeAFList(snpAFList)chiAFTotDf <- chisqAFTotDf(snpAFTotDf)

chiAFTotDfFilt <-filtChiAFTotDf(chiAFTotDf,0.05)#Use plot functionplotAFTotDf(chiAFTotDfFilt)

ratioplotAfDf Plot AI Ratio and chi-square value

Description

To get a direct visualization of interesting snps that show significant allelic imbalance.

Usage

ratioplotAfDf(chiAFTotDfFilt)

Arguments

chiAFTotDfFiltAs argument is the output from the chiAFTotDfFilt function

Value

ratioplotAfDf returns an allele imbalance ratio plot

Author(s)

Jesper Gadin

snpAFList Snp AF List

Description

A general data structure object which can be extended by applying functions on it.

Usage

snpAFList

(37)

Page 46: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

10 snpAFListBcf

Format

S-4 class

Source

data(snpAFList)

snpAFListBcf AFList object from Bcfs and Bams

Description

The aim of this function is to create data frames with all interesting snps and their allele frequenciesinto a list container. To easier access data of concern.

Usage

snpAFListBcf(BamGRL, BcfGRL)

Arguments

BamGRL A GRanges Object, see BamImpGRListBcfGRL A GRanges Object, see BcfImpGRList

Value

snpAFList returns a List of Data Frames, one for each snp.

Note

A very time consuming function, where all snp positions are mapped back to the Bam import (seeBamGRList). A tip is to keep the snp list as small as possible if you are working under timeconstraints.

Author(s)

Jesper Gadin

See Also

mergeAFList

Examples

#Use objects provided by the BamImpGRList and BcfImpGRList functions.## Not run:

snpAFList <- snpAFListBcf(BamGRL,BcfGRL)

## End(Not run)

(38)

Page 47: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

Index

∗Topic Allele frequencymergeAFList, 7plotAFTotDf, 8snpAFListBcf, 10

∗Topic Allelic imbalanceratioplotAfDf, 9

∗Topic BamBamImpGRList, 3

∗Topic BcfBcfImpGRList, 4

∗Topic BiomaRtgetAreaOfGene, 7

∗Topic Chi-squarechisqAFTotDf, 5filtChiAFTotDf, 6

∗Topic FilterfiltChiAFTotDf, 6

∗Topic GRangesgetAreaOfGene, 7

∗Topic ImportBamImpGRList, 3BcfImpGRList, 4

∗Topic IndividualchisqAFTotDf, 5

∗Topic MergemergeAFList, 7snpAFListBcf, 10

∗Topic PlotplotAFTotDf, 8ratioplotAfDf, 9

∗Topic RatiochisqAFTotDf, 5ratioplotAfDf, 9

∗Topic packagebasicASE-package, 2

BamGRList, 10BamImpGRL, 5BamImpGRList, 3, 10basicASE (basicASE-package), 2

basicASE-package, 2BcfImpGRList, 4, 4, 10

chisqAFTotDf, 5

filtChiAFTotDf, 6

getAreaOfGene, 7

http://hapmap.ncbi.nlm.nih.gov/,5

mergeAFList, 7, 10

plotAFTotDf, 8

ratioplotAfDf, 9

snpAFList, 9snpAFListBcf, 10

11 (39)

Page 48: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

(40)

Page 49: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

� �� � ��� ���� � � ��

� ��� � � � � �� ��� ������ �� ��� �� � � � ��� ��

� � ������� ����� ����� � ���� � !"� #� $�% &'(& �

� � )� �� * � � $�������� $����� − +���� ��,� " � � � � �� ��� � )�%���- . � / &'(& +��� � ��,� " � � � � �� � �� � � � � - � � � � � �0�� 1��

�� ������� �2 #�)�$ 3���"�3 4�����

�� 5-���( 3�$ ��

� 2�,��2�� �2�� 6 1 ��

�� 5-���( 4��4�� ��

�� ��� ��� ����� �� - �� � ����7 � � ��� *��7 -� � � * � � � � � ���7� 1�� �-��� �� �� ���� * � � 0 � � � * � � � � � � * � �� * ���� �� � � � � � * � * * � � � � � � � * �� ��7�

� ���� � -7��

�� 5-���( ���� ��

�� � � � 2�,��2�� �2�� 6 1 � �8�7��−��� 1 * � � � 1�

� 5-���( "34����

�� ��� � � * � � � * � � � � * �� ��6���� � �� ��� *��7 � � � * � � � � � ���7� %�� �� � 7�,������ *��7 1 ��� �8�7�� ����� 1

��

�� 9� � :&&;<=>=(<�;?;((?@@−;?;(A?>A ��7� �� � � � �-��7���7� @ B ��)-@A 1 < 4��7��% ����7��%�� )��)�������������)�������������))��))�))�������)���)�����������))�)�������)���)������������� 5-���( ���4����

�� � � * � � � � � 1 * � � � �� 7�8 1 * � � � �� � � 1 � � � � � * � � � � � * 1 * � � � �� 7�8 1 * � � 6�

��

�� 5-���( ��#���4����

�� -� � � � � � � � � � � * �� � -� ����� � ��� �� 1 ���� � 1 � � * � � ��� 5-���( # C���"3���

�� �-��, � * -� * � � � * � � � -�� ��� ��� � ��6���� 1 ��� ��� � ��7�0� � � � ��� ��� 1�� ��� − −� D � �D −� DE � �F��� �3� � �D � � 1 8 �

� ����� �� - � � � � � � � ��� -� -����� � -� ��7� � � � 1 �� � � -� * � � � � 7�,� � �� � � �� * � � -� -����� 7�����% 1

��

�� 5-���( ��������

�� ����� ������

�� 5�� ��

�� �� 3# �2 #�)�$ 3���"�3 4����

� �� ����� �2 )�# ��

�� � ���� 7��������� 7% E � * � � � � � � � � 5 D�-��� ��� ��7� -�� ���� �� - %��� � * � � � B � �� �� �7�� ��D �

��

Appendix C Perl scripts

Page 50: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

�� �� � � � � � � � � � � � ��� ��� �������� ����� ���� �� � � ���� � � � � � � � � � ���� � ��� ��� �� ���������� � �� ��� ��� ��� ��� ��� � � �� ����� �� ��� �� � � � � �!� ��� �� � ������� � � � � � ���

�� "#������ �� � � � � � � � � � � � �� � � $� % & � � ��� & � �' ( ��� �� � �� � � � � � � � � � � � �� � � $� % & � � ��� & � �' ( ��� �� �� � )'' �� �� ���� � *+, � "�� � � � � � � ������ �� ����� �� � ��� -�� � ���� �� ����.�����/'��� �� ������ 0 � "� � � � $ � ���� � � � � � � � � � � � � � 1�� �� � ���� ������� ��� �� � ���*� "� � ��� �� ��� ��� �� �� � � � � � �� � � � � � � �� 1 ���� ���� �� � � � �

������ ��� �� �� ��� 1�� "�� �� ������ � � � � � �� ���� ���� � � �� ��� ��� 1�� ����� % � �� ( ���

�� "2�� � � ��� ��� #� � 3� � � � � �� � � � � � � � � � � � �� ��� 24��� � 5� �� � � � � � 6 � � � � � � � 1 � � � � � �� � � � � � � � � � � � � �� ��� 24��� � 5� �� � � � � � 6 � � � � � � � 1 � � � � � �� � � � � � � � � � � � � ��� ��� 24����� � 5� �� � � � � � 6 ��� � �� � 1 � � � � �� � � � � � � � � � � � � ��� ��� 24���$� 5� �� � � � � � 6�����$ 1 � � � � � �� � � � � � � � � � � � � ��� ��� 24���$)� 5� �� � � � � � 6�����$ 1 � � � � 7 �� � � � � � � � � � � � � ���

�� �� 8����� � 3#�5��� �� ����� � � � � � � % 8����� ( �� � � � ������� ��� �� � �7��� � � � � � � % 8����� ( �� � � � ������� ���

� "�� �� � 9������ 9� �� "�� �� � 9�� �7��� 9� ���

�� "�� ���� � � �7��� ���� � � � � � �� �� ���� 1�� �� ���.���� � ���� % � �7��� ( ���

�� ":�; � �� �7��� � � � � ��;����7��� ���� �� � � �7��� ���� �� ���� ���-�� � ��� 1

�� �� ���� � ���� � � % � �7��� � ���� � <( ���� �� �-�� ���� � � % � ��� 7 ( =�-��� � � � ���� ��������<�>�� � � � % � ��� 7 � ( =�-��� � � ���� ��������)�>�� � � � % � ��� 7 ! ( =�-��� � � � ���� ��������*�>��� � � � % � ��� 7 � ( =�-��� ! � � ���� ��������+�>��� � = � � ���������� � >��� �� � ��;����7��� � � �7��� ���� ���� � � % � ��;����7��� � ���� � <( � �-�� � "� � � � � � ��� �� � � �7 1��� "�� �� � ��� -�� � �� � ������ � � 0 � -�� 9� ���� "�� �� � ��; �7��� 0 9 �� ��;����7��� 9� ���� "���� � ��� � ��; ���� ���� � � �7��� ��� �� ��; ��� �7��� 1��� �� ������ ��� �� � ��������� ��� �� �����?�� ����

��� �� ��7���@�� ���� �� � ��;����7���@�� ���� �� � ��� ����

��� "� � � � � � � � � ! ��� �� 8� � � � � � � �%' �' �' �'( ��� �� 8��� ���� �%' �' �' �'( ��

� � � � % � ����� � < � � ����� 3� �� � � �����AA(=��

�� """""""""""""""�� "@�� -�� � ��� <�� � ��� � 5����@� 1 � �����9� ���

�� � ��������� � �� � % ���� % ���.����−� ���.���� ( ( �

��

Page 51: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

��� �������� � � �������� ������� � ���� ��� �� � ����� ��� � � � ��� ���� ��� � � ���� ������ ��� ���� � � �� ������ � � ��

� � �� � � ������� ��� ���� ��� � � � � � � � � � � � � � ����� � !��� ������ �� ����� " # ���� ��� � $ � � � �%� �

�����& ��&��� � � � � � ������� � ���& �� ��� � � �� ���� ��� ��'����� ���� � � " �������� ( � ������ � # )��� �����−−���� ��* ���� +���

�� � ��'�����,��� � ���� � " � ��'����� � � ������� � � ������� � # ���

��� �� �� -.���� � ���� ���� �� �� -.���� /� ��'�����,���0�/ ����

��� �� �� -.�&�* � ���� ���� �� �� -.�&�* /� ��'�����,���0�/ ����

��� �!��� � � � ' ���&� $�� ����� � �� � ���� � ���� �1 � 2(232 ��� �� �� -.�&�*4 � ���� ��� �� �� -.�&�*4 /� ��'�����,���0�/ ���� � ���� �1 � 2322 ���� �� �� -.�&�*4 � ���� ���� � ��'�����,��� �1 � 2 56−7�−8 9 2������2 ���� �� �� -.�&�*4 /� ��'�����,���0�/ ����

��� ������ ��� ��%� � � � � � � ���� � � " ���� :� �������� ;; ���� (� � ������� # )��� � � " � ��6��� <�� �� =# )� � � � � � � 5>9�+�� � � " � ��6��� <�� �� 4# )� � � � � � � 5=9�+�� � � " � ��6��� <�� �� ?# )� � � � � � � 549�+��� � � " � ��6��� <�� �� @# )� � � � � � � 5?9�+��� +���

��� ������������������ �,��� %�� � �� 4��� � ���� � /(��&���<�� � � ����0�/ ����

��� � ������ ���� ���� ��� � ������� � �� " ���� " � ������ �−� ������� � # # ���

��� ��� �� /0� �����& ��&��� � � � �� � A � ������� 0� / ���� �������� � � �������� ������� � ���� ��� �� � ����� ��� � � � ��� ���� ��� � � ���� ������ ��� ���� � � �� ������ � � ��

� � �� � � ������� ��� � ���� $ � � � ��� � � � �� � �� �&������� � �� ����� ���& ��� � � � � � � � � ��� ��'����� �

��� ��� � � � � � � � � � � � � � ����� � !��� ������ �� ����� " # ���� ��� � $ � � � �%� ������& ��&��� � � � � � ������� � ���& �� ��� � � �� ���� ��� ��'����� �

��� � � " �������� ( � ������ � # )��� �����−−���� ��* ���� +��

�� � ���������'�����,��� � ���� � " � ���������'����� � � ������� � � ������� � # ��� �� �� -.���� � ���� ��� �� �� -.���� /� ���������'�����,���0�/ ���

�� �� �� -.�&�* � ���� ��� �� �� -.�&�* /� ���������'�����,���0�/ ���

��

�� �!��� � � � ' ���&� $�� ����� � �� � �� � ���� �1 � 2(232 �� �� �� -.�&�*4 � ���� ��� �� �� -.�&�*4 /� ���������'�����,���0�/ ��� � ���� �1 � 2322 ��� �� �� -.�&�*4 � ���� �

��

Page 52: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

��� � ���������������� �� �� ��−��−� � ������ �� ���� �� �� � ��� �!" #� ���������������� $�# ����

��� %����� �� ��&� � � � � � � � � � ���� � � ' ��(� )� ���� *� ++ ��(� ,� � ��� ����� - .��� � � ' � ��������/0(� �� 1- .� � ( 2 � � � � � �1�33�4��� � � ' � ��������/0(� �� "- .� � ( 2 � � � � � �5�33�4 � � ' � ��������/0(� �� 6- .� � ( 2 � � � � � �6�33�4� � � ' � ��������/0(� �� 7- .� � ( 2 � � � � � �"�33�4 4� 4� %�� �� � ��� � � � � � �( � � 2 �� �� �� � # � � � � � � � � 8 9� � � � � � � � $�# �� �� �� � # � ( 2 � � � � � 8 9�(2 � ��� � $�# �� �� �� � ������� # 9�� � � � � � � $ �9�(2����� # ��

� � 2 ( � � :; � � 2 ( � � ������ � � 2 ( � � ����(2 � � 2 ( � � ������� � � 2 ( � � ��� �!" � � 2 ( � � ��� �!��

�� %% *;< �= >�<*

��

Page 53: basicASE: an R-statistics package to detect significant ... · UPTEC X 12 013. Date of issue 2012-06. Author . Jesper Gådin. Title (English) basicASE: an R-statistics package to

� ��� � � � � � � � �� � � � �� � � � � � � � � � �� � � ��� � � � � � �� ������ �� ��� �− � ��� � � �� � ���� � ���� � � � � � � � ���������� !" #� �������� �− ���� � ���� "� ������� �− � � ��� �� � � ���� � � � "� � � � � � �� ������� " #� �� �� � � � "� ��−� � ������� � � "� � � � � $ �� � � % �������� " " # �� �� � � $ "

� ���&����� �− ���� ' ' $ ( (�� � �����&����� �− ���&����� ' ��)���� � ���&����� "��� � (�� ������)�− � �����&����� ' � ����� � � �����&����� " "*��*�+����� � � � � ��� � ,��� ��" " � (�� � � � - ���� � ������) "��." #�� � � � � / �� � � % ���� � ������) " " " #�� �� � � � � � � �− � �−� � � � � ������) ' / ( " " 0��� � �� � � � �− � � � �� � � � � ����, � ������1���� � ������) " ' ' 2 ��) 2 ( ( ' � ( � �� � � � � �� �

� � � � � � � � " "�� �� �� � � � �� � � � "�� 3� 3� 3�� 3�� 3�� ��4 �−� ��� � � �� �5�6�7�5��6�7" #�� 5��6�7������ �− � � � $ � � � � � � � � � �5��6�7 � ��� � ���� � 8�79!" "�� ���� 5��6�7������ �− ���� �5��6�7������ "�� � � � � � �� � % ���� �5��6�7������ " " #�� �� �� � � ���� � 2��� ������ 2 � � " "�� ���� 5�6�7 �− ���� �5�6�7"� � � � � $ �� � % ���� 5�6�7" #� �� �� � � ���� � 2 ���� ��2 � ���� 5�6�7" "�� �� �� � � ���� � 2 ���� ������2 � $ " "�� ���9��� �− 5�6�7' ' $ ( (�� ���������� �− ������5:;����� � ���9��� � ���9�� "�� � � � - ���� � ���������� "��." #�� � � � � / �� � � % ���� � ���������� " " " #�� �� � � � � � � �− � � � � � � ���9�� "−� � � � � ���������� ' / ( " " 0��� � �� � � � �− � � � �� � � � � �����) � ������1���� � ���������� ' / ( " ' ' 2 ��) 2 ( ( ' ' � ( ( �

� � � ����� � � � �� � ������ � � � � � � " "�� �� �� � � � �� � � � "� 3� 3�� 3�� 3�� 3�� ��< �− � ��� � � �� � ���� � ���� � � � � � � � ���������� !" #�� �������� �− ���� � ���� "�� ������� �− � � ��� �� � � ���� � � � "�� � � � � � �� ������� " #�� �� �� � � � "� ��−� � ������� � � "� � � � � $ �� � � % �������� " " #�� �� �� � � $ "�� ���&����� �− ���� ' ' $ ( (�� � �����&����� �− ���&����� ' ��)���� � ���&����� "��� � (�� ������)�− � �����&����� ' � ����� � � �����&����� " "*��*�+����� � � � � ��� � ,��� ��" " � (�� � � � ���� � ������) " -�." #�� �� � � � � � � �− � − � � � � � ������) " 0 �7�� � �� � � � �− � � � �� � � � � ����, � ������1���� � ������) " ' ' 2 ��) 2 ( ( � � � � ����� � � � �� �

������ � � � � � � " "�� �� �� � � � �� � � � "� 3� 3�� 3�� 3

��

Appendix D R scripts for Algorithm testing