Skip to content

Commit

Permalink
Group samples on group in igv
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-cheshire committed Nov 11, 2023
1 parent 81baaf1 commit 448b192
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions bin/igv_files_to_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ def igv_files_to_session(XMLOut, ListFile, Genome, GtfBed, PathPrefix=""):
break
fout.close()


## Construct groups
groups = {}
group_num = 1
for ifile, colour in fileList:
group = os.path.basename(ifile).split('_R')[0]
if group not in groups:
groups[group] = group_num
group_num = group_num + 1

## ADD RESOURCES SECTION
XMLStr = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'
XMLStr += '<Session genome="%s" hasGeneTrack="true" hasSequenceTrack="true" locus="All" version="8">\n' % (Genome)
Expand Down Expand Up @@ -159,8 +169,8 @@ def igv_files_to_session(XMLOut, ListFile, Genome, GtfBed, PathPrefix=""):
)
elif extension in [".bw", ".bigwig", ".tdf", ".bedGraph", ".bedgraph"]:
XMLStr += (
'\t\t<Track altColor="0,0,178" autoScale="true" autoscaleGroup="1" clazz="org.broad.igv.track.DataSourceTrack" color="%s" '
% (colour)
'\t\t<Track altColor="0,0,178" autoScale="true" autoscaleGroup="%s" clazz="org.broad.igv.track.DataSourceTrack" color="%s" '
% (groups[os.path.basename(ifile).split('_R')[0]], colour)
)
XMLStr += 'displayMode="COLLAPSED" featureVisibilityWindow="-1" fontSize="12" height="100" '
XMLStr += (
Expand Down

0 comments on commit 448b192

Please sign in to comment.